diff --git a/gen/adexchangebuyer1d3-cli/Cargo.toml b/gen/adexchangebuyer1d3-cli/Cargo.toml index dab045af8a..0cca71eb0f 100644 --- a/gen/adexchangebuyer1d3-cli/Cargo.toml +++ b/gen/adexchangebuyer1d3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangebuyer1d3-cli" -version = "0.3.2+20150909" +version = "0.3.3+20160118" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/adexchangebuyer1d3-cli/LICENSE.md b/gen/adexchangebuyer1d3-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/adexchangebuyer1d3-cli/LICENSE.md +++ b/gen/adexchangebuyer1d3-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/adexchangebuyer1d3-cli/README.md b/gen/adexchangebuyer1d3-cli/README.md index 96800d2b41..8775a73aca 100644 --- a/gen/adexchangebuyer1d3-cli/README.md +++ b/gen/adexchangebuyer1d3-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Ad Exchange Buyer* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/adexchangebuyer1d3.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/adexchangebuyer1d3.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/adexchangebuyer1d3.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/adexchangebuyer1d3.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3-cli). # Usage -This documentation was generated from the *Ad Exchange Buyer* API at revision *20150909*. The CLI is at version *0.3.2*. +This documentation was generated from the *Ad Exchange Buyer* API at revision *20160118*. The CLI is at version *0.3.3*. ```bash adexchangebuyer1d3 [options] @@ -60,18 +60,18 @@ adexchangebuyer1d3 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/adexchangebuyer1d3-cli/mkdocs.yml b/gen/adexchangebuyer1d3-cli/mkdocs.yml index 832cc1a10d..5e6f8c309c 100644 --- a/gen/adexchangebuyer1d3-cli/mkdocs.yml +++ b/gen/adexchangebuyer1d3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Ad Exchange Buyer v0.3.2+20150909 +site_name: Ad Exchange Buyer v0.3.3+20160118 site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3-cli site_description: Write integrating applications with bcore @@ -33,5 +33,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/adexchangebuyer1d3-cli/src/main.rs b/gen/adexchangebuyer1d3-cli/src/main.rs index 71d07a5966..19b166cacc 100644 --- a/gen/adexchangebuyer1d3-cli/src/main.rs +++ b/gen/adexchangebuyer1d3-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,20 +36,20 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::AdExchangeBuyer>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let id: i32 = arg_from_str(&opt.value_of("id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.accounts().get(id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -62,7 +62,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -75,7 +75,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -98,10 +98,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -114,7 +114,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -127,7 +127,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -150,13 +150,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -170,8 +170,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "maximum-total-qps" => Some(("maximumTotalQps", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -193,7 +193,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Account = json::value::from_value(object).unwrap(); let id: i32 = arg_from_str(&opt.value_of("id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.accounts().patch(request, id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -206,7 +206,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -219,7 +219,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -242,13 +242,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -262,8 +262,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "maximum-total-qps" => Some(("maximumTotalQps", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -285,7 +285,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Account = json::value::from_value(object).unwrap(); let id: i32 = arg_from_str(&opt.value_of("id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.accounts().update(request, id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -298,7 +298,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -311,7 +311,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -334,11 +334,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _billing_info_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _billing_info_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let account_id: i32 = arg_from_str(&opt.value_of("account-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.billing_info().get(account_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -351,7 +351,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -364,7 +364,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -387,10 +387,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _billing_info_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _billing_info_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.billing_info().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -403,7 +403,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -416,7 +416,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -439,10 +439,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _budget_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _budget_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.budget().get(opt.value_of("account-id").unwrap_or(""), opt.value_of("billing-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -455,7 +455,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -468,7 +468,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -491,13 +491,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _budget_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _budget_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -511,8 +511,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "budget-amount" => Some(("budgetAmount", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -532,7 +532,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Budget = json::value::from_value(object).unwrap(); let mut call = self.hub.budget().patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("billing-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -545,7 +545,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -558,7 +558,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -581,13 +581,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _budget_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _budget_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -601,8 +601,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "budget-amount" => Some(("budgetAmount", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -622,7 +622,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Budget = json::value::from_value(object).unwrap(); let mut call = self.hub.budget().update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("billing-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -635,7 +635,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -648,7 +648,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -671,11 +671,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let account_id: i32 = arg_from_str(&opt.value_of("account-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.creatives().get(account_id, opt.value_of("buyer-creative-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -688,7 +688,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -701,7 +701,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -724,13 +724,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -744,10 +744,10 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "api-upload-timestamp" => Some(("api_upload_timestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "attribute" => Some(("attribute", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "height" => Some(("height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "advertiser-name" => Some(("advertiserName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -777,13 +777,13 @@ impl<'n, 'a> Engine<'n, 'a> { "native-ad.price" => Some(("nativeAd.price", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native-ad.click-tracking-url" => Some(("nativeAd.clickTrackingUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "api-upload-timestamp" => Some(("apiUploadTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "vendor-type" => Some(("vendorType", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "sensitive-categories" => Some(("sensitiveCategories", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "product-categories" => Some(("productCategories", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "agency-id" => Some(("agencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "restricted-categories" => Some(("restrictedCategories", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "filtering-reasons.date" => Some(("filteringReasons.date", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -798,7 +798,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Creative = json::value::from_value(object).unwrap(); let mut call = self.hub.creatives().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -811,7 +811,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -824,7 +824,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -847,10 +847,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creatives().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "status-filter" => { @@ -878,7 +878,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status-filter", "page-token", "buyer-creative-id", "max-results", "account-id"].iter().map(|v|*v)); @@ -892,7 +892,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -915,10 +915,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _direct_deals_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _direct_deals_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.direct_deals().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -931,7 +931,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -944,7 +944,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -967,10 +967,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _direct_deals_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _direct_deals_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.direct_deals().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -983,7 +983,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -996,7 +996,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1019,10 +1019,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _performance_report_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _performance_report_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.performance_report().list(opt.value_of("account-id").unwrap_or(""), opt.value_of("end-date-time").unwrap_or(""), opt.value_of("start-date-time").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1041,7 +1041,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1055,7 +1055,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1078,10 +1078,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pretargeting_config().delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("config-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1094,7 +1094,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1107,7 +1107,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1122,10 +1122,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pretargeting_config().get(opt.value_of("account-id").unwrap_or(""), opt.value_of("config-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1138,7 +1138,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1151,7 +1151,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1174,13 +1174,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1194,8 +1194,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "billing-id" => Some(("billingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "languages" => Some(("languages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1229,7 +1229,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PretargetingConfig = json::value::from_value(object).unwrap(); let mut call = self.hub.pretargeting_config().insert(request, opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1242,7 +1242,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1255,7 +1255,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1278,10 +1278,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pretargeting_config().list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1294,7 +1294,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1307,7 +1307,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1330,13 +1330,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1350,8 +1350,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "billing-id" => Some(("billingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "languages" => Some(("languages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1385,7 +1385,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PretargetingConfig = json::value::from_value(object).unwrap(); let mut call = self.hub.pretargeting_config().patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("config-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1398,7 +1398,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1411,7 +1411,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1434,13 +1434,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1454,8 +1454,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "billing-id" => Some(("billingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "languages" => Some(("languages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1489,7 +1489,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PretargetingConfig = json::value::from_value(object).unwrap(); let mut call = self.hub.pretargeting_config().update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("config-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1502,7 +1502,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1515,7 +1515,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1679,14 +1679,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "adexchangebuyer1d3-secret.json", + match cmn::application_secret_from_directory(&config_dir, "adexchangebuyer1d3-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1706,7 +1706,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1745,7 +1745,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("accounts", "methods: 'get', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one account by ID."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/accounts_get", vec![ @@ -1767,7 +1767,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the authenticated user's list of accounts."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/accounts_list", vec![ @@ -1783,7 +1783,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/accounts_patch", vec![ @@ -1811,7 +1811,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/accounts_update", vec![ @@ -1842,7 +1842,7 @@ fn main() { ]), ("billing-info", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Returns the billing information for one account specified by account ID."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/billing-info_get", vec![ @@ -1864,7 +1864,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of billing information for all accounts of the authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/billing-info_list", vec![ @@ -1883,7 +1883,7 @@ fn main() { ]), ("budget", "methods: 'get', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Returns the budget information for the adgroup specified by the accountId and billingId."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/budget_get", vec![ @@ -1911,7 +1911,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates the budget amount for the budget of the adgroup specified by the accountId and billingId, with the budget amount in the request. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/budget_patch", vec![ @@ -1945,7 +1945,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates the budget amount for the budget of the adgroup specified by the accountId and billingId, with the budget amount in the request."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/budget_update", vec![ @@ -1982,7 +1982,7 @@ fn main() { ]), ("creatives", "methods: 'get', 'insert' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets the status for a single creative. A creative will be available 30-40 minutes after submission."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/creatives_get", vec![ @@ -2010,7 +2010,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Submit a new creative."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/creatives_insert", vec![ @@ -2032,7 +2032,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/creatives_list", vec![ @@ -2051,7 +2051,7 @@ fn main() { ]), ("direct-deals", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one direct deal by ID."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/direct-deals_get", vec![ @@ -2073,7 +2073,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the authenticated user's list of direct deals."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/direct-deals_list", vec![ @@ -2092,7 +2092,7 @@ fn main() { ]), ("performance-report", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves the authenticated user's list of performance metrics."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/performance-report_list", vec![ @@ -2129,7 +2129,7 @@ fn main() { ]), ("pretargeting-config", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing pretargeting config."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/pretargeting-config_delete", vec![ @@ -2151,7 +2151,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a specific pretargeting configuration"##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/pretargeting-config_get", vec![ @@ -2179,7 +2179,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new pretargeting configuration."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/pretargeting-config_insert", vec![ @@ -2207,7 +2207,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of the authenticated user's pretargeting configurations."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/pretargeting-config_list", vec![ @@ -2229,7 +2229,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing pretargeting config. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/pretargeting-config_patch", vec![ @@ -2263,7 +2263,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing pretargeting config."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/pretargeting-config_update", vec![ @@ -2303,7 +2303,7 @@ fn main() { let mut app = App::new("adexchangebuyer1d3") .author("Sebastian Thiel ") - .version("0.3.2+20150909") + .version("0.3.3+20160118") .about("Accesses your bidding-account information, submits creatives for validation, finds available direct deals, and retrieves performance reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli") .arg(Arg::with_name("url") @@ -2327,7 +2327,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -2338,7 +2338,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/adexchangebuyer1d3/Cargo.toml b/gen/adexchangebuyer1d3/Cargo.toml index 8f47ea4163..c97bbb8ccb 100644 --- a/gen/adexchangebuyer1d3/Cargo.toml +++ b/gen/adexchangebuyer1d3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangebuyer1d3" -version = "0.1.10+20150909" +version = "0.1.11+20160118" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/adexchangebuyer1d3/LICENSE.md b/gen/adexchangebuyer1d3/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/adexchangebuyer1d3/LICENSE.md +++ b/gen/adexchangebuyer1d3/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/adexchangebuyer1d3/README.md b/gen/adexchangebuyer1d3/README.md index e413b6a078..acffa96fed 100644 --- a/gen/adexchangebuyer1d3/README.md +++ b/gen/adexchangebuyer1d3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-adexchangebuyer1d3` library allows access to all features of the *Google Ad Exchange Buyer* service. -This documentation was generated from *Ad Exchange Buyer* crate version *0.1.10+20150909*, where *20150909* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Ad Exchange Buyer* crate version *0.1.11+20160118*, where *20160118* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the [official documentation site](https://developers.google.com/ad-exchange/buyer-rest). diff --git a/gen/adexchangebuyer1d3/src/cmn.rs b/gen/adexchangebuyer1d3/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/adexchangebuyer1d3/src/cmn.rs +++ b/gen/adexchangebuyer1d3/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/adexchangebuyer1d3/src/lib.rs b/gen/adexchangebuyer1d3/src/lib.rs index 28ce8b365c..9604a45360 100644 --- a/gen/adexchangebuyer1d3/src/lib.rs +++ b/gen/adexchangebuyer1d3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Ad Exchange Buyer* crate version *0.1.10+20150909*, where *20150909* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Ad Exchange Buyer* crate version *0.1.11+20160118*, where *20160118* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the //! [official documentation site](https://developers.google.com/ad-exchange/buyer-rest). diff --git a/gen/adexchangebuyer1d3/src/lib.rs.in b/gen/adexchangebuyer1d3/src/lib.rs.in index 56e806037a..83e03d5f51 100644 --- a/gen/adexchangebuyer1d3/src/lib.rs.in +++ b/gen/adexchangebuyer1d3/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -132,7 +133,7 @@ impl<'a, C, A> AdExchangeBuyer AdExchangeBuyer { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -159,7 +160,7 @@ impl<'a, C, A> AdExchangeBuyer } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -224,13 +225,16 @@ pub struct Creative { /// Detected product categories, if any. Read-only. This field should not be set in requests. #[serde(rename="productCategories")] pub product_categories: Option>, - /// The last upload timestamp of this creative if it was uploaded via API. Read-only. The value of this field is generated, and will be ignored for uploads. (formatted RFC 3339 timestamp). - pub api_upload_timestamp: Option, + /// Creative serving status. Read-only. This field should not be set in requests. + pub status: Option, /// The agency id for this creative. #[serde(rename="agencyId")] pub agency_id: Option, /// All attributes for the ads that may be shown from this snippet. pub attribute: Option>, + /// All restricted categories for the ads that may be shown from this snippet. + #[serde(rename="restrictedCategories")] + pub restricted_categories: Option>, /// Ad height. pub height: Option, /// The name of the company being advertised in the creative. @@ -268,11 +272,9 @@ pub struct Creative { pub native_ad: Option, /// The version for this creative. Read-only. This field should not be set in requests. pub version: Option, - /// Creative serving status. Read-only. This field should not be set in requests. - pub status: Option, - /// All restricted categories for the ads that may be shown from this snippet. - #[serde(rename="restrictedCategories")] - pub restricted_categories: Option>, + /// The last upload timestamp of this creative if it was uploaded via API. Read-only. The value of this field is generated, and will be ignored for uploads. (formatted RFC 3339 timestamp). + #[serde(rename="apiUploadTimestamp")] + pub api_upload_timestamp: Option, /// All vendor types for the ads that may be shown from this snippet. #[serde(rename="vendorType")] pub vendor_type: Option>, @@ -451,14 +453,17 @@ pub struct DirectDeal { pub advertiser: Option, /// Resource type. pub kind: Option, + /// The account id of the buyer this deal is for. + #[serde(rename="accountId")] + pub account_id: Option, /// Deal name. pub name: Option, /// The currency code that applies to the fixed_cpm value. If not set then assumed to be USD. #[serde(rename="currencyCode")] pub currency_code: Option, - /// The account id of the buyer this deal is for. - #[serde(rename="accountId")] - pub account_id: Option, + /// The deal type such as programmatic reservation or fixed price and so on. + #[serde(rename="dealTier")] + pub deal_tier: Option, /// The fixed price for this direct deal. In cpm micros of currency according to currency_code. If set, then this deal is eligible for the fixed price tier of buying (highest priority, pay exactly the configured fixed price). #[serde(rename="fixedCpm")] pub fixed_cpm: Option, @@ -633,7 +638,7 @@ pub struct Budget { pub billing_id: Option, /// The kind of the resource, i.e. "adexchangebuyer#budget". pub kind: Option, - /// The budget amount to apply for the billingId provided. This is required for update requests. + /// The daily budget amount in unit amount of the account currency to apply for the billingId provided. This is required for update requests. #[serde(rename="budgetAmount")] pub budget_amount: Option, /// The currency code for the buyer. This cannot be altered here. @@ -1658,7 +1663,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.billingInfo.get", + dlg.begin(MethodInfo { id: "adexchangebuyer.billingInfo.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -1700,7 +1705,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1736,7 +1741,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1746,10 +1751,10 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1782,7 +1787,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: i32) -> BillingInfoGetCall<'a, C, A> { self._account_id = new_value; @@ -1800,12 +1805,12 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1822,17 +1827,17 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BillingInfoGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BillingInfoGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1893,7 +1898,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.billingInfo.list", + dlg.begin(MethodInfo { id: "adexchangebuyer.billingInfo.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1913,7 +1918,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1949,7 +1954,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1959,10 +1964,10 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2003,12 +2008,12 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2025,17 +2030,17 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BillingInfoListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BillingInfoListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2096,7 +2101,7 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.directDeals.list", + dlg.begin(MethodInfo { id: "adexchangebuyer.directDeals.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2116,7 +2121,7 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2152,7 +2157,7 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2162,10 +2167,10 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2206,12 +2211,12 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2228,17 +2233,17 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DirectDealListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectDealListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2300,7 +2305,7 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.directDeals.get", + dlg.begin(MethodInfo { id: "adexchangebuyer.directDeals.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -2342,7 +2347,7 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2378,7 +2383,7 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2388,10 +2393,10 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2424,7 +2429,7 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> DirectDealGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -2442,12 +2447,12 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2464,17 +2469,17 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DirectDealGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectDealGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2544,7 +2549,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.budget.patch", + dlg.begin(MethodInfo { id: "adexchangebuyer.budget.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2587,14 +2592,14 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2638,7 +2643,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2648,10 +2653,10 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2683,7 +2688,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Budget) -> BudgetPatchCall<'a, C, A> { self._request = new_value; @@ -2693,7 +2698,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> BudgetPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2703,7 +2708,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *billing id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn billing_id(mut self, new_value: &str) -> BudgetPatchCall<'a, C, A> { self._billing_id = new_value.to_string(); @@ -2721,12 +2726,12 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2743,17 +2748,17 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BudgetPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BudgetPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2823,7 +2828,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.budget.update", + dlg.begin(MethodInfo { id: "adexchangebuyer.budget.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2866,14 +2871,14 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2917,7 +2922,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2927,10 +2932,10 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2962,7 +2967,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Budget) -> BudgetUpdateCall<'a, C, A> { self._request = new_value; @@ -2972,7 +2977,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> BudgetUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2982,7 +2987,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *billing id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn billing_id(mut self, new_value: &str) -> BudgetUpdateCall<'a, C, A> { self._billing_id = new_value.to_string(); @@ -3000,12 +3005,12 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3022,17 +3027,17 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BudgetUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BudgetUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3095,7 +3100,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.budget.get", + dlg.begin(MethodInfo { id: "adexchangebuyer.budget.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -3138,7 +3143,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3174,7 +3179,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3184,10 +3189,10 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3220,7 +3225,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> BudgetGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -3230,7 +3235,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *billing id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn billing_id(mut self, new_value: &str) -> BudgetGetCall<'a, C, A> { self._billing_id = new_value.to_string(); @@ -3248,12 +3253,12 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3270,17 +3275,17 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BudgetGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BudgetGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3348,7 +3353,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.insert", + dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3368,14 +3373,14 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3419,7 +3424,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3429,10 +3434,10 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3464,7 +3469,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Creative) -> CreativeInsertCall<'a, C, A> { self._request = new_value; @@ -3482,12 +3487,12 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3504,17 +3509,17 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3585,7 +3590,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.list", + dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); if let Some(value) = self._status_filter { @@ -3628,7 +3633,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3664,7 +3669,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3674,10 +3679,10 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3755,12 +3760,12 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3777,17 +3782,17 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3850,7 +3855,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.get", + dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -3893,7 +3898,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3929,7 +3934,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3939,10 +3944,10 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3975,7 +3980,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: i32) -> CreativeGetCall<'a, C, A> { self._account_id = new_value; @@ -3985,7 +3990,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *buyer creative id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn buyer_creative_id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { self._buyer_creative_id = new_value.to_string(); @@ -4003,12 +4008,12 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4025,17 +4030,17 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4104,7 +4109,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.update", + dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -4146,14 +4151,14 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4197,7 +4202,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4207,10 +4212,10 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4242,7 +4247,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountUpdateCall<'a, C, A> { self._request = new_value; @@ -4252,7 +4257,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: i32) -> AccountUpdateCall<'a, C, A> { self._id = new_value; @@ -4270,12 +4275,12 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4292,17 +4297,17 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4371,7 +4376,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.patch", + dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -4413,14 +4418,14 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4464,7 +4469,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4474,10 +4479,10 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4509,7 +4514,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountPatchCall<'a, C, A> { self._request = new_value; @@ -4519,7 +4524,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: i32) -> AccountPatchCall<'a, C, A> { self._id = new_value; @@ -4537,12 +4542,12 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4559,17 +4564,17 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4630,7 +4635,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.list", + dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -4650,7 +4655,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4686,7 +4691,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4696,10 +4701,10 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4740,12 +4745,12 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4762,17 +4767,17 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4834,7 +4839,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.get", + dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -4876,7 +4881,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4912,7 +4917,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4922,10 +4927,10 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4958,7 +4963,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: i32) -> AccountGetCall<'a, C, A> { self._id = new_value; @@ -4976,12 +4981,12 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4998,17 +5003,17 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5076,7 +5081,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.performanceReport.list", + dlg.begin(MethodInfo { id: "adexchangebuyer.performanceReport.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5105,7 +5110,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5141,7 +5146,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5151,10 +5156,10 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut PerformanceReportListCall<'a, C, A> where C: BorrowMut PerformanceReportListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5197,7 +5202,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut PerformanceReportListCall<'a, C, A> { self._end_date_time = new_value.to_string(); @@ -5207,7 +5212,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut PerformanceReportListCall<'a, C, A> { self._start_date_time = new_value.to_string(); @@ -5239,12 +5244,12 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut PerformanceReportListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PerformanceReportListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PerformanceReportListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5334,7 +5339,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.delete", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5376,7 +5381,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5412,7 +5417,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5422,10 +5427,10 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5458,7 +5463,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> { self._config_id = new_value.to_string(); @@ -5476,12 +5481,12 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5578,7 +5583,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.patch", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5621,14 +5626,14 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5672,7 +5677,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5682,10 +5687,10 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> { self._request = new_value; @@ -5727,7 +5732,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5737,7 +5742,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> { self._config_id = new_value.to_string(); @@ -5755,12 +5760,12 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5850,7 +5855,7 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.get", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5893,7 +5898,7 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5929,7 +5934,7 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5939,10 +5944,10 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut PretargetingConfigGetCall<'a, C, A> where C: BorrowMut PretargetingConfigGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5985,7 +5990,7 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut PretargetingConfigGetCall<'a, C, A> { self._config_id = new_value.to_string(); @@ -6003,12 +6008,12 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut PretargetingConfigGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6104,7 +6109,7 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.insert", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6146,14 +6151,14 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6197,7 +6202,7 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6207,10 +6212,10 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> { self._request = new_value; @@ -6252,7 +6257,7 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6270,12 +6275,12 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6364,7 +6369,7 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.list", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6406,7 +6411,7 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6442,7 +6447,7 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6452,10 +6457,10 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut PretargetingConfigListCall<'a, C, A> where C: BorrowMut PretargetingConfigListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6506,12 +6511,12 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut PretargetingConfigListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6608,7 +6613,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.update", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6651,14 +6656,14 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6702,7 +6707,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6712,10 +6717,10 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> { self._request = new_value; @@ -6757,7 +6762,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6767,7 +6772,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> { self._config_id = new_value.to_string(); @@ -6785,12 +6790,12 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/adexchangebuyer1d4-cli/Cargo.toml b/gen/adexchangebuyer1d4-cli/Cargo.toml index 206e346a12..62c2dd9b0c 100644 --- a/gen/adexchangebuyer1d4-cli/Cargo.toml +++ b/gen/adexchangebuyer1d4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangebuyer1d4-cli" -version = "0.3.2+20150909" +version = "0.3.3+20160118" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Exchange Buyer (protocol v1.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d4-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/adexchangebuyer1d4-cli/LICENSE.md b/gen/adexchangebuyer1d4-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/adexchangebuyer1d4-cli/LICENSE.md +++ b/gen/adexchangebuyer1d4-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/adexchangebuyer1d4-cli/README.md b/gen/adexchangebuyer1d4-cli/README.md index 7496d56043..72f656378d 100644 --- a/gen/adexchangebuyer1d4-cli/README.md +++ b/gen/adexchangebuyer1d4-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Ad Exchange Buyer* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/adexchangebuyer1d4.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/adexchangebuyer1d4.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/adexchangebuyer1d4.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/adexchangebuyer1d4.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d4-cli). # Usage -This documentation was generated from the *Ad Exchange Buyer* API at revision *20150909*. The CLI is at version *0.3.2*. +This documentation was generated from the *Ad Exchange Buyer* API at revision *20160118*. The CLI is at version *0.3.3*. ```bash adexchangebuyer1d4 [options] @@ -40,46 +40,20 @@ adexchangebuyer1d4 [options] get [-p ]... [-o ] patch (-r )... [-p ]... [-o ] update (-r )... [-p ]... [-o ] - clientaccess - delete [-p ]... - get [-p ]... [-o ] - insert (-r )... [-p ]... [-o ] - list (-r )... [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - update (-r )... [-p ]... [-o ] creatives + add-deal [-p ]... get [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] - deals - get (-r )... [-p ]... [-o ] + remove-deal [-p ]... marketplacedeals - delete (-r )... [-p ]... [-o ] - insert (-r )... [-p ]... [-o ] - list [-p ]... [-o ] - update (-r )... [-p ]... [-o ] + delete (-r )... [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + update (-r )... [-p ]... [-o ] marketplacenotes - insert (-r )... [-p ]... [-o ] - list [-p ]... [-o ] - marketplaceoffers - get [-p ]... [-o ] - search [-p ]... [-o ] - marketplaceorders - get [-p ]... [-o ] - insert (-r )... [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - search [-p ]... [-o ] - update (-r )... [-p ]... [-o ] - negotiationrounds - insert (-r )... [-p ]... [-o ] - negotiations - get (-r )... [-p ]... [-o ] - insert (-r )... [-p ]... [-o ] - list (-r )... [-p ]... [-o ] - offers - get [-p ]... [-o ] - insert (-r )... [-p ]... [-o ] - list (-r )... [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] performance-report list [-p ]... [-o ] pretargeting-config @@ -89,22 +63,31 @@ adexchangebuyer1d4 [options] list [-p ]... [-o ] patch (-r )... [-p ]... [-o ] update (-r )... [-p ]... [-o ] + products + get [-p ]... [-o ] + search [-p ]... [-o ] + proposals + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + search [-p ]... [-o ] + update (-r )... [-p ]... [-o ] adexchangebuyer1d4 --help Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/adexchangebuyer1d4-cli/mkdocs.yml b/gen/adexchangebuyer1d4-cli/mkdocs.yml index 89be06a785..77b4198887 100644 --- a/gen/adexchangebuyer1d4-cli/mkdocs.yml +++ b/gen/adexchangebuyer1d4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Ad Exchange Buyer v0.3.2+20150909 +site_name: Ad Exchange Buyer v0.3.3+20160118 site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d4-cli site_description: Write integrating applications with bcore @@ -18,36 +18,17 @@ pages: - ['budget_get.md', 'Budget', 'Get'] - ['budget_patch.md', 'Budget', 'Patch'] - ['budget_update.md', 'Budget', 'Update'] -- ['clientaccess_delete.md', 'Clientaccess', 'Delete'] -- ['clientaccess_get.md', 'Clientaccess', 'Get'] -- ['clientaccess_insert.md', 'Clientaccess', 'Insert'] -- ['clientaccess_list.md', 'Clientaccess', 'List'] -- ['clientaccess_patch.md', 'Clientaccess', 'Patch'] -- ['clientaccess_update.md', 'Clientaccess', 'Update'] +- ['creatives_add-deal.md', 'Creatives', 'Add Deal'] - ['creatives_get.md', 'Creatives', 'Get'] - ['creatives_insert.md', 'Creatives', 'Insert'] - ['creatives_list.md', 'Creatives', 'List'] -- ['deals_get.md', 'Deals', 'Get'] +- ['creatives_remove-deal.md', 'Creatives', 'Remove Deal'] - ['marketplacedeals_delete.md', 'Marketplacedeals', 'Delete'] - ['marketplacedeals_insert.md', 'Marketplacedeals', 'Insert'] - ['marketplacedeals_list.md', 'Marketplacedeals', 'List'] - ['marketplacedeals_update.md', 'Marketplacedeals', 'Update'] - ['marketplacenotes_insert.md', 'Marketplacenotes', 'Insert'] - ['marketplacenotes_list.md', 'Marketplacenotes', 'List'] -- ['marketplaceoffers_get.md', 'Marketplaceoffers', 'Get'] -- ['marketplaceoffers_search.md', 'Marketplaceoffers', 'Search'] -- ['marketplaceorders_get.md', 'Marketplaceorders', 'Get'] -- ['marketplaceorders_insert.md', 'Marketplaceorders', 'Insert'] -- ['marketplaceorders_patch.md', 'Marketplaceorders', 'Patch'] -- ['marketplaceorders_search.md', 'Marketplaceorders', 'Search'] -- ['marketplaceorders_update.md', 'Marketplaceorders', 'Update'] -- ['negotiationrounds_insert.md', 'Negotiationrounds', 'Insert'] -- ['negotiations_get.md', 'Negotiations', 'Get'] -- ['negotiations_insert.md', 'Negotiations', 'Insert'] -- ['negotiations_list.md', 'Negotiations', 'List'] -- ['offers_get.md', 'Offers', 'Get'] -- ['offers_insert.md', 'Offers', 'Insert'] -- ['offers_list.md', 'Offers', 'List'] - ['performance-report_list.md', 'Performance Report', 'List'] - ['pretargeting-config_delete.md', 'Pretargeting Config', 'Delete'] - ['pretargeting-config_get.md', 'Pretargeting Config', 'Get'] @@ -55,8 +36,15 @@ pages: - ['pretargeting-config_list.md', 'Pretargeting Config', 'List'] - ['pretargeting-config_patch.md', 'Pretargeting Config', 'Patch'] - ['pretargeting-config_update.md', 'Pretargeting Config', 'Update'] +- ['products_get.md', 'Products', 'Get'] +- ['products_search.md', 'Products', 'Search'] +- ['proposals_get.md', 'Proposals', 'Get'] +- ['proposals_insert.md', 'Proposals', 'Insert'] +- ['proposals_patch.md', 'Proposals', 'Patch'] +- ['proposals_search.md', 'Proposals', 'Search'] +- ['proposals_update.md', 'Proposals', 'Update'] theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/adexchangebuyer1d4-cli/src/main.rs b/gen/adexchangebuyer1d4-cli/src/main.rs index 7a7784f1ea..271921fb21 100644 --- a/gen/adexchangebuyer1d4-cli/src/main.rs +++ b/gen/adexchangebuyer1d4-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,20 +36,20 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::AdExchangeBuyer>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let id: i32 = arg_from_str(&opt.value_of("id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.accounts().get(id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -62,7 +62,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -75,7 +75,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -98,10 +98,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -114,7 +114,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -127,7 +127,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -150,13 +150,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -170,8 +170,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "maximum-total-qps" => Some(("maximumTotalQps", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -193,7 +193,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Account = json::value::from_value(object).unwrap(); let id: i32 = arg_from_str(&opt.value_of("id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.accounts().patch(request, id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -206,7 +206,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -219,7 +219,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -242,13 +242,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -262,8 +262,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "maximum-total-qps" => Some(("maximumTotalQps", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -285,7 +285,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Account = json::value::from_value(object).unwrap(); let id: i32 = arg_from_str(&opt.value_of("id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.accounts().update(request, id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -298,7 +298,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -311,7 +311,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -334,11 +334,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _billing_info_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _billing_info_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let account_id: i32 = arg_from_str(&opt.value_of("account-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.billing_info().get(account_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -351,7 +351,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -364,7 +364,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -387,10 +387,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _billing_info_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _billing_info_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.billing_info().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -403,7 +403,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -416,7 +416,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -439,10 +439,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _budget_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _budget_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.budget().get(opt.value_of("account-id").unwrap_or(""), opt.value_of("billing-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -455,7 +455,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -468,7 +468,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -491,13 +491,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _budget_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _budget_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -511,8 +511,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "budget-amount" => Some(("budgetAmount", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -532,7 +532,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Budget = json::value::from_value(object).unwrap(); let mut call = self.hub.budget().patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("billing-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -545,7 +545,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -558,7 +558,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -581,13 +581,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _budget_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _budget_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -601,8 +601,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "budget-amount" => Some(("budgetAmount", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -622,7 +622,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Budget = json::value::from_value(object).unwrap(); let mut call = self.hub.budget().update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("billing-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -635,7 +635,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -648,7 +648,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -671,11 +671,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _clientaccess_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_add_deal(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let sponsor_account_id: i32 = arg_from_str(&opt.value_of("sponsor-account-id").unwrap_or(""), err, "", "integer"); - let mut call = self.hub.clientaccess().delete(opt.value_of("client-account-id").unwrap_or(""), sponsor_account_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let account_id: i32 = arg_from_str(&opt.value_of("account-id").unwrap_or(""), err, "", "integer"); + let mut call = self.hub.creatives().add_deal(account_id, opt.value_of("buyer-creative-id").unwrap_or(""), opt.value_of("deal-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -688,7 +688,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -701,7 +701,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -716,416 +716,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _clientaccess_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let sponsor_account_id: i32 = arg_from_str(&opt.value_of("sponsor-account-id").unwrap_or(""), err, "", "integer"); - let mut call = self.hub.clientaccess().get(opt.value_of("client-account-id").unwrap_or(""), sponsor_account_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _clientaccess_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "client-account-id" => Some(("clientAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "capabilities" => Some(("capabilities", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["capabilities", "client-account-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ClientAccessCapabilities = json::value::from_value(object).unwrap(); - let mut call = self.hub.clientaccess().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sponsor-account-id" => { - call = call.sponsor_account_id(arg_from_str(value.unwrap_or("-0"), err, "sponsor-account-id", "integer")); - }, - "client-account-id" => { - call = call.client_account_id(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["client-account-id", "sponsor-account-id"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _clientaccess_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "sponsor-account-id" => Some(("sponsorAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["sponsor-account-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ListClientAccessCapabilitiesRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.clientaccess().list(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _clientaccess_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "client-account-id" => Some(("clientAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "capabilities" => Some(("capabilities", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["capabilities", "client-account-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ClientAccessCapabilities = json::value::from_value(object).unwrap(); - let sponsor_account_id: i32 = arg_from_str(&opt.value_of("sponsor-account-id").unwrap_or(""), err, "", "integer"); - let mut call = self.hub.clientaccess().patch(request, opt.value_of("client-account-id").unwrap_or(""), sponsor_account_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _clientaccess_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "client-account-id" => Some(("clientAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "capabilities" => Some(("capabilities", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["capabilities", "client-account-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ClientAccessCapabilities = json::value::from_value(object).unwrap(); - let sponsor_account_id: i32 = arg_from_str(&opt.value_of("sponsor-account-id").unwrap_or(""), err, "", "integer"); - let mut call = self.hub.clientaccess().update(request, opt.value_of("client-account-id").unwrap_or(""), sponsor_account_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _creatives_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let account_id: i32 = arg_from_str(&opt.value_of("account-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.creatives().get(account_id, opt.value_of("buyer-creative-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1138,7 +733,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1151,7 +746,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1174,13 +769,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1194,10 +789,9 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "api-upload-timestamp" => Some(("api_upload_timestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "attribute" => Some(("attribute", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "height" => Some(("height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "advertiser-name" => Some(("advertiserName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1228,6 +822,7 @@ impl<'n, 'a> Engine<'n, 'a> { "native-ad.price" => Some(("nativeAd.price", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "native-ad.click-tracking-url" => Some(("nativeAd.clickTrackingUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "api-upload-timestamp" => Some(("apiUploadTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "vendor-type" => Some(("vendorType", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "sensitive-categories" => Some(("sensitiveCategories", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), "product-categories" => Some(("productCategories", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), @@ -1249,7 +844,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Creative = json::value::from_value(object).unwrap(); let mut call = self.hub.creatives().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1262,7 +857,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1275,7 +870,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1298,10 +893,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creatives().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1332,7 +927,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["open-auction-status-filter", "max-results", "page-token", "buyer-creative-id", "deals-status-filter", "account-id"].iter().map(|v|*v)); @@ -1346,7 +941,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1369,43 +964,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deals_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_remove_deal(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "include-private-auctions" => Some(("includePrivateAuctions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["include-private-auctions"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GetFinalizedNegotiationByExternalDealIdRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.deals().get(request, opt.value_of("deal-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let account_id: i32 = arg_from_str(&opt.value_of("account-id").unwrap_or(""), err, "", "integer"); + let mut call = self.hub.creatives().remove_deal(account_id, opt.value_of("buyer-creative-id").unwrap_or(""), opt.value_of("deal-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1418,7 +981,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1431,36 +994,28 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; match match protocol { CallType::Standard => call.doit(), _ => unreachable!() } { Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); + Ok(mut response) => { Ok(()) } } } } - fn _marketplacedeals_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _marketplacedeals_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1474,14 +1029,14 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "order-revision-number" => Some(("orderRevisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal-revision-number" => Some(("proposalRevisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-action" => Some(("updateAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "deal-ids" => Some(("dealIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["deal-ids", "order-revision-number", "update-action"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["deal-ids", "proposal-revision-number", "update-action"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1491,8 +1046,8 @@ impl<'n, 'a> Engine<'n, 'a> { } } let mut request: api::DeleteOrderDealsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.marketplacedeals().delete(request, opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.marketplacedeals().delete(request, opt.value_of("proposal-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1505,7 +1060,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1518,7 +1073,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1541,13 +1096,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _marketplacedeals_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _marketplacedeals_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1561,13 +1116,13 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "order-revision-number" => Some(("orderRevisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal-revision-number" => Some(("proposalRevisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-action" => Some(("updateAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["order-revision-number", "update-action"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["proposal-revision-number", "update-action"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1577,8 +1132,8 @@ impl<'n, 'a> Engine<'n, 'a> { } } let mut request: api::AddOrderDealsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.marketplacedeals().insert(request, opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.marketplacedeals().insert(request, opt.value_of("proposal-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1591,7 +1146,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1604,7 +1159,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1627,10 +1182,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _marketplacedeals_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _marketplacedeals_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.marketplacedeals().list(opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.marketplacedeals().list(opt.value_of("proposal-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1643,7 +1198,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1656,7 +1211,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1679,13 +1234,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _marketplacedeals_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _marketplacedeals_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1699,32 +1254,33 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "order-revision-number" => Some(("orderRevisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.order-id" => Some(("order.orderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.kind" => Some(("order.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.name" => Some(("order.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.revision-time-ms" => Some(("order.revisionTimeMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.buyer-private-data.reference-id" => Some(("order.buyerPrivateData.referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.buyer-private-data.reference-payload" => Some(("order.buyerPrivateData.referencePayload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.billed-buyer.account-id" => Some(("order.billedBuyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.originator-role" => Some(("order.originatorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.seller.sub-account-id" => Some(("order.seller.subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.seller.account-id" => Some(("order.seller.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.last-updater-role" => Some(("order.lastUpdaterRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.order-state" => Some(("order.orderState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.has-seller-signed-off" => Some(("order.hasSellerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "order.is-renegotiating" => Some(("order.isRenegotiating", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "order.buyer.account-id" => Some(("order.buyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.has-buyer-signed-off" => Some(("order.hasBuyerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "order.is-setup-complete" => Some(("order.isSetupComplete", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "order.revision-number" => Some(("order.revisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order.last-updater-or-commentor-role" => Some(("order.lastUpdaterOrCommentorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.kind" => Some(("proposal.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.proposal-state" => Some(("proposal.proposalState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.name" => Some(("proposal.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.revision-time-ms" => Some(("proposal.revisionTimeMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.buyer-private-data.reference-id" => Some(("proposal.buyerPrivateData.referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.buyer-private-data.reference-payload" => Some(("proposal.buyerPrivateData.referencePayload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.billed-buyer.account-id" => Some(("proposal.billedBuyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.originator-role" => Some(("proposal.originatorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.seller.sub-account-id" => Some(("proposal.seller.subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.seller.account-id" => Some(("proposal.seller.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.last-updater-role" => Some(("proposal.lastUpdaterRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.proposal-id" => Some(("proposal.proposalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.inventory-source" => Some(("proposal.inventorySource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.last-updater-or-commentor-role" => Some(("proposal.lastUpdaterOrCommentorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.has-seller-signed-off" => Some(("proposal.hasSellerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "proposal.is-renegotiating" => Some(("proposal.isRenegotiating", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "proposal.buyer.account-id" => Some(("proposal.buyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal.has-buyer-signed-off" => Some(("proposal.hasBuyerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "proposal.is-setup-complete" => Some(("proposal.isSetupComplete", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "proposal.revision-number" => Some(("proposal.revisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal-revision-number" => Some(("proposalRevisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-action" => Some(("updateAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "has-buyer-signed-off", "has-seller-signed-off", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "last-updater-role", "name", "order", "order-id", "order-revision-number", "order-state", "originator-role", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id", "update-action"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "has-buyer-signed-off", "has-seller-signed-off", "inventory-source", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "last-updater-role", "name", "originator-role", "proposal", "proposal-id", "proposal-revision-number", "proposal-state", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id", "update-action"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1734,8 +1290,8 @@ impl<'n, 'a> Engine<'n, 'a> { } } let mut request: api::EditAllOrderDealsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.marketplacedeals().update(request, opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.marketplacedeals().update(request, opt.value_of("proposal-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1748,7 +1304,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1761,7 +1317,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1784,13 +1340,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _marketplacenotes_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _marketplacenotes_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1804,8 +1360,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -1818,8 +1374,8 @@ impl<'n, 'a> Engine<'n, 'a> { } } let mut request: api::AddOrderNotesRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.marketplacenotes().insert(request, opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.marketplacenotes().insert(request, opt.value_of("proposal-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1832,7 +1388,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1845,7 +1401,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1868,10 +1424,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _marketplacenotes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _marketplacenotes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.marketplacenotes().list(opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.marketplacenotes().list(opt.value_of("proposal-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1884,7 +1440,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1897,7 +1453,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1920,1349 +1476,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _marketplaceoffers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.marketplaceoffers().get(opt.value_of("offer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _marketplaceoffers_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.marketplaceoffers().search(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "pql-query" => { - call = call.pql_query(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["pql-query"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _marketplaceorders_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.marketplaceorders().get(opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _marketplaceorders_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "web-property-code" => Some(("webPropertyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["web-property-code"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::CreateOrdersRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.marketplaceorders().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _marketplaceorders_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "order-id" => Some(("orderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "revision-time-ms" => Some(("revisionTimeMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer-private-data.reference-id" => Some(("buyerPrivateData.referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer-private-data.reference-payload" => Some(("buyerPrivateData.referencePayload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.account-id" => Some(("billedBuyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "originator-role" => Some(("originatorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller.sub-account-id" => Some(("seller.subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller.account-id" => Some(("seller.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-updater-role" => Some(("lastUpdaterRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order-state" => Some(("orderState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "has-seller-signed-off" => Some(("hasSellerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "is-renegotiating" => Some(("isRenegotiating", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "buyer.account-id" => Some(("buyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "has-buyer-signed-off" => Some(("hasBuyerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "is-setup-complete" => Some(("isSetupComplete", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "revision-number" => Some(("revisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-updater-or-commentor-role" => Some(("lastUpdaterOrCommentorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "has-buyer-signed-off", "has-seller-signed-off", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "last-updater-role", "name", "order-id", "order-state", "originator-role", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::MarketplaceOrder = json::value::from_value(object).unwrap(); - let mut call = self.hub.marketplaceorders().patch(request, opt.value_of("order-id").unwrap_or(""), opt.value_of("revision-number").unwrap_or(""), opt.value_of("update-action").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _marketplaceorders_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.marketplaceorders().search(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "pql-query" => { - call = call.pql_query(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["pql-query"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _marketplaceorders_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "order-id" => Some(("orderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "revision-time-ms" => Some(("revisionTimeMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer-private-data.reference-id" => Some(("buyerPrivateData.referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer-private-data.reference-payload" => Some(("buyerPrivateData.referencePayload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.account-id" => Some(("billedBuyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "originator-role" => Some(("originatorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller.sub-account-id" => Some(("seller.subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller.account-id" => Some(("seller.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-updater-role" => Some(("lastUpdaterRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "order-state" => Some(("orderState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "has-seller-signed-off" => Some(("hasSellerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "is-renegotiating" => Some(("isRenegotiating", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "buyer.account-id" => Some(("buyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "has-buyer-signed-off" => Some(("hasBuyerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "is-setup-complete" => Some(("isSetupComplete", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "revision-number" => Some(("revisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "last-updater-or-commentor-role" => Some(("lastUpdaterOrCommentorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "has-buyer-signed-off", "has-seller-signed-off", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "last-updater-role", "name", "order-id", "order-state", "originator-role", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::MarketplaceOrder = json::value::from_value(object).unwrap(); - let mut call = self.hub.marketplaceorders().update(request, opt.value_of("order-id").unwrap_or(""), opt.value_of("revision-number").unwrap_or(""), opt.value_of("update-action").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _negotiationrounds_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.finalize-automatically" => Some(("terms.finalizeAutomatically", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.inventory-segment-targeting.positive-icm-interests" => Some(("terms.inventorySegmentTargeting.positiveIcmInterests", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-inventory-slots" => Some(("terms.inventorySegmentTargeting.positiveInventorySlots", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-site-urls" => Some(("terms.inventorySegmentTargeting.negativeSiteUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-icm-brands" => Some(("terms.inventorySegmentTargeting.positiveIcmBrands", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-xfp-placements" => Some(("terms.inventorySegmentTargeting.negativeXfpPlacements", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-video-ad-position-segments" => Some(("terms.inventorySegmentTargeting.positiveVideoAdPositionSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-icm-interests" => Some(("terms.inventorySegmentTargeting.negativeIcmInterests", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-audience-segments" => Some(("terms.inventorySegmentTargeting.negativeAudienceSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-operating-systems" => Some(("terms.inventorySegmentTargeting.positiveOperatingSystems", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-operating-systems" => Some(("terms.inventorySegmentTargeting.negativeOperatingSystems", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-icm-brands" => Some(("terms.inventorySegmentTargeting.negativeIcmBrands", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-locations" => Some(("terms.inventorySegmentTargeting.positiveLocations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-mobile-apps" => Some(("terms.inventorySegmentTargeting.negativeMobileApps", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-device-categories" => Some(("terms.inventorySegmentTargeting.positiveDeviceCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-inventory-slots" => Some(("terms.inventorySegmentTargeting.negativeInventorySlots", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-video-ad-position-segments" => Some(("terms.inventorySegmentTargeting.negativeVideoAdPositionSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-video-duration-segments" => Some(("terms.inventorySegmentTargeting.negativeVideoDurationSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-sizes" => Some(("terms.inventorySegmentTargeting.positiveSizes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-xfp-ad-slots" => Some(("terms.inventorySegmentTargeting.positiveXfpAdSlots", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-site-urls" => Some(("terms.inventorySegmentTargeting.positiveSiteUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-mobile-apps" => Some(("terms.inventorySegmentTargeting.positiveMobileApps", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-sizes" => Some(("terms.inventorySegmentTargeting.negativeSizes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-operating-system-versions" => Some(("terms.inventorySegmentTargeting.positiveOperatingSystemVersions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-locations" => Some(("terms.inventorySegmentTargeting.negativeLocations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-operating-system-versions" => Some(("terms.inventorySegmentTargeting.negativeOperatingSystemVersions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-xfp-placements" => Some(("terms.inventorySegmentTargeting.positiveXfpPlacements", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-xfp-ad-slots" => Some(("terms.inventorySegmentTargeting.negativeXfpAdSlots", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-video-duration-segments" => Some(("terms.inventorySegmentTargeting.positiveVideoDurationSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-audience-segments" => Some(("terms.inventorySegmentTargeting.positiveAudienceSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-device-categories" => Some(("terms.inventorySegmentTargeting.negativeDeviceCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-ad-type-segments" => Some(("terms.inventorySegmentTargeting.positiveAdTypeSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-ad-type-segments" => Some(("terms.inventorySegmentTargeting.negativeAdTypeSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.end-date.time-zone-id" => Some(("terms.endDate.timeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.end-date.hour" => Some(("terms.endDate.hour", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.end-date.month" => Some(("terms.endDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.end-date.second" => Some(("terms.endDate.second", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.end-date.year" => Some(("terms.endDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.end-date.day" => Some(("terms.endDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.end-date.minute" => Some(("terms.endDate.minute", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.terms-attributes" => Some(("terms.termsAttributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.start-date.time-zone-id" => Some(("terms.startDate.timeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.start-date.hour" => Some(("terms.startDate.hour", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.start-date.month" => Some(("terms.startDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.start-date.second" => Some(("terms.startDate.second", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.start-date.year" => Some(("terms.startDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.start-date.day" => Some(("terms.startDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.start-date.minute" => Some(("terms.startDate.minute", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.buyer-billing-type" => Some(("terms.buyerBillingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.estimated-impressions-per-day" => Some(("terms.estimatedImpressionsPerDay", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.monetizer-type" => Some(("terms.monetizerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.target-by-deal-id" => Some(("terms.targetByDealId", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.minimum-spend-micros" => Some(("terms.minimumSpendMicros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.targeting-all-ad-slots" => Some(("terms.targetingAllAdSlots", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.creative-review-policy" => Some(("terms.creativeReviewPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.audience-segment-description" => Some(("terms.audienceSegmentDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.deal-premium.micros" => Some(("terms.dealPremium.micros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.deal-premium.currency-code" => Some(("terms.dealPremium.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.creative-blocking-level" => Some(("terms.creativeBlockingLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.audience-segment.num-cookies" => Some(("terms.audienceSegment.numCookies", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.audience-segment.description" => Some(("terms.audienceSegment.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.audience-segment.name" => Some(("terms.audienceSegment.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.audience-segment.id" => Some(("terms.audienceSegment.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.description" => Some(("terms.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.billing-terms" => Some(("terms.billingTerms", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.is-reservation" => Some(("terms.isReservation", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.semi-transparent" => Some(("terms.semiTransparent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.minimum-true-looks" => Some(("terms.minimumTrueLooks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.cpm.micros" => Some(("terms.cpm.micros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.cpm.currency-code" => Some(("terms.cpm.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.descriptive-name" => Some(("terms.descriptiveName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.urls" => Some(("terms.urls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.estimated-spend.micros" => Some(("terms.estimatedSpend.micros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.estimated-spend.currency-code" => Some(("terms.estimatedSpend.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "round-number" => Some(("roundNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "originator-role" => Some(("originatorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "negotiation-id" => Some(("negotiationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "edit-history.created-time-stamp" => Some(("editHistory.createdTimeStamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "edit-history.created-by-login-name" => Some(("editHistory.createdByLoginName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "edit-history.last-updated-by-login-name" => Some(("editHistory.lastUpdatedByLoginName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "edit-history.last-update-time-stamp" => Some(("editHistory.lastUpdateTimeStamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dbm-partner-id" => Some(("dbmPartnerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "action" => Some(("action", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["action", "audience-segment", "audience-segment-description", "billing-terms", "buyer-billing-type", "cpm", "created-by-login-name", "created-time-stamp", "creative-blocking-level", "creative-review-policy", "currency-code", "day", "dbm-partner-id", "deal-premium", "description", "descriptive-name", "edit-history", "end-date", "estimated-impressions-per-day", "estimated-spend", "finalize-automatically", "hour", "id", "inventory-segment-targeting", "is-reservation", "kind", "last-update-time-stamp", "last-updated-by-login-name", "micros", "minimum-spend-micros", "minimum-true-looks", "minute", "monetizer-type", "month", "name", "negative-ad-type-segments", "negative-audience-segments", "negative-device-categories", "negative-icm-brands", "negative-icm-interests", "negative-inventory-slots", "negative-locations", "negative-mobile-apps", "negative-operating-system-versions", "negative-operating-systems", "negative-site-urls", "negative-sizes", "negative-video-ad-position-segments", "negative-video-duration-segments", "negative-xfp-ad-slots", "negative-xfp-placements", "negotiation-id", "notes", "num-cookies", "originator-role", "positive-ad-type-segments", "positive-audience-segments", "positive-device-categories", "positive-icm-brands", "positive-icm-interests", "positive-inventory-slots", "positive-locations", "positive-mobile-apps", "positive-operating-system-versions", "positive-operating-systems", "positive-site-urls", "positive-sizes", "positive-video-ad-position-segments", "positive-video-duration-segments", "positive-xfp-ad-slots", "positive-xfp-placements", "round-number", "second", "semi-transparent", "start-date", "target-by-deal-id", "targeting-all-ad-slots", "terms", "terms-attributes", "time-zone-id", "urls", "year"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::NegotiationRoundDto = json::value::from_value(object).unwrap(); - let mut call = self.hub.negotiationrounds().insert(request, opt.value_of("negotiation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _negotiations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "include-private-auctions" => Some(("includePrivateAuctions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["include-private-auctions"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GetNegotiationByIdRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.negotiations().get(request, opt.value_of("negotiation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _negotiations_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer-email-contacts" => Some(("buyerEmailContacts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "label-names" => Some(("labelNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "billed-buyer.buyer.enabled-for-preferred-deals" => Some(("billedBuyer.buyer.enabledForPreferredDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "billed-buyer.buyer.display-name" => Some(("billedBuyer.buyer.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.buyer.customer-id" => Some(("billedBuyer.buyer.customerId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.buyer.enabled-for-interest-targeting-deals" => Some(("billedBuyer.buyer.enabledForInterestTargetingDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "billed-buyer.buyer.sponsor-account-id" => Some(("billedBuyer.buyer.sponsorAccountId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.buyer.id" => Some(("billedBuyer.buyer.id", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.buyer.account-id" => Some(("billedBuyer.buyer.accountId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.web-property.enabled-for-preferred-deals" => Some(("billedBuyer.webProperty.enabledForPreferredDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "billed-buyer.web-property.name" => Some(("billedBuyer.webProperty.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.web-property.syndication-product" => Some(("billedBuyer.webProperty.syndicationProduct", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.web-property.allow-interest-targeted-ads" => Some(("billedBuyer.webProperty.allowInterestTargetedAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "billed-buyer.web-property.site-urls" => Some(("billedBuyer.webProperty.siteUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "billed-buyer.web-property.property-code" => Some(("billedBuyer.webProperty.propertyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.web-property.id" => Some(("billedBuyer.webProperty.id", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.customer-id" => Some(("billedBuyer.customerId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.name" => Some(("billedBuyer.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.buyer-seller-role" => Some(("billedBuyer.buyerSellerRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "offer-id" => Some(("offerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller.buyer.enabled-for-preferred-deals" => Some(("seller.buyer.enabledForPreferredDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "seller.buyer.display-name" => Some(("seller.buyer.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller.buyer.customer-id" => Some(("seller.buyer.customerId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "seller.buyer.enabled-for-interest-targeting-deals" => Some(("seller.buyer.enabledForInterestTargetingDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "seller.buyer.sponsor-account-id" => Some(("seller.buyer.sponsorAccountId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "seller.buyer.id" => Some(("seller.buyer.id", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "seller.buyer.account-id" => Some(("seller.buyer.accountId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "seller.web-property.enabled-for-preferred-deals" => Some(("seller.webProperty.enabledForPreferredDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "seller.web-property.name" => Some(("seller.webProperty.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller.web-property.syndication-product" => Some(("seller.webProperty.syndicationProduct", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller.web-property.allow-interest-targeted-ads" => Some(("seller.webProperty.allowInterestTargetedAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "seller.web-property.site-urls" => Some(("seller.webProperty.siteUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "seller.web-property.property-code" => Some(("seller.webProperty.propertyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller.web-property.id" => Some(("seller.webProperty.id", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "seller.customer-id" => Some(("seller.customerId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "seller.name" => Some(("seller.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller.buyer-seller-role" => Some(("seller.buyerSellerRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "negotiation-id" => Some(("negotiationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "negotiation-state" => Some(("negotiationState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer.buyer.enabled-for-preferred-deals" => Some(("buyer.buyer.enabledForPreferredDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "buyer.buyer.display-name" => Some(("buyer.buyer.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer.buyer.customer-id" => Some(("buyer.buyer.customerId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "buyer.buyer.enabled-for-interest-targeting-deals" => Some(("buyer.buyer.enabledForInterestTargetingDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "buyer.buyer.sponsor-account-id" => Some(("buyer.buyer.sponsorAccountId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "buyer.buyer.id" => Some(("buyer.buyer.id", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "buyer.buyer.account-id" => Some(("buyer.buyer.accountId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "buyer.web-property.enabled-for-preferred-deals" => Some(("buyer.webProperty.enabledForPreferredDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "buyer.web-property.name" => Some(("buyer.webProperty.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer.web-property.syndication-product" => Some(("buyer.webProperty.syndicationProduct", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer.web-property.allow-interest-targeted-ads" => Some(("buyer.webProperty.allowInterestTargetedAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "buyer.web-property.site-urls" => Some(("buyer.webProperty.siteUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "buyer.web-property.property-code" => Some(("buyer.webProperty.propertyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer.web-property.id" => Some(("buyer.webProperty.id", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "buyer.customer-id" => Some(("buyer.customerId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "buyer.name" => Some(("buyer.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "buyer.buyer-seller-role" => Some(("buyer.buyerSellerRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "stats.revenue.micros" => Some(("stats.revenue.micros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "stats.revenue.currency-code" => Some(("stats.revenue.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "stats.bids" => Some(("stats.bids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "stats.impressions" => Some(("stats.impressions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "stats.requests" => Some(("stats.requests", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "stats.good-bids" => Some(("stats.goodBids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "stats.spend.micros" => Some(("stats.spend.micros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "stats.spend.currency-code" => Some(("stats.spend.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "external-deal-id" => Some(("externalDealId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "seller-email-contacts" => Some(("sellerEmailContacts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "deal-type" => Some(("dealType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "allow-interest-targeted-ads", "bids", "billed-buyer", "buyer", "buyer-email-contacts", "buyer-seller-role", "currency-code", "customer-id", "deal-type", "display-name", "enabled-for-interest-targeting-deals", "enabled-for-preferred-deals", "external-deal-id", "good-bids", "id", "impressions", "kind", "label-names", "micros", "name", "negotiation-id", "negotiation-state", "offer-id", "property-code", "requests", "revenue", "seller", "seller-email-contacts", "site-urls", "spend", "sponsor-account-id", "stats", "status", "syndication-product", "web-property"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::NegotiationDto = json::value::from_value(object).unwrap(); - let mut call = self.hub.negotiations().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _negotiations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "since-timestamp-millis" => Some(("sinceTimestampMillis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "include-private-auctions" => Some(("includePrivateAuctions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "finalized" => Some(("finalized", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["finalized", "include-private-auctions", "since-timestamp-millis"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::GetNegotiationsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.negotiations().list(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _offers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.offers().get(opt.value_of("offer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _offers_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "label-names" => Some(("labelNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "point-of-contact" => Some(("pointOfContact", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "is-open" => Some(("isOpen", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "creator.buyer.enabled-for-preferred-deals" => Some(("creator.buyer.enabledForPreferredDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "creator.buyer.display-name" => Some(("creator.buyer.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "creator.buyer.customer-id" => Some(("creator.buyer.customerId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "creator.buyer.enabled-for-interest-targeting-deals" => Some(("creator.buyer.enabledForInterestTargetingDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "creator.buyer.sponsor-account-id" => Some(("creator.buyer.sponsorAccountId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "creator.buyer.id" => Some(("creator.buyer.id", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "creator.buyer.account-id" => Some(("creator.buyer.accountId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "creator.web-property.enabled-for-preferred-deals" => Some(("creator.webProperty.enabledForPreferredDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "creator.web-property.name" => Some(("creator.webProperty.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "creator.web-property.syndication-product" => Some(("creator.webProperty.syndicationProduct", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "creator.web-property.allow-interest-targeted-ads" => Some(("creator.webProperty.allowInterestTargetedAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "creator.web-property.site-urls" => Some(("creator.webProperty.siteUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "creator.web-property.property-code" => Some(("creator.webProperty.propertyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "creator.web-property.id" => Some(("creator.webProperty.id", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "creator.customer-id" => Some(("creator.customerId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "creator.name" => Some(("creator.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "creator.buyer-seller-role" => Some(("creator.buyerSellerRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.buyer.enabled-for-preferred-deals" => Some(("billedBuyer.buyer.enabledForPreferredDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "billed-buyer.buyer.display-name" => Some(("billedBuyer.buyer.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.buyer.customer-id" => Some(("billedBuyer.buyer.customerId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.buyer.enabled-for-interest-targeting-deals" => Some(("billedBuyer.buyer.enabledForInterestTargetingDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "billed-buyer.buyer.sponsor-account-id" => Some(("billedBuyer.buyer.sponsorAccountId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.buyer.id" => Some(("billedBuyer.buyer.id", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.buyer.account-id" => Some(("billedBuyer.buyer.accountId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.web-property.enabled-for-preferred-deals" => Some(("billedBuyer.webProperty.enabledForPreferredDeals", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "billed-buyer.web-property.name" => Some(("billedBuyer.webProperty.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.web-property.syndication-product" => Some(("billedBuyer.webProperty.syndicationProduct", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.web-property.allow-interest-targeted-ads" => Some(("billedBuyer.webProperty.allowInterestTargetedAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "billed-buyer.web-property.site-urls" => Some(("billedBuyer.webProperty.siteUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "billed-buyer.web-property.property-code" => Some(("billedBuyer.webProperty.propertyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.web-property.id" => Some(("billedBuyer.webProperty.id", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.customer-id" => Some(("billedBuyer.customerId", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "billed-buyer.name" => Some(("billedBuyer.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "billed-buyer.buyer-seller-role" => Some(("billedBuyer.buyerSellerRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "offer-id" => Some(("offerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "offer-state" => Some(("offerState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "anonymous" => Some(("anonymous", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.finalize-automatically" => Some(("terms.finalizeAutomatically", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.inventory-segment-targeting.positive-icm-interests" => Some(("terms.inventorySegmentTargeting.positiveIcmInterests", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-inventory-slots" => Some(("terms.inventorySegmentTargeting.positiveInventorySlots", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-site-urls" => Some(("terms.inventorySegmentTargeting.negativeSiteUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-icm-brands" => Some(("terms.inventorySegmentTargeting.positiveIcmBrands", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-xfp-placements" => Some(("terms.inventorySegmentTargeting.negativeXfpPlacements", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-video-ad-position-segments" => Some(("terms.inventorySegmentTargeting.positiveVideoAdPositionSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-icm-interests" => Some(("terms.inventorySegmentTargeting.negativeIcmInterests", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-audience-segments" => Some(("terms.inventorySegmentTargeting.negativeAudienceSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-operating-systems" => Some(("terms.inventorySegmentTargeting.positiveOperatingSystems", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-operating-systems" => Some(("terms.inventorySegmentTargeting.negativeOperatingSystems", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-icm-brands" => Some(("terms.inventorySegmentTargeting.negativeIcmBrands", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-locations" => Some(("terms.inventorySegmentTargeting.positiveLocations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-mobile-apps" => Some(("terms.inventorySegmentTargeting.negativeMobileApps", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-device-categories" => Some(("terms.inventorySegmentTargeting.positiveDeviceCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-inventory-slots" => Some(("terms.inventorySegmentTargeting.negativeInventorySlots", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-video-ad-position-segments" => Some(("terms.inventorySegmentTargeting.negativeVideoAdPositionSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-video-duration-segments" => Some(("terms.inventorySegmentTargeting.negativeVideoDurationSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-sizes" => Some(("terms.inventorySegmentTargeting.positiveSizes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-xfp-ad-slots" => Some(("terms.inventorySegmentTargeting.positiveXfpAdSlots", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-site-urls" => Some(("terms.inventorySegmentTargeting.positiveSiteUrls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-mobile-apps" => Some(("terms.inventorySegmentTargeting.positiveMobileApps", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-sizes" => Some(("terms.inventorySegmentTargeting.negativeSizes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-operating-system-versions" => Some(("terms.inventorySegmentTargeting.positiveOperatingSystemVersions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-locations" => Some(("terms.inventorySegmentTargeting.negativeLocations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-operating-system-versions" => Some(("terms.inventorySegmentTargeting.negativeOperatingSystemVersions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-xfp-placements" => Some(("terms.inventorySegmentTargeting.positiveXfpPlacements", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-xfp-ad-slots" => Some(("terms.inventorySegmentTargeting.negativeXfpAdSlots", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-video-duration-segments" => Some(("terms.inventorySegmentTargeting.positiveVideoDurationSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-audience-segments" => Some(("terms.inventorySegmentTargeting.positiveAudienceSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-device-categories" => Some(("terms.inventorySegmentTargeting.negativeDeviceCategories", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.positive-ad-type-segments" => Some(("terms.inventorySegmentTargeting.positiveAdTypeSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.inventory-segment-targeting.negative-ad-type-segments" => Some(("terms.inventorySegmentTargeting.negativeAdTypeSegments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.end-date.time-zone-id" => Some(("terms.endDate.timeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.end-date.hour" => Some(("terms.endDate.hour", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.end-date.month" => Some(("terms.endDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.end-date.second" => Some(("terms.endDate.second", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.end-date.year" => Some(("terms.endDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.end-date.day" => Some(("terms.endDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.end-date.minute" => Some(("terms.endDate.minute", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.terms-attributes" => Some(("terms.termsAttributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.start-date.time-zone-id" => Some(("terms.startDate.timeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.start-date.hour" => Some(("terms.startDate.hour", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.start-date.month" => Some(("terms.startDate.month", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.start-date.second" => Some(("terms.startDate.second", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.start-date.year" => Some(("terms.startDate.year", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.start-date.day" => Some(("terms.startDate.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.start-date.minute" => Some(("terms.startDate.minute", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "terms.buyer-billing-type" => Some(("terms.buyerBillingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.estimated-impressions-per-day" => Some(("terms.estimatedImpressionsPerDay", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.monetizer-type" => Some(("terms.monetizerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.target-by-deal-id" => Some(("terms.targetByDealId", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.minimum-spend-micros" => Some(("terms.minimumSpendMicros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.targeting-all-ad-slots" => Some(("terms.targetingAllAdSlots", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.creative-review-policy" => Some(("terms.creativeReviewPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.audience-segment-description" => Some(("terms.audienceSegmentDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.deal-premium.micros" => Some(("terms.dealPremium.micros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.deal-premium.currency-code" => Some(("terms.dealPremium.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.creative-blocking-level" => Some(("terms.creativeBlockingLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.audience-segment.num-cookies" => Some(("terms.audienceSegment.numCookies", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.audience-segment.description" => Some(("terms.audienceSegment.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.audience-segment.name" => Some(("terms.audienceSegment.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.audience-segment.id" => Some(("terms.audienceSegment.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.description" => Some(("terms.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.billing-terms" => Some(("terms.billingTerms", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.is-reservation" => Some(("terms.isReservation", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.semi-transparent" => Some(("terms.semiTransparent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "terms.minimum-true-looks" => Some(("terms.minimumTrueLooks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.cpm.micros" => Some(("terms.cpm.micros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.cpm.currency-code" => Some(("terms.cpm.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.descriptive-name" => Some(("terms.descriptiveName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.urls" => Some(("terms.urls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "terms.estimated-spend.micros" => Some(("terms.estimatedSpend.micros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "terms.estimated-spend.currency-code" => Some(("terms.estimatedSpend.currencyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "email-contacts" => Some(("emailContacts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "allow-interest-targeted-ads", "anonymous", "audience-segment", "audience-segment-description", "billed-buyer", "billing-terms", "buyer", "buyer-billing-type", "buyer-seller-role", "cpm", "creative-blocking-level", "creative-review-policy", "creator", "currency-code", "customer-id", "day", "deal-premium", "description", "descriptive-name", "display-name", "email-contacts", "enabled-for-interest-targeting-deals", "enabled-for-preferred-deals", "end-date", "estimated-impressions-per-day", "estimated-spend", "finalize-automatically", "hour", "id", "inventory-segment-targeting", "is-open", "is-reservation", "kind", "label-names", "micros", "minimum-spend-micros", "minimum-true-looks", "minute", "monetizer-type", "month", "name", "negative-ad-type-segments", "negative-audience-segments", "negative-device-categories", "negative-icm-brands", "negative-icm-interests", "negative-inventory-slots", "negative-locations", "negative-mobile-apps", "negative-operating-system-versions", "negative-operating-systems", "negative-site-urls", "negative-sizes", "negative-video-ad-position-segments", "negative-video-duration-segments", "negative-xfp-ad-slots", "negative-xfp-placements", "num-cookies", "offer-id", "offer-state", "point-of-contact", "positive-ad-type-segments", "positive-audience-segments", "positive-device-categories", "positive-icm-brands", "positive-icm-interests", "positive-inventory-slots", "positive-locations", "positive-mobile-apps", "positive-operating-system-versions", "positive-operating-systems", "positive-site-urls", "positive-sizes", "positive-video-ad-position-segments", "positive-video-duration-segments", "positive-xfp-ad-slots", "positive-xfp-placements", "property-code", "second", "semi-transparent", "site-urls", "sponsor-account-id", "start-date", "status", "syndication-product", "target-by-deal-id", "targeting-all-ad-slots", "terms", "terms-attributes", "time-zone-id", "urls", "web-property", "year"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::OfferDto = json::value::from_value(object).unwrap(); - let mut call = self.hub.offers().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _offers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "since-timestamp-millis" => Some(("sinceTimestampMillis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["since-timestamp-millis"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ListOffersRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.offers().list(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _performance_report_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _performance_report_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.performance_report().list(opt.value_of("account-id").unwrap_or(""), opt.value_of("end-date-time").unwrap_or(""), opt.value_of("start-date-time").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3281,7 +1498,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -3295,7 +1512,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3318,10 +1535,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pretargeting_config().delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("config-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3334,7 +1551,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3347,7 +1564,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3362,10 +1579,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pretargeting_config().get(opt.value_of("account-id").unwrap_or(""), opt.value_of("config-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3378,7 +1595,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3391,7 +1608,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3414,13 +1631,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3434,8 +1651,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "billing-id" => Some(("billingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "languages" => Some(("languages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -3469,7 +1686,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PretargetingConfig = json::value::from_value(object).unwrap(); let mut call = self.hub.pretargeting_config().insert(request, opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3482,7 +1699,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3495,7 +1712,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3518,10 +1735,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pretargeting_config().list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3534,7 +1751,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3547,7 +1764,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3570,13 +1787,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3590,8 +1807,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "billing-id" => Some(("billingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "languages" => Some(("languages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -3625,7 +1842,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PretargetingConfig = json::value::from_value(object).unwrap(); let mut call = self.hub.pretargeting_config().patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("config-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3638,7 +1855,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3651,7 +1868,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3674,13 +1891,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pretargeting_config_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pretargeting_config_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3694,8 +1911,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "billing-id" => Some(("billingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "languages" => Some(("languages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -3729,7 +1946,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PretargetingConfig = json::value::from_value(object).unwrap(); let mut call = self.hub.pretargeting_config().update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("config-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3742,7 +1959,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3755,7 +1972,516 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _products_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.products().get(opt.value_of("product-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _products_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.products().search(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "pql-query" => { + call = call.pql_query(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["pql-query"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _proposals_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.proposals().get(opt.value_of("proposal-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _proposals_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "web-property-code" => Some(("webPropertyCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["web-property-code"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreateOrdersRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.proposals().insert(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _proposals_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal-state" => Some(("proposalState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "revision-time-ms" => Some(("revisionTimeMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "buyer-private-data.reference-id" => Some(("buyerPrivateData.referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "buyer-private-data.reference-payload" => Some(("buyerPrivateData.referencePayload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billed-buyer.account-id" => Some(("billedBuyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "originator-role" => Some(("originatorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "seller.sub-account-id" => Some(("seller.subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "seller.account-id" => Some(("seller.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-updater-role" => Some(("lastUpdaterRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal-id" => Some(("proposalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "inventory-source" => Some(("inventorySource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-updater-or-commentor-role" => Some(("lastUpdaterOrCommentorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "has-seller-signed-off" => Some(("hasSellerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "is-renegotiating" => Some(("isRenegotiating", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "buyer.account-id" => Some(("buyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "has-buyer-signed-off" => Some(("hasBuyerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "is-setup-complete" => Some(("isSetupComplete", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "revision-number" => Some(("revisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "has-buyer-signed-off", "has-seller-signed-off", "inventory-source", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "last-updater-role", "name", "originator-role", "proposal-id", "proposal-state", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Proposal = json::value::from_value(object).unwrap(); + let mut call = self.hub.proposals().patch(request, opt.value_of("proposal-id").unwrap_or(""), opt.value_of("revision-number").unwrap_or(""), opt.value_of("update-action").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _proposals_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.proposals().search(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "pql-query" => { + call = call.pql_query(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["pql-query"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _proposals_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal-state" => Some(("proposalState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "revision-time-ms" => Some(("revisionTimeMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "buyer-private-data.reference-id" => Some(("buyerPrivateData.referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "buyer-private-data.reference-payload" => Some(("buyerPrivateData.referencePayload", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billed-buyer.account-id" => Some(("billedBuyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "originator-role" => Some(("originatorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "seller.sub-account-id" => Some(("seller.subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "seller.account-id" => Some(("seller.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-updater-role" => Some(("lastUpdaterRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "proposal-id" => Some(("proposalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "inventory-source" => Some(("inventorySource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-updater-or-commentor-role" => Some(("lastUpdaterOrCommentorRole", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "has-seller-signed-off" => Some(("hasSellerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "is-renegotiating" => Some(("isRenegotiating", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "buyer.account-id" => Some(("buyer.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "has-buyer-signed-off" => Some(("hasBuyerSignedOff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "is-setup-complete" => Some(("isSetupComplete", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "revision-number" => Some(("revisionNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "billed-buyer", "buyer", "buyer-private-data", "has-buyer-signed-off", "has-seller-signed-off", "inventory-source", "is-renegotiating", "is-setup-complete", "kind", "last-updater-or-commentor-role", "last-updater-role", "name", "originator-role", "proposal-id", "proposal-state", "reference-id", "reference-payload", "revision-number", "revision-time-ms", "seller", "sub-account-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Proposal = json::value::from_value(object).unwrap(); + let mut call = self.hub.proposals().update(request, opt.value_of("proposal-id").unwrap_or(""), opt.value_of("revision-number").unwrap_or(""), opt.value_of("update-action").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3834,34 +2560,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, - ("clientaccess", Some(opt)) => { - match opt.subcommand() { - ("delete", Some(opt)) => { - call_result = self._clientaccess_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._clientaccess_get(opt, dry_run, &mut err); - }, - ("insert", Some(opt)) => { - call_result = self._clientaccess_insert(opt, dry_run, &mut err); - }, - ("list", Some(opt)) => { - call_result = self._clientaccess_list(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._clientaccess_patch(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._clientaccess_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("clientaccess".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, ("creatives", Some(opt)) => { match opt.subcommand() { + ("add-deal", Some(opt)) => { + call_result = self._creatives_add_deal(opt, dry_run, &mut err); + }, ("get", Some(opt)) => { call_result = self._creatives_get(opt, dry_run, &mut err); }, @@ -3871,19 +2574,11 @@ impl<'n, 'a> Engine<'n, 'a> { ("list", Some(opt)) => { call_result = self._creatives_list(opt, dry_run, &mut err); }, - _ => { - err.issues.push(CLIError::MissingMethodError("creatives".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("deals", Some(opt)) => { - match opt.subcommand() { - ("get", Some(opt)) => { - call_result = self._deals_get(opt, dry_run, &mut err); + ("remove-deal", Some(opt)) => { + call_result = self._creatives_remove_deal(opt, dry_run, &mut err); }, _ => { - err.issues.push(CLIError::MissingMethodError("deals".to_string())); + err.issues.push(CLIError::MissingMethodError("creatives".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); } } @@ -3922,88 +2617,6 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, - ("marketplaceoffers", Some(opt)) => { - match opt.subcommand() { - ("get", Some(opt)) => { - call_result = self._marketplaceoffers_get(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._marketplaceoffers_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("marketplaceoffers".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("marketplaceorders", Some(opt)) => { - match opt.subcommand() { - ("get", Some(opt)) => { - call_result = self._marketplaceorders_get(opt, dry_run, &mut err); - }, - ("insert", Some(opt)) => { - call_result = self._marketplaceorders_insert(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._marketplaceorders_patch(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._marketplaceorders_search(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._marketplaceorders_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("marketplaceorders".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("negotiationrounds", Some(opt)) => { - match opt.subcommand() { - ("insert", Some(opt)) => { - call_result = self._negotiationrounds_insert(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("negotiationrounds".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("negotiations", Some(opt)) => { - match opt.subcommand() { - ("get", Some(opt)) => { - call_result = self._negotiations_get(opt, dry_run, &mut err); - }, - ("insert", Some(opt)) => { - call_result = self._negotiations_insert(opt, dry_run, &mut err); - }, - ("list", Some(opt)) => { - call_result = self._negotiations_list(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("negotiations".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("offers", Some(opt)) => { - match opt.subcommand() { - ("get", Some(opt)) => { - call_result = self._offers_get(opt, dry_run, &mut err); - }, - ("insert", Some(opt)) => { - call_result = self._offers_insert(opt, dry_run, &mut err); - }, - ("list", Some(opt)) => { - call_result = self._offers_list(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("offers".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, ("performance-report", Some(opt)) => { match opt.subcommand() { ("list", Some(opt)) => { @@ -4041,6 +2654,43 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, + ("products", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._products_get(opt, dry_run, &mut err); + }, + ("search", Some(opt)) => { + call_result = self._products_search(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("products".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("proposals", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._proposals_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._proposals_insert(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._proposals_patch(opt, dry_run, &mut err); + }, + ("search", Some(opt)) => { + call_result = self._proposals_search(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._proposals_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("proposals".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, _ => { err.issues.push(CLIError::MissingCommandError); writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); @@ -4058,14 +2708,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "adexchangebuyer1d4-secret.json", + match cmn::application_secret_from_directory(&config_dir, "adexchangebuyer1d4-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -4085,7 +2735,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -4124,7 +2774,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("accounts", "methods: 'get', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one account by ID."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/accounts_get", vec![ @@ -4146,7 +2796,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the authenticated user's list of accounts."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/accounts_list", vec![ @@ -4162,7 +2812,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/accounts_patch", vec![ @@ -4190,7 +2840,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/accounts_update", vec![ @@ -4221,7 +2871,7 @@ fn main() { ]), ("billing-info", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Returns the billing information for one account specified by account ID."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/billing-info_get", vec![ @@ -4243,7 +2893,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of billing information for all accounts of the authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/billing-info_list", vec![ @@ -4262,7 +2912,7 @@ fn main() { ]), ("budget", "methods: 'get', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Returns the budget information for the adgroup specified by the accountId and billingId."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/budget_get", vec![ @@ -4290,7 +2940,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates the budget amount for the budget of the adgroup specified by the accountId and billingId, with the budget amount in the request. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/budget_patch", vec![ @@ -4324,7 +2974,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates the budget amount for the budget of the adgroup specified by the accountId and billingId, with the budget amount in the request."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/budget_update", vec![ @@ -4360,20 +3010,26 @@ fn main() { ]), ]), - ("clientaccess", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", - None, - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/clientaccess_delete", + ("creatives", "methods: 'add-deal', 'get', 'insert', 'list' and 'remove-deal'", vec![ + ("add-deal", + Some(r##"Add a deal id association for the creative."##), + "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/creatives_add-deal", vec![ - (Some(r##"client-account-id"##), - None, + (Some(r##"account-id"##), None, + Some(r##"The id for the account that will serve this creative."##), Some(true), Some(false)), - (Some(r##"sponsor-account-id"##), + (Some(r##"buyer-creative-id"##), None, + Some(r##"The buyer-specific id for this creative."##), + Some(true), + Some(false)), + + (Some(r##"deal-id"##), None, + Some(r##"The id of the deal id to associate with this creative."##), Some(true), Some(false)), @@ -4383,150 +3039,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", - None, - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/clientaccess_get", - vec![ - (Some(r##"client-account-id"##), - None, - None, - Some(true), - Some(false)), - - (Some(r##"sponsor-account-id"##), - None, - None, - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("insert", - None, - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/clientaccess_insert", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("list", - None, - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/clientaccess_list", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - None, - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/clientaccess_patch", - vec![ - (Some(r##"client-account-id"##), - None, - None, - Some(true), - Some(false)), - - (Some(r##"sponsor-account-id"##), - None, - None, - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - None, - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/clientaccess_update", - vec![ - (Some(r##"client-account-id"##), - None, - None, - Some(true), - Some(false)), - - (Some(r##"sponsor-account-id"##), - None, - None, - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("creatives", "methods: 'get', 'insert' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets the status for a single creative. A creative will be available 30-40 minutes after submission."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/creatives_get", vec![ @@ -4554,7 +3067,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Submit a new creative."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/creatives_insert", vec![ @@ -4576,7 +3089,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/creatives_list", vec![ @@ -4592,47 +3105,44 @@ fn main() { Some(false), Some(false)), ]), - ]), - - ("deals", "methods: 'get'", vec![ - ("get", - Some(r##"Gets the requested deal."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/deals_get", + ("remove-deal", + Some(r##"Remove a deal id associated with the creative."##), + "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/creatives_remove-deal", vec![ - (Some(r##"deal-id"##), - None, + (Some(r##"account-id"##), None, + Some(r##"The id for the account that will serve this creative."##), Some(true), Some(false)), - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), + (Some(r##"buyer-creative-id"##), + None, + Some(r##"The buyer-specific id for this creative."##), Some(true), - Some(true)), + Some(false)), + + (Some(r##"deal-id"##), + None, + Some(r##"The id of the deal id to disassociate with this creative."##), + Some(true), + Some(false)), (Some(r##"v"##), Some(r##"p"##), Some(r##"Set various optional parameters, matching the key=value form"##), Some(false), Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), ]), ]), ("marketplacedeals", "methods: 'delete', 'insert', 'list' and 'update'", vec![ - ("delete", - Some(r##"Delete the specified deals from the order"##), + ("delete", + Some(r##"Delete the specified deals from the proposal"##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplacedeals_delete", vec![ - (Some(r##"order-id"##), + (Some(r##"proposal-id"##), None, - Some(r##"The orderId to delete deals from."##), + Some(r##"The proposalId to delete deals from."##), Some(true), Some(false)), @@ -4654,13 +3164,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", - Some(r##"Add new deals for the specified order"##), + ("insert", + Some(r##"Add new deals for the specified proposal"##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplacedeals_insert", vec![ - (Some(r##"order-id"##), + (Some(r##"proposal-id"##), None, - Some(r##"OrderId for which deals need to be added."##), + Some(r##"proposalId for which deals need to be added."##), Some(true), Some(false)), @@ -4682,13 +3192,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"List all the deals for a given order"##), + ("list", + Some(r##"List all the deals for a given proposal"##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplacedeals_list", vec![ - (Some(r##"order-id"##), + (Some(r##"proposal-id"##), None, - Some(r##"The orderId to get deals for."##), + Some(r##"The proposalId to get deals for."##), Some(true), Some(false)), @@ -4704,13 +3214,13 @@ fn main() { Some(false), Some(false)), ]), - ("update", - Some(r##"Replaces all the deals in the order with the passed in deals"##), + ("update", + Some(r##"Replaces all the deals in the proposal with the passed in deals"##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplacedeals_update", vec![ - (Some(r##"order-id"##), + (Some(r##"proposal-id"##), None, - Some(r##"The orderId to edit deals on."##), + Some(r##"The proposalId to edit deals on."##), Some(true), Some(false)), @@ -4735,13 +3245,13 @@ fn main() { ]), ("marketplacenotes", "methods: 'insert' and 'list'", vec![ - ("insert", - Some(r##"Add notes to the order"##), + ("insert", + Some(r##"Add notes to the proposal"##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplacenotes_insert", vec![ - (Some(r##"order-id"##), + (Some(r##"proposal-id"##), None, - Some(r##"The orderId to add notes for."##), + Some(r##"The proposalId to add notes for."##), Some(true), Some(false)), @@ -4763,13 +3273,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Get all the notes associated with an order"##), + ("list", + Some(r##"Get all the notes associated with a proposal"##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplacenotes_list", vec![ - (Some(r##"order-id"##), + (Some(r##"proposal-id"##), None, - Some(r##"The orderId to get notes for."##), + Some(r##"The proposalId to get notes for."##), Some(true), Some(false)), @@ -4787,367 +3297,8 @@ fn main() { ]), ]), - ("marketplaceoffers", "methods: 'get' and 'search'", vec![ - ("get", - Some(r##"Gets the requested negotiation."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplaceoffers_get", - vec![ - (Some(r##"offer-id"##), - None, - Some(r##"The offerId for the offer to get the head revision for."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Gets the requested negotiation."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplaceoffers_search", - vec![ - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("marketplaceorders", "methods: 'get', 'insert', 'patch', 'search' and 'update'", vec![ - ("get", - Some(r##"Get an order given its id"##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplaceorders_get", - vec![ - (Some(r##"order-id"##), - None, - Some(r##"Id of the order to retrieve."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("insert", - Some(r##"Create the given list of orders"##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplaceorders_insert", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Update the given order. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplaceorders_patch", - vec![ - (Some(r##"order-id"##), - None, - Some(r##"The order id to update."##), - Some(true), - Some(false)), - - (Some(r##"revision-number"##), - None, - Some(r##"The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the lastest order at head revision and retry the update at that revision."##), - Some(true), - Some(false)), - - (Some(r##"update-action"##), - None, - Some(r##"The proposed action to take on the order."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Search for orders using pql query"##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplaceorders_search", - vec![ - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - Some(r##"Update the given order"##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/marketplaceorders_update", - vec![ - (Some(r##"order-id"##), - None, - Some(r##"The order id to update."##), - Some(true), - Some(false)), - - (Some(r##"revision-number"##), - None, - Some(r##"The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the lastest order at head revision and retry the update at that revision."##), - Some(true), - Some(false)), - - (Some(r##"update-action"##), - None, - Some(r##"The proposed action to take on the order."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("negotiationrounds", "methods: 'insert'", vec![ - ("insert", - Some(r##"Adds the requested negotiationRound to the requested negotiation."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/negotiationrounds_insert", - vec![ - (Some(r##"negotiation-id"##), - None, - None, - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("negotiations", "methods: 'get', 'insert' and 'list'", vec![ - ("get", - Some(r##"Gets the requested negotiation."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/negotiations_get", - vec![ - (Some(r##"negotiation-id"##), - None, - None, - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("insert", - Some(r##"Creates or updates the requested negotiation."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/negotiations_insert", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("list", - Some(r##"Lists all negotiations the authenticated user has access to."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/negotiations_list", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("offers", "methods: 'get', 'insert' and 'list'", vec![ - ("get", - Some(r##"Gets the requested offer."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/offers_get", - vec![ - (Some(r##"offer-id"##), - None, - None, - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("insert", - Some(r##"Creates or updates the requested offer."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/offers_insert", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("list", - Some(r##"Lists all offers the authenticated user has access to."##), - "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/offers_list", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - ("performance-report", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves the authenticated user's list of performance metrics."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/performance-report_list", vec![ @@ -5184,7 +3335,7 @@ fn main() { ]), ("pretargeting-config", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing pretargeting config."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/pretargeting-config_delete", vec![ @@ -5206,7 +3357,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a specific pretargeting configuration"##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/pretargeting-config_get", vec![ @@ -5234,7 +3385,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new pretargeting configuration."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/pretargeting-config_insert", vec![ @@ -5262,7 +3413,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of the authenticated user's pretargeting configurations."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/pretargeting-config_list", vec![ @@ -5284,7 +3435,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing pretargeting config. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/pretargeting-config_patch", vec![ @@ -5318,7 +3469,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing pretargeting config."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/pretargeting-config_update", vec![ @@ -5354,11 +3505,195 @@ fn main() { ]), ]), + ("products", "methods: 'get' and 'search'", vec![ + ("get", + Some(r##"Gets the requested product by id."##), + "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/products_get", + vec![ + (Some(r##"product-id"##), + None, + Some(r##"The id for the product to get the head revision for."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("search", + Some(r##"Gets the requested product."##), + "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/products_search", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("proposals", "methods: 'get', 'insert', 'patch', 'search' and 'update'", vec![ + ("get", + Some(r##"Get a proposal given its id"##), + "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/proposals_get", + vec![ + (Some(r##"proposal-id"##), + None, + Some(r##"Id of the proposal to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Create the given list of proposals"##), + "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/proposals_insert", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Update the given proposal. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/proposals_patch", + vec![ + (Some(r##"proposal-id"##), + None, + Some(r##"The proposal id to update."##), + Some(true), + Some(false)), + + (Some(r##"revision-number"##), + None, + Some(r##"The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the latest proposal at head revision and retry the update at that revision."##), + Some(true), + Some(false)), + + (Some(r##"update-action"##), + None, + Some(r##"The proposed action to take on the proposal."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("search", + Some(r##"Search for proposals using pql query"##), + "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/proposals_search", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Update the given proposal"##), + "Details at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli/proposals_update", + vec![ + (Some(r##"proposal-id"##), + None, + Some(r##"The proposal id to update."##), + Some(true), + Some(false)), + + (Some(r##"revision-number"##), + None, + Some(r##"The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the latest proposal at head revision and retry the update at that revision."##), + Some(true), + Some(false)), + + (Some(r##"update-action"##), + None, + Some(r##"The proposed action to take on the proposal."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ]; let mut app = App::new("adexchangebuyer1d4") .author("Sebastian Thiel ") - .version("0.3.2+20150909") + .version("0.3.3+20160118") .about("Accesses your bidding-account information, submits creatives for validation, finds available direct deals, and retrieves performance reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli") .arg(Arg::with_name("url") @@ -5382,7 +3717,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -5393,7 +3728,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/adexchangebuyer1d4/Cargo.toml b/gen/adexchangebuyer1d4/Cargo.toml index 75b22dc57f..aa264f2d91 100644 --- a/gen/adexchangebuyer1d4/Cargo.toml +++ b/gen/adexchangebuyer1d4/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangebuyer1d4" -version = "0.1.10+20150909" +version = "0.1.11+20160118" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Exchange Buyer (protocol v1.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d4" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/adexchangebuyer1d4/LICENSE.md b/gen/adexchangebuyer1d4/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/adexchangebuyer1d4/LICENSE.md +++ b/gen/adexchangebuyer1d4/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/adexchangebuyer1d4/README.md b/gen/adexchangebuyer1d4/README.md index 37e6168bb8..dc507a9ac8 100644 --- a/gen/adexchangebuyer1d4/README.md +++ b/gen/adexchangebuyer1d4/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-adexchangebuyer1d4` library allows access to all features of the *Google Ad Exchange Buyer* service. -This documentation was generated from *Ad Exchange Buyer* crate version *0.1.10+20150909*, where *20150909* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Ad Exchange Buyer* crate version *0.1.11+20160118*, where *20160118* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Ad Exchange Buyer* *v1d4* API can be found at the [official documentation site](https://developers.google.com/ad-exchange/buyer-rest). @@ -19,30 +19,20 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.BillingInfoGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.BillingInfoListCall.html) * [budget](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.Budget.html) * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.BudgetGetCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.BudgetPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.BudgetUpdateCall.html) -* clientaccess - * [*delete*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ClientaccesDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ClientaccesGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ClientaccesInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ClientaccesListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ClientaccesPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ClientaccesUpdateCall.html) * [creatives](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.Creative.html) - * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeListCall.html) -* deals - * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.DealGetCall.html) + * [*add deal*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeAddDealCall.html), [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeListCall.html) and [*remove deal*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.CreativeRemoveDealCall.html) * marketplacedeals * [*delete*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplacedealDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplacedealInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplacedealListCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplacedealUpdateCall.html) * marketplacenotes * [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplacenoteInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplacenoteListCall.html) -* marketplaceoffers - * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplaceofferGetCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplaceofferSearchCall.html) -* marketplaceorders - * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplaceorderGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplaceorderInsertCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplaceorderPatchCall.html), [*search*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplaceorderSearchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.MarketplaceorderUpdateCall.html) -* negotiationrounds - * [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.NegotiationroundInsertCall.html) -* negotiations - * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.NegotiationGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.NegotiationInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.NegotiationListCall.html) -* offers - * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.OfferGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.OfferInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.OfferListCall.html) * [performance report](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.PerformanceReport.html) * [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.PerformanceReportListCall.html) * [pretargeting config](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.PretargetingConfig.html) * [*delete*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.PretargetingConfigDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.PretargetingConfigGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.PretargetingConfigInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.PretargetingConfigListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.PretargetingConfigPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.PretargetingConfigUpdateCall.html) +* [products](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.Product.html) + * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ProductGetCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ProductSearchCall.html) +* [proposals](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.Proposal.html) + * [*get*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ProposalGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ProposalInsertCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ProposalPatchCall.html), [*search*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ProposalSearchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4/struct.ProposalUpdateCall.html) @@ -75,10 +65,11 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.pretargeting_config().insert(...).doit() -let r = hub.pretargeting_config().patch(...).doit() -let r = hub.pretargeting_config().get(...).doit() -let r = hub.pretargeting_config().update(...).doit() +let r = hub.creatives().remove_deal(...).doit() +let r = hub.creatives().add_deal(...).doit() +let r = hub.creatives().insert(...).doit() +let r = hub.creatives().list(...).doit() +let r = hub.creatives().get(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -103,7 +94,6 @@ google-adexchangebuyer1d4 = "*" extern crate hyper; extern crate yup_oauth2 as oauth2; extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -use adexchangebuyer1d4::PretargetingConfig; use adexchangebuyer1d4::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -121,15 +111,16 @@ let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::new(), ::default(), None); let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -let mut req = PretargetingConfig::default(); - // 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 ! -let result = hub.pretargeting_config().patch(req, "accountId", "configId") +let result = hub.creatives().list() + .page_token("eirmod") + .open_auction_status_filter("sit") + .max_results(36) + .deals_status_filter("sed") + .add_buyer_creative_id("et") + .add_account_id(-18) .doit(); match result { diff --git a/gen/adexchangebuyer1d4/src/cmn.rs b/gen/adexchangebuyer1d4/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/adexchangebuyer1d4/src/cmn.rs +++ b/gen/adexchangebuyer1d4/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/adexchangebuyer1d4/src/lib.rs b/gen/adexchangebuyer1d4/src/lib.rs index 06c4c39ee4..d6caaa96b1 100644 --- a/gen/adexchangebuyer1d4/src/lib.rs +++ b/gen/adexchangebuyer1d4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Ad Exchange Buyer* crate version *0.1.10+20150909*, where *20150909* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Ad Exchange Buyer* crate version *0.1.11+20160118*, where *20160118* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Ad Exchange Buyer* *v1d4* API can be found at the //! [official documentation site](https://developers.google.com/ad-exchange/buyer-rest). @@ -17,30 +17,20 @@ //! * [*get*](struct.BillingInfoGetCall.html) and [*list*](struct.BillingInfoListCall.html) //! * [budget](struct.Budget.html) //! * [*get*](struct.BudgetGetCall.html), [*patch*](struct.BudgetPatchCall.html) and [*update*](struct.BudgetUpdateCall.html) -//! * clientaccess -//! * [*delete*](struct.ClientaccesDeleteCall.html), [*get*](struct.ClientaccesGetCall.html), [*insert*](struct.ClientaccesInsertCall.html), [*list*](struct.ClientaccesListCall.html), [*patch*](struct.ClientaccesPatchCall.html) and [*update*](struct.ClientaccesUpdateCall.html) //! * [creatives](struct.Creative.html) -//! * [*get*](struct.CreativeGetCall.html), [*insert*](struct.CreativeInsertCall.html) and [*list*](struct.CreativeListCall.html) -//! * deals -//! * [*get*](struct.DealGetCall.html) +//! * [*add deal*](struct.CreativeAddDealCall.html), [*get*](struct.CreativeGetCall.html), [*insert*](struct.CreativeInsertCall.html), [*list*](struct.CreativeListCall.html) and [*remove deal*](struct.CreativeRemoveDealCall.html) //! * marketplacedeals //! * [*delete*](struct.MarketplacedealDeleteCall.html), [*insert*](struct.MarketplacedealInsertCall.html), [*list*](struct.MarketplacedealListCall.html) and [*update*](struct.MarketplacedealUpdateCall.html) //! * marketplacenotes //! * [*insert*](struct.MarketplacenoteInsertCall.html) and [*list*](struct.MarketplacenoteListCall.html) -//! * marketplaceoffers -//! * [*get*](struct.MarketplaceofferGetCall.html) and [*search*](struct.MarketplaceofferSearchCall.html) -//! * marketplaceorders -//! * [*get*](struct.MarketplaceorderGetCall.html), [*insert*](struct.MarketplaceorderInsertCall.html), [*patch*](struct.MarketplaceorderPatchCall.html), [*search*](struct.MarketplaceorderSearchCall.html) and [*update*](struct.MarketplaceorderUpdateCall.html) -//! * negotiationrounds -//! * [*insert*](struct.NegotiationroundInsertCall.html) -//! * negotiations -//! * [*get*](struct.NegotiationGetCall.html), [*insert*](struct.NegotiationInsertCall.html) and [*list*](struct.NegotiationListCall.html) -//! * offers -//! * [*get*](struct.OfferGetCall.html), [*insert*](struct.OfferInsertCall.html) and [*list*](struct.OfferListCall.html) //! * [performance report](struct.PerformanceReport.html) //! * [*list*](struct.PerformanceReportListCall.html) //! * [pretargeting config](struct.PretargetingConfig.html) //! * [*delete*](struct.PretargetingConfigDeleteCall.html), [*get*](struct.PretargetingConfigGetCall.html), [*insert*](struct.PretargetingConfigInsertCall.html), [*list*](struct.PretargetingConfigListCall.html), [*patch*](struct.PretargetingConfigPatchCall.html) and [*update*](struct.PretargetingConfigUpdateCall.html) +//! * [products](struct.Product.html) +//! * [*get*](struct.ProductGetCall.html) and [*search*](struct.ProductSearchCall.html) +//! * [proposals](struct.Proposal.html) +//! * [*get*](struct.ProposalGetCall.html), [*insert*](struct.ProposalInsertCall.html), [*patch*](struct.ProposalPatchCall.html), [*search*](struct.ProposalSearchCall.html) and [*update*](struct.ProposalUpdateCall.html) //! //! //! @@ -75,10 +65,11 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.pretargeting_config().insert(...).doit() -//! let r = hub.pretargeting_config().patch(...).doit() -//! let r = hub.pretargeting_config().get(...).doit() -//! let r = hub.pretargeting_config().update(...).doit() +//! let r = hub.creatives().remove_deal(...).doit() +//! let r = hub.creatives().add_deal(...).doit() +//! let r = hub.creatives().insert(...).doit() +//! let r = hub.creatives().list(...).doit() +//! let r = hub.creatives().get(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -103,7 +94,6 @@ //! extern crate hyper; //! extern crate yup_oauth2 as oauth2; //! extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -//! use adexchangebuyer1d4::PretargetingConfig; //! use adexchangebuyer1d4::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -122,15 +112,16 @@ //! hyper::Client::new(), //! ::default(), None); //! let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -//! let mut req = PretargetingConfig::default(); -//! //! // 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 ! -//! let result = hub.pretargeting_config().patch(req, "accountId", "configId") +//! let result = hub.creatives().list() +//! .page_token("voluptua.") +//! .open_auction_status_filter("Lorem") +//! .max_results(90) +//! .deals_status_filter("justo") +//! .add_buyer_creative_id("sit") +//! .add_account_id(-26) //! .doit(); //! //! match result { diff --git a/gen/adexchangebuyer1d4/src/lib.rs.in b/gen/adexchangebuyer1d4/src/lib.rs.in index 279b480718..90bf51c44b 100644 --- a/gen/adexchangebuyer1d4/src/lib.rs.in +++ b/gen/adexchangebuyer1d4/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -69,7 +70,6 @@ impl Default for Scope { /// extern crate hyper; /// extern crate yup_oauth2 as oauth2; /// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::PretargetingConfig; /// use adexchangebuyer1d4::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -88,15 +88,16 @@ impl Default for Scope { /// hyper::Client::new(), /// ::default(), None); /// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = PretargetingConfig::default(); -/// /// // 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 ! -/// let result = hub.pretargeting_config().patch(req, "accountId", "configId") +/// let result = hub.creatives().list() +/// .page_token("kasd") +/// .open_auction_status_filter("accusam") +/// .max_results(93) +/// .deals_status_filter("justo") +/// .add_buyer_creative_id("amet.") +/// .add_account_id(-81) /// .doit(); /// /// match result { @@ -132,7 +133,7 @@ impl<'a, C, A> AdExchangeBuyer AdExchangeBuyer { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -145,45 +146,30 @@ impl<'a, C, A> AdExchangeBuyer pub fn budget(&'a self) -> BudgetMethods<'a, C, A> { BudgetMethods { hub: &self } } - pub fn clientaccess(&'a self) -> ClientaccesMethods<'a, C, A> { - ClientaccesMethods { hub: &self } - } pub fn creatives(&'a self) -> CreativeMethods<'a, C, A> { CreativeMethods { hub: &self } } - pub fn deals(&'a self) -> DealMethods<'a, C, A> { - DealMethods { hub: &self } - } pub fn marketplacedeals(&'a self) -> MarketplacedealMethods<'a, C, A> { MarketplacedealMethods { hub: &self } } pub fn marketplacenotes(&'a self) -> MarketplacenoteMethods<'a, C, A> { MarketplacenoteMethods { hub: &self } } - pub fn marketplaceoffers(&'a self) -> MarketplaceofferMethods<'a, C, A> { - MarketplaceofferMethods { hub: &self } - } - pub fn marketplaceorders(&'a self) -> MarketplaceorderMethods<'a, C, A> { - MarketplaceorderMethods { hub: &self } - } - pub fn negotiationrounds(&'a self) -> NegotiationroundMethods<'a, C, A> { - NegotiationroundMethods { hub: &self } - } - pub fn negotiations(&'a self) -> NegotiationMethods<'a, C, A> { - NegotiationMethods { hub: &self } - } - pub fn offers(&'a self) -> OfferMethods<'a, C, A> { - OfferMethods { hub: &self } - } pub fn performance_report(&'a self) -> PerformanceReportMethods<'a, C, A> { PerformanceReportMethods { hub: &self } } pub fn pretargeting_config(&'a self) -> PretargetingConfigMethods<'a, C, A> { PretargetingConfigMethods { hub: &self } } + pub fn products(&'a self) -> ProductMethods<'a, C, A> { + ProductMethods { hub: &self } + } + pub fn proposals(&'a self) -> ProposalMethods<'a, C, A> { + ProposalMethods { hub: &self } + } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -197,6 +183,88 @@ impl<'a, C, A> AdExchangeBuyer // ############ // SCHEMAS ### // ########## +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetingValueDayPartTargeting { + /// no description provided + #[serde(rename="dayParts")] + pub day_parts: Option>, + /// no description provided + #[serde(rename="timeZoneType")] + pub time_zone_type: Option, +} + +impl Part for TargetingValueDayPartTargeting {} + + +/// The filtering reasons for the creative. Read-only. This field should not be set in requests. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFilteringReasons { + /// The date in ISO 8601 format for the data. The data is collected from 00:00:00 to 23:59:59 in PST. + pub date: Option, + /// The filtering reasons. + pub reasons: Option>, +} + +impl NestedType for CreativeFilteringReasons {} +impl Part for CreativeFilteringReasons {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ContactInformation { + /// Email address of the contact. + pub email: Option, + /// The name of the contact. + pub name: Option, +} + +impl Part for ContactInformation {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PrivateData { + /// no description provided + #[serde(rename="referenceId")] + pub reference_id: Option, + /// no description provided + #[serde(rename="referencePayload")] + pub reference_payload: Option, +} + +impl Part for PrivateData {} + + +/// Requests containing any of these placements will match. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PretargetingConfigPlacements { + /// The value of the placement. Interpretation depends on the placement type, e.g. URL for a site placement, channel name for a channel placement, app id for a mobile app placement. + pub token: Option, + /// The type of the placement. + #[serde(rename="type")] + pub type_: Option, +} + +impl NestedType for PretargetingConfigPlacements {} +impl Part for PretargetingConfigPlacements {} + + /// A creative and its classification data. /// /// # Activities @@ -204,6 +272,8 @@ impl<'a, C, A> AdExchangeBuyer /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// +/// * [remove deal creatives](struct.CreativeRemoveDealCall.html) (none) +/// * [add deal creatives](struct.CreativeAddDealCall.html) (none) /// * [insert creatives](struct.CreativeInsertCall.html) (request|response) /// * [list creatives](struct.CreativeListCall.html) (none) /// * [get creatives](struct.CreativeGetCall.html) (response) @@ -213,18 +283,19 @@ pub struct Creative { /// Detected product categories, if any. Read-only. This field should not be set in requests. #[serde(rename="productCategories")] pub product_categories: Option>, - /// The last upload timestamp of this creative if it was uploaded via API. Read-only. The value of this field is generated, and will be ignored for uploads. (formatted RFC 3339 timestamp). - pub api_upload_timestamp: Option, /// The agency id for this creative. #[serde(rename="agencyId")] pub agency_id: Option, /// All attributes for the ads that may be shown from this snippet. pub attribute: Option>, + /// All restricted categories for the ads that may be shown from this snippet. + #[serde(rename="restrictedCategories")] + pub restricted_categories: Option>, /// Ad height. pub height: Option, - /// The name of the company being advertised in the creative. - #[serde(rename="advertiserName")] - pub advertiser_name: Option, + /// Detected advertiser id, if any. Read-only. This field should not be set in requests. + #[serde(rename="advertiserId")] + pub advertiser_id: Option>, /// The HTML snippet that displays the ad when inserted in the web page. If set, videoURL should not be set. #[serde(rename="HTMLSnippet")] pub html_snippet: Option, @@ -243,9 +314,9 @@ pub struct Creative { /// Account id. #[serde(rename="accountId")] pub account_id: Option, - /// Detected advertiser id, if any. Read-only. This field should not be set in requests. - #[serde(rename="advertiserId")] - pub advertiser_id: Option>, + /// The name of the company being advertised in the creative. + #[serde(rename="advertiserName")] + pub advertiser_name: Option, /// Resource type. pub kind: Option, /// The url to fetch a video ad. If set, HTMLSnippet should not be set. @@ -266,9 +337,9 @@ pub struct Creative { pub native_ad: Option, /// The version for this creative. Read-only. This field should not be set in requests. pub version: Option, - /// All restricted categories for the ads that may be shown from this snippet. - #[serde(rename="restrictedCategories")] - pub restricted_categories: Option>, + /// The last upload timestamp of this creative if it was uploaded via API. Read-only. The value of this field is generated, and will be ignored for uploads. (formatted RFC 3339 timestamp). + #[serde(rename="apiUploadTimestamp")] + pub api_upload_timestamp: Option, /// All vendor types for the ads that may be shown from this snippet. #[serde(rename="vendorType")] pub vendor_type: Option>, @@ -296,13 +367,13 @@ impl ResponseResult for Creative {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DeleteOrderDealsRequest { - /// The last known order revision number. - #[serde(rename="orderRevisionNumber")] - pub order_revision_number: Option, + /// The last known proposal revision number. + #[serde(rename="proposalRevisionNumber")] + pub proposal_revision_number: Option, /// no description provided #[serde(rename="updateAction")] pub update_action: Option, - /// List of deals to delete for a given order + /// List of deals to delete for a given proposal #[serde(rename="dealIds")] pub deal_ids: Option>, } @@ -310,6 +381,27 @@ pub struct DeleteOrderDealsRequest { impl RequestValue for DeleteOrderDealsRequest {} +/// Video requests satisfying any of these player size constraints will match. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PretargetingConfigVideoPlayerSizes { + /// The minimum player width in pixels. Leave this field blank to match any player width. + #[serde(rename="minWidth")] + pub min_width: Option, + /// The type of aspect ratio. Leave this field blank to match all aspect ratios. + #[serde(rename="aspectRatio")] + pub aspect_ratio: Option, + /// The minimum player height in pixels. Leave this field blank to match any player height. + #[serde(rename="minHeight")] + pub min_height: Option, +} + +impl NestedType for PretargetingConfigVideoPlayerSizes {} +impl Part for PretargetingConfigVideoPlayerSizes {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -351,6 +443,109 @@ pub struct TargetingValueDayPartTargetingDayPart { impl Part for TargetingValueDayPartTargetingDayPart {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert marketplacedeals](struct.MarketplacedealInsertCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AddOrderDealsResponse { + /// List of deals added (in the same proposal as passed in the request) + pub deals: Option>, + /// The updated revision number for the proposal. + #[serde(rename="proposalRevisionNumber")] + pub proposal_revision_number: Option, +} + +impl ResponseResult for AddOrderDealsResponse {} + + +/// Represents a proposal in the marketplace. A proposal is the unit of negotiation between a seller and a buyer and contains deals which are served. Each field in a proposal can have one of the following setting: +/// +/// (readonly) - It is an error to try and set this field. (buyer-readonly) - Only the seller can set this field. (seller-readonly) - Only the buyer can set this field. (updatable) - The field is updatable at all times by either buyer or the seller. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search proposals](struct.ProposalSearchCall.html) (none) +/// * [patch proposals](struct.ProposalPatchCall.html) (request|response) +/// * [insert proposals](struct.ProposalInsertCall.html) (none) +/// * [get proposals](struct.ProposalGetCall.html) (response) +/// * [update proposals](struct.ProposalUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Proposal { + /// List of labels associated with the proposal. (readonly) + pub labels: Option>, + /// Indicates whether the buyer/seller created the proposal.(readonly) + #[serde(rename="originatorRole")] + pub originator_role: Option, + /// Optional contact information for the seller (buyer-readonly). + #[serde(rename="sellerContacts")] + pub seller_contacts: Option>, + /// Reference to the buyer on the proposal. (readonly, except on create) + pub buyer: Option, + /// What exchange will provide this inventory (readonly, except on create). + #[serde(rename="inventorySource")] + pub inventory_source: Option, + /// When an proposal is in an accepted state, indicates whether the buyer has signed off Once both sides have signed off on a deal, the proposal can be finalized by the seller. (buyer-readonly) + #[serde(rename="hasSellerSignedOff")] + pub has_seller_signed_off: Option, + /// no description provided + #[serde(rename="lastUpdaterRole")] + pub last_updater_role: Option, + /// When an proposal is in an accepted state, indicates whether the buyer has signed off Once both sides have signed off on a deal, the proposal can be finalized by the seller. (seller-readonly) + #[serde(rename="hasBuyerSignedOff")] + pub has_buyer_signed_off: Option, + /// The revision number for the proposal (readonly). + #[serde(rename="revisionNumber")] + pub revision_number: Option, + /// Identifies what kind of resource this is. Value: the fixed string "adexchangebuyer#proposal". + pub kind: Option, + /// The current state of the proposal. (readonly) + #[serde(rename="proposalState")] + pub proposal_state: Option, + /// The name for the proposal (updatable) + pub name: Option, + /// The time (ms since epoch) when the proposal was last revised (readonly). + #[serde(rename="revisionTimeMs")] + pub revision_time_ms: Option, + /// Private data for buyer. (hidden from seller). + #[serde(rename="buyerPrivateData")] + pub buyer_private_data: Option, + /// Reference to the buyer that will get billed for this proposal. (readonly) + #[serde(rename="billedBuyer")] + pub billed_buyer: Option, + /// Reference to the seller on the proposal. (readonly, except on create) + pub seller: Option, + /// The unique id of the proposal. (readonly). + #[serde(rename="proposalId")] + pub proposal_id: Option, + /// True if the proposal is being renegotiated (readonly). + #[serde(rename="isRenegotiating")] + pub is_renegotiating: Option, + /// True, if the buyside inventory setup is complete for this proposal. (readonly) + #[serde(rename="isSetupComplete")] + pub is_setup_complete: Option, + /// The role of the last user that either updated the proposal or left a comment. (readonly) + #[serde(rename="lastUpdaterOrCommentorRole")] + pub last_updater_or_commentor_role: Option, + /// Optional contact information fort the buyer. (seller-readonly) + #[serde(rename="buyerContacts")] + pub buyer_contacts: Option>, +} + +impl RequestValue for Proposal {} +impl Resource for Proposal {} +impl ResponseResult for Proposal {} + + /// The app icon, for app download ads. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -369,35 +564,72 @@ impl NestedType for CreativeNativeAdAppIcon {} impl Part for CreativeNativeAdAppIcon {} -/// There is no detailed description. +/// A product is segment of inventory that a seller wishes to sell. It is associated with certain terms and targeting information which helps buyer know more about the inventory. Each field in a product can have one of the following setting: /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// (readonly) - It is an error to try and set this field. (buyer-readonly) - Only the seller can set this field. (seller-readonly) - Only the buyer can set this field. (updatable) - The field is updatable at all times by either buyer or the seller. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search products](struct.ProductSearchCall.html) (none) +/// * [get products](struct.ProductGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BuyerDto { +pub struct Product { + /// Optional contact information for the creator of this product. (buyer-readonly) + #[serde(rename="creatorContacts")] + pub creator_contacts: Option>, + /// Targeting that is shared between the buyer and the seller. Each targeting criteria has a specified key and for each key there is a list of inclusion value or exclusion values. (buyer-readonly) + #[serde(rename="sharedTargetings")] + pub shared_targetings: Option>, + /// The negotiable terms of the deal (buyer-readonly) + pub terms: Option, + /// The proposed end time for the deal (ms since epoch) (buyer-readonly) + #[serde(rename="flightEndTimeMs")] + pub flight_end_time_ms: Option, + /// Optional List of labels for the product (optional, buyer-readonly). + pub labels: Option>, + /// What exchange will provide this inventory (readonly, except on create). + #[serde(rename="inventorySource")] + pub inventory_source: Option, + /// Time of last update in ms. since epoch (readonly) + #[serde(rename="lastUpdateTimeMs")] + pub last_update_time_ms: Option, + /// The revision number of the product. (readonly) + #[serde(rename="revisionNumber")] + pub revision_number: Option, + /// Identifies what kind of resource this is. Value: the fixed string "adexchangebuyer#product". + pub kind: Option, + /// The name for this product as set by the seller. (buyer-readonly) + pub name: Option, + /// The syndication product associated with the deal. (readonly, except on create) + #[serde(rename="syndicationProduct")] + pub syndication_product: Option, + /// Information about the seller that created this product (readonly, except on create) + pub seller: Option, /// no description provided - #[serde(rename="enabledForPreferredDeals")] - pub enabled_for_preferred_deals: Option, - /// no description provided - #[serde(rename="enabledForInterestTargetingDeals")] - pub enabled_for_interest_targeting_deals: Option, - /// no description provided - #[serde(rename="displayName")] - pub display_name: Option, - /// no description provided - #[serde(rename="sponsorAccountId")] - pub sponsor_account_id: Option, - /// no description provided - #[serde(rename="accountId")] - pub account_id: Option, - /// no description provided - pub id: Option, - /// no description provided - #[serde(rename="customerId")] - pub customer_id: Option, + #[serde(rename="webPropertyCode")] + pub web_property_code: Option, + /// The state of the product. (buyer-readonly) + pub state: Option, + /// Inventory availability dates. (times are in ms since epoch) The granularity is generally in the order of seconds. (buyer-readonly) + #[serde(rename="flightStartTimeMs")] + pub flight_start_time_ms: Option, + /// If the creator has already signed off on the product, then the buyer can finalize the deal by accepting the product as is. When copying to a proposal, if any of the terms are changed, then auto_finalize is automatically set to false. + #[serde(rename="hasCreatorSignedOff")] + pub has_creator_signed_off: Option, + /// Creation time in ms. since epoch (readonly) + #[serde(rename="creationTimeMs")] + pub creation_time_ms: Option, + /// The unique id for the product (readonly) + #[serde(rename="productId")] + pub product_id: Option, } -impl Part for BuyerDto {} +impl Resource for Product {} +impl ResponseResult for Product {} /// There is no detailed description. @@ -436,28 +668,92 @@ impl NestedType for CreativeNativeAdLogo {} impl Part for CreativeNativeAdLogo {} -/// There is no detailed description. +/// The configuration data for an Ad Exchange billing info. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get billing info](struct.BillingInfoGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DealPartyDto { - /// no description provided - pub buyer: Option, - /// no description provided - #[serde(rename="webProperty")] - pub web_property: Option, - /// no description provided - #[serde(rename="buyerSellerRole")] - pub buyer_seller_role: Option, - /// no description provided - #[serde(rename="customerId")] - pub customer_id: Option, - /// no description provided - pub name: Option, +pub struct BillingInfo { + /// Resource type. + pub kind: Option, + /// A list of adgroup IDs associated with this particular account. These IDs may show up as part of a realtime bidding BidRequest, which indicates a bid request for this account. + #[serde(rename="billingId")] + pub billing_id: Option>, + /// Account id. + #[serde(rename="accountId")] + pub account_id: Option, + /// Account name. + #[serde(rename="accountName")] + pub account_name: Option, } -impl Part for DealPartyDto {} +impl ResponseResult for BillingInfo {} + + +/// The creatives feed lists the active creatives for the Ad Exchange buyer accounts that the user has access to. Each entry in the feed corresponds to a single creative. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creatives](struct.CreativeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativesList { + /// Continuation token used to page through creatives. To retrieve the next page of results, set the next request's "pageToken" value to this. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of creatives. + pub items: Option>, + /// Resource type. + pub kind: Option, +} + +impl ResponseResult for CreativesList {} + + +/// An account feed lists Ad Exchange buyer accounts that the user has access to. Each entry in the feed corresponds to a single buyer account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list accounts](struct.AccountListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountsList { + /// A list of accounts. + pub items: Option>, + /// Resource type. + pub kind: Option, +} + +impl ResponseResult for AccountsList {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search products](struct.ProductSearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GetOffersResponse { + /// The returned list of products. + pub products: Option>, +} + +impl ResponseResult for GetOffersResponse {} /// There is no detailed description. @@ -465,17 +761,19 @@ impl Part for DealPartyDto {} /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BrandDto { - /// no description provided - #[serde(rename="advertiserId")] - pub advertiser_id: Option, - /// no description provided - pub id: Option, - /// no description provided - pub name: Option, +pub struct Price { + /// The pricing type for the deal/product. + #[serde(rename="pricingType")] + pub pricing_type: Option, + /// The currency code for the price. + #[serde(rename="currencyCode")] + pub currency_code: Option, + /// The price value in micros. + #[serde(rename="amountMicros")] + pub amount_micros: Option, } -impl Part for BrandDto {} +impl Part for Price {} /// All known contexts/restrictions. @@ -512,13 +810,31 @@ impl Part for CreativeServingRestrictionsContexts {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct EditAllOrderDealsResponse { - /// List of all deals in the order after edit. + /// List of all deals in the proposal after edit. pub deals: Option>, } impl ResponseResult for EditAllOrderDealsResponse {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert marketplacenotes](struct.MarketplacenoteInsertCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AddOrderNotesResponse { + /// no description provided + pub notes: Option>, +} + +impl ResponseResult for AddOrderNotesResponse {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -536,20 +852,44 @@ pub struct DealTermsNonGuaranteedAuctionTerms { impl Part for DealTermsNonGuaranteedAuctionTerms {} -/// Shows any corrections that were applied to this creative. Read-only. This field should not be set in requests. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreativeCorrections { - /// The type of correction that was applied to the creative. - pub reason: Option, - /// Additional details about the correction. - pub details: Option>, +pub struct MarketplaceLabel { + /// The creation time (in ms since epoch) for the label. + #[serde(rename="createTimeMs")] + pub create_time_ms: Option, + /// Information about the party that created the label. + #[serde(rename="deprecatedMarketplaceDealParty")] + pub deprecated_marketplace_deal_party: Option, + /// The label to use. + pub label: Option, + /// The accountId of the party that created the label. + #[serde(rename="accountId")] + pub account_id: Option, } -impl NestedType for CreativeCorrections {} -impl Part for CreativeCorrections {} +impl Part for MarketplaceLabel {} + + +/// The filtering reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFilteringReasonsReasons { + /// The number of times the creative was filtered for the status. The count is aggregated across all publishers on the exchange. + #[serde(rename="filteringCount")] + pub filtering_count: Option, + /// The filtering status code. Please refer to the creative-status-codes.txt file for different statuses. + #[serde(rename="filteringStatus")] + pub filtering_status: Option, +} + +impl NestedType for CreativeFilteringReasonsReasons {} +impl Part for CreativeFilteringReasonsReasons {} /// There is no detailed description. @@ -559,34 +899,15 @@ impl Part for CreativeCorrections {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list clientaccess](struct.ClientaccesListCall.html) (request) +/// * [insert marketplacenotes](struct.MarketplacenoteInsertCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListClientAccessCapabilitiesRequest { - /// no description provided - #[serde(rename="sponsorAccountId")] - pub sponsor_account_id: Option, +pub struct AddOrderNotesRequest { + /// The list of notes to add. + pub notes: Option>, } -impl RequestValue for ListClientAccessCapabilitiesRequest {} - - -/// A large image. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreativeNativeAdImage { - /// no description provided - pub url: Option, - /// no description provided - pub width: Option, - /// no description provided - pub height: Option, -} - -impl NestedType for CreativeNativeAdImage {} -impl Part for CreativeNativeAdImage {} +impl RequestValue for AddOrderNotesRequest {} /// There is no detailed description. @@ -640,6 +961,23 @@ impl NestedType for AccountBidderLocation {} impl Part for AccountBidderLocation {} +/// Requests containing any of these placements will not match. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PretargetingConfigExcludedPlacements { + /// The value of the placement. Interpretation depends on the placement type, e.g. URL for a site placement, channel name for a channel placement, app id for a mobile app placement. + pub token: Option, + /// The type of the placement. + #[serde(rename="type")] + pub type_: Option, +} + +impl NestedType for PretargetingConfigExcludedPlacements {} +impl Part for PretargetingConfigExcludedPlacements {} + + /// Configuration data for an Ad Exchange buyer account. /// /// # Activities @@ -683,6 +1021,25 @@ impl Resource for Account {} impl ResponseResult for Account {} +/// The granular status of this ad in specific contexts. A context here relates to where something ultimately serves (for example, a physical location, a platform, an HTTPS vs HTTP request, or the type of auction). Read-only. This field should not be set in requests. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeServingRestrictions { + /// All known contexts/restrictions. + pub contexts: Option>, + /// The reasons for disapproval within this restriction, if any. Note that not all disapproval reasons may be categorized, so it is possible for the creative to have a status of DISAPPROVED or CONDITIONALLY_APPROVED with an empty list for disapproval_reasons. In this case, please reach out to your TAM to help debug the issue. + #[serde(rename="disapprovalReasons")] + pub disapproval_reasons: Option>, + /// Why the creative is ineligible to serve in this context (e.g., it has been explicitly disapproved or is pending review). + pub reason: Option, +} + +impl NestedType for CreativeServingRestrictions {} +impl Part for CreativeServingRestrictions {} + + /// There is no detailed description. /// /// # Activities @@ -690,42 +1047,41 @@ impl ResponseResult for Account {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [insert marketplacedeals](struct.MarketplacedealInsertCall.html) (response) +/// * [list pretargeting config](struct.PretargetingConfigListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddOrderDealsResponse { - /// List of deals added (in the same order as passed in the request) - pub deals: Option>, - /// The updated revision number for the order. - #[serde(rename="orderRevisionNumber")] - pub order_revision_number: Option, +pub struct PretargetingConfigList { + /// A list of pretargeting configs + pub items: Option>, + /// Resource type. + pub kind: Option, } -impl ResponseResult for AddOrderDealsResponse {} +impl ResponseResult for PretargetingConfigList {} -/// An order is associated with a bunch of notes which may optionally be associated with a deal and/or revision number. +/// A proposal is associated with a bunch of notes which may optionally be associated with a deal and/or revision number. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MarketplaceNote { - /// The order_id that a note is attached to. (readonly) - #[serde(rename="orderId")] - pub order_id: Option, /// Identifies what kind of resource this is. Value: the fixed string "adexchangebuyer#marketplaceNote". pub kind: Option, - /// The role of the person (buyer/seller) creating the note. (readonly) - #[serde(rename="creatorRole")] - pub creator_role: Option, + /// If the note is associated with a proposal revision number, then store that here. (readonly, except on create) + #[serde(rename="proposalRevisionNumber")] + pub proposal_revision_number: Option, /// Notes can optionally be associated with a deal. (readonly, except on create) #[serde(rename="dealId")] pub deal_id: Option, /// The actual note to attach. (readonly, except on create) pub note: Option, - /// If the note is associated with an order revision number, then store that here. (readonly, except on create) - #[serde(rename="orderRevisionNumber")] - pub order_revision_number: Option, + /// The proposalId that a note is attached to. (readonly) + #[serde(rename="proposalId")] + pub proposal_id: Option, + /// The role of the person (buyer/seller) creating the note. (readonly) + #[serde(rename="creatorRole")] + pub creator_role: Option, /// The unique id for the note. (readonly) #[serde(rename="noteId")] pub note_id: Option, @@ -739,23 +1095,17 @@ impl Part for MarketplaceNote {} /// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [delete marketplacedeals](struct.MarketplacedealDeleteCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteOrderDealsResponse { - /// List of deals deleted (in the same order as passed in the request) - pub deals: Option>, - /// The updated revision number for the order. - #[serde(rename="orderRevisionNumber")] - pub order_revision_number: Option, +pub struct MarketplaceDealParty { + /// The buyer/seller associated with the deal. One of buyer/seller is specified for a deal-party. + pub buyer: Option, + /// The buyer/seller associated with the deal. One of buyer/seller is specified for a deal party. + pub seller: Option, } -impl ResponseResult for DeleteOrderDealsResponse {} +impl Part for MarketplaceDealParty {} /// There is no detailed description. @@ -765,15 +1115,50 @@ impl ResponseResult for DeleteOrderDealsResponse {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [insert marketplacenotes](struct.MarketplacenoteInsertCall.html) (request) +/// * [search proposals](struct.ProposalSearchCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddOrderNotesRequest { - /// The list of notes to add. - pub notes: Option>, +pub struct GetOrdersResponse { + /// The list of matching proposals. + pub proposals: Option>, } -impl RequestValue for AddOrderNotesRequest {} +impl ResponseResult for GetOrdersResponse {} + + +/// The configuration data for Ad Exchange RTB - Budget API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch budget](struct.BudgetPatchCall.html) (request|response) +/// * [update budget](struct.BudgetUpdateCall.html) (request|response) +/// * [get budget](struct.BudgetGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Budget { + /// The billing id to determine which adgroup to provide budget information for. This is required for get and update requests. + #[serde(rename="billingId")] + pub billing_id: Option, + /// The kind of the resource, i.e. "adexchangebuyer#budget". + pub kind: Option, + /// The daily budget amount in unit amount of the account currency to apply for the billingId provided. This is required for update requests. + #[serde(rename="budgetAmount")] + pub budget_amount: Option, + /// The currency code for the buyer. This cannot be altered here. + #[serde(rename="currencyCode")] + pub currency_code: Option, + /// The unique id that describes this item. + pub id: Option, + /// The id of the account. This is required for get and update requests. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for Budget {} +impl ResponseResult for Budget {} /// The configuration data for an Ad Exchange performance report list. @@ -873,21 +1258,28 @@ impl ResponseResult for PerformanceReportList {} /// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update marketplacedeals](struct.MarketplacedealUpdateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AdvertiserDto { - /// no description provided - pub brands: Option>, - /// no description provided - pub status: Option, - /// no description provided - pub id: Option, - /// no description provided - pub name: Option, +pub struct EditAllOrderDealsRequest { + /// List of deals to edit. Service may perform 3 different operations based on comparison of deals in this list vs deals already persisted in database: 1. Add new deal to proposal If a deal in this list does not exist in the proposal, the service will create a new deal and add it to the proposal. Validation will follow AddOrderDealsRequest. 2. Update existing deal in the proposal If a deal in this list already exist in the proposal, the service will update that existing deal to this new deal in the request. Validation will follow UpdateOrderDealsRequest. 3. Delete deals from the proposal (just need the id) If a existing deal in the proposal is not present in this list, the service will delete that deal from the proposal. Validation will follow DeleteOrderDealsRequest. + pub deals: Option>, + /// If specified, also updates the proposal in the batch transaction. This is useful when the proposal and the deals need to be updated in one transaction. + pub proposal: Option, + /// The last known revision number for the proposal. + #[serde(rename="proposalRevisionNumber")] + pub proposal_revision_number: Option, + /// Indicates an optional action to take on the proposal + #[serde(rename="updateAction")] + pub update_action: Option, } -impl Part for AdvertiserDto {} +impl RequestValue for EditAllOrderDealsRequest {} /// There is no detailed description. @@ -901,7 +1293,7 @@ impl Part for AdvertiserDto {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GetOrderDealsResponse { - /// List of deals for the order + /// List of deals for the proposal pub deals: Option>, } @@ -925,6 +1317,74 @@ pub struct SharedTargeting { impl Part for SharedTargeting {} +/// A proposal can contain multiple deals. A deal contains the terms and targeting information that is used for serving. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MarketplaceDeal { + /// The set of fields around delivery control that are interesting for a buyer to see but are non-negotiable. These are set by the publisher. This message is assigned an id of 100 since some day we would want to model this as a protobuf extension. + #[serde(rename="deliveryControl")] + pub delivery_control: Option, + /// The negotiable terms of the deal. (updatable) + pub terms: Option, + /// Proposed flight end time of the deal (ms since epoch) This will generally be stored in a granularity of a second. (updatable) + #[serde(rename="flightEndTimeMs")] + pub flight_end_time_ms: Option, + /// The shared targeting visible to buyers and sellers. (updatable) + #[serde(rename="sharedTargetings")] + pub shared_targetings: Option>, + /// A unique deal=id for the deal (readonly). + #[serde(rename="dealId")] + pub deal_id: Option, + /// Optional Seller contact information for the deal (buyer-readonly) + #[serde(rename="sellerContacts")] + pub seller_contacts: Option>, + /// The external deal id assigned to this deal once the deal is finalized. This is the deal-id that shows up in serving/reporting etc. (readonly) + #[serde(rename="externalDealId")] + pub external_deal_id: Option, + /// The time (ms since epoch) when the deal was last updated. (readonly) + #[serde(rename="lastUpdateTimeMs")] + pub last_update_time_ms: Option, + /// Identifies what kind of resource this is. Value: the fixed string "adexchangebuyer#marketplaceDeal". + pub kind: Option, + /// Specifies the creative pre-approval policy (buyer-readonly) + #[serde(rename="creativePreApprovalPolicy")] + pub creative_pre_approval_policy: Option, + /// The name of the deal. (updatable) + pub name: Option, + /// Buyer private data (hidden from seller). + #[serde(rename="buyerPrivateData")] + pub buyer_private_data: Option, + /// The syndication product associated with the deal. (readonly, except on create) + #[serde(rename="syndicationProduct")] + pub syndication_product: Option, + /// The revision number of the product that the deal was created from (readonly, except on create) + #[serde(rename="productRevisionNumber")] + pub product_revision_number: Option, + /// no description provided + #[serde(rename="webPropertyCode")] + pub web_property_code: Option, + /// no description provided + #[serde(rename="proposalId")] + pub proposal_id: Option, + /// Proposed flight start time of the deal (ms since epoch) This will generally be stored in a granularity of a second. (updatable) + #[serde(rename="flightStartTimeMs")] + pub flight_start_time_ms: Option, + /// The time (ms since epoch) of the deal creation. (readonly) + #[serde(rename="creationTimeMs")] + pub creation_time_ms: Option, + /// Description for the deal terms. (updatable) + #[serde(rename="inventoryDescription")] + pub inventory_description: Option, + /// The product-id from which this deal was created. (readonly, except on create) + #[serde(rename="productId")] + pub product_id: Option, +} + +impl Part for MarketplaceDeal {} + + /// A billing info feed lists Billing Info the Ad Exchange buyer account has access to. Each entry in the feed corresponds to a single billing info. /// /// # Activities @@ -945,983 +1405,6 @@ pub struct BillingInfoList { impl ResponseResult for BillingInfoList {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DateTime { - /// no description provided - #[serde(rename="timeZoneId")] - pub time_zone_id: Option, - /// no description provided - pub second: Option, - /// no description provided - pub hour: Option, - /// no description provided - pub year: Option, - /// no description provided - pub day: Option, - /// no description provided - pub minute: Option, - /// no description provided - pub month: Option, -} - -impl Part for DateTime {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InventorySegmentTargeting { - /// no description provided - #[serde(rename="negativeXfpAdSlots")] - pub negative_xfp_ad_slots: Option>, - /// no description provided - #[serde(rename="positiveInventorySlots")] - pub positive_inventory_slots: Option>, - /// no description provided - #[serde(rename="negativeSiteUrls")] - pub negative_site_urls: Option>, - /// no description provided - #[serde(rename="positiveIcmBrands")] - pub positive_icm_brands: Option>, - /// no description provided - #[serde(rename="negativeXfpPlacements")] - pub negative_xfp_placements: Option>, - /// no description provided - #[serde(rename="positiveVideoAdPositionSegments")] - pub positive_video_ad_position_segments: Option>, - /// no description provided - #[serde(rename="negativeIcmInterests")] - pub negative_icm_interests: Option>, - /// no description provided - #[serde(rename="negativeAudienceSegments")] - pub negative_audience_segments: Option>, - /// no description provided - #[serde(rename="positiveOperatingSystems")] - pub positive_operating_systems: Option>, - /// no description provided - #[serde(rename="negativeOperatingSystems")] - pub negative_operating_systems: Option>, - /// no description provided - #[serde(rename="negativeIcmBrands")] - pub negative_icm_brands: Option>, - /// no description provided - #[serde(rename="positiveLocations")] - pub positive_locations: Option>, - /// no description provided - #[serde(rename="negativeVideoAdPositionSegments")] - pub negative_video_ad_position_segments: Option>, - /// no description provided - #[serde(rename="positiveDeviceCategories")] - pub positive_device_categories: Option>, - /// no description provided - #[serde(rename="negativeAdSizes")] - pub negative_ad_sizes: Option>, - /// no description provided - #[serde(rename="negativeInventorySlots")] - pub negative_inventory_slots: Option>, - /// no description provided - #[serde(rename="negativeMobileApps")] - pub negative_mobile_apps: Option>, - /// no description provided - #[serde(rename="negativeVideoDurationSegments")] - pub negative_video_duration_segments: Option>, - /// no description provided - #[serde(rename="positiveSizes")] - pub positive_sizes: Option>, - /// no description provided - #[serde(rename="positiveXfpAdSlots")] - pub positive_xfp_ad_slots: Option>, - /// no description provided - #[serde(rename="positiveKeyValues")] - pub positive_key_values: Option>, - /// no description provided - #[serde(rename="positiveSiteUrls")] - pub positive_site_urls: Option>, - /// no description provided - #[serde(rename="positiveMobileApps")] - pub positive_mobile_apps: Option>, - /// no description provided - #[serde(rename="negativeKeyValues")] - pub negative_key_values: Option>, - /// no description provided - #[serde(rename="negativeSizes")] - pub negative_sizes: Option>, - /// no description provided - #[serde(rename="positiveOperatingSystemVersions")] - pub positive_operating_system_versions: Option>, - /// no description provided - #[serde(rename="negativeLocations")] - pub negative_locations: Option>, - /// no description provided - #[serde(rename="positiveAdSizes")] - pub positive_ad_sizes: Option>, - /// no description provided - #[serde(rename="negativeOperatingSystemVersions")] - pub negative_operating_system_versions: Option>, - /// no description provided - #[serde(rename="positiveXfpPlacements")] - pub positive_xfp_placements: Option>, - /// no description provided - #[serde(rename="positiveIcmInterests")] - pub positive_icm_interests: Option>, - /// no description provided - #[serde(rename="positiveVideoDurationSegments")] - pub positive_video_duration_segments: Option>, - /// no description provided - #[serde(rename="positiveAudienceSegments")] - pub positive_audience_segments: Option>, - /// no description provided - #[serde(rename="negativeDeviceCategories")] - pub negative_device_categories: Option>, - /// no description provided - #[serde(rename="positiveAdTypeSegments")] - pub positive_ad_type_segments: Option>, - /// no description provided - #[serde(rename="negativeAdTypeSegments")] - pub negative_ad_type_segments: Option>, -} - -impl Part for InventorySegmentTargeting {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AudienceSegment { - /// no description provided - pub description: Option, - /// no description provided - pub id: Option, - /// no description provided - pub name: Option, - /// no description provided - #[serde(rename="numCookies")] - pub num_cookies: Option, -} - -impl Part for AudienceSegment {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get negotiations](struct.NegotiationGetCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetNegotiationByIdRequest { - /// no description provided - #[serde(rename="includePrivateAuctions")] - pub include_private_auctions: Option, -} - -impl RequestValue for GetNegotiationByIdRequest {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [insert marketplaceorders](struct.MarketplaceorderInsertCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateOrdersResponse { - /// The list of orders successfully created. - pub orders: Option>, -} - -impl ResponseResult for CreateOrdersResponse {} - - -/// Represents an order in the marketplace. An order is the unit of negotiation between a seller and a buyer and contains deals which are served. Each field in an order can have one of the following setting: -/// -/// (readonly) - It is an error to try and set this field. (buyer-readonly) - Only the seller can set this field. (seller-readonly) - Only the buyer can set this field. (updatable) - The field is updatable at all times by either buyer or the seller. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get marketplaceorders](struct.MarketplaceorderGetCall.html) (response) -/// * [patch marketplaceorders](struct.MarketplaceorderPatchCall.html) (request|response) -/// * [update marketplaceorders](struct.MarketplaceorderUpdateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MarketplaceOrder { - /// The unique id of the order. (readonly). - #[serde(rename="orderId")] - pub order_id: Option, - /// List of labels associated with the order. (readonly) - pub labels: Option>, - /// Indicates whether the buyer/seller created the offer.(readonly) - #[serde(rename="originatorRole")] - pub originator_role: Option, - /// Optional contact information for the seller (buyer-readonly). - #[serde(rename="sellerContacts")] - pub seller_contacts: Option>, - /// Reference to the buyer on the order. (readonly, except on create) - pub buyer: Option, - /// The current state of the order. (readonly) - #[serde(rename="orderState")] - pub order_state: Option, - /// When an order is in an accepted state, indicates whether the buyer has signed off Once both sides have signed off on a deal, the order can be finalized by the seller. (buyer-readonly) - #[serde(rename="hasSellerSignedOff")] - pub has_seller_signed_off: Option, - /// no description provided - #[serde(rename="lastUpdaterRole")] - pub last_updater_role: Option, - /// When an order is in an accepted state, indicates whether the buyer has signed off Once both sides have signed off on a deal, the order can be finalized by the seller. (seller-readonly) - #[serde(rename="hasBuyerSignedOff")] - pub has_buyer_signed_off: Option, - /// The revision number for the order (readonly). - #[serde(rename="revisionNumber")] - pub revision_number: Option, - /// Identifies what kind of resource this is. Value: the fixed string "adexchangebuyer#marketplaceOrder". - pub kind: Option, - /// The name for the order (updatable) - pub name: Option, - /// The time (ms since epoch) when the order was last revised (readonly). - #[serde(rename="revisionTimeMs")] - pub revision_time_ms: Option, - /// Private data for buyer. (hidden from seller). - #[serde(rename="buyerPrivateData")] - pub buyer_private_data: Option, - /// Reference to the buyer that will get billed for this order. (readonly) - #[serde(rename="billedBuyer")] - pub billed_buyer: Option, - /// Reference to the seller on the order. (readonly, except on create) - pub seller: Option, - /// True if the order is being renegotiated (readonly). - #[serde(rename="isRenegotiating")] - pub is_renegotiating: Option, - /// True, if the buyside inventory setup is complete for this order. (readonly) - #[serde(rename="isSetupComplete")] - pub is_setup_complete: Option, - /// The role of the last user that either updated the order or left a comment. (readonly) - #[serde(rename="lastUpdaterOrCommentorRole")] - pub last_updater_or_commentor_role: Option, - /// Optional contact information fort the buyer. (seller-readonly) - #[serde(rename="buyerContacts")] - pub buyer_contacts: Option>, -} - -impl RequestValue for MarketplaceOrder {} -impl Resource for MarketplaceOrder {} -impl ResponseResult for MarketplaceOrder {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetingValueCreativeSize { - /// The Creative size type. - #[serde(rename="creativeSizeType")] - pub creative_size_type: Option, - /// For video size type, the list of companion sizes. - #[serde(rename="companionSizes")] - pub companion_sizes: Option>, - /// For regular creative size type, specifies the size of the creative. - pub size: Option, -} - -impl Part for TargetingValueCreativeSize {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetingValue { - /// The daypart targeting to include / exclude. Filled in when the key is GOOG_DAYPART_TARGETING. - #[serde(rename="dayPartTargetingValue")] - pub day_part_targeting_value: Option, - /// The long value to exclude/include. - #[serde(rename="longValue")] - pub long_value: Option, - /// The creative size value to exclude/include. - #[serde(rename="creativeSizeValue")] - pub creative_size_value: Option, - /// The string value to exclude/include. - #[serde(rename="stringValue")] - pub string_value: Option, -} - -impl Part for TargetingValue {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DealTerms { - /// The terms for guaranteed fixed price deals. - #[serde(rename="guaranteedFixedPriceTerms")] - pub guaranteed_fixed_price_terms: Option, - /// Description for the proposed terms of the deal. - pub description: Option, - /// The terms for non-guaranteed auction deals. - #[serde(rename="nonGuaranteedAuctionTerms")] - pub non_guaranteed_auction_terms: Option, - /// The terms for non-guaranteed fixed price deals. - #[serde(rename="nonGuaranteedFixedPriceTerms")] - pub non_guaranteed_fixed_price_terms: Option, -} - -impl Part for DealTerms {} - - -/// Requests containing any of these placements will not match. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PretargetingConfigExcludedPlacements { - /// The value of the placement. Interpretation depends on the placement type, e.g. URL for a site placement, channel name for a channel placement, app id for a mobile app placement. - pub token: Option, - /// The type of the placement. - #[serde(rename="type")] - pub type_: Option, -} - -impl NestedType for PretargetingConfigExcludedPlacements {} -impl Part for PretargetingConfigExcludedPlacements {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list negotiations](struct.NegotiationListCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetNegotiationsRequest { - /// no description provided - #[serde(rename="sinceTimestampMillis")] - pub since_timestamp_millis: Option, - /// no description provided - #[serde(rename="includePrivateAuctions")] - pub include_private_auctions: Option, - /// no description provided - pub finalized: Option, -} - -impl RequestValue for GetNegotiationsRequest {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TargetingValueDayPartTargeting { - /// no description provided - #[serde(rename="dayParts")] - pub day_parts: Option>, - /// no description provided - #[serde(rename="timeZoneType")] - pub time_zone_type: Option, -} - -impl Part for TargetingValueDayPartTargeting {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list offers](struct.OfferListCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListOffersRequest { - /// no description provided - #[serde(rename="sinceTimestampMillis")] - pub since_timestamp_millis: Option, -} - -impl RequestValue for ListOffersRequest {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PrivateData { - /// no description provided - #[serde(rename="referenceId")] - pub reference_id: Option, - /// no description provided - #[serde(rename="referencePayload")] - pub reference_payload: Option, -} - -impl Part for PrivateData {} - - -/// Requests containing any of these placements will match. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PretargetingConfigPlacements { - /// The value of the placement. Interpretation depends on the placement type, e.g. URL for a site placement, channel name for a channel placement, app id for a mobile app placement. - pub token: Option, - /// The type of the placement. - #[serde(rename="type")] - pub type_: Option, -} - -impl NestedType for PretargetingConfigPlacements {} -impl Part for PretargetingConfigPlacements {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list offers](struct.OfferListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListOffersResponse { - /// no description provided - pub kind: Option, - /// no description provided - pub offers: Option>, -} - -impl ResponseResult for ListOffersResponse {} - - -/// The granular status of this ad in specific contexts. A context here relates to where something ultimately serves (for example, a physical location, a platform, an HTTPS vs HTTP request, or the type of auction). Read-only. This field should not be set in requests. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreativeServingRestrictions { - /// All known contexts/restrictions. - pub contexts: Option>, - /// The reasons for disapproval within this restriction, if any. Note that not all disapproval reasons may be categorized, so it is possible for the creative to have a status of DISAPPROVED or CONDITIONALLY_APPROVED with an empty list for disapproval_reasons. In this case, please reach out to your TAM to help debug the issue. - #[serde(rename="disapprovalReasons")] - pub disapproval_reasons: Option>, - /// Why the creative is ineligible to serve in this context (e.g., it has been explicitly disapproved or is pending review). - pub reason: Option, -} - -impl NestedType for CreativeServingRestrictions {} -impl Part for CreativeServingRestrictions {} - - -/// The filtering reasons for the creative. Read-only. This field should not be set in requests. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreativeFilteringReasons { - /// The date in ISO 8601 format for the data. The data is collected from 00:00:00 to 23:59:59 in PST. - pub date: Option, - /// The filtering reasons. - pub reasons: Option>, -} - -impl NestedType for CreativeFilteringReasons {} -impl Part for CreativeFilteringReasons {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AdSlotDto { - /// no description provided - pub description: Option, - /// no description provided - pub name: Option, - /// no description provided - #[serde(rename="webPropertyId")] - pub web_property_id: Option, - /// no description provided - #[serde(rename="channelId")] - pub channel_id: Option, - /// no description provided - #[serde(rename="channelCode")] - pub channel_code: Option, - /// no description provided - pub size: Option, -} - -impl Part for AdSlotDto {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list pretargeting config](struct.PretargetingConfigListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PretargetingConfigList { - /// A list of pretargeting configs - pub items: Option>, - /// Resource type. - pub kind: Option, -} - -impl ResponseResult for PretargetingConfigList {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TermsDto { - /// If true, the offer will finalize automatically when accepted. - #[serde(rename="finalizeAutomatically")] - pub finalize_automatically: Option, - /// The inventory segment targeting for the offer. - #[serde(rename="inventorySegmentTargeting")] - pub inventory_segment_targeting: Option, - /// The audience segment for the offer. - #[serde(rename="audienceSegment")] - pub audience_segment: Option, - /// The end date for the offer. - #[serde(rename="endDate")] - pub end_date: Option, - /// A list of terms attributes. - #[serde(rename="termsAttributes")] - pub terms_attributes: Option>, - /// The start date for the offer. - #[serde(rename="startDate")] - pub start_date: Option, - /// The buyer billing type. - #[serde(rename="buyerBillingType")] - pub buyer_billing_type: Option, - /// The estimated daily impressions for the offer. - #[serde(rename="estimatedImpressionsPerDay")] - pub estimated_impressions_per_day: Option, - /// The monetizer type. - #[serde(rename="monetizerType")] - pub monetizer_type: Option, - /// The billing terms. - #[serde(rename="billingTerms")] - pub billing_terms: Option, - /// Whether to target by deal id. - #[serde(rename="targetByDealId")] - pub target_by_deal_id: Option, - /// The particular ad slots targeted by the offer. - #[serde(rename="adSlots")] - pub ad_slots: Option>, - /// A list of advertisers for this offer. - pub advertisers: Option>, - /// The minimum spend for the offer. - #[serde(rename="minimumSpendMicros")] - pub minimum_spend_micros: Option, - /// If true, the offer targets all ad slots. - #[serde(rename="targetingAllAdSlots")] - pub targeting_all_ad_slots: Option, - /// A description for these terms. - pub description: Option, - /// The minimum true looks for the offer. - #[serde(rename="minimumTrueLooks")] - pub minimum_true_looks: Option, - /// The cpm terms. - pub cpm: Option, - /// Whether the offer is a reservation. - #[serde(rename="isReservation")] - pub is_reservation: Option, - /// The urls applicable to the offer. - pub urls: Option>, - /// Whether to use or ignore publisher blocking rules. - #[serde(rename="creativeBlockingLevel")] - pub creative_blocking_level: Option, - /// Whether to use publisher review policy or AdX review policy. - #[serde(rename="creativeReviewPolicy")] - pub creative_review_policy: Option, - /// A description of the audience segment for the offer. - #[serde(rename="audienceSegmentDescription")] - pub audience_segment_description: Option, - /// A descriptive name for these terms. - #[serde(rename="descriptiveName")] - pub descriptive_name: Option, - /// Whether this offer is semi-transparent. - #[serde(rename="semiTransparent")] - pub semi_transparent: Option, - /// The estimated spend for the offer. - #[serde(rename="estimatedSpend")] - pub estimated_spend: Option, - /// The premium terms. - #[serde(rename="dealPremium")] - pub deal_premium: Option, -} - -impl Part for TermsDto {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [update clientaccess](struct.ClientaccesUpdateCall.html) (request|response) -/// * [get clientaccess](struct.ClientaccesGetCall.html) (response) -/// * [insert clientaccess](struct.ClientaccesInsertCall.html) (request|response) -/// * [patch clientaccess](struct.ClientaccesPatchCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ClientAccessCapabilities { - /// no description provided - #[serde(rename="clientAccountId")] - pub client_account_id: Option, - /// no description provided - pub capabilities: Option>, -} - -impl RequestValue for ClientAccessCapabilities {} -impl ResponseResult for ClientAccessCapabilities {} - - -/// The creatives feed lists the active creatives for the Ad Exchange buyer accounts that the user has access to. Each entry in the feed corresponds to a single creative. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list creatives](struct.CreativeListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreativesList { - /// Continuation token used to page through creatives. To retrieve the next page of results, set the next request's "pageToken" value to this. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// A list of creatives. - pub items: Option>, - /// Resource type. - pub kind: Option, -} - -impl ResponseResult for CreativesList {} - - -/// An account feed lists Ad Exchange buyer accounts that the user has access to. Each entry in the feed corresponds to a single buyer account. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list accounts](struct.AccountListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AccountsList { - /// A list of accounts. - pub items: Option>, - /// Resource type. - pub kind: Option, -} - -impl ResponseResult for AccountsList {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search marketplaceoffers](struct.MarketplaceofferSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetOffersResponse { - /// The returned list of offers. - pub offers: Option>, -} - -impl ResponseResult for GetOffersResponse {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Price { - /// The currency code for the price. - #[serde(rename="currencyCode")] - pub currency_code: Option, - /// The CPM value in micros. - #[serde(rename="amountMicros")] - pub amount_micros: Option, -} - -impl Part for Price {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ContactInformation { - /// Email address of the contact. - pub email: Option, - /// The name of the contact. - pub name: Option, -} - -impl Part for ContactInformation {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MarketplaceLabel { - /// The creation time (in ms since epoch) for the label. - #[serde(rename="createTimeMs")] - pub create_time_ms: Option, - /// Information about the party that created the label. - #[serde(rename="deprecatedMarketplaceDealParty")] - pub deprecated_marketplace_deal_party: Option, - /// The label to use. - pub label: Option, - /// The accountId of the party that created the label. - #[serde(rename="accountId")] - pub account_id: Option, -} - -impl Part for MarketplaceLabel {} - - -/// The filtering reasons. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreativeFilteringReasonsReasons { - /// The number of times the creative was filtered for the status. The count is aggregated across all publishers on the exchange. - #[serde(rename="filteringCount")] - pub filtering_count: Option, - /// The filtering status code. Please refer to the creative-status-codes.txt file for different statuses. - #[serde(rename="filteringStatus")] - pub filtering_status: Option, -} - -impl NestedType for CreativeFilteringReasonsReasons {} -impl Part for CreativeFilteringReasonsReasons {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MoneyDto { - /// no description provided - pub micros: Option, - /// no description provided - #[serde(rename="currencyCode")] - pub currency_code: Option, -} - -impl Part for MoneyDto {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list clientaccess](struct.ClientaccesListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListClientAccessCapabilitiesResponse { - /// no description provided - #[serde(rename="clientAccessPermissions")] - pub client_access_permissions: Option>, -} - -impl ResponseResult for ListClientAccessCapabilitiesResponse {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list negotiations](struct.NegotiationListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetNegotiationsResponse { - /// no description provided - pub kind: Option, - /// no description provided - pub negotiations: Option>, -} - -impl ResponseResult for GetNegotiationsResponse {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WebPropertyDto { - /// no description provided - #[serde(rename="enabledForPreferredDeals")] - pub enabled_for_preferred_deals: Option, - /// no description provided - pub name: Option, - /// no description provided - #[serde(rename="siteUrls")] - pub site_urls: Option>, - /// no description provided - #[serde(rename="syndicationProduct")] - pub syndication_product: Option, - /// no description provided - #[serde(rename="propertyCode")] - pub property_code: Option, - /// no description provided - #[serde(rename="allowInterestTargetedAds")] - pub allow_interest_targeted_ads: Option, - /// no description provided - pub id: Option, -} - -impl Part for WebPropertyDto {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [insert negotiationrounds](struct.NegotiationroundInsertCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NegotiationRoundDto { - /// no description provided - pub kind: Option, - /// The detailed terms proposed in this negotiation round. - pub terms: Option, - /// The number of this negotiation round, in sequence. - #[serde(rename="roundNumber")] - pub round_number: Option, - /// Notes regarding this negotiation round. - pub notes: Option, - /// The role, either buyer or seller, initiating this negotiation round. - #[serde(rename="originatorRole")] - pub originator_role: Option, - /// The ID of the negotiation to which this negotiation round applies. - #[serde(rename="negotiationId")] - pub negotiation_id: Option, - /// The edit history of this negotiation round. - #[serde(rename="editHistory")] - pub edit_history: Option, - /// Stores DBM partner ID for use by DBM - #[serde(rename="dbmPartnerId")] - pub dbm_partner_id: Option, - /// The action performed by this negotiation round. - pub action: Option, -} - -impl RequestValue for NegotiationRoundDto {} -impl ResponseResult for NegotiationRoundDto {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StatsDto { - /// no description provided - pub revenue: Option, - /// no description provided - pub impressions: Option, - /// no description provided - pub requests: Option, - /// no description provided - #[serde(rename="goodBids")] - pub good_bids: Option, - /// no description provided - pub bids: Option, - /// no description provided - pub spend: Option, -} - -impl Part for StatsDto {} - - -/// The configuration data for an Ad Exchange billing info. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get billing info](struct.BillingInfoGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BillingInfo { - /// Resource type. - pub kind: Option, - /// A list of adgroup IDs associated with this particular account. These IDs may show up as part of a realtime bidding BidRequest, which indicates a bid request for this account. - #[serde(rename="billingId")] - pub billing_id: Option>, - /// Account id. - #[serde(rename="accountId")] - pub account_id: Option, - /// Account name. - #[serde(rename="accountName")] - pub account_name: Option, -} - -impl ResponseResult for BillingInfo {} - - /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1931,7 +1414,7 @@ pub struct Seller { /// Optional sub-account id for the seller. #[serde(rename="subAccountId")] pub sub_account_id: Option, - /// The unique id for the seller. The seller fills in this field. The seller account id is then available to buyer in the offer. + /// The unique id for the seller. The seller fills in this field. The seller account id is then available to buyer in the product. #[serde(rename="accountId")] pub account_id: Option, } @@ -1939,359 +1422,6 @@ pub struct Seller { impl Part for Seller {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MarketplaceDealParty { - /// The buyer/seller associated with the deal. One of buyer/seller is specified for a deal-party. - pub buyer: Option, - /// The buyer/seller associated with the deal. One of buyer/seller is specified for a deal party. - pub seller: Option, -} - -impl Part for MarketplaceDealParty {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search marketplaceorders](struct.MarketplaceorderSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetOrdersResponse { - /// The list of matching orders. - pub orders: Option>, -} - -impl ResponseResult for GetOrdersResponse {} - - -/// The configuration data for Ad Exchange RTB - Budget API. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [patch budget](struct.BudgetPatchCall.html) (request|response) -/// * [update budget](struct.BudgetUpdateCall.html) (request|response) -/// * [get budget](struct.BudgetGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Budget { - /// The billing id to determine which adgroup to provide budget information for. This is required for get and update requests. - #[serde(rename="billingId")] - pub billing_id: Option, - /// The kind of the resource, i.e. "adexchangebuyer#budget". - pub kind: Option, - /// The budget amount to apply for the billingId provided. This is required for update requests. - #[serde(rename="budgetAmount")] - pub budget_amount: Option, - /// The currency code for the buyer. This cannot be altered here. - #[serde(rename="currencyCode")] - pub currency_code: Option, - /// The unique id that describes this item. - pub id: Option, - /// The id of the account. This is required for get and update requests. - #[serde(rename="accountId")] - pub account_id: Option, -} - -impl RequestValue for Budget {} -impl ResponseResult for Budget {} - - -/// Requests which allow one of these (width, height) pairs will match. All pairs must be supported ad dimensions. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PretargetingConfigDimensions { - /// Width in pixels. - pub width: Option, - /// Height in pixels. - pub height: Option, -} - -impl NestedType for PretargetingConfigDimensions {} -impl Part for PretargetingConfigDimensions {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get deals](struct.DealGetCall.html) (response) -/// * [insert negotiations](struct.NegotiationInsertCall.html) (request|response) -/// * [get negotiations](struct.NegotiationGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NegotiationDto { - /// The status of this negotiation. - pub status: Option, - /// The buyer party's contact email. - #[serde(rename="buyerEmailContacts")] - pub buyer_email_contacts: Option>, - /// A list of label names applicable to this negotiation. - #[serde(rename="labelNames")] - pub label_names: Option>, - /// The billed buyer; Specified by a buyer buying through an intermediary. - #[serde(rename="billedBuyer")] - pub billed_buyer: Option, - /// no description provided - pub kind: Option, - /// The ID of this negotiation's original offer. - #[serde(rename="offerId")] - pub offer_id: Option, - /// The series of negotiation rounds for this negotiation. - #[serde(rename="negotiationRounds")] - pub negotiation_rounds: Option>, - /// The unique ID of this negotiation. - #[serde(rename="negotiationId")] - pub negotiation_id: Option, - /// The state of this negotiation. - #[serde(rename="negotiationState")] - pub negotiation_state: Option, - /// Details of the buyer party in this negotiation. - pub buyer: Option, - /// The stats for this negotiation. - pub stats: Option, - /// For finalized negotiations, the ID of the finalized deal. - #[serde(rename="externalDealId")] - pub external_deal_id: Option, - /// Details of the seller party in this negotiation. - pub seller: Option, - /// The type of this deal. - #[serde(rename="dealType")] - pub deal_type: Option, - /// The seller party's contact email. - #[serde(rename="sellerEmailContacts")] - pub seller_email_contacts: Option>, -} - -impl RequestValue for NegotiationDto {} -impl ResponseResult for NegotiationDto {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [insert offers](struct.OfferInsertCall.html) (request|response) -/// * [get offers](struct.OfferGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OfferDto { - /// The status of this offer. - pub status: Option, - /// no description provided - pub kind: Option, - /// The list of label names applicable to this offer. - #[serde(rename="labelNames")] - pub label_names: Option>, - /// The point of contact for this offer. - #[serde(rename="pointOfContact")] - pub point_of_contact: Option, - /// Whether this offer is open. - #[serde(rename="isOpen")] - pub is_open: Option, - /// The creator of this offer. - pub creator: Option, - /// The list of buyer or seller parties this offer is closed to. - #[serde(rename="closedToDealParties")] - pub closed_to_deal_parties: Option>, - /// The billed buyer; For buyer initiated offers, buying through an intermediary. - #[serde(rename="billedBuyer")] - pub billed_buyer: Option, - /// The unique ID of this offer. - #[serde(rename="offerId")] - pub offer_id: Option, - /// The list of buyer or seller parties this offer is open to. - #[serde(rename="openToDealParties")] - pub open_to_deal_parties: Option>, - /// The state of this offer. - #[serde(rename="offerState")] - pub offer_state: Option, - /// Whether this offer is anonymous. - pub anonymous: Option, - /// The terms of this offer. - pub terms: Option, - /// The list of email contacts for this offer. - #[serde(rename="emailContacts")] - pub email_contacts: Option>, -} - -impl RequestValue for OfferDto {} -impl ResponseResult for OfferDto {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [update marketplacedeals](struct.MarketplacedealUpdateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EditAllOrderDealsRequest { - /// List of deals to edit. Service may perform 3 different operations based on comparison of deals in this list vs deals already persisted in database: 1. Add new deal to order If a deal in this list does not exist in the order, the service will create a new deal and add it to the order. Validation will follow AddOrderDealsRequest. 2. Update existing deal in the order If a deal in this list already exist in the order, the service will update that existing deal to this new deal in the request. Validation will follow UpdateOrderDealsRequest. 3. Delete deals from the order (just need the id) If a existing deal in the order is not present in this list, the service will delete that deal from the order. Validation will follow DeleteOrderDealsRequest. - pub deals: Option>, - /// The last known revision number for the order. - #[serde(rename="orderRevisionNumber")] - pub order_revision_number: Option, - /// If specified, also updates the order in the batch transaction. This is useful when the order and the deals need to be updated in one transaction. - pub order: Option, - /// Indicates an optional action to take on the order - #[serde(rename="updateAction")] - pub update_action: Option, -} - -impl RequestValue for EditAllOrderDealsRequest {} - - -/// An offer is segment of inventory that a seller wishes to sell. It is associated with certain terms and targeting information which helps buyer know more about the inventory. Each field in an order can have one of the following setting: -/// -/// (readonly) - It is an error to try and set this field. (buyer-readonly) - Only the seller can set this field. (seller-readonly) - Only the buyer can set this field. (updatable) - The field is updatable at all times by either buyer or the seller. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get marketplaceoffers](struct.MarketplaceofferGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MarketplaceOffer { - /// Optional contact information for the creator of this offer. (buyer-readonly) - #[serde(rename="creatorContacts")] - pub creator_contacts: Option>, - /// Targeting that is shared between the buyer and the seller. Each targeting criteria has a specified key and for each key there is a list of inclusion value or exclusion values. (buyer-readonly) - #[serde(rename="sharedTargetings")] - pub shared_targetings: Option>, - /// The negotiable terms of the deal (buyer-readonly) - pub terms: Option, - /// The proposed end time for the deal (ms since epoch) (buyer-readonly) - #[serde(rename="flightEndTimeMs")] - pub flight_end_time_ms: Option, - /// Optional List of labels for the offer (optional, buyer-readonly). - pub labels: Option>, - /// The unique id for the offer (readonly) - #[serde(rename="offerId")] - pub offer_id: Option, - /// Time of last update in ms. since epoch (readonly) - #[serde(rename="lastUpdateTimeMs")] - pub last_update_time_ms: Option, - /// The revision number of the offer. (readonly) - #[serde(rename="revisionNumber")] - pub revision_number: Option, - /// Identifies what kind of resource this is. Value: the fixed string "adexchangebuyer#marketplaceOffer". - pub kind: Option, - /// The name for this offer as set by the seller. (buyer-readonly) - pub name: Option, - /// The syndication product associated with the deal. (readonly, except on create) - #[serde(rename="syndicationProduct")] - pub syndication_product: Option, - /// Information about the seller that created this offer (readonly, except on create) - pub seller: Option, - /// no description provided - #[serde(rename="webPropertyCode")] - pub web_property_code: Option, - /// The state of the offer. (buyer-readonly) - pub state: Option, - /// If the creator has already signed off on the offer, then the buyer can finalize the deal by accepting the offer as is. When copying to an order, if any of the terms are changed, then auto_finalize is automatically set to false. - #[serde(rename="hasCreatorSignedOff")] - pub has_creator_signed_off: Option, - /// Inventory availability dates. (times are in ms since epoch) The granularity is generally in the order of seconds. (buyer-readonly) - #[serde(rename="flightStartTimeMs")] - pub flight_start_time_ms: Option, - /// Creation time in ms. since epoch (readonly) - #[serde(rename="creationTimeMs")] - pub creation_time_ms: Option, -} - -impl Resource for MarketplaceOffer {} -impl ResponseResult for MarketplaceOffer {} - - -/// An order can contain multiple deals. A deal contains the terms and targeting information that is used for serving. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MarketplaceDeal { - /// The set of fields around delivery control that are interesting for a buyer to see but are non-negotiable. These are set by the publisher. This message is assigned an id of 100 since some day we would want to model this as a protobuf extension. - #[serde(rename="deliveryControl")] - pub delivery_control: Option, - /// no description provided - #[serde(rename="orderId")] - pub order_id: Option, - /// The negotiable terms of the deal. (updatable) - pub terms: Option, - /// Proposed flight end time of the deal (ms since epoch) This will generally be stored in a granularity of a second. (updatable) - #[serde(rename="flightEndTimeMs")] - pub flight_end_time_ms: Option, - /// The shared targeting visible to buyers and sellers. (updatable) - #[serde(rename="sharedTargetings")] - pub shared_targetings: Option>, - /// The offer-id from which this deal was created. (readonly, except on create) - #[serde(rename="offerId")] - pub offer_id: Option, - /// A unique deal=id for the deal (readonly). - #[serde(rename="dealId")] - pub deal_id: Option, - /// Optional Seller contact information for the deal (buyer-readonly) - #[serde(rename="sellerContacts")] - pub seller_contacts: Option>, - /// The revision number of the offer that the deal was created from (readonly, except on create) - #[serde(rename="offerRevisionNumber")] - pub offer_revision_number: Option, - /// The external deal id assigned to this deal once the deal is finalized. This is the deal-id that shows up in serving/reporting etc. (readonly) - #[serde(rename="externalDealId")] - pub external_deal_id: Option, - /// The time (ms since epoch) when the deal was last updated. (readonly) - #[serde(rename="lastUpdateTimeMs")] - pub last_update_time_ms: Option, - /// Identifies what kind of resource this is. Value: the fixed string "adexchangebuyer#marketplaceDeal". - pub kind: Option, - /// The name of the deal. (updatable) - pub name: Option, - /// Buyer private data (hidden from seller). - #[serde(rename="buyerPrivateData")] - pub buyer_private_data: Option, - /// The syndication product associated with the deal. (readonly, except on create) - #[serde(rename="syndicationProduct")] - pub syndication_product: Option, - /// no description provided - #[serde(rename="webPropertyCode")] - pub web_property_code: Option, - /// Proposed flight start time of the deal (ms since epoch) This will generally be stored in a granularity of a second. (updatable) - #[serde(rename="flightStartTimeMs")] - pub flight_start_time_ms: Option, - /// The time (ms since epoch) of the deal creation. (readonly) - #[serde(rename="creationTimeMs")] - pub creation_time_ms: Option, - /// Description for the deal terms. (updatable) - #[serde(rename="inventoryDescription")] - pub inventory_description: Option, -} - -impl Part for MarketplaceDeal {} - - /// There is no detailed description. /// /// # Activities @@ -2321,6 +1451,9 @@ pub struct PretargetingConfig { /// Requests containing any of these mobile operating system version ids will match. Values are from mobile-os.csv in the downloadable files section. #[serde(rename="mobileOperatingSystemVersions")] pub mobile_operating_system_versions: Option>, + /// Video requests satisfying any of these player size constraints will match. + #[serde(rename="videoPlayerSizes")] + pub video_player_sizes: Option>, /// The config id; generated automatically. Leave this field blank for insert requests. #[serde(rename="configId")] pub config_id: Option, @@ -2382,15 +1515,15 @@ impl ResponseResult for PretargetingConfig {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [insert marketplaceorders](struct.MarketplaceorderInsertCall.html) (request) +/// * [insert proposals](struct.ProposalInsertCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreateOrdersRequest { /// no description provided #[serde(rename="webPropertyCode")] pub web_property_code: Option, - /// The list of orders to create. - pub orders: Option>, + /// The list of proposals to create. + pub proposals: Option>, } impl RequestValue for CreateOrdersRequest {} @@ -2406,6 +1539,9 @@ pub struct DeliveryControl { #[serde(rename="frequencyCaps")] pub frequency_caps: Option>, /// no description provided + #[serde(rename="creativeBlockingLevel")] + pub creative_blocking_level: Option, + /// no description provided #[serde(rename="deliveryRateType")] pub delivery_rate_type: Option, } @@ -2415,20 +1551,42 @@ impl Part for DeliveryControl {} /// There is no detailed description. /// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete marketplacedeals](struct.MarketplacedealDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeleteOrderDealsResponse { + /// List of deals deleted (in the same proposal as passed in the request) + pub deals: Option>, + /// The updated revision number for the proposal. + #[serde(rename="proposalRevisionNumber")] + pub proposal_revision_number: Option, +} + +impl ResponseResult for DeleteOrderDealsResponse {} + + +/// Requests which allow one of these (width, height) pairs will match. All pairs must be supported ad dimensions. +/// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AdSize { - /// no description provided - pub width: Option, - /// no description provided - pub height: Option, +pub struct PretargetingConfigDimensions { + /// Width in pixels. + pub width: Option, + /// Height in pixels. + pub height: Option, } -impl Part for AdSize {} +impl NestedType for PretargetingConfigDimensions {} +impl Part for PretargetingConfigDimensions {} -/// Used to specify pricing rules for buyers/advertisers. Each PricePerBuyer in an offer can become [0,1] deals. To check if there is a PricePerBuyer for a particular buyer or buyer/advertiser pair, we look for the most specific matching rule - we first look for a rule matching the buyer and advertiser, next a rule with the buyer but an empty advertiser list, and otherwise look for a matching rule where no buyer is set. +/// Used to specify pricing rules for buyers/advertisers. Each PricePerBuyer in an product can become [0,1] deals. To check if there is a PricePerBuyer for a particular buyer or buyer/advertiser pair, we look for the most specific matching rule - we first look for a rule matching the buyer and advertiser, next a rule with the buyer but an empty advertiser list, and otherwise look for a matching rule where no buyer is set. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -2443,6 +1601,24 @@ pub struct PricePerBuyer { impl Part for PricePerBuyer {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert proposals](struct.ProposalInsertCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateOrdersResponse { + /// The list of proposals successfully created. + pub proposals: Option>, +} + +impl ResponseResult for CreateOrdersResponse {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -2475,7 +1651,7 @@ pub struct DealTermsGuaranteedFixedPriceTerms { /// Fixed price for the specified buyer. #[serde(rename="fixedPrices")] pub fixed_prices: Option>, - /// Count of guaranteed looks. Required for deal, optional for offer. + /// Count of guaranteed looks. Required for deal, optional for product. #[serde(rename="guaranteedLooks")] pub guaranteed_looks: Option, } @@ -2483,43 +1659,38 @@ pub struct DealTermsGuaranteedFixedPriceTerms { impl Part for DealTermsGuaranteedFixedPriceTerms {} -/// There is no detailed description. +/// A large image. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EditHistoryDto { +pub struct CreativeNativeAdImage { /// no description provided - #[serde(rename="createdTimeStamp")] - pub created_time_stamp: Option, + pub url: Option, /// no description provided - #[serde(rename="createdByLoginName")] - pub created_by_login_name: Option, + pub width: Option, /// no description provided - #[serde(rename="lastUpdatedByLoginName")] - pub last_updated_by_login_name: Option, - /// no description provided - #[serde(rename="lastUpdateTimeStamp")] - pub last_update_time_stamp: Option, + pub height: Option, } -impl Part for EditHistoryDto {} +impl NestedType for CreativeNativeAdImage {} +impl Part for CreativeNativeAdImage {} -/// There is no detailed description. +/// The reasons for disapproval within this restriction, if any. Note that not all disapproval reasons may be categorized, so it is possible for the creative to have a status of DISAPPROVED or CONDITIONALLY_APPROVED with an empty list for disapproval_reasons. In this case, please reach out to your TAM to help debug the issue. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RuleKeyValuePair { - /// no description provided - #[serde(rename="keyName")] - pub key_name: Option, - /// no description provided - pub value: Option, +pub struct CreativeServingRestrictionsDisapprovalReasons { + /// The categorized reason for disapproval. + pub reason: Option, + /// Additional details about the reason for disapproval. + pub details: Option>, } -impl Part for RuleKeyValuePair {} +impl NestedType for CreativeServingRestrictionsDisapprovalReasons {} +impl Part for CreativeServingRestrictionsDisapprovalReasons {} /// If nativeAd is set, HTMLSnippet and videoURL should not be set. @@ -2563,41 +1734,39 @@ impl NestedType for CreativeNativeAd {} impl Part for CreativeNativeAd {} -/// There is no detailed description. +/// Shows any corrections that were applied to this creative. Read-only. This field should not be set in requests. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get deals](struct.DealGetCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct GetFinalizedNegotiationByExternalDealIdRequest { - /// no description provided - #[serde(rename="includePrivateAuctions")] - pub include_private_auctions: Option, +pub struct CreativeCorrections { + /// The type of correction that was applied to the creative. + pub reason: Option, + /// Additional details about the correction. + pub details: Option>, } -impl RequestValue for GetFinalizedNegotiationByExternalDealIdRequest {} +impl NestedType for CreativeCorrections {} +impl Part for CreativeCorrections {} /// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [insert marketplacenotes](struct.MarketplacenoteInsertCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddOrderNotesResponse { - /// no description provided - pub notes: Option>, +pub struct TargetingValueCreativeSize { + /// The Creative size type. + #[serde(rename="creativeSizeType")] + pub creative_size_type: Option, + /// For video size type, the list of companion sizes. + #[serde(rename="companionSizes")] + pub companion_sizes: Option>, + /// For regular or video creative size type, specifies the size of the creative. + pub size: Option, } -impl ResponseResult for AddOrderNotesResponse {} +impl Part for TargetingValueCreativeSize {} /// There is no detailed description. @@ -2613,10 +1782,10 @@ impl ResponseResult for AddOrderNotesResponse {} pub struct AddOrderDealsRequest { /// The list of deals to add pub deals: Option>, - /// The last known order revision number. - #[serde(rename="orderRevisionNumber")] - pub order_revision_number: Option, - /// Indicates an optional action to take on the order + /// The last known proposal revision number. + #[serde(rename="proposalRevisionNumber")] + pub proposal_revision_number: Option, + /// Indicates an optional action to take on the proposal #[serde(rename="updateAction")] pub update_action: Option, } @@ -2624,20 +1793,58 @@ pub struct AddOrderDealsRequest { impl RequestValue for AddOrderDealsRequest {} -/// The reasons for disapproval within this restriction, if any. Note that not all disapproval reasons may be categorized, so it is possible for the creative to have a status of DISAPPROVED or CONDITIONALLY_APPROVED with an empty list for disapproval_reasons. In this case, please reach out to your TAM to help debug the issue. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreativeServingRestrictionsDisapprovalReasons { - /// The categorized reason for disapproval. - pub reason: Option, - /// Additional details about the reason for disapproval. - pub details: Option>, +pub struct TargetingValue { + /// The daypart targeting to include / exclude. Filled in when the key is GOOG_DAYPART_TARGETING. + #[serde(rename="dayPartTargetingValue")] + pub day_part_targeting_value: Option, + /// The long value to exclude/include. + #[serde(rename="longValue")] + pub long_value: Option, + /// The creative size value to exclude/include. + #[serde(rename="creativeSizeValue")] + pub creative_size_value: Option, + /// The string value to exclude/include. + #[serde(rename="stringValue")] + pub string_value: Option, } -impl NestedType for CreativeServingRestrictionsDisapprovalReasons {} -impl Part for CreativeServingRestrictionsDisapprovalReasons {} +impl Part for TargetingValue {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DealTerms { + /// Description for the proposed terms of the deal. + pub description: Option, + /// Non-binding estimate of the estimated gross spend for this deal Can be set by buyer or seller. + #[serde(rename="estimatedGrossSpend")] + pub estimated_gross_spend: Option, + /// The terms for guaranteed fixed price deals. + #[serde(rename="guaranteedFixedPriceTerms")] + pub guaranteed_fixed_price_terms: Option, + /// Non-binding estimate of the impressions served per day Can be set by buyer or seller. + #[serde(rename="estimatedImpressionsPerDay")] + pub estimated_impressions_per_day: Option, + /// Visibilty of the URL in bid requests. + #[serde(rename="brandingType")] + pub branding_type: Option, + /// The terms for non-guaranteed auction deals. + #[serde(rename="nonGuaranteedAuctionTerms")] + pub non_guaranteed_auction_terms: Option, + /// The terms for non-guaranteed fixed price deals. + #[serde(rename="nonGuaranteedFixedPriceTerms")] + pub non_guaranteed_fixed_price_terms: Option, +} + +impl Part for DealTerms {} @@ -2755,17 +1962,17 @@ impl<'a, C, A> MarketplacedealMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Delete the specified deals from the order + /// Delete the specified deals from the proposal /// /// # Arguments /// /// * `request` - No description provided. - /// * `orderId` - The orderId to delete deals from. - pub fn delete(&self, request: DeleteOrderDealsRequest, order_id: &str) -> MarketplacedealDeleteCall<'a, C, A> { + /// * `proposalId` - The proposalId to delete deals from. + pub fn delete(&self, request: DeleteOrderDealsRequest, proposal_id: &str) -> MarketplacedealDeleteCall<'a, C, A> { MarketplacedealDeleteCall { hub: self.hub, _request: request, - _order_id: order_id.to_string(), + _proposal_id: proposal_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2774,17 +1981,17 @@ impl<'a, C, A> MarketplacedealMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Add new deals for the specified order + /// Add new deals for the specified proposal /// /// # Arguments /// /// * `request` - No description provided. - /// * `orderId` - OrderId for which deals need to be added. - pub fn insert(&self, request: AddOrderDealsRequest, order_id: &str) -> MarketplacedealInsertCall<'a, C, A> { + /// * `proposalId` - proposalId for which deals need to be added. + pub fn insert(&self, request: AddOrderDealsRequest, proposal_id: &str) -> MarketplacedealInsertCall<'a, C, A> { MarketplacedealInsertCall { hub: self.hub, _request: request, - _order_id: order_id.to_string(), + _proposal_id: proposal_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2793,17 +2000,17 @@ impl<'a, C, A> MarketplacedealMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Replaces all the deals in the order with the passed in deals + /// Replaces all the deals in the proposal with the passed in deals /// /// # Arguments /// /// * `request` - No description provided. - /// * `orderId` - The orderId to edit deals on. - pub fn update(&self, request: EditAllOrderDealsRequest, order_id: &str) -> MarketplacedealUpdateCall<'a, C, A> { + /// * `proposalId` - The proposalId to edit deals on. + pub fn update(&self, request: EditAllOrderDealsRequest, proposal_id: &str) -> MarketplacedealUpdateCall<'a, C, A> { MarketplacedealUpdateCall { hub: self.hub, _request: request, - _order_id: order_id.to_string(), + _proposal_id: proposal_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2812,15 +2019,15 @@ impl<'a, C, A> MarketplacedealMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// List all the deals for a given order + /// List all the deals for a given proposal /// /// # Arguments /// - /// * `orderId` - The orderId to get deals for. - pub fn list(&self, order_id: &str) -> MarketplacedealListCall<'a, C, A> { + /// * `proposalId` - The proposalId to get deals for. + pub fn list(&self, proposal_id: &str) -> MarketplacedealListCall<'a, C, A> { MarketplacedealListCall { hub: self.hub, - _order_id: order_id.to_string(), + _proposal_id: proposal_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2830,7 +2037,7 @@ impl<'a, C, A> MarketplacedealMethods<'a, C, A> { -/// A builder providing access to all methods supported on *marketplaceoffer* resources. +/// A builder providing access to all methods supported on *proposal* resources. /// It is not used directly, but through the `AdExchangeBuyer` hub. /// /// # Example @@ -2853,43 +2060,26 @@ impl<'a, C, A> MarketplacedealMethods<'a, C, A> { /// ::default(), None); /// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)` and `search(...)` +/// // like `get(...)`, `insert(...)`, `patch(...)`, `search(...)` and `update(...)` /// // to build up your call. -/// let rb = hub.marketplaceoffers(); +/// let rb = hub.proposals(); /// # } /// ``` -pub struct MarketplaceofferMethods<'a, C, A> +pub struct ProposalMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyer, } -impl<'a, C, A> MethodsBuilder for MarketplaceofferMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for ProposalMethods<'a, C, A> {} -impl<'a, C, A> MarketplaceofferMethods<'a, C, A> { +impl<'a, C, A> ProposalMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the requested negotiation. - /// - /// # Arguments - /// - /// * `offerId` - The offerId for the offer to get the head revision for. - pub fn get(&self, offer_id: &str) -> MarketplaceofferGetCall<'a, C, A> { - MarketplaceofferGetCall { - hub: self.hub, - _offer_id: offer_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the requested negotiation. - pub fn search(&self) -> MarketplaceofferSearchCall<'a, C, A> { - MarketplaceofferSearchCall { + /// Search for proposals using pql query + pub fn search(&self) -> ProposalSearchCall<'a, C, A> { + ProposalSearchCall { hub: self.hub, _pql_query: Default::default(), _delegate: Default::default(), @@ -2897,229 +2087,16 @@ impl<'a, C, A> MarketplaceofferMethods<'a, C, A> { _additional_params: Default::default(), } } -} - - - -/// A builder providing access to all methods supported on *creative* resources. -/// It is not used directly, but through the `AdExchangeBuyer` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)`, `insert(...)` and `list(...)` -/// // to build up your call. -/// let rb = hub.creatives(); -/// # } -/// ``` -pub struct CreativeMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, -} - -impl<'a, C, A> MethodsBuilder for CreativeMethods<'a, C, A> {} - -impl<'a, C, A> CreativeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission. - pub fn list(&self) -> CreativeListCall<'a, C, A> { - CreativeListCall { - hub: self.hub, - _page_token: Default::default(), - _open_auction_status_filter: Default::default(), - _max_results: Default::default(), - _deals_status_filter: Default::default(), - _buyer_creative_id: Default::default(), - _account_id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the status for a single creative. A creative will be available 30-40 minutes after submission. - /// - /// # Arguments - /// - /// * `accountId` - The id for the account that will serve this creative. - /// * `buyerCreativeId` - The buyer-specific id for this creative. - pub fn get(&self, account_id: i32, buyer_creative_id: &str) -> CreativeGetCall<'a, C, A> { - CreativeGetCall { - hub: self.hub, - _account_id: account_id, - _buyer_creative_id: buyer_creative_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Submit a new creative. + /// Create the given list of proposals /// /// # Arguments /// /// * `request` - No description provided. - pub fn insert(&self, request: Creative) -> CreativeInsertCall<'a, C, A> { - CreativeInsertCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *deal* resources. -/// It is not used directly, but through the `AdExchangeBuyer` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)` -/// // to build up your call. -/// let rb = hub.deals(); -/// # } -/// ``` -pub struct DealMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, -} - -impl<'a, C, A> MethodsBuilder for DealMethods<'a, C, A> {} - -impl<'a, C, A> DealMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Gets the requested deal. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `dealId` - No description provided. - pub fn get(&self, request: GetFinalizedNegotiationByExternalDealIdRequest, deal_id: &str) -> DealGetCall<'a, C, A> { - DealGetCall { - hub: self.hub, - _request: request, - _deal_id: deal_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *offer* resources. -/// It is not used directly, but through the `AdExchangeBuyer` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)`, `insert(...)` and `list(...)` -/// // to build up your call. -/// let rb = hub.offers(); -/// # } -/// ``` -pub struct OfferMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, -} - -impl<'a, C, A> MethodsBuilder for OfferMethods<'a, C, A> {} - -impl<'a, C, A> OfferMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Gets the requested offer. - /// - /// # Arguments - /// - /// * `offerId` - No description provided. - pub fn get(&self, offer_id: &str) -> OfferGetCall<'a, C, A> { - OfferGetCall { - hub: self.hub, - _offer_id: offer_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists all offers the authenticated user has access to. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn list(&self, request: ListOffersRequest) -> OfferListCall<'a, C, A> { - OfferListCall { + pub fn insert(&self, request: CreateOrdersRequest) -> ProposalInsertCall<'a, C, A> { + ProposalInsertCall { hub: self.hub, _request: request, _delegate: Default::default(), @@ -3130,214 +2107,21 @@ impl<'a, C, A> OfferMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates or updates the requested offer. + /// Update the given proposal /// /// # Arguments /// /// * `request` - No description provided. - pub fn insert(&self, request: OfferDto) -> OfferInsertCall<'a, C, A> { - OfferInsertCall { + /// * `proposalId` - The proposal id to update. + /// * `revisionNumber` - The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the latest proposal at head revision and retry the update at that revision. + /// * `updateAction` - The proposed action to take on the proposal. + pub fn update(&self, request: Proposal, proposal_id: &str, revision_number: &str, update_action: &str) -> ProposalUpdateCall<'a, C, A> { + ProposalUpdateCall { hub: self.hub, _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *clientacces* resources. -/// It is not used directly, but through the `AdExchangeBuyer` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.clientaccess(); -/// # } -/// ``` -pub struct ClientaccesMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, -} - -impl<'a, C, A> MethodsBuilder for ClientaccesMethods<'a, C, A> {} - -impl<'a, C, A> ClientaccesMethods<'a, C, A> { - - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn insert(&self, request: ClientAccessCapabilities) -> ClientaccesInsertCall<'a, C, A> { - ClientaccesInsertCall { - hub: self.hub, - _request: request, - _sponsor_account_id: Default::default(), - _client_account_id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn list(&self, request: ListClientAccessCapabilitiesRequest) -> ClientaccesListCall<'a, C, A> { - ClientaccesListCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// - /// # Arguments - /// - /// * `clientAccountId` - No description provided. - /// * `sponsorAccountId` - No description provided. - pub fn get(&self, client_account_id: &str, sponsor_account_id: i32) -> ClientaccesGetCall<'a, C, A> { - ClientaccesGetCall { - hub: self.hub, - _client_account_id: client_account_id.to_string(), - _sponsor_account_id: sponsor_account_id, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `clientAccountId` - No description provided. - /// * `sponsorAccountId` - No description provided. - pub fn patch(&self, request: ClientAccessCapabilities, client_account_id: &str, sponsor_account_id: i32) -> ClientaccesPatchCall<'a, C, A> { - ClientaccesPatchCall { - hub: self.hub, - _request: request, - _client_account_id: client_account_id.to_string(), - _sponsor_account_id: sponsor_account_id, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// - /// # Arguments - /// - /// * `clientAccountId` - No description provided. - /// * `sponsorAccountId` - No description provided. - pub fn delete(&self, client_account_id: &str, sponsor_account_id: i32) -> ClientaccesDeleteCall<'a, C, A> { - ClientaccesDeleteCall { - hub: self.hub, - _client_account_id: client_account_id.to_string(), - _sponsor_account_id: sponsor_account_id, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `clientAccountId` - No description provided. - /// * `sponsorAccountId` - No description provided. - pub fn update(&self, request: ClientAccessCapabilities, client_account_id: &str, sponsor_account_id: i32) -> ClientaccesUpdateCall<'a, C, A> { - ClientaccesUpdateCall { - hub: self.hub, - _request: request, - _client_account_id: client_account_id.to_string(), - _sponsor_account_id: sponsor_account_id, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *account* resources. -/// It is not used directly, but through the `AdExchangeBuyer` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.accounts(); -/// # } -/// ``` -pub struct AccountMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, -} - -impl<'a, C, A> MethodsBuilder for AccountMethods<'a, C, A> {} - -impl<'a, C, A> AccountMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Updates an existing account. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `id` - The account id - pub fn patch(&self, request: Account, id: i32) -> AccountPatchCall<'a, C, A> { - AccountPatchCall { - hub: self.hub, - _request: request, - _id: id, + _proposal_id: proposal_id.to_string(), + _revision_number: revision_number.to_string(), + _update_action: update_action.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3346,110 +2130,38 @@ impl<'a, C, A> AccountMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the authenticated user's list of accounts. - pub fn list(&self) -> AccountListCall<'a, C, A> { - AccountListCall { - hub: self.hub, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets one account by ID. - /// - /// # Arguments - /// - /// * `id` - The account id - pub fn get(&self, id: i32) -> AccountGetCall<'a, C, A> { - AccountGetCall { - hub: self.hub, - _id: id, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates an existing account. + /// Update the given proposal. This method supports patch semantics. /// /// # Arguments /// /// * `request` - No description provided. - /// * `id` - The account id - pub fn update(&self, request: Account, id: i32) -> AccountUpdateCall<'a, C, A> { - AccountUpdateCall { + /// * `proposalId` - The proposal id to update. + /// * `revisionNumber` - The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the latest proposal at head revision and retry the update at that revision. + /// * `updateAction` - The proposed action to take on the proposal. + pub fn patch(&self, request: Proposal, proposal_id: &str, revision_number: &str, update_action: &str) -> ProposalPatchCall<'a, C, A> { + ProposalPatchCall { hub: self.hub, _request: request, - _id: id, + _proposal_id: proposal_id.to_string(), + _revision_number: revision_number.to_string(), + _update_action: update_action.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } -} - - - -/// A builder providing access to all methods supported on *performanceReport* resources. -/// It is not used directly, but through the `AdExchangeBuyer` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `list(...)` -/// // to build up your call. -/// let rb = hub.performance_report(); -/// # } -/// ``` -pub struct PerformanceReportMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, -} - -impl<'a, C, A> MethodsBuilder for PerformanceReportMethods<'a, C, A> {} - -impl<'a, C, A> PerformanceReportMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the authenticated user's list of performance metrics. + /// Get a proposal given its id /// /// # Arguments /// - /// * `accountId` - The account id to get the reports. - /// * `endDateTime` - The end time of the report in ISO 8601 timestamp format using UTC. - /// * `startDateTime` - The start time of the report in ISO 8601 timestamp format using UTC. - pub fn list(&self, account_id: &str, end_date_time: &str, start_date_time: &str) -> PerformanceReportListCall<'a, C, A> { - PerformanceReportListCall { + /// * `proposalId` - Id of the proposal to retrieve. + pub fn get(&self, proposal_id: &str) -> ProposalGetCall<'a, C, A> { + ProposalGetCall { hub: self.hub, - _account_id: account_id.to_string(), - _end_date_time: end_date_time.to_string(), - _start_date_time: start_date_time.to_string(), - _page_token: Default::default(), - _max_results: Default::default(), + _proposal_id: proposal_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3561,6 +2273,278 @@ impl<'a, C, A> BudgetMethods<'a, C, A> { +/// A builder providing access to all methods supported on *creative* resources. +/// It is not used directly, but through the `AdExchangeBuyer` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `add_deal(...)`, `get(...)`, `insert(...)`, `list(...)` and `remove_deal(...)` +/// // to build up your call. +/// let rb = hub.creatives(); +/// # } +/// ``` +pub struct CreativeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, +} + +impl<'a, C, A> MethodsBuilder for CreativeMethods<'a, C, A> {} + +impl<'a, C, A> CreativeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission. + pub fn list(&self) -> CreativeListCall<'a, C, A> { + CreativeListCall { + hub: self.hub, + _page_token: Default::default(), + _open_auction_status_filter: Default::default(), + _max_results: Default::default(), + _deals_status_filter: Default::default(), + _buyer_creative_id: Default::default(), + _account_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Remove a deal id associated with the creative. + /// + /// # Arguments + /// + /// * `accountId` - The id for the account that will serve this creative. + /// * `buyerCreativeId` - The buyer-specific id for this creative. + /// * `dealId` - The id of the deal id to disassociate with this creative. + pub fn remove_deal(&self, account_id: i32, buyer_creative_id: &str, deal_id: &str) -> CreativeRemoveDealCall<'a, C, A> { + CreativeRemoveDealCall { + hub: self.hub, + _account_id: account_id, + _buyer_creative_id: buyer_creative_id.to_string(), + _deal_id: deal_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Add a deal id association for the creative. + /// + /// # Arguments + /// + /// * `accountId` - The id for the account that will serve this creative. + /// * `buyerCreativeId` - The buyer-specific id for this creative. + /// * `dealId` - The id of the deal id to associate with this creative. + pub fn add_deal(&self, account_id: i32, buyer_creative_id: &str, deal_id: &str) -> CreativeAddDealCall<'a, C, A> { + CreativeAddDealCall { + hub: self.hub, + _account_id: account_id, + _buyer_creative_id: buyer_creative_id.to_string(), + _deal_id: deal_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the status for a single creative. A creative will be available 30-40 minutes after submission. + /// + /// # Arguments + /// + /// * `accountId` - The id for the account that will serve this creative. + /// * `buyerCreativeId` - The buyer-specific id for this creative. + pub fn get(&self, account_id: i32, buyer_creative_id: &str) -> CreativeGetCall<'a, C, A> { + CreativeGetCall { + hub: self.hub, + _account_id: account_id, + _buyer_creative_id: buyer_creative_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Submit a new creative. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn insert(&self, request: Creative) -> CreativeInsertCall<'a, C, A> { + CreativeInsertCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *product* resources. +/// It is not used directly, but through the `AdExchangeBuyer` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `search(...)` +/// // to build up your call. +/// let rb = hub.products(); +/// # } +/// ``` +pub struct ProductMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, +} + +impl<'a, C, A> MethodsBuilder for ProductMethods<'a, C, A> {} + +impl<'a, C, A> ProductMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets the requested product. + pub fn search(&self) -> ProductSearchCall<'a, C, A> { + ProductSearchCall { + hub: self.hub, + _pql_query: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the requested product by id. + /// + /// # Arguments + /// + /// * `productId` - The id for the product to get the head revision for. + pub fn get(&self, product_id: &str) -> ProductGetCall<'a, C, A> { + ProductGetCall { + hub: self.hub, + _product_id: product_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *performanceReport* resources. +/// It is not used directly, but through the `AdExchangeBuyer` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.performance_report(); +/// # } +/// ``` +pub struct PerformanceReportMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, +} + +impl<'a, C, A> MethodsBuilder for PerformanceReportMethods<'a, C, A> {} + +impl<'a, C, A> PerformanceReportMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the authenticated user's list of performance metrics. + /// + /// # Arguments + /// + /// * `accountId` - The account id to get the reports. + /// * `endDateTime` - The end time of the report in ISO 8601 timestamp format using UTC. + /// * `startDateTime` - The start time of the report in ISO 8601 timestamp format using UTC. + pub fn list(&self, account_id: &str, end_date_time: &str, start_date_time: &str) -> PerformanceReportListCall<'a, C, A> { + PerformanceReportListCall { + hub: self.hub, + _account_id: account_id.to_string(), + _end_date_time: end_date_time.to_string(), + _start_date_time: start_date_time.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *marketplacenote* resources. /// It is not used directly, but through the `AdExchangeBuyer` hub. /// @@ -3601,15 +2585,15 @@ impl<'a, C, A> MarketplacenoteMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Get all the notes associated with an order + /// Get all the notes associated with a proposal /// /// # Arguments /// - /// * `orderId` - The orderId to get notes for. - pub fn list(&self, order_id: &str) -> MarketplacenoteListCall<'a, C, A> { + /// * `proposalId` - The proposalId to get notes for. + pub fn list(&self, proposal_id: &str) -> MarketplacenoteListCall<'a, C, A> { MarketplacenoteListCall { hub: self.hub, - _order_id: order_id.to_string(), + _proposal_id: proposal_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3618,17 +2602,125 @@ impl<'a, C, A> MarketplacenoteMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Add notes to the order + /// Add notes to the proposal /// /// # Arguments /// /// * `request` - No description provided. - /// * `orderId` - The orderId to add notes for. - pub fn insert(&self, request: AddOrderNotesRequest, order_id: &str) -> MarketplacenoteInsertCall<'a, C, A> { + /// * `proposalId` - The proposalId to add notes for. + pub fn insert(&self, request: AddOrderNotesRequest, proposal_id: &str) -> MarketplacenoteInsertCall<'a, C, A> { MarketplacenoteInsertCall { hub: self.hub, _request: request, - _order_id: order_id.to_string(), + _proposal_id: proposal_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *account* resources. +/// It is not used directly, but through the `AdExchangeBuyer` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.accounts(); +/// # } +/// ``` +pub struct AccountMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, +} + +impl<'a, C, A> MethodsBuilder for AccountMethods<'a, C, A> {} + +impl<'a, C, A> AccountMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `id` - The account id + pub fn patch(&self, request: Account, id: i32) -> AccountPatchCall<'a, C, A> { + AccountPatchCall { + hub: self.hub, + _request: request, + _id: id, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the authenticated user's list of accounts. + pub fn list(&self) -> AccountListCall<'a, C, A> { + AccountListCall { + hub: self.hub, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one account by ID. + /// + /// # Arguments + /// + /// * `id` - The account id + pub fn get(&self, id: i32) -> AccountGetCall<'a, C, A> { + AccountGetCall { + hub: self.hub, + _id: id, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `id` - The account id + pub fn update(&self, request: Account, id: i32) -> AccountUpdateCall<'a, C, A> { + AccountUpdateCall { + hub: self.hub, + _request: request, + _id: id, _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3752,25 +2844,6 @@ impl<'a, C, A> PretargetingConfigMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Gets a specific pretargeting configuration - /// - /// # Arguments - /// - /// * `accountId` - The account id to get the pretargeting config for. - /// * `configId` - The specific id of the configuration to retrieve. - pub fn get(&self, account_id: &str, config_id: &str) -> PretargetingConfigGetCall<'a, C, A> { - PretargetingConfigGetCall { - hub: self.hub, - _account_id: account_id.to_string(), - _config_id: config_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Updates an existing pretargeting config. This method supports patch semantics. @@ -3791,289 +2864,20 @@ impl<'a, C, A> PretargetingConfigMethods<'a, C, A> { _additional_params: Default::default(), } } -} - - - -/// A builder providing access to all methods supported on *negotiationround* resources. -/// It is not used directly, but through the `AdExchangeBuyer` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `insert(...)` -/// // to build up your call. -/// let rb = hub.negotiationrounds(); -/// # } -/// ``` -pub struct NegotiationroundMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, -} - -impl<'a, C, A> MethodsBuilder for NegotiationroundMethods<'a, C, A> {} - -impl<'a, C, A> NegotiationroundMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Adds the requested negotiationRound to the requested negotiation. + /// Gets a specific pretargeting configuration /// /// # Arguments /// - /// * `request` - No description provided. - /// * `negotiationId` - No description provided. - pub fn insert(&self, request: NegotiationRoundDto, negotiation_id: &str) -> NegotiationroundInsertCall<'a, C, A> { - NegotiationroundInsertCall { + /// * `accountId` - The account id to get the pretargeting config for. + /// * `configId` - The specific id of the configuration to retrieve. + pub fn get(&self, account_id: &str, config_id: &str) -> PretargetingConfigGetCall<'a, C, A> { + PretargetingConfigGetCall { hub: self.hub, - _request: request, - _negotiation_id: negotiation_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *negotiation* resources. -/// It is not used directly, but through the `AdExchangeBuyer` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)`, `insert(...)` and `list(...)` -/// // to build up your call. -/// let rb = hub.negotiations(); -/// # } -/// ``` -pub struct NegotiationMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, -} - -impl<'a, C, A> MethodsBuilder for NegotiationMethods<'a, C, A> {} - -impl<'a, C, A> NegotiationMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Lists all negotiations the authenticated user has access to. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn list(&self, request: GetNegotiationsRequest) -> NegotiationListCall<'a, C, A> { - NegotiationListCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets the requested negotiation. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `negotiationId` - No description provided. - pub fn get(&self, request: GetNegotiationByIdRequest, negotiation_id: &str) -> NegotiationGetCall<'a, C, A> { - NegotiationGetCall { - hub: self.hub, - _request: request, - _negotiation_id: negotiation_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates or updates the requested negotiation. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn insert(&self, request: NegotiationDto) -> NegotiationInsertCall<'a, C, A> { - NegotiationInsertCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *marketplaceorder* resources. -/// It is not used directly, but through the `AdExchangeBuyer` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = AdExchangeBuyer::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)`, `insert(...)`, `patch(...)`, `search(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.marketplaceorders(); -/// # } -/// ``` -pub struct MarketplaceorderMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, -} - -impl<'a, C, A> MethodsBuilder for MarketplaceorderMethods<'a, C, A> {} - -impl<'a, C, A> MarketplaceorderMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Update the given order. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `orderId` - The order id to update. - /// * `revisionNumber` - The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the lastest order at head revision and retry the update at that revision. - /// * `updateAction` - The proposed action to take on the order. - pub fn patch(&self, request: MarketplaceOrder, order_id: &str, revision_number: &str, update_action: &str) -> MarketplaceorderPatchCall<'a, C, A> { - MarketplaceorderPatchCall { - hub: self.hub, - _request: request, - _order_id: order_id.to_string(), - _revision_number: revision_number.to_string(), - _update_action: update_action.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Search for orders using pql query - pub fn search(&self) -> MarketplaceorderSearchCall<'a, C, A> { - MarketplaceorderSearchCall { - hub: self.hub, - _pql_query: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Update the given order - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `orderId` - The order id to update. - /// * `revisionNumber` - The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the lastest order at head revision and retry the update at that revision. - /// * `updateAction` - The proposed action to take on the order. - pub fn update(&self, request: MarketplaceOrder, order_id: &str, revision_number: &str, update_action: &str) -> MarketplaceorderUpdateCall<'a, C, A> { - MarketplaceorderUpdateCall { - hub: self.hub, - _request: request, - _order_id: order_id.to_string(), - _revision_number: revision_number.to_string(), - _update_action: update_action.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Create the given list of orders - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn insert(&self, request: CreateOrdersRequest) -> MarketplaceorderInsertCall<'a, C, A> { - MarketplaceorderInsertCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Get an order given its id - /// - /// # Arguments - /// - /// * `orderId` - Id of the order to retrieve. - pub fn get(&self, order_id: &str) -> MarketplaceorderGetCall<'a, C, A> { - MarketplaceorderGetCall { - hub: self.hub, - _order_id: order_id.to_string(), + _account_id: account_id.to_string(), + _config_id: config_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -4115,7 +2919,7 @@ impl<'a, C, A> MarketplaceorderMethods<'a, C, A> { /// // 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 ! -/// let result = hub.billing_info().get(-85) +/// let result = hub.billing_info().get(-35) /// .doit(); /// # } /// ``` @@ -4143,7 +2947,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.billingInfo.get", + dlg.begin(MethodInfo { id: "adexchangebuyer.billingInfo.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -4185,7 +2989,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4221,7 +3025,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4231,10 +3035,10 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4267,7 +3071,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: i32) -> BillingInfoGetCall<'a, C, A> { self._account_id = new_value; @@ -4285,12 +3089,12 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4307,17 +3111,17 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BillingInfoGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BillingInfoGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4378,7 +3182,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.billingInfo.list", + dlg.begin(MethodInfo { id: "adexchangebuyer.billingInfo.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -4398,7 +3202,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4434,7 +3238,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4444,10 +3248,10 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4488,12 +3292,12 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4510,17 +3314,17 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BillingInfoListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BillingInfoListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4528,7 +3332,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, } -/// Delete the specified deals from the order +/// Delete the specified deals from the proposal /// /// A builder for the *delete* method supported by a *marketplacedeal* resource. /// It is not used directly, but through a `MarketplacedealMethods` instance. @@ -4560,7 +3364,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut, /// // 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 ! -/// let result = hub.marketplacedeals().delete(req, "orderId") +/// let result = hub.marketplacedeals().delete(req, "proposalId") /// .doit(); /// # } /// ``` @@ -4569,7 +3373,7 @@ pub struct MarketplacedealDeleteCall<'a, C, A> hub: &'a AdExchangeBuyer, _request: DeleteOrderDealsRequest, - _order_id: String, + _proposal_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -4589,11 +3393,11 @@ impl<'a, C, A> MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacedeals.delete", + dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacedeals.delete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("orderId", self._order_id.to_string())); - for &field in ["alt", "orderId"].iter() { + params.push(("proposalId", self._proposal_id.to_string())); + for &field in ["alt", "proposalId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -4605,12 +3409,12 @@ impl<'a, C, A> MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -4622,7 +3426,7 @@ impl<'a, C, A> MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["orderId"].iter() { + for param_name in ["proposalId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -4631,14 +3435,14 @@ impl<'a, C, A> MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4682,7 +3486,7 @@ impl<'a, C, A> MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4692,10 +3496,10 @@ impl<'a, C, A> MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut MarketplacedealDeleteCall<'a, C, A> { self._request = new_value; self } - /// The orderId to delete deals from. + /// The proposalId to delete deals from. /// - /// Sets the *order id* path property to the given value. + /// Sets the *proposal id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn order_id(mut self, new_value: &str) -> MarketplacedealDeleteCall<'a, C, A> { - self._order_id = new_value.to_string(); + pub fn proposal_id(mut self, new_value: &str) -> MarketplacedealDeleteCall<'a, C, A> { + self._proposal_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -4755,12 +3559,12 @@ impl<'a, C, A> MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MarketplacedealDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MarketplacedealDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4795,7 +3599,7 @@ impl<'a, C, A> MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut MarketplacedealDeleteCall<'a, C, A> where C: BorrowMut hub: &'a AdExchangeBuyer, _request: AddOrderDealsRequest, - _order_id: String, + _proposal_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -4856,11 +3660,11 @@ impl<'a, C, A> MarketplacedealInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacedeals.insert", + dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacedeals.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("orderId", self._order_id.to_string())); - for &field in ["alt", "orderId"].iter() { + params.push(("proposalId", self._proposal_id.to_string())); + for &field in ["alt", "proposalId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -4872,12 +3676,12 @@ impl<'a, C, A> MarketplacedealInsertCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -4889,7 +3693,7 @@ impl<'a, C, A> MarketplacedealInsertCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["orderId"].iter() { + for param_name in ["proposalId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -4898,14 +3702,14 @@ impl<'a, C, A> MarketplacedealInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4949,7 +3753,7 @@ impl<'a, C, A> MarketplacedealInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4959,10 +3763,10 @@ impl<'a, C, A> MarketplacedealInsertCall<'a, C, A> where C: BorrowMut MarketplacedealInsertCall<'a, C, A> where C: BorrowMut MarketplacedealInsertCall<'a, C, A> { self._request = new_value; self } - /// OrderId for which deals need to be added. + /// proposalId for which deals need to be added. /// - /// Sets the *order id* path property to the given value. + /// Sets the *proposal id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn order_id(mut self, new_value: &str) -> MarketplacedealInsertCall<'a, C, A> { - self._order_id = new_value.to_string(); + pub fn proposal_id(mut self, new_value: &str) -> MarketplacedealInsertCall<'a, C, A> { + self._proposal_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -5022,12 +3826,12 @@ impl<'a, C, A> MarketplacedealInsertCall<'a, C, A> where C: BorrowMut MarketplacedealInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MarketplacedealInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MarketplacedealInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5062,7 +3866,7 @@ impl<'a, C, A> MarketplacedealInsertCall<'a, C, A> where C: BorrowMut MarketplacedealInsertCall<'a, C, A> where C: BorrowMut hub: &'a AdExchangeBuyer, _request: EditAllOrderDealsRequest, - _order_id: String, + _proposal_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -5123,11 +3927,11 @@ impl<'a, C, A> MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacedeals.update", + dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacedeals.update", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("orderId", self._order_id.to_string())); - for &field in ["alt", "orderId"].iter() { + params.push(("proposalId", self._proposal_id.to_string())); + for &field in ["alt", "proposalId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5139,12 +3943,12 @@ impl<'a, C, A> MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -5156,7 +3960,7 @@ impl<'a, C, A> MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["orderId"].iter() { + for param_name in ["proposalId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -5165,14 +3969,14 @@ impl<'a, C, A> MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5216,7 +4020,7 @@ impl<'a, C, A> MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5226,10 +4030,10 @@ impl<'a, C, A> MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut MarketplacedealUpdateCall<'a, C, A> { self._request = new_value; self } - /// The orderId to edit deals on. + /// The proposalId to edit deals on. /// - /// Sets the *order id* path property to the given value. + /// Sets the *proposal id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn order_id(mut self, new_value: &str) -> MarketplacedealUpdateCall<'a, C, A> { - self._order_id = new_value.to_string(); + pub fn proposal_id(mut self, new_value: &str) -> MarketplacedealUpdateCall<'a, C, A> { + self._proposal_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -5289,12 +4093,12 @@ impl<'a, C, A> MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MarketplacedealUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MarketplacedealUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5329,7 +4133,7 @@ impl<'a, C, A> MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut MarketplacedealUpdateCall<'a, C, A> where C: BorrowMut where C: 'a, A: 'a { hub: &'a AdExchangeBuyer, - _order_id: String, + _proposal_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -5383,11 +4187,11 @@ impl<'a, C, A> MarketplacedealListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacedeals.list", + dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacedeals.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("orderId", self._order_id.to_string())); - for &field in ["alt", "orderId"].iter() { + params.push(("proposalId", self._proposal_id.to_string())); + for &field in ["alt", "proposalId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5399,12 +4203,12 @@ impl<'a, C, A> MarketplacedealListCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -5416,7 +4220,7 @@ impl<'a, C, A> MarketplacedealListCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["orderId"].iter() { + for param_name in ["proposalId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -5425,7 +4229,7 @@ impl<'a, C, A> MarketplacedealListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5461,7 +4265,7 @@ impl<'a, C, A> MarketplacedealListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5471,10 +4275,10 @@ impl<'a, C, A> MarketplacedealListCall<'a, C, A> where C: BorrowMut MarketplacedealListCall<'a, C, A> where C: BorrowMut MarketplacedealListCall<'a, C, A> { - self._order_id = new_value.to_string(); + pub fn proposal_id(mut self, new_value: &str) -> MarketplacedealListCall<'a, C, A> { + self._proposal_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -5525,12 +4329,12 @@ impl<'a, C, A> MarketplacedealListCall<'a, C, A> where C: BorrowMut MarketplacedealListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MarketplacedealListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MarketplacedealListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5565,10 +4369,10 @@ impl<'a, C, A> MarketplacedealListCall<'a, C, A> where C: BorrowMut MarketplacedealListCall<'a, C, A> where C: BorrowMut - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _offer_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MarketplaceofferGetCall<'a, C, A> {} - -impl<'a, C, A> MarketplaceofferGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, MarketplaceOffer)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplaceoffers.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("offerId", self._offer_id.to_string())); - for &field in ["alt", "offerId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/marketplaceOffers/{offerId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{offerId}", "offerId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["offerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The offerId for the offer to get the head revision for. - /// - /// Sets the *offer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn offer_id(mut self, new_value: &str) -> MarketplaceofferGetCall<'a, C, A> { - self._offer_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MarketplaceofferGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MarketplaceofferGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MarketplaceofferGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets the requested negotiation. -/// -/// A builder for the *search* method supported by a *marketplaceoffer* resource. -/// It is not used directly, but through a `MarketplaceofferMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.marketplaceoffers().search() -/// .pql_query("amet.") -/// .doit(); -/// # } -/// ``` -pub struct MarketplaceofferSearchCall<'a, C, A> +pub struct ProposalSearchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyer, @@ -5842,13 +4410,13 @@ pub struct MarketplaceofferSearchCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for MarketplaceofferSearchCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProposalSearchCall<'a, C, A> {} -impl<'a, C, A> MarketplaceofferSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProposalSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GetOffersResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, GetOrdersResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -5856,7 +4424,7 @@ impl<'a, C, A> MarketplaceofferSearchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplaceoffers.search", + dlg.begin(MethodInfo { id: "adexchangebuyer.proposals.search", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if let Some(value) = self._pql_query { @@ -5874,12 +4442,12 @@ impl<'a, C, A> MarketplaceofferSearchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5915,7 +4483,7 @@ impl<'a, C, A> MarketplaceofferSearchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5925,10 +4493,10 @@ impl<'a, C, A> MarketplaceofferSearchCall<'a, C, A> where C: BorrowMut MarketplaceofferSearchCall<'a, C, A> where C: BorrowMut MarketplaceofferSearchCall<'a, C, A> { + pub fn pql_query(mut self, new_value: &str) -> ProposalSearchCall<'a, C, A> { self._pql_query = Some(new_value.to_string()); self } @@ -5970,18 +4538,18 @@ impl<'a, C, A> MarketplaceofferSearchCall<'a, C, A> where C: BorrowMut MarketplaceofferSearchCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProposalSearchCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5991,24 +4559,24 @@ impl<'a, C, A> MarketplaceofferSearchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> MarketplaceofferSearchCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProposalSearchCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MarketplaceofferSearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProposalSearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6016,10 +4584,10 @@ impl<'a, C, A> MarketplaceofferSearchCall<'a, C, A> where C: BorrowMut MarketplaceofferSearchCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.creatives().list() -/// .page_token("erat") -/// .open_auction_status_filter("labore") -/// .max_results(92) -/// .deals_status_filter("nonumy") -/// .add_buyer_creative_id("dolores") -/// .add_account_id(-61) -/// .doit(); -/// # } -/// ``` -pub struct CreativeListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _page_token: Option, - _open_auction_status_filter: Option, - _max_results: Option, - _deals_status_filter: Option, - _buyer_creative_id: Vec, - _account_id: Vec, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CreativeListCall<'a, C, A> {} - -impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CreativesList)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._open_auction_status_filter { - params.push(("openAuctionStatusFilter", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._deals_status_filter { - params.push(("dealsStatusFilter", value.to_string())); - } - if self._buyer_creative_id.len() > 0 { - let mut s = String::new(); - for f in self._buyer_creative_id.iter() { - s.push_str(&("/".to_string() + &f.to_string())); - } - params.push(("buyerCreativeId", s)); - } - if self._account_id.len() > 0 { - let mut s = String::new(); - for f in self._account_id.iter() { - s.push_str(&("/".to_string() + &f.to_string())); - } - params.push(("accountId", s)); - } - for &field in ["alt", "pageToken", "openAuctionStatusFilter", "maxResults", "dealsStatusFilter", "buyerCreativeId", "accountId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/creatives".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. Optional. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// When specified, only creatives having the given open auction status are returned. - /// - /// Sets the *open auction status filter* query property to the given value. - pub fn open_auction_status_filter(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { - self._open_auction_status_filter = Some(new_value.to_string()); - self - } - /// Maximum number of entries returned on one result page. If not set, the default is 100. Optional. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> CreativeListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// When specified, only creatives having the given direct deals status are returned. - /// - /// Sets the *deals status filter* query property to the given value. - pub fn deals_status_filter(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { - self._deals_status_filter = Some(new_value.to_string()); - self - } - /// When specified, only creatives for the given buyer creative ids are returned. - /// - /// Append the given value to the *buyer creative id* query property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - pub fn add_buyer_creative_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { - self._buyer_creative_id.push(new_value.to_string()); - self - } - /// When specified, only creatives for the given account ids are returned. - /// - /// Append the given value to the *account id* query property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - pub fn add_account_id(mut self, new_value: i32) -> CreativeListCall<'a, C, A> { - self._account_id.push(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CreativeListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CreativeListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CreativeListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets the status for a single creative. A creative will be available 30-40 minutes after submission. -/// -/// A builder for the *get* method supported by a *creative* resource. -/// It is not used directly, but through a `CreativeMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.creatives().get(-95, "buyerCreativeId") -/// .doit(); -/// # } -/// ``` -pub struct CreativeGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _account_id: i32, - _buyer_creative_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CreativeGetCall<'a, C, A> {} - -impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("accountId", self._account_id.to_string())); - params.push(("buyerCreativeId", self._buyer_creative_id.to_string())); - for &field in ["alt", "accountId", "buyerCreativeId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/creatives/{accountId}/{buyerCreativeId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{accountId}", "accountId"), ("{buyerCreativeId}", "buyerCreativeId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["buyerCreativeId", "accountId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id for the account that will serve this creative. - /// - /// Sets the *account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: i32) -> CreativeGetCall<'a, C, A> { - self._account_id = new_value; - self - } - /// The buyer-specific id for this creative. - /// - /// Sets the *buyer creative id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn buyer_creative_id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { - self._buyer_creative_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CreativeGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CreativeGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CreativeGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Submit a new creative. -/// -/// A builder for the *insert* method supported by a *creative* resource. -/// It is not used directly, but through a `CreativeMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::Creative; +/// use adexchangebuyer1d4::CreateOrdersRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -6576,32 +4611,32 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// // 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 ! -/// let mut req = Creative::default(); +/// let mut req = CreateOrdersRequest::default(); /// /// // 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 ! -/// let result = hub.creatives().insert(req) +/// let result = hub.proposals().insert(req) /// .doit(); /// # } /// ``` -pub struct CreativeInsertCall<'a, C, A> +pub struct ProposalInsertCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyer, - _request: Creative, + _request: CreateOrdersRequest, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for CreativeInsertCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProposalInsertCall<'a, C, A> {} -impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProposalInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, CreateOrdersResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -6609,7 +4644,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.insert", + dlg.begin(MethodInfo { id: "adexchangebuyer.proposals.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -6624,19 +4659,19 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/creatives".to_string(); + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/proposals/insert".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6680,7 +4715,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6690,10 +4725,10 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6725,9 +4760,9 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Creative) -> CreativeInsertCall<'a, C, A> { + pub fn request(mut self, new_value: CreateOrdersRequest) -> ProposalInsertCall<'a, C, A> { self._request = new_value; self } @@ -6737,18 +4772,18 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, 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 Delegate) -> CreativeInsertCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProposalInsertCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6758,24 +4793,24 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CreativeInsertCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProposalInsertCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProposalInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6783,10 +4818,10 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } -/// Gets the requested deal. +/// Update the given proposal /// -/// A builder for the *get* method supported by a *deal* resource. -/// It is not used directly, but through a `DealMethods` instance. +/// A builder for the *update* method supported by a *proposal* resource. +/// It is not used directly, but through a `ProposalMethods` instance. /// /// # Example /// @@ -6796,7 +4831,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::GetFinalizedNegotiationByExternalDealIdRequest; +/// use adexchangebuyer1d4::Proposal; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -6810,33 +4845,35 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// // 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 ! -/// let mut req = GetFinalizedNegotiationByExternalDealIdRequest::default(); +/// let mut req = Proposal::default(); /// /// // 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 ! -/// let result = hub.deals().get(req, "dealId") +/// let result = hub.proposals().update(req, "proposalId", "revisionNumber", "updateAction") /// .doit(); /// # } /// ``` -pub struct DealGetCall<'a, C, A> +pub struct ProposalUpdateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyer, - _request: GetFinalizedNegotiationByExternalDealIdRequest, - _deal_id: String, + _request: Proposal, + _proposal_id: String, + _revision_number: String, + _update_action: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for DealGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProposalUpdateCall<'a, C, A> {} -impl<'a, C, A> DealGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProposalUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, NegotiationDto)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Proposal)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -6844,2218 +4881,13 @@ impl<'a, C, A> DealGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.deals.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("dealId", self._deal_id.to_string())); - for &field in ["alt", "dealId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/deals/{dealId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{dealId}", "dealId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["dealId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: GetFinalizedNegotiationByExternalDealIdRequest) -> DealGetCall<'a, C, A> { - self._request = new_value; - self - } - /// - /// Sets the *deal id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn deal_id(mut self, new_value: &str) -> DealGetCall<'a, C, A> { - self._deal_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DealGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DealGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DealGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets the requested offer. -/// -/// A builder for the *get* method supported by a *offer* resource. -/// It is not used directly, but through a `OfferMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.offers().get("offerId") -/// .doit(); -/// # } -/// ``` -pub struct OfferGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _offer_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OfferGetCall<'a, C, A> {} - -impl<'a, C, A> OfferGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, OfferDto)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.offers.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("offerId", self._offer_id.to_string())); - for &field in ["alt", "offerId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/offers/{offerId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{offerId}", "offerId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["offerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *offer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn offer_id(mut self, new_value: &str) -> OfferGetCall<'a, C, A> { - self._offer_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> OfferGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OfferGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> OfferGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Lists all offers the authenticated user has access to. -/// -/// A builder for the *list* method supported by a *offer* resource. -/// It is not used directly, but through a `OfferMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::ListOffersRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = ListOffersRequest::default(); -/// -/// // 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 ! -/// let result = hub.offers().list(req) -/// .doit(); -/// # } -/// ``` -pub struct OfferListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: ListOffersRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OfferListCall<'a, C, A> {} - -impl<'a, C, A> OfferListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListOffersResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.offers.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/offers".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ListOffersRequest) -> OfferListCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> OfferListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OfferListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> OfferListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates or updates the requested offer. -/// -/// A builder for the *insert* method supported by a *offer* resource. -/// It is not used directly, but through a `OfferMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::OfferDto; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = OfferDto::default(); -/// -/// // 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 ! -/// let result = hub.offers().insert(req) -/// .doit(); -/// # } -/// ``` -pub struct OfferInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: OfferDto, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OfferInsertCall<'a, C, A> {} - -impl<'a, C, A> OfferInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, OfferDto)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.offers.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/offers".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: OfferDto) -> OfferInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> OfferInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OfferInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> OfferInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// A builder for the *insert* method supported by a *clientacces* resource. -/// It is not used directly, but through a `ClientaccesMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::ClientAccessCapabilities; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = ClientAccessCapabilities::default(); -/// -/// // 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 ! -/// let result = hub.clientaccess().insert(req) -/// .sponsor_account_id(-21) -/// .client_account_id("justo") -/// .doit(); -/// # } -/// ``` -pub struct ClientaccesInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: ClientAccessCapabilities, - _sponsor_account_id: Option, - _client_account_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ClientaccesInsertCall<'a, C, A> {} - -impl<'a, C, A> ClientaccesInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ClientAccessCapabilities)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.clientaccess.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - if let Some(value) = self._sponsor_account_id { - params.push(("sponsorAccountId", value.to_string())); - } - if let Some(value) = self._client_account_id { - params.push(("clientAccountId", value.to_string())); - } - for &field in ["alt", "sponsorAccountId", "clientAccountId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/clientAccess".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ClientAccessCapabilities) -> ClientaccesInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// - /// Sets the *sponsor account id* query property to the given value. - pub fn sponsor_account_id(mut self, new_value: i32) -> ClientaccesInsertCall<'a, C, A> { - self._sponsor_account_id = Some(new_value); - self - } - /// - /// Sets the *client account id* query property to the given value. - pub fn client_account_id(mut self, new_value: &str) -> ClientaccesInsertCall<'a, C, A> { - self._client_account_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ClientaccesInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ClientaccesInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ClientaccesInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// A builder for the *list* method supported by a *clientacces* resource. -/// It is not used directly, but through a `ClientaccesMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::ListClientAccessCapabilitiesRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = ListClientAccessCapabilitiesRequest::default(); -/// -/// // 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 ! -/// let result = hub.clientaccess().list(req) -/// .doit(); -/// # } -/// ``` -pub struct ClientaccesListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: ListClientAccessCapabilitiesRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ClientaccesListCall<'a, C, A> {} - -impl<'a, C, A> ClientaccesListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListClientAccessCapabilitiesResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.clientaccess.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/clientAccess".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ListClientAccessCapabilitiesRequest) -> ClientaccesListCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ClientaccesListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ClientaccesListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ClientaccesListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// A builder for the *get* method supported by a *clientacces* resource. -/// It is not used directly, but through a `ClientaccesMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.clientaccess().get("clientAccountId", -17) -/// .doit(); -/// # } -/// ``` -pub struct ClientaccesGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _client_account_id: String, - _sponsor_account_id: i32, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ClientaccesGetCall<'a, C, A> {} - -impl<'a, C, A> ClientaccesGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ClientAccessCapabilities)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.clientaccess.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("clientAccountId", self._client_account_id.to_string())); - params.push(("sponsorAccountId", self._sponsor_account_id.to_string())); - for &field in ["alt", "clientAccountId", "sponsorAccountId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/clientAccess/{clientAccountId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{clientAccountId}", "clientAccountId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["clientAccountId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *client account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn client_account_id(mut self, new_value: &str) -> ClientaccesGetCall<'a, C, A> { - self._client_account_id = new_value.to_string(); - self - } - /// - /// Sets the *sponsor account id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn sponsor_account_id(mut self, new_value: i32) -> ClientaccesGetCall<'a, C, A> { - self._sponsor_account_id = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ClientaccesGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ClientaccesGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ClientaccesGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// A builder for the *patch* method supported by a *clientacces* resource. -/// It is not used directly, but through a `ClientaccesMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::ClientAccessCapabilities; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = ClientAccessCapabilities::default(); -/// -/// // 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 ! -/// let result = hub.clientaccess().patch(req, "clientAccountId", -55) -/// .doit(); -/// # } -/// ``` -pub struct ClientaccesPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: ClientAccessCapabilities, - _client_account_id: String, - _sponsor_account_id: i32, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ClientaccesPatchCall<'a, C, A> {} - -impl<'a, C, A> ClientaccesPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ClientAccessCapabilities)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.clientaccess.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("clientAccountId", self._client_account_id.to_string())); - params.push(("sponsorAccountId", self._sponsor_account_id.to_string())); - for &field in ["alt", "clientAccountId", "sponsorAccountId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/clientAccess/{clientAccountId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{clientAccountId}", "clientAccountId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["clientAccountId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ClientAccessCapabilities) -> ClientaccesPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// - /// Sets the *client account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn client_account_id(mut self, new_value: &str) -> ClientaccesPatchCall<'a, C, A> { - self._client_account_id = new_value.to_string(); - self - } - /// - /// Sets the *sponsor account id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn sponsor_account_id(mut self, new_value: i32) -> ClientaccesPatchCall<'a, C, A> { - self._sponsor_account_id = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ClientaccesPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ClientaccesPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ClientaccesPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// A builder for the *delete* method supported by a *clientacces* resource. -/// It is not used directly, but through a `ClientaccesMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.clientaccess().delete("clientAccountId", -21) -/// .doit(); -/// # } -/// ``` -pub struct ClientaccesDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _client_account_id: String, - _sponsor_account_id: i32, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ClientaccesDeleteCall<'a, C, A> {} - -impl<'a, C, A> ClientaccesDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.clientaccess.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("clientAccountId", self._client_account_id.to_string())); - params.push(("sponsorAccountId", self._sponsor_account_id.to_string())); - for &field in ["clientAccountId", "sponsorAccountId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/clientAccess/{clientAccountId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{clientAccountId}", "clientAccountId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["clientAccountId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *client account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn client_account_id(mut self, new_value: &str) -> ClientaccesDeleteCall<'a, C, A> { - self._client_account_id = new_value.to_string(); - self - } - /// - /// Sets the *sponsor account id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn sponsor_account_id(mut self, new_value: i32) -> ClientaccesDeleteCall<'a, C, A> { - self._sponsor_account_id = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ClientaccesDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ClientaccesDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ClientaccesDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// A builder for the *update* method supported by a *clientacces* resource. -/// It is not used directly, but through a `ClientaccesMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::ClientAccessCapabilities; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = ClientAccessCapabilities::default(); -/// -/// // 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 ! -/// let result = hub.clientaccess().update(req, "clientAccountId", -32) -/// .doit(); -/// # } -/// ``` -pub struct ClientaccesUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: ClientAccessCapabilities, - _client_account_id: String, - _sponsor_account_id: i32, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ClientaccesUpdateCall<'a, C, A> {} - -impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ClientAccessCapabilities)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.clientaccess.update", + dlg.begin(MethodInfo { id: "adexchangebuyer.proposals.update", http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("clientAccountId", self._client_account_id.to_string())); - params.push(("sponsorAccountId", self._sponsor_account_id.to_string())); - for &field in ["alt", "clientAccountId", "sponsorAccountId"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("proposalId", self._proposal_id.to_string())); + params.push(("revisionNumber", self._revision_number.to_string())); + params.push(("updateAction", self._update_action.to_string())); + for &field in ["alt", "proposalId", "revisionNumber", "updateAction"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -9067,12 +4899,12 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/clientAccess/{clientAccountId}".to_string(); + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/proposals/{proposalId}/{revisionNumber}/{updateAction}".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{clientAccountId}", "clientAccountId")].iter() { + for &(find_this, param_name) in [("{proposalId}", "proposalId"), ("{revisionNumber}", "revisionNumber"), ("{updateAction}", "updateAction")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -9083,8 +4915,8 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["clientAccountId"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["updateAction", "revisionNumber", "proposalId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -9093,14 +4925,14 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9144,7 +4976,7 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9154,10 +4986,10 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9189,28 +5021,40 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ClientAccessCapabilities) -> ClientaccesUpdateCall<'a, C, A> { + pub fn request(mut self, new_value: Proposal) -> ProposalUpdateCall<'a, C, A> { self._request = new_value; self } + /// The proposal id to update. /// - /// Sets the *client account id* path property to the given value. + /// Sets the *proposal id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn client_account_id(mut self, new_value: &str) -> ClientaccesUpdateCall<'a, C, A> { - self._client_account_id = new_value.to_string(); + pub fn proposal_id(mut self, new_value: &str) -> ProposalUpdateCall<'a, C, A> { + self._proposal_id = new_value.to_string(); self } + /// The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the latest proposal at head revision and retry the update at that revision. /// - /// Sets the *sponsor account id* query property to the given value. + /// Sets the *revision number* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn sponsor_account_id(mut self, new_value: i32) -> ClientaccesUpdateCall<'a, C, A> { - self._sponsor_account_id = new_value; + pub fn revision_number(mut self, new_value: &str) -> ProposalUpdateCall<'a, C, A> { + self._revision_number = new_value.to_string(); + self + } + /// The proposed action to take on the proposal. + /// + /// Sets the *update action* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn update_action(mut self, new_value: &str) -> ProposalUpdateCall<'a, C, A> { + self._update_action = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -9219,18 +5063,18 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut /// 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 Delegate) -> ClientaccesUpdateCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProposalUpdateCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9240,24 +5084,24 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ClientaccesUpdateCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProposalUpdateCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ClientaccesUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProposalUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9265,10 +5109,10 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut } -/// Updates an existing account. This method supports patch semantics. +/// Update the given proposal. This method supports patch semantics. /// -/// A builder for the *patch* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. +/// A builder for the *patch* method supported by a *proposal* resource. +/// It is not used directly, but through a `ProposalMethods` instance. /// /// # Example /// @@ -9278,7 +5122,7 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::Account; +/// use adexchangebuyer1d4::Proposal; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -9292,33 +5136,35 @@ impl<'a, C, A> ClientaccesUpdateCall<'a, C, A> where C: BorrowMut /// // 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 ! -/// let mut req = Account::default(); +/// let mut req = Proposal::default(); /// /// // 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 ! -/// let result = hub.accounts().patch(req, -9) +/// let result = hub.proposals().patch(req, "proposalId", "revisionNumber", "updateAction") /// .doit(); /// # } /// ``` -pub struct AccountPatchCall<'a, C, A> +pub struct ProposalPatchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyer, - _request: Account, - _id: i32, + _request: Proposal, + _proposal_id: String, + _revision_number: String, + _update_action: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountPatchCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProposalPatchCall<'a, C, A> {} -impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProposalPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Proposal)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -9326,11 +5172,13 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.patch", + dlg.begin(MethodInfo { id: "adexchangebuyer.proposals.patch", http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - for &field in ["alt", "id"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("proposalId", self._proposal_id.to_string())); + params.push(("revisionNumber", self._revision_number.to_string())); + params.push(("updateAction", self._update_action.to_string())); + for &field in ["alt", "proposalId", "revisionNumber", "updateAction"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -9342,12 +5190,12 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/accounts/{id}".to_string(); + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/proposals/{proposalId}/{revisionNumber}/{updateAction}".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{id}", "id")].iter() { + for &(find_this, param_name) in [("{proposalId}", "proposalId"), ("{revisionNumber}", "revisionNumber"), ("{updateAction}", "updateAction")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -9358,8 +5206,8 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["id"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["updateAction", "revisionNumber", "proposalId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -9368,14 +5216,14 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9419,7 +5267,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9429,10 +5277,10 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9464,20 +5312,40 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountPatchCall<'a, C, A> { + pub fn request(mut self, new_value: Proposal) -> ProposalPatchCall<'a, C, A> { self._request = new_value; self } - /// The account id + /// The proposal id to update. /// - /// Sets the *id* path property to the given value. + /// Sets the *proposal id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn id(mut self, new_value: i32) -> AccountPatchCall<'a, C, A> { - self._id = new_value; + pub fn proposal_id(mut self, new_value: &str) -> ProposalPatchCall<'a, C, A> { + self._proposal_id = new_value.to_string(); + self + } + /// The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the latest proposal at head revision and retry the update at that revision. + /// + /// Sets the *revision number* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn revision_number(mut self, new_value: &str) -> ProposalPatchCall<'a, C, A> { + self._revision_number = new_value.to_string(); + self + } + /// The proposed action to take on the proposal. + /// + /// Sets the *update action* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn update_action(mut self, new_value: &str) -> ProposalPatchCall<'a, C, A> { + self._update_action = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -9486,18 +5354,18 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, 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 Delegate) -> AccountPatchCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProposalPatchCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9507,24 +5375,24 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountPatchCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProposalPatchCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProposalPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9532,10 +5400,10 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } -/// Retrieves the authenticated user's list of accounts. +/// Get a proposal given its id /// -/// A builder for the *list* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. +/// A builder for the *get* method supported by a *proposal* resource. +/// It is not used directly, but through a `ProposalMethods` instance. /// /// # Example /// @@ -9558,26 +5426,27 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// // 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 ! -/// let result = hub.accounts().list() +/// let result = hub.proposals().get("proposalId") /// .doit(); /// # } /// ``` -pub struct AccountListCall<'a, C, A> +pub struct ProposalGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyer, + _proposal_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for AccountListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ProposalGetCall<'a, C, A> {} -impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ProposalGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AccountsList)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Proposal)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -9585,215 +5454,11 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/accounts".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AccountListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets one account by ID. -/// -/// A builder for the *get* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.accounts().get(-55) -/// .doit(); -/// # } -/// ``` -pub struct AccountGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _id: i32, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AccountGetCall<'a, C, A> {} - -impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.get", + dlg.begin(MethodInfo { id: "adexchangebuyer.proposals.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - for &field in ["alt", "id"].iter() { + params.push(("proposalId", self._proposal_id.to_string())); + for &field in ["alt", "proposalId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -9805,12 +5470,12 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/accounts/{id}".to_string(); + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/proposals/{proposalId}".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{id}", "id")].iter() { + for &(find_this, param_name) in [("{proposalId}", "proposalId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -9822,7 +5487,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["id"].iter() { + for param_name in ["proposalId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -9831,7 +5496,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9867,7 +5532,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9877,10 +5542,10 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9909,14 +5574,14 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } - /// The account id + /// Id of the proposal to retrieve. /// - /// Sets the *id* path property to the given value. + /// Sets the *proposal id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn id(mut self, new_value: i32) -> AccountGetCall<'a, C, A> { - self._id = new_value; + pub fn proposal_id(mut self, new_value: &str) -> ProposalGetCall<'a, C, A> { + self._proposal_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -9925,18 +5590,18 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// 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 Delegate) -> AccountGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ProposalGetCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9946,554 +5611,24 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ProposalGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates an existing account. -/// -/// A builder for the *update* method supported by a *account* resource. -/// It is not used directly, but through a `AccountMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::Account; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = Account::default(); -/// -/// // 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 ! -/// let result = hub.accounts().update(req, -75) -/// .doit(); -/// # } -/// ``` -pub struct AccountUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: Account, - _id: i32, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AccountUpdateCall<'a, C, A> {} - -impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - for &field in ["alt", "id"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/accounts/{id}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{id}", "id")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["id"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Account) -> AccountUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The account id - /// - /// Sets the *id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: i32) -> AccountUpdateCall<'a, C, A> { - self._id = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AccountUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AccountUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AccountUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieves the authenticated user's list of performance metrics. -/// -/// A builder for the *list* method supported by a *performanceReport* resource. -/// It is not used directly, but through a `PerformanceReportMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.performance_report().list("accountId", "endDateTime", "startDateTime") -/// .page_token("eirmod") -/// .max_results(58) -/// .doit(); -/// # } -/// ``` -pub struct PerformanceReportListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _account_id: String, - _end_date_time: String, - _start_date_time: String, - _page_token: Option, - _max_results: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for PerformanceReportListCall<'a, C, A> {} - -impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, PerformanceReportList)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.performanceReport.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); - params.push(("accountId", self._account_id.to_string())); - params.push(("endDateTime", self._end_date_time.to_string())); - params.push(("startDateTime", self._start_date_time.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - for &field in ["alt", "accountId", "endDateTime", "startDateTime", "pageToken", "maxResults"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/performancereport".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The account id to get the reports. - /// - /// Sets the *account id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> PerformanceReportListCall<'a, C, A> { - self._account_id = new_value.to_string(); - self - } - /// The end time of the report in ISO 8601 timestamp format using UTC. - /// - /// Sets the *end date time* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn end_date_time(mut self, new_value: &str) -> PerformanceReportListCall<'a, C, A> { - self._end_date_time = new_value.to_string(); - self - } - /// The start time of the report in ISO 8601 timestamp format using UTC. - /// - /// Sets the *start date time* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn start_date_time(mut self, new_value: &str) -> PerformanceReportListCall<'a, C, A> { - self._start_date_time = new_value.to_string(); - self - } - /// A continuation token, used to page through performance reports. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. Optional. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> PerformanceReportListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Maximum number of entries returned on one result page. If not set, the default is 100. Optional. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> PerformanceReportListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> PerformanceReportListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> PerformanceReportListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> PerformanceReportListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProposalGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10563,7 +5698,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.budget.update", + dlg.begin(MethodInfo { id: "adexchangebuyer.budget.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -10606,14 +5741,14 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10657,7 +5792,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10667,10 +5802,10 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10702,7 +5837,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Budget) -> BudgetUpdateCall<'a, C, A> { self._request = new_value; @@ -10712,7 +5847,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> BudgetUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10722,7 +5857,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *billing id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn billing_id(mut self, new_value: &str) -> BudgetUpdateCall<'a, C, A> { self._billing_id = new_value.to_string(); @@ -10740,12 +5875,12 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10762,17 +5897,17 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BudgetUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BudgetUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10835,7 +5970,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.budget.get", + dlg.begin(MethodInfo { id: "adexchangebuyer.budget.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -10878,7 +6013,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10914,7 +6049,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10924,10 +6059,10 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10960,7 +6095,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> BudgetGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10970,7 +6105,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *billing id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn billing_id(mut self, new_value: &str) -> BudgetGetCall<'a, C, A> { self._billing_id = new_value.to_string(); @@ -10988,12 +6123,12 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11010,17 +6145,17 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BudgetGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BudgetGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11090,7 +6225,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.budget.patch", + dlg.begin(MethodInfo { id: "adexchangebuyer.budget.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -11133,14 +6268,14 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11184,7 +6319,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11194,10 +6329,10 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11229,7 +6364,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Budget) -> BudgetPatchCall<'a, C, A> { self._request = new_value; @@ -11239,7 +6374,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> BudgetPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -11249,7 +6384,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *billing id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn billing_id(mut self, new_value: &str) -> BudgetPatchCall<'a, C, A> { self._billing_id = new_value.to_string(); @@ -11267,12 +6402,12 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11289,17 +6424,17 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BudgetPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BudgetPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11307,10 +6442,10 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o } -/// Get all the notes associated with an order +/// Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission. /// -/// A builder for the *list* method supported by a *marketplacenote* resource. -/// It is not used directly, but through a `MarketplacenoteMethods` instance. +/// A builder for the *list* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. /// /// # Example /// @@ -11333,27 +6468,38 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut, A: o /// // 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 ! -/// let result = hub.marketplacenotes().list("orderId") +/// let result = hub.creatives().list() +/// .page_token("sea") +/// .open_auction_status_filter("Lorem") +/// .max_results(26) +/// .deals_status_filter("erat") +/// .add_buyer_creative_id("sadipscing") +/// .add_account_id(-48) /// .doit(); /// # } /// ``` -pub struct MarketplacenoteListCall<'a, C, A> +pub struct CreativeListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyer, - _order_id: String, + _page_token: Option, + _open_auction_status_filter: Option, + _max_results: Option, + _deals_status_filter: Option, + _buyer_creative_id: Vec, + _account_id: Vec, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for MarketplacenoteListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for CreativeListCall<'a, C, A> {} -impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GetOrderNotesResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativesList)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -11361,11 +6507,36 @@ impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacenotes.list", + dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("orderId", self._order_id.to_string())); - for &field in ["alt", "orderId"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._open_auction_status_filter { + params.push(("openAuctionStatusFilter", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._deals_status_filter { + params.push(("dealsStatusFilter", value.to_string())); + } + if self._buyer_creative_id.len() > 0 { + let mut s = String::new(); + for f in self._buyer_creative_id.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("buyerCreativeId", s)); + } + if self._account_id.len() > 0 { + let mut s = String::new(); + for f in self._account_id.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("accountId", s)); + } + for &field in ["alt", "pageToken", "openAuctionStatusFilter", "maxResults", "dealsStatusFilter", "buyerCreativeId", "accountId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -11377,33 +6548,12 @@ impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["orderId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11439,7 +6589,7 @@ impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11449,10 +6599,10 @@ impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut MarketplacenoteListCall<'a, C, A> where C: BorrowMut CreativeListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// When specified, only creatives having the given open auction status are returned. /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn order_id(mut self, new_value: &str) -> MarketplacenoteListCall<'a, C, A> { - self._order_id = new_value.to_string(); + /// Sets the *open auction status filter* query property to the given value. + pub fn open_auction_status_filter(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._open_auction_status_filter = Some(new_value.to_string()); + self + } + /// Maximum number of entries returned on one result page. If not set, the default is 100. Optional. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> CreativeListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// When specified, only creatives having the given deals status are returned. + /// + /// Sets the *deals status filter* query property to the given value. + pub fn deals_status_filter(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._deals_status_filter = Some(new_value.to_string()); + self + } + /// When specified, only creatives for the given buyer creative ids are returned. + /// + /// Append the given value to the *buyer creative id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_buyer_creative_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._buyer_creative_id.push(new_value.to_string()); + self + } + /// When specified, only creatives for the given account ids are returned. + /// + /// Append the given value to the *account id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_account_id(mut self, new_value: i32) -> CreativeListCall<'a, C, A> { + self._account_id.push(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -11497,18 +6681,18 @@ impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut MarketplacenoteListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> CreativeListCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11518,24 +6702,24 @@ impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> MarketplacenoteListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> CreativeListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MarketplacenoteListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11543,10 +6727,10 @@ impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut MarketplacenoteListCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let result = hub.creatives().remove_deal(-39, "buyerCreativeId", "dealId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeRemoveDealCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _account_id: i32, + _buyer_creative_id: String, + _deal_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeRemoveDealCall<'a, C, A> {} + +impl<'a, C, A> CreativeRemoveDealCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.removeDeal", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("accountId", self._account_id.to_string())); + params.push(("buyerCreativeId", self._buyer_creative_id.to_string())); + params.push(("dealId", self._deal_id.to_string())); + for &field in ["accountId", "buyerCreativeId", "dealId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/creatives/{accountId}/{buyerCreativeId}/removeDeal/{dealId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{accountId}", "accountId"), ("{buyerCreativeId}", "buyerCreativeId"), ("{dealId}", "dealId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["dealId", "buyerCreativeId", "accountId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id for the account that will serve this creative. + /// + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: i32) -> CreativeRemoveDealCall<'a, C, A> { + self._account_id = new_value; + self + } + /// The buyer-specific id for this creative. + /// + /// Sets the *buyer creative id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn buyer_creative_id(mut self, new_value: &str) -> CreativeRemoveDealCall<'a, C, A> { + self._buyer_creative_id = new_value.to_string(); + self + } + /// The id of the deal id to disassociate with this creative. + /// + /// Sets the *deal id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn deal_id(mut self, new_value: &str) -> CreativeRemoveDealCall<'a, C, A> { + self._deal_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeRemoveDealCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeRemoveDealCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeRemoveDealCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Add a deal id association for the creative. +/// +/// A builder for the *addDeal* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let result = hub.creatives().add_deal(-60, "buyerCreativeId", "dealId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeAddDealCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _account_id: i32, + _buyer_creative_id: String, + _deal_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeAddDealCall<'a, C, A> {} + +impl<'a, C, A> CreativeAddDealCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.addDeal", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("accountId", self._account_id.to_string())); + params.push(("buyerCreativeId", self._buyer_creative_id.to_string())); + params.push(("dealId", self._deal_id.to_string())); + for &field in ["accountId", "buyerCreativeId", "dealId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/creatives/{accountId}/{buyerCreativeId}/addDeal/{dealId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{accountId}", "accountId"), ("{buyerCreativeId}", "buyerCreativeId"), ("{dealId}", "dealId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["dealId", "buyerCreativeId", "accountId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id for the account that will serve this creative. + /// + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: i32) -> CreativeAddDealCall<'a, C, A> { + self._account_id = new_value; + self + } + /// The buyer-specific id for this creative. + /// + /// Sets the *buyer creative id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn buyer_creative_id(mut self, new_value: &str) -> CreativeAddDealCall<'a, C, A> { + self._buyer_creative_id = new_value.to_string(); + self + } + /// The id of the deal id to associate with this creative. + /// + /// Sets the *deal id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn deal_id(mut self, new_value: &str) -> CreativeAddDealCall<'a, C, A> { + self._deal_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeAddDealCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeAddDealCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeAddDealCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the status for a single creative. A creative will be available 30-40 minutes after submission. +/// +/// A builder for the *get* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let result = hub.creatives().get(-33, "buyerCreativeId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _account_id: i32, + _buyer_creative_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("accountId", self._account_id.to_string())); + params.push(("buyerCreativeId", self._buyer_creative_id.to_string())); + for &field in ["alt", "accountId", "buyerCreativeId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/creatives/{accountId}/{buyerCreativeId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{accountId}", "accountId"), ("{buyerCreativeId}", "buyerCreativeId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["buyerCreativeId", "accountId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id for the account that will serve this creative. + /// + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: i32) -> CreativeGetCall<'a, C, A> { + self._account_id = new_value; + self + } + /// The buyer-specific id for this creative. + /// + /// Sets the *buyer creative id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn buyer_creative_id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { + self._buyer_creative_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Submit a new creative. +/// +/// A builder for the *insert* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// use adexchangebuyer1d4::Creative; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -11570,33 +7500,32 @@ impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut +pub struct CreativeInsertCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyer, - _request: AddOrderNotesRequest, - _order_id: String, + _request: Creative, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for MarketplacenoteInsertCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for CreativeInsertCall<'a, C, A> {} -impl<'a, C, A> MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AddOrderNotesResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -11604,11 +7533,10 @@ impl<'a, C, A> MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacenotes.insert", + dlg.begin(MethodInfo { id: "adexchangebuyer.creatives.insert", http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("orderId", self._order_id.to_string())); - for &field in ["alt", "orderId"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -11620,40 +7548,19 @@ impl<'a, C, A> MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["orderId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11697,7 +7604,7 @@ impl<'a, C, A> MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11707,10 +7614,10 @@ impl<'a, C, A> MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut CreativeInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the requested product. +/// +/// A builder for the *search* method supported by a *product* resource. +/// It is not used directly, but through a `ProductMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let result = hub.products().search() +/// .pql_query("aliquyam") +/// .doit(); +/// # } +/// ``` +pub struct ProductSearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _pql_query: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProductSearchCall<'a, C, A> {} + +impl<'a, C, A> ProductSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GetOffersResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.products.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + if let Some(value) = self._pql_query { + params.push(("pqlQuery", value.to_string())); + } + for &field in ["alt", "pqlQuery"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/products/search".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The pql query used to query for products. + /// + /// Sets the *pql query* query property to the given value. + pub fn pql_query(mut self, new_value: &str) -> ProductSearchCall<'a, C, A> { + self._pql_query = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProductSearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProductSearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProductSearchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the requested product by id. +/// +/// A builder for the *get* method supported by a *product* resource. +/// It is not used directly, but through a `ProductMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let result = hub.products().get("productId") +/// .doit(); +/// # } +/// ``` +pub struct ProductGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _product_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProductGetCall<'a, C, A> {} + +impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Product)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.products.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("productId", self._product_id.to_string())); + for &field in ["alt", "productId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/products/{productId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{productId}", "productId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["productId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id for the product to get the head revision for. + /// + /// Sets the *product id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn product_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { + self._product_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProductGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProductGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProductGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the authenticated user's list of performance metrics. +/// +/// A builder for the *list* method supported by a *performanceReport* resource. +/// It is not used directly, but through a `PerformanceReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let result = hub.performance_report().list("accountId", "endDateTime", "startDateTime") +/// .page_token("duo") +/// .max_results(80) +/// .doit(); +/// # } +/// ``` +pub struct PerformanceReportListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _account_id: String, + _end_date_time: String, + _start_date_time: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PerformanceReportListCall<'a, C, A> {} + +impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PerformanceReportList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.performanceReport.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("accountId", self._account_id.to_string())); + params.push(("endDateTime", self._end_date_time.to_string())); + params.push(("startDateTime", self._start_date_time.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "accountId", "endDateTime", "startDateTime", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/performancereport".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The account id to get the reports. + /// + /// Sets the *account id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: &str) -> PerformanceReportListCall<'a, C, A> { + self._account_id = new_value.to_string(); + self + } + /// The end time of the report in ISO 8601 timestamp format using UTC. + /// + /// Sets the *end date time* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn end_date_time(mut self, new_value: &str) -> PerformanceReportListCall<'a, C, A> { + self._end_date_time = new_value.to_string(); + self + } + /// The start time of the report in ISO 8601 timestamp format using UTC. + /// + /// Sets the *start date time* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn start_date_time(mut self, new_value: &str) -> PerformanceReportListCall<'a, C, A> { + self._start_date_time = new_value.to_string(); + self + } + /// A continuation token, used to page through performance reports. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. Optional. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PerformanceReportListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of entries returned on one result page. If not set, the default is 100. Optional. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> PerformanceReportListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PerformanceReportListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PerformanceReportListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PerformanceReportListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Get all the notes associated with a proposal +/// +/// A builder for the *list* method supported by a *marketplacenote* resource. +/// It is not used directly, but through a `MarketplacenoteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let result = hub.marketplacenotes().list("proposalId") +/// .doit(); +/// # } +/// ``` +pub struct MarketplacenoteListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _proposal_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MarketplacenoteListCall<'a, C, A> {} + +impl<'a, C, A> MarketplacenoteListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GetOrderNotesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacenotes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("proposalId", self._proposal_id.to_string())); + for &field in ["alt", "proposalId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/proposals/{proposalId}/notes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{proposalId}", "proposalId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["proposalId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The proposalId to get notes for. + /// + /// Sets the *proposal id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn proposal_id(mut self, new_value: &str) -> MarketplacenoteListCall<'a, C, A> { + self._proposal_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MarketplacenoteListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MarketplacenoteListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MarketplacenoteListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Add notes to the proposal +/// +/// A builder for the *insert* method supported by a *marketplacenote* resource. +/// It is not used directly, but through a `MarketplacenoteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// use adexchangebuyer1d4::AddOrderNotesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let mut req = AddOrderNotesRequest::default(); +/// +/// // 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 ! +/// let result = hub.marketplacenotes().insert(req, "proposalId") +/// .doit(); +/// # } +/// ``` +pub struct MarketplacenoteInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _request: AddOrderNotesRequest, + _proposal_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MarketplacenoteInsertCall<'a, C, A> {} + +impl<'a, C, A> MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AddOrderNotesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.marketplacenotes.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("proposalId", self._proposal_id.to_string())); + for &field in ["alt", "proposalId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/proposals/{proposalId}/notes/insert".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{proposalId}", "proposalId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["proposalId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: AddOrderNotesRequest) -> MarketplacenoteInsertCall<'a, C, A> { self._request = new_value; self } - /// The orderId to add notes for. + /// The proposalId to add notes for. /// - /// Sets the *order id* path property to the given value. + /// Sets the *proposal id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn order_id(mut self, new_value: &str) -> MarketplacenoteInsertCall<'a, C, A> { - self._order_id = new_value.to_string(); + pub fn proposal_id(mut self, new_value: &str) -> MarketplacenoteInsertCall<'a, C, A> { + self._proposal_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -11770,12 +8884,12 @@ impl<'a, C, A> MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut MarketplacenoteInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MarketplacenoteInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MarketplacenoteInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing account. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// use adexchangebuyer1d4::Account; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let mut req = Account::default(); +/// +/// // 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 ! +/// let result = hub.accounts().patch(req, -22) +/// .doit(); +/// # } +/// ``` +pub struct AccountPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _request: Account, + _id: i32, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPatchCall<'a, C, A> {} + +impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/accounts/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["id"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Account) -> AccountPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The account id + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: i32) -> AccountPatchCall<'a, C, A> { + self._id = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the authenticated user's list of accounts. +/// +/// A builder for the *list* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let result = hub.accounts().list() +/// .doit(); +/// # } +/// ``` +pub struct AccountListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountListCall<'a, C, A> {} + +impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountsList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/accounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one account by ID. +/// +/// A builder for the *get* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let result = hub.accounts().get(-46) +/// .doit(); +/// # } +/// ``` +pub struct AccountGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _id: i32, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountGetCall<'a, C, A> {} + +impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/accounts/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["id"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The account id + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: i32) -> AccountGetCall<'a, C, A> { + self._id = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing account. +/// +/// A builder for the *update* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; +/// use adexchangebuyer1d4::Account; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use adexchangebuyer1d4::AdExchangeBuyer; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! +/// let mut req = Account::default(); +/// +/// // 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 ! +/// let result = hub.accounts().update(req, -23) +/// .doit(); +/// # } +/// ``` +pub struct AccountUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AdExchangeBuyer, + _request: Account, + _id: i32, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUpdateCall<'a, C, A> {} + +impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "adexchangebuyer.accounts.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/accounts/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["id"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Account) -> AccountUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The account id + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: i32) -> AccountUpdateCall<'a, C, A> { + self._id = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::AdexchangeBuyer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11865,7 +9952,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.delete", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -11907,7 +9994,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11943,7 +10030,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11953,10 +10040,10 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -11989,7 +10076,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> { self._config_id = new_value.to_string(); @@ -12007,12 +10094,12 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12108,7 +10195,7 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.insert", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -12150,14 +10237,14 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12201,7 +10288,7 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12211,10 +10298,10 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> { self._request = new_value; @@ -12256,7 +10343,7 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12274,12 +10361,12 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12368,7 +10455,7 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.list", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -12410,7 +10497,7 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12446,7 +10533,7 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12456,10 +10543,10 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut PretargetingConfigListCall<'a, C, A> where C: BorrowMut PretargetingConfigListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12510,12 +10597,12 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut PretargetingConfigListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12612,7 +10699,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.update", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -12655,14 +10742,14 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12706,7 +10793,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12716,10 +10803,10 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> { self._request = new_value; @@ -12761,7 +10848,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12771,7 +10858,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> { self._config_id = new_value.to_string(); @@ -12789,12 +10876,12 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a specific pretargeting configuration -/// -/// A builder for the *get* method supported by a *pretargetingConfig* resource. -/// It is not used directly, but through a `PretargetingConfigMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.pretargeting_config().get("accountId", "configId") -/// .doit(); -/// # } -/// ``` -pub struct PretargetingConfigGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _account_id: String, - _config_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for PretargetingConfigGetCall<'a, C, A> {} - -impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, PretargetingConfig)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("accountId", self._account_id.to_string())); - params.push(("configId", self._config_id.to_string())); - for &field in ["alt", "accountId", "configId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/pretargetingconfigs/{accountId}/{configId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{accountId}", "accountId"), ("{configId}", "configId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["configId", "accountId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The account id to get the pretargeting config for. - /// - /// Sets the *account id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn account_id(mut self, new_value: &str) -> PretargetingConfigGetCall<'a, C, A> { - self._account_id = new_value.to_string(); - self - } - /// The specific id of the configuration to retrieve. - /// - /// Sets the *config id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn config_id(mut self, new_value: &str) -> PretargetingConfigGetCall<'a, C, A> { - self._config_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> PretargetingConfigGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> PretargetingConfigGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> PretargetingConfigGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13139,7 +10978,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.patch", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -13182,14 +11021,14 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13233,7 +11072,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13243,10 +11082,10 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> { self._request = new_value; @@ -13288,7 +11127,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -13298,7 +11137,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> { self._config_id = new_value.to_string(); @@ -13316,12 +11155,12 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PretargetingConfigPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13356,10 +11195,10 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = NegotiationRoundDto::default(); -/// /// // 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 ! -/// let result = hub.negotiationrounds().insert(req, "negotiationId") +/// let result = hub.pretargeting_config().get("accountId", "configId") /// .doit(); /// # } /// ``` -pub struct NegotiationroundInsertCall<'a, C, A> +pub struct PretargetingConfigGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a AdExchangeBuyer, - _request: NegotiationRoundDto, - _negotiation_id: String, + _account_id: String, + _config_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for NegotiationroundInsertCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for PretargetingConfigGetCall<'a, C, A> {} -impl<'a, C, A> NegotiationroundInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, NegotiationRoundDto)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, PretargetingConfig)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -13417,511 +11250,12 @@ impl<'a, C, A> NegotiationroundInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangebuyer.negotiationrounds.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("negotiationId", self._negotiation_id.to_string())); - for &field in ["alt", "negotiationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/negotiations/{negotiationId}/negotiationrounds".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{negotiationId}", "negotiationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["negotiationId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: NegotiationRoundDto) -> NegotiationroundInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// - /// Sets the *negotiation id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn negotiation_id(mut self, new_value: &str) -> NegotiationroundInsertCall<'a, C, A> { - self._negotiation_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> NegotiationroundInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> NegotiationroundInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> NegotiationroundInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Lists all negotiations the authenticated user has access to. -/// -/// A builder for the *list* method supported by a *negotiation* resource. -/// It is not used directly, but through a `NegotiationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::GetNegotiationsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = GetNegotiationsRequest::default(); -/// -/// // 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 ! -/// let result = hub.negotiations().list(req) -/// .doit(); -/// # } -/// ``` -pub struct NegotiationListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: GetNegotiationsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for NegotiationListCall<'a, C, A> {} - -impl<'a, C, A> NegotiationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GetNegotiationsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.negotiations.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/negotiations".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: GetNegotiationsRequest) -> NegotiationListCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> NegotiationListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> NegotiationListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> NegotiationListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets the requested negotiation. -/// -/// A builder for the *get* method supported by a *negotiation* resource. -/// It is not used directly, but through a `NegotiationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::GetNegotiationByIdRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = GetNegotiationByIdRequest::default(); -/// -/// // 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 ! -/// let result = hub.negotiations().get(req, "negotiationId") -/// .doit(); -/// # } -/// ``` -pub struct NegotiationGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: GetNegotiationByIdRequest, - _negotiation_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for NegotiationGetCall<'a, C, A> {} - -impl<'a, C, A> NegotiationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, NegotiationDto)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.negotiations.get", + dlg.begin(MethodInfo { id: "adexchangebuyer.pretargetingConfig.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("negotiationId", self._negotiation_id.to_string())); - for &field in ["alt", "negotiationId"].iter() { + params.push(("accountId", self._account_id.to_string())); + params.push(("configId", self._config_id.to_string())); + for &field in ["alt", "accountId", "configId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -13933,12 +11267,12 @@ impl<'a, C, A> NegotiationGetCall<'a, C, A> where C: BorrowMut, A params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/negotiations/{negotiationId}".to_string(); + let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/pretargetingconfigs/{accountId}/{configId}".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{negotiationId}", "negotiationId")].iter() { + for &(find_this, param_name) in [("{accountId}", "accountId"), ("{configId}", "configId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -13949,8 +11283,8 @@ impl<'a, C, A> NegotiationGetCall<'a, C, A> where C: BorrowMut, A url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["negotiationId"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["configId", "accountId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -13959,773 +11293,7 @@ impl<'a, C, A> NegotiationGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: GetNegotiationByIdRequest) -> NegotiationGetCall<'a, C, A> { - self._request = new_value; - self - } - /// - /// Sets the *negotiation id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn negotiation_id(mut self, new_value: &str) -> NegotiationGetCall<'a, C, A> { - self._negotiation_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> NegotiationGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> NegotiationGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> NegotiationGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates or updates the requested negotiation. -/// -/// A builder for the *insert* method supported by a *negotiation* resource. -/// It is not used directly, but through a `NegotiationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::NegotiationDto; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = NegotiationDto::default(); -/// -/// // 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 ! -/// let result = hub.negotiations().insert(req) -/// .doit(); -/// # } -/// ``` -pub struct NegotiationInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: NegotiationDto, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for NegotiationInsertCall<'a, C, A> {} - -impl<'a, C, A> NegotiationInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, NegotiationDto)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.negotiations.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/negotiations".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: NegotiationDto) -> NegotiationInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> NegotiationInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> NegotiationInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> NegotiationInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Update the given order. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *marketplaceorder* resource. -/// It is not used directly, but through a `MarketplaceorderMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::MarketplaceOrder; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = MarketplaceOrder::default(); -/// -/// // 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 ! -/// let result = hub.marketplaceorders().patch(req, "orderId", "revisionNumber", "updateAction") -/// .doit(); -/// # } -/// ``` -pub struct MarketplaceorderPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: MarketplaceOrder, - _order_id: String, - _revision_number: String, - _update_action: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MarketplaceorderPatchCall<'a, C, A> {} - -impl<'a, C, A> MarketplaceorderPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, MarketplaceOrder)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplaceorders.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("orderId", self._order_id.to_string())); - params.push(("revisionNumber", self._revision_number.to_string())); - params.push(("updateAction", self._update_action.to_string())); - for &field in ["alt", "orderId", "revisionNumber", "updateAction"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/marketplaceOrders/{orderId}/{revisionNumber}/{updateAction}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{orderId}", "orderId"), ("{revisionNumber}", "revisionNumber"), ("{updateAction}", "updateAction")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["updateAction", "revisionNumber", "orderId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: MarketplaceOrder) -> MarketplaceorderPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The order id to update. - /// - /// Sets the *order id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn order_id(mut self, new_value: &str) -> MarketplaceorderPatchCall<'a, C, A> { - self._order_id = new_value.to_string(); - self - } - /// The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the lastest order at head revision and retry the update at that revision. - /// - /// Sets the *revision number* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn revision_number(mut self, new_value: &str) -> MarketplaceorderPatchCall<'a, C, A> { - self._revision_number = new_value.to_string(); - self - } - /// The proposed action to take on the order. - /// - /// Sets the *update action* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn update_action(mut self, new_value: &str) -> MarketplaceorderPatchCall<'a, C, A> { - self._update_action = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MarketplaceorderPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MarketplaceorderPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MarketplaceorderPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Search for orders using pql query -/// -/// A builder for the *search* method supported by a *marketplaceorder* resource. -/// It is not used directly, but through a `MarketplaceorderMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.marketplaceorders().search() -/// .pql_query("dolor") -/// .doit(); -/// # } -/// ``` -pub struct MarketplaceorderSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _pql_query: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MarketplaceorderSearchCall<'a, C, A> {} - -impl<'a, C, A> MarketplaceorderSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GetOrdersResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplaceorders.search", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - if let Some(value) = self._pql_query { - params.push(("pqlQuery", value.to_string())); - } - for &field in ["alt", "pqlQuery"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/marketplaceOrders/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14761,7 +11329,7 @@ impl<'a, C, A> MarketplaceorderSearchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14771,10 +11339,10 @@ impl<'a, C, A> MarketplaceorderSearchCall<'a, C, A> where C: BorrowMut MarketplaceorderSearchCall<'a, C, A> where C: BorrowMut MarketplaceorderSearchCall<'a, C, A> { - self._pql_query = Some(new_value.to_string()); + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: &str) -> PretargetingConfigGetCall<'a, C, A> { + self._account_id = new_value.to_string(); + self + } + /// The specific id of the configuration to retrieve. + /// + /// Sets the *config id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn config_id(mut self, new_value: &str) -> PretargetingConfigGetCall<'a, C, A> { + self._config_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -14816,18 +11397,18 @@ impl<'a, C, A> MarketplaceorderSearchCall<'a, C, A> where C: BorrowMut MarketplaceorderSearchCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> PretargetingConfigGetCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14837,785 +11418,24 @@ impl<'a, C, A> MarketplaceorderSearchCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> MarketplaceorderSearchCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> PretargetingConfigGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeBuyer`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MarketplaceorderSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Update the given order -/// -/// A builder for the *update* method supported by a *marketplaceorder* resource. -/// It is not used directly, but through a `MarketplaceorderMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::MarketplaceOrder; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = MarketplaceOrder::default(); -/// -/// // 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 ! -/// let result = hub.marketplaceorders().update(req, "orderId", "revisionNumber", "updateAction") -/// .doit(); -/// # } -/// ``` -pub struct MarketplaceorderUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: MarketplaceOrder, - _order_id: String, - _revision_number: String, - _update_action: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MarketplaceorderUpdateCall<'a, C, A> {} - -impl<'a, C, A> MarketplaceorderUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, MarketplaceOrder)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplaceorders.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("orderId", self._order_id.to_string())); - params.push(("revisionNumber", self._revision_number.to_string())); - params.push(("updateAction", self._update_action.to_string())); - for &field in ["alt", "orderId", "revisionNumber", "updateAction"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/marketplaceOrders/{orderId}/{revisionNumber}/{updateAction}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{orderId}", "orderId"), ("{revisionNumber}", "revisionNumber"), ("{updateAction}", "updateAction")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["updateAction", "revisionNumber", "orderId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: MarketplaceOrder) -> MarketplaceorderUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The order id to update. - /// - /// Sets the *order id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn order_id(mut self, new_value: &str) -> MarketplaceorderUpdateCall<'a, C, A> { - self._order_id = new_value.to_string(); - self - } - /// The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the lastest order at head revision and retry the update at that revision. - /// - /// Sets the *revision number* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn revision_number(mut self, new_value: &str) -> MarketplaceorderUpdateCall<'a, C, A> { - self._revision_number = new_value.to_string(); - self - } - /// The proposed action to take on the order. - /// - /// Sets the *update action* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn update_action(mut self, new_value: &str) -> MarketplaceorderUpdateCall<'a, C, A> { - self._update_action = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MarketplaceorderUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MarketplaceorderUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MarketplaceorderUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Create the given list of orders -/// -/// A builder for the *insert* method supported by a *marketplaceorder* resource. -/// It is not used directly, but through a `MarketplaceorderMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// use adexchangebuyer1d4::CreateOrdersRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let mut req = CreateOrdersRequest::default(); -/// -/// // 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 ! -/// let result = hub.marketplaceorders().insert(req) -/// .doit(); -/// # } -/// ``` -pub struct MarketplaceorderInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _request: CreateOrdersRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MarketplaceorderInsertCall<'a, C, A> {} - -impl<'a, C, A> MarketplaceorderInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CreateOrdersResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplaceorders.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/marketplaceOrders/insert".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: CreateOrdersRequest) -> MarketplaceorderInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MarketplaceorderInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MarketplaceorderInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MarketplaceorderInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Get an order given its id -/// -/// A builder for the *get* method supported by a *marketplaceorder* resource. -/// It is not used directly, but through a `MarketplaceorderMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use adexchangebuyer1d4::AdExchangeBuyer; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AdExchangeBuyer::new(hyper::Client::new(), 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 ! -/// let result = hub.marketplaceorders().get("orderId") -/// .doit(); -/// # } -/// ``` -pub struct MarketplaceorderGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AdExchangeBuyer, - _order_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MarketplaceorderGetCall<'a, C, A> {} - -impl<'a, C, A> MarketplaceorderGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, MarketplaceOrder)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "adexchangebuyer.marketplaceorders.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("orderId", self._order_id.to_string())); - for &field in ["alt", "orderId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/adexchangebuyer/v1.4/marketplaceOrders/{orderId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::AdexchangeBuyer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{orderId}", "orderId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["orderId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Id of the order to retrieve. - /// - /// Sets the *order id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn order_id(mut self, new_value: &str) -> MarketplaceorderGetCall<'a, C, A> { - self._order_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MarketplaceorderGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MarketplaceorderGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::AdexchangeBuyer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MarketplaceorderGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PretargetingConfigGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/adexchangeseller2-cli/Cargo.toml b/gen/adexchangeseller2-cli/Cargo.toml index 1d8d1c90bd..9ca8644ca6 100644 --- a/gen/adexchangeseller2-cli/Cargo.toml +++ b/gen/adexchangeseller2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangeseller2-cli" -version = "0.3.2+20151013" +version = "0.3.3+20151127" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Exchange Seller (protocol v2.0)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangeseller2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/adexchangeseller2-cli/LICENSE.md b/gen/adexchangeseller2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/adexchangeseller2-cli/LICENSE.md +++ b/gen/adexchangeseller2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/adexchangeseller2-cli/README.md b/gen/adexchangeseller2-cli/README.md index 6656b6c3e4..f011960858 100644 --- a/gen/adexchangeseller2-cli/README.md +++ b/gen/adexchangeseller2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Ad Exchange Seller* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/adexchangeseller2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/adexchangeseller2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/adexchangeseller2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/adexchangeseller2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangeseller2-cli). # Usage -This documentation was generated from the *Ad Exchange Seller* API at revision *20151013*. The CLI is at version *0.3.2*. +This documentation was generated from the *Ad Exchange Seller* API at revision *20151127*. The CLI is at version *0.3.3*. ```bash adexchangeseller2 [options] @@ -47,18 +47,18 @@ adexchangeseller2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/adexchangeseller2-cli/mkdocs.yml b/gen/adexchangeseller2-cli/mkdocs.yml index 44a7d2650a..533aace6d3 100644 --- a/gen/adexchangeseller2-cli/mkdocs.yml +++ b/gen/adexchangeseller2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Ad Exchange Seller v0.3.2+20151013 +site_name: Ad Exchange Seller v0.3.3+20151127 site_url: http://byron.github.io/google-apis-rs/google-adexchangeseller2-cli site_description: Write integrating applications with bcore @@ -26,5 +26,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/adexchangeseller2-cli/src/main.rs b/gen/adexchangeseller2-cli/src/main.rs index fb30d8b61c..9e0041269d 100644 --- a/gen/adexchangeseller2-cli/src/main.rs +++ b/gen/adexchangeseller2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::AdExchangeSeller>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _accounts_adclients_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _accounts_adclients_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adclients_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -67,7 +67,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -81,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -104,10 +104,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_alerts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_alerts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().alerts_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "locale" => { @@ -123,7 +123,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale"].iter().map(|v|*v)); @@ -137,7 +137,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -160,10 +160,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_customchannels_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_customchannels_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().customchannels_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("custom-channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -176,7 +176,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -189,7 +189,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -212,10 +212,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_customchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_customchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().customchannels_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -234,7 +234,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -248,7 +248,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -271,10 +271,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().get(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -287,7 +287,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -300,7 +300,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -323,10 +323,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -345,7 +345,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -359,7 +359,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -382,10 +382,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_metadata_dimensions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_metadata_dimensions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().metadata_dimensions_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -398,7 +398,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -411,7 +411,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -434,10 +434,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_metadata_metrics_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_metadata_metrics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().metadata_metrics_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -450,7 +450,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -463,7 +463,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -486,10 +486,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_preferreddeals_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_preferreddeals_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().preferreddeals_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("deal-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -502,7 +502,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -515,7 +515,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -538,10 +538,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_preferreddeals_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_preferreddeals_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().preferreddeals_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -554,7 +554,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -567,7 +567,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -590,11 +590,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_reports_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_reports_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.accounts().reports_generate(opt.value_of("account-id").unwrap_or(""), opt.value_of("start-date").unwrap_or(""), opt.value_of("end-date").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -631,7 +631,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort", "locale", "metric", "max-results", "filter", "start-index", "dimension"].iter().map(|v|*v)); @@ -645,7 +645,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -673,10 +673,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_reports_saved_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_reports_saved_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().reports_saved_generate(opt.value_of("account-id").unwrap_or(""), opt.value_of("saved-report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -698,7 +698,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "start-index", "max-results"].iter().map(|v|*v)); @@ -712,7 +712,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -735,10 +735,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_reports_saved_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_reports_saved_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().reports_saved_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -757,7 +757,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -771,7 +771,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -794,10 +794,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_urlchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_urlchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().urlchannels_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -816,7 +816,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -830,7 +830,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -925,14 +925,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "adexchangeseller2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "adexchangeseller2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -952,7 +952,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -991,7 +991,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("accounts", "methods: 'adclients-list', 'alerts-list', 'customchannels-get', 'customchannels-list', 'get', 'list', 'metadata-dimensions-list', 'metadata-metrics-list', 'preferreddeals-get', 'preferreddeals-list', 'reports-generate', 'reports-saved-generate', 'reports-saved-list' and 'urlchannels-list'", vec![ - ("adclients-list", + ("adclients-list", Some(r##"List all ad clients in this Ad Exchange account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_adclients-list", vec![ @@ -1013,7 +1013,7 @@ fn main() { Some(false), Some(false)), ]), - ("alerts-list", + ("alerts-list", Some(r##"List the alerts for this Ad Exchange account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_alerts-list", vec![ @@ -1035,7 +1035,7 @@ fn main() { Some(false), Some(false)), ]), - ("customchannels-get", + ("customchannels-get", Some(r##"Get the specified custom channel from the specified ad client."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_customchannels-get", vec![ @@ -1069,7 +1069,7 @@ fn main() { Some(false), Some(false)), ]), - ("customchannels-list", + ("customchannels-list", Some(r##"List all custom channels in the specified ad client for this Ad Exchange account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_customchannels-list", vec![ @@ -1097,7 +1097,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Get information about the selected Ad Exchange account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_get", vec![ @@ -1119,7 +1119,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all accounts available to this Ad Exchange account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_list", vec![ @@ -1135,7 +1135,7 @@ fn main() { Some(false), Some(false)), ]), - ("metadata-dimensions-list", + ("metadata-dimensions-list", Some(r##"List the metadata for the dimensions available to this AdExchange account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_metadata-dimensions-list", vec![ @@ -1157,7 +1157,7 @@ fn main() { Some(false), Some(false)), ]), - ("metadata-metrics-list", + ("metadata-metrics-list", Some(r##"List the metadata for the metrics available to this AdExchange account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_metadata-metrics-list", vec![ @@ -1179,7 +1179,7 @@ fn main() { Some(false), Some(false)), ]), - ("preferreddeals-get", + ("preferreddeals-get", Some(r##"Get information about the selected Ad Exchange Preferred Deal."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_preferreddeals-get", vec![ @@ -1207,7 +1207,7 @@ fn main() { Some(false), Some(false)), ]), - ("preferreddeals-list", + ("preferreddeals-list", Some(r##"List the preferred deals for this Ad Exchange account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_preferreddeals-list", vec![ @@ -1229,7 +1229,7 @@ fn main() { Some(false), Some(false)), ]), - ("reports-generate", + ("reports-generate", Some(r##"Generate an Ad Exchange report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_reports-generate", vec![ @@ -1263,7 +1263,7 @@ fn main() { Some(false), Some(false)), ]), - ("reports-saved-generate", + ("reports-saved-generate", Some(r##"Generate an Ad Exchange report based on the saved report ID sent in the query parameters."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_reports-saved-generate", vec![ @@ -1291,7 +1291,7 @@ fn main() { Some(false), Some(false)), ]), - ("reports-saved-list", + ("reports-saved-list", Some(r##"List all saved reports in this Ad Exchange account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_reports-saved-list", vec![ @@ -1313,7 +1313,7 @@ fn main() { Some(false), Some(false)), ]), - ("urlchannels-list", + ("urlchannels-list", Some(r##"List all URL channels in the specified ad client for this Ad Exchange account."##), "Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_urlchannels-list", vec![ @@ -1347,7 +1347,7 @@ fn main() { let mut app = App::new("adexchangeseller2") .author("Sebastian Thiel ") - .version("0.3.2+20151013") + .version("0.3.3+20151127") .about("Gives Ad Exchange seller users access to their inventory and the ability to generate reports") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli") .arg(Arg::with_name("url") @@ -1371,7 +1371,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1382,7 +1382,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/adexchangeseller2/Cargo.toml b/gen/adexchangeseller2/Cargo.toml index 74fb04f5f7..ccda1cfa4a 100644 --- a/gen/adexchangeseller2/Cargo.toml +++ b/gen/adexchangeseller2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangeseller2" -version = "0.1.10+20151013" +version = "0.1.11+20151127" authors = ["Sebastian Thiel "] description = "A complete library to interact with Ad Exchange Seller (protocol v2.0)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangeseller2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/adexchangeseller2/LICENSE.md b/gen/adexchangeseller2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/adexchangeseller2/LICENSE.md +++ b/gen/adexchangeseller2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/adexchangeseller2/README.md b/gen/adexchangeseller2/README.md index a0c010a8fd..ca4e52c55d 100644 --- a/gen/adexchangeseller2/README.md +++ b/gen/adexchangeseller2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-adexchangeseller2` library allows access to all features of the *Google Ad Exchange Seller* service. -This documentation was generated from *Ad Exchange Seller* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Ad Exchange Seller* crate version *0.1.11+20151127*, where *20151127* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Ad Exchange Seller* *v2* API can be found at the [official documentation site](https://developers.google.com/ad-exchange/seller-rest/). diff --git a/gen/adexchangeseller2/src/cmn.rs b/gen/adexchangeseller2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/adexchangeseller2/src/cmn.rs +++ b/gen/adexchangeseller2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/adexchangeseller2/src/lib.rs b/gen/adexchangeseller2/src/lib.rs index 51d16fef27..ab8c5aa121 100644 --- a/gen/adexchangeseller2/src/lib.rs +++ b/gen/adexchangeseller2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Ad Exchange Seller* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Ad Exchange Seller* crate version *0.1.11+20151127*, where *20151127* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Ad Exchange Seller* *v2* API can be found at the //! [official documentation site](https://developers.google.com/ad-exchange/seller-rest/). diff --git a/gen/adexchangeseller2/src/lib.rs.in b/gen/adexchangeseller2/src/lib.rs.in index 54ed69b1af..aad4328c31 100644 --- a/gen/adexchangeseller2/src/lib.rs.in +++ b/gen/adexchangeseller2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -137,7 +138,7 @@ impl<'a, C, A> AdExchangeSeller AdExchangeSeller { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -146,7 +147,7 @@ impl<'a, C, A> AdExchangeSeller } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1014,7 +1015,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.reports.saved.generate", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.reports.saved.generate", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -1066,7 +1067,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1102,7 +1103,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1112,10 +1113,10 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountReportSavedGenerateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -1158,7 +1159,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountReportSavedGenerateCall<'a, C, A> { self._saved_report_id = new_value.to_string(); @@ -1197,12 +1198,12 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountReportSavedGenerateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountReportSavedGenerateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1291,7 +1292,7 @@ impl<'a, C, A> AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.metadata.metrics.list", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.metadata.metrics.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -1333,7 +1334,7 @@ impl<'a, C, A> AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1369,7 +1370,7 @@ impl<'a, C, A> AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1379,10 +1380,10 @@ impl<'a, C, A> AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut AccountMetadataMetricListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -1433,12 +1434,12 @@ impl<'a, C, A> AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountMetadataMetricListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountMetadataMetricListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1548,7 +1549,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.reports.generate", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.reports.generate", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -1645,7 +1646,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1681,7 +1682,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1691,10 +1692,10 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -1737,7 +1738,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> { self._start_date = new_value.to_string(); @@ -1747,7 +1748,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> { self._end_date = new_value.to_string(); @@ -1818,12 +1819,12 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountReportGenerateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountReportGenerateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1917,7 +1918,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.urlchannels.list", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.urlchannels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -1966,7 +1967,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2002,7 +2003,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2012,10 +2013,10 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2058,7 +2059,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -2090,12 +2091,12 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUrlchannelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUrlchannelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2188,7 +2189,7 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.reports.saved.list", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.reports.saved.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2236,7 +2237,7 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2272,7 +2273,7 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2282,10 +2283,10 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut AccountReportSavedListCall<'a, C, A> where C: BorrowMut AccountReportSavedListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2350,12 +2351,12 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut AccountReportSavedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountReportSavedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountReportSavedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2445,7 +2446,7 @@ impl<'a, C, A> AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.preferreddeals.get", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.preferreddeals.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2488,7 +2489,7 @@ impl<'a, C, A> AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2524,7 +2525,7 @@ impl<'a, C, A> AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2534,10 +2535,10 @@ impl<'a, C, A> AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut AccountPreferreddealGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2580,7 +2581,7 @@ impl<'a, C, A> AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut AccountPreferreddealGetCall<'a, C, A> { self._deal_id = new_value.to_string(); @@ -2598,12 +2599,12 @@ impl<'a, C, A> AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPreferreddealGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPreferreddealGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2696,7 +2697,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.adclients.list", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.adclients.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2744,7 +2745,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2780,7 +2781,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2790,10 +2791,10 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2858,12 +2859,12 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdclientListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdclientListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2952,7 +2953,7 @@ impl<'a, C, A> AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.metadata.dimensions.list", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.metadata.dimensions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2994,7 +2995,7 @@ impl<'a, C, A> AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3030,7 +3031,7 @@ impl<'a, C, A> AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3040,10 +3041,10 @@ impl<'a, C, A> AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut AccountMetadataDimensionListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -3094,12 +3095,12 @@ impl<'a, C, A> AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountMetadataDimensionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountMetadataDimensionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3190,7 +3191,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.customchannels.get", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.customchannels.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -3234,7 +3235,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3270,7 +3271,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3280,10 +3281,10 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -3326,7 +3327,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -3336,7 +3337,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> { self._custom_channel_id = new_value.to_string(); @@ -3354,12 +3355,12 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountCustomchannelGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountCustomchannelGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3453,7 +3454,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.customchannels.list", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.customchannels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -3502,7 +3503,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3538,7 +3539,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3548,10 +3549,10 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -3594,7 +3595,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -3626,12 +3627,12 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountCustomchannelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountCustomchannelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3723,7 +3724,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.list", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -3749,7 +3750,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::AdexchangeSellerReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3785,7 +3786,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3795,10 +3796,10 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3853,12 +3854,12 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3875,17 +3876,17 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeSellerReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3949,7 +3950,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.alerts.list", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.alerts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -3994,7 +3995,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4030,7 +4031,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4040,10 +4041,10 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4076,7 +4077,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountAlertListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -4101,12 +4102,12 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4123,17 +4124,17 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeSellerReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountAlertListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAlertListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4195,7 +4196,7 @@ impl<'a, C, A> AccountPreferreddealListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.preferreddeals.list", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.preferreddeals.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -4237,7 +4238,7 @@ impl<'a, C, A> AccountPreferreddealListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4273,7 +4274,7 @@ impl<'a, C, A> AccountPreferreddealListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4283,10 +4284,10 @@ impl<'a, C, A> AccountPreferreddealListCall<'a, C, A> where C: BorrowMut AccountPreferreddealListCall<'a, C, A> where C: BorrowMut AccountPreferreddealListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -4337,12 +4338,12 @@ impl<'a, C, A> AccountPreferreddealListCall<'a, C, A> where C: BorrowMut AccountPreferreddealListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPreferreddealListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPreferreddealListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4431,7 +4432,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adexchangeseller.accounts.get", + dlg.begin(MethodInfo { id: "adexchangeseller.accounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -4473,7 +4474,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4509,7 +4510,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4519,10 +4520,10 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4555,7 +4556,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -4573,12 +4574,12 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4595,17 +4596,17 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AdexchangeSellerReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/admin1_directory-cli/Cargo.toml b/gen/admin1_directory-cli/Cargo.toml index 7eec0dde89..a4b888e166 100644 --- a/gen/admin1_directory-cli/Cargo.toml +++ b/gen/admin1_directory-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-admin1_directory-cli" -version = "0.3.2+20151005" +version = "0.3.3+20151208" authors = ["Sebastian Thiel "] description = "A complete library to interact with directory (protocol directory_v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/admin1_directory-cli/LICENSE.md b/gen/admin1_directory-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/admin1_directory-cli/LICENSE.md +++ b/gen/admin1_directory-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/admin1_directory-cli/README.md b/gen/admin1_directory-cli/README.md index 517f9f29a5..233c439770 100644 --- a/gen/admin1_directory-cli/README.md +++ b/gen/admin1_directory-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *directory* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/admin1-directory.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/admin1-directory.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/admin1-directory.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/admin1-directory.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory-cli). # Usage -This documentation was generated from the *directory* API at revision *20151005*. The CLI is at version *0.3.2*. +This documentation was generated from the *directory* API at revision *20151208*. The CLI is at version *0.3.3*. ```bash admin1-directory [options] @@ -90,6 +90,13 @@ admin1-directory [options] update ... (-r )... [-p ]... [-o ] privileges list [-p ]... [-o ] + resources + calendars-delete [-p ]... + calendars-get [-p ]... [-o ] + calendars-insert (-r )... [-p ]... [-o ] + calendars-list [-p ]... [-o ] + calendars-patch (-r )... [-p ]... [-o ] + calendars-update (-r )... [-p ]... [-o ] role-assignments delete [-p ]... get [-p ]... [-o ] @@ -139,18 +146,18 @@ admin1-directory [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/admin1_directory-cli/mkdocs.yml b/gen/admin1_directory-cli/mkdocs.yml index 0e330425cd..13e3884494 100644 --- a/gen/admin1_directory-cli/mkdocs.yml +++ b/gen/admin1_directory-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: directory v0.3.2+20151005 +site_name: directory v0.3.3+20151208 site_url: http://byron.github.io/google-apis-rs/google-admin1_directory-cli site_description: Write integrating applications with bcore @@ -59,6 +59,12 @@ pages: - ['orgunits_patch.md', 'Orgunits', 'Patch'] - ['orgunits_update.md', 'Orgunits', 'Update'] - ['privileges_list.md', 'Privileges', 'List'] +- ['resources_calendars-delete.md', 'Resources', 'Calendars Delete'] +- ['resources_calendars-get.md', 'Resources', 'Calendars Get'] +- ['resources_calendars-insert.md', 'Resources', 'Calendars Insert'] +- ['resources_calendars-list.md', 'Resources', 'Calendars List'] +- ['resources_calendars-patch.md', 'Resources', 'Calendars Patch'] +- ['resources_calendars-update.md', 'Resources', 'Calendars Update'] - ['role-assignments_delete.md', 'Role Assignments', 'Delete'] - ['role-assignments_get.md', 'Role Assignments', 'Get'] - ['role-assignments_insert.md', 'Role Assignments', 'Insert'] @@ -101,5 +107,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/admin1_directory-cli/src/main.rs b/gen/admin1_directory-cli/src/main.rs index 15bb307bb7..6e38a4402a 100644 --- a/gen/admin1_directory-cli/src/main.rs +++ b/gen/admin1_directory-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,20 +36,20 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Directory>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _asps_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _asps_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let code_id: i32 = arg_from_str(&opt.value_of("code-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.asps().delete(opt.value_of("user-key").unwrap_or(""), code_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -62,7 +62,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -75,7 +75,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -90,11 +90,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _asps_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _asps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let code_id: i32 = arg_from_str(&opt.value_of("code-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.asps().get(opt.value_of("user-key").unwrap_or(""), code_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -107,7 +107,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -120,7 +120,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -143,10 +143,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _asps_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _asps_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.asps().list(opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -159,7 +159,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -172,7 +172,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -195,13 +195,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channels_stop(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channels_stop(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -215,8 +215,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -240,7 +240,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.channels().stop(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -253,7 +253,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -266,7 +266,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -281,10 +281,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _chromeosdevices_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _chromeosdevices_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.chromeosdevices().get(opt.value_of("customer-id").unwrap_or(""), opt.value_of("device-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -300,7 +300,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["projection"].iter().map(|v|*v)); @@ -314,7 +314,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -337,10 +337,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _chromeosdevices_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _chromeosdevices_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.chromeosdevices().list(opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -371,7 +371,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "projection", "max-results", "page-token", "sort-order", "query"].iter().map(|v|*v)); @@ -385,7 +385,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -408,13 +408,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _chromeosdevices_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _chromeosdevices_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -428,8 +428,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "mac-address" => Some(("macAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-sync" => Some(("lastSync", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -466,7 +466,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ChromeOsDevice = json::value::from_value(object).unwrap(); let mut call = self.hub.chromeosdevices().patch(request, opt.value_of("customer-id").unwrap_or(""), opt.value_of("device-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -482,7 +482,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["projection"].iter().map(|v|*v)); @@ -496,7 +496,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -519,13 +519,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _chromeosdevices_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _chromeosdevices_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -539,8 +539,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "mac-address" => Some(("macAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-sync" => Some(("lastSync", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -577,7 +577,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ChromeOsDevice = json::value::from_value(object).unwrap(); let mut call = self.hub.chromeosdevices().update(request, opt.value_of("customer-id").unwrap_or(""), opt.value_of("device-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -593,7 +593,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["projection"].iter().map(|v|*v)); @@ -607,7 +607,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -630,10 +630,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.customers().get(opt.value_of("customer-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -646,7 +646,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -659,7 +659,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -682,13 +682,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customers_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -702,8 +702,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "customer-domain" => Some(("customerDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "language" => Some(("language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -734,7 +734,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Customer = json::value::from_value(object).unwrap(); let mut call = self.hub.customers().patch(request, opt.value_of("customer-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -747,7 +747,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -760,7 +760,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -783,13 +783,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customers_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -803,8 +803,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "customer-domain" => Some(("customerDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "language" => Some(("language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -835,7 +835,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Customer = json::value::from_value(object).unwrap(); let mut call = self.hub.customers().update(request, opt.value_of("customer-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -848,7 +848,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -861,7 +861,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -884,10 +884,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _domain_aliases_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _domain_aliases_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.domain_aliases().delete(opt.value_of("customer").unwrap_or(""), opt.value_of("domain-alias-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -900,7 +900,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -913,7 +913,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -928,10 +928,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _domain_aliases_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _domain_aliases_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.domain_aliases().get(opt.value_of("customer").unwrap_or(""), opt.value_of("domain-alias-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -944,7 +944,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -957,7 +957,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -980,13 +980,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _domain_aliases_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _domain_aliases_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1000,8 +1000,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "verified" => Some(("verified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1021,7 +1021,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DomainAlias = json::value::from_value(object).unwrap(); let mut call = self.hub.domain_aliases().insert(request, opt.value_of("customer").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1034,7 +1034,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1047,7 +1047,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1070,10 +1070,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _domain_aliases_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _domain_aliases_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.domain_aliases().list(opt.value_of("customer").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "parent-domain-name" => { @@ -1089,7 +1089,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["parent-domain-name"].iter().map(|v|*v)); @@ -1103,7 +1103,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1126,10 +1126,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _domains_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _domains_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.domains().delete(opt.value_of("customer").unwrap_or(""), opt.value_of("domain-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1142,7 +1142,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1155,7 +1155,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1170,10 +1170,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _domains_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _domains_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.domains().get(opt.value_of("customer").unwrap_or(""), opt.value_of("domain-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1186,7 +1186,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1199,7 +1199,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1222,13 +1222,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _domains_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _domains_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1242,8 +1242,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "verified" => Some(("verified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1263,7 +1263,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Domains = json::value::from_value(object).unwrap(); let mut call = self.hub.domains().insert(request, opt.value_of("customer").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1276,7 +1276,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1289,7 +1289,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1312,10 +1312,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _domains_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _domains_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.domains().list(opt.value_of("customer").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1328,7 +1328,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1341,7 +1341,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1364,10 +1364,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_aliases_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_aliases_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().aliases_delete(opt.value_of("group-key").unwrap_or(""), opt.value_of("alias").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1380,7 +1380,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1393,7 +1393,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1408,13 +1408,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_aliases_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_aliases_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1428,8 +1428,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "alias" => Some(("alias", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1448,7 +1448,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Alias = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().aliases_insert(request, opt.value_of("group-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1461,7 +1461,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1474,7 +1474,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1497,10 +1497,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_aliases_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_aliases_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().aliases_list(opt.value_of("group-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1513,7 +1513,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1526,7 +1526,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1549,10 +1549,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().delete(opt.value_of("group-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1565,7 +1565,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1578,7 +1578,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1593,10 +1593,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().get(opt.value_of("group-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1609,7 +1609,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1622,7 +1622,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1645,13 +1645,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1665,8 +1665,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "non-editable-aliases" => Some(("nonEditableAliases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1690,7 +1690,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Group = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1703,7 +1703,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1716,7 +1716,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1739,10 +1739,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-key" => { @@ -1770,7 +1770,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["customer", "user-key", "domain", "max-results", "page-token"].iter().map(|v|*v)); @@ -1784,7 +1784,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1807,13 +1807,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1827,8 +1827,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "non-editable-aliases" => Some(("nonEditableAliases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1852,7 +1852,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Group = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().patch(request, opt.value_of("group-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1865,7 +1865,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1878,7 +1878,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1901,13 +1901,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1921,8 +1921,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "non-editable-aliases" => Some(("nonEditableAliases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1946,7 +1946,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Group = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().update(request, opt.value_of("group-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1959,7 +1959,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1972,7 +1972,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1995,10 +1995,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _members_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _members_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.members().delete(opt.value_of("group-key").unwrap_or(""), opt.value_of("member-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2011,7 +2011,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2024,7 +2024,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2039,10 +2039,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _members_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _members_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.members().get(opt.value_of("group-key").unwrap_or(""), opt.value_of("member-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2055,7 +2055,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2068,7 +2068,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2091,13 +2091,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _members_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _members_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2111,8 +2111,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2132,7 +2132,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Member = json::value::from_value(object).unwrap(); let mut call = self.hub.members().insert(request, opt.value_of("group-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2145,7 +2145,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2158,7 +2158,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2181,10 +2181,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _members_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _members_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.members().list(opt.value_of("group-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "roles" => { @@ -2206,7 +2206,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results", "roles"].iter().map(|v|*v)); @@ -2220,7 +2220,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2243,13 +2243,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _members_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _members_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2263,8 +2263,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2284,7 +2284,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Member = json::value::from_value(object).unwrap(); let mut call = self.hub.members().patch(request, opt.value_of("group-key").unwrap_or(""), opt.value_of("member-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2297,7 +2297,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2310,7 +2310,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2333,13 +2333,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _members_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _members_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2353,8 +2353,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2374,7 +2374,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Member = json::value::from_value(object).unwrap(); let mut call = self.hub.members().update(request, opt.value_of("group-key").unwrap_or(""), opt.value_of("member-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2387,7 +2387,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2400,7 +2400,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2423,13 +2423,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mobiledevices_action(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mobiledevices_action(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2443,8 +2443,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "action" => Some(("action", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -2459,7 +2459,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::MobileDeviceAction = json::value::from_value(object).unwrap(); let mut call = self.hub.mobiledevices().action(request, opt.value_of("customer-id").unwrap_or(""), opt.value_of("resource-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2472,7 +2472,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2485,7 +2485,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2500,10 +2500,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mobiledevices_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mobiledevices_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mobiledevices().delete(opt.value_of("customer-id").unwrap_or(""), opt.value_of("resource-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2516,7 +2516,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2529,7 +2529,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2544,10 +2544,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mobiledevices_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mobiledevices_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mobiledevices().get(opt.value_of("customer-id").unwrap_or(""), opt.value_of("resource-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -2563,7 +2563,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["projection"].iter().map(|v|*v)); @@ -2577,7 +2577,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2600,10 +2600,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mobiledevices_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mobiledevices_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mobiledevices().list(opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -2634,7 +2634,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "projection", "max-results", "page-token", "sort-order", "query"].iter().map(|v|*v)); @@ -2648,7 +2648,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2671,10 +2671,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _notifications_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _notifications_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.notifications().delete(opt.value_of("customer").unwrap_or(""), opt.value_of("notification-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2687,7 +2687,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2700,7 +2700,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2715,10 +2715,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _notifications_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _notifications_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.notifications().get(opt.value_of("customer").unwrap_or(""), opt.value_of("notification-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2731,7 +2731,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2744,7 +2744,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2767,10 +2767,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _notifications_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _notifications_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.notifications().list(opt.value_of("customer").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2792,7 +2792,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -2806,7 +2806,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2829,13 +2829,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _notifications_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _notifications_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2849,8 +2849,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "body" => Some(("body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2872,7 +2872,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Notification = json::value::from_value(object).unwrap(); let mut call = self.hub.notifications().patch(request, opt.value_of("customer").unwrap_or(""), opt.value_of("notification-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2885,7 +2885,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2898,7 +2898,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2921,13 +2921,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _notifications_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _notifications_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2941,8 +2941,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "body" => Some(("body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2964,7 +2964,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Notification = json::value::from_value(object).unwrap(); let mut call = self.hub.notifications().update(request, opt.value_of("customer").unwrap_or(""), opt.value_of("notification-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2977,7 +2977,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2990,7 +2990,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3013,10 +3013,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orgunits_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orgunits_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.orgunits().delete(opt.value_of("customer-id").unwrap_or(""), &opt.values_of("org-unit-path").unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.orgunits().delete(opt.value_of("customer-id").unwrap_or(""), &opt.values_of("org-unit-path").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3029,7 +3029,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3042,7 +3042,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3057,10 +3057,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orgunits_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orgunits_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.orgunits().get(opt.value_of("customer-id").unwrap_or(""), &opt.values_of("org-unit-path").unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.orgunits().get(opt.value_of("customer-id").unwrap_or(""), &opt.values_of("org-unit-path").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3073,7 +3073,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3086,7 +3086,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3109,13 +3109,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orgunits_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orgunits_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3129,8 +3129,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "parent-org-unit-path" => Some(("parentOrgUnitPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3153,7 +3153,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrgUnit = json::value::from_value(object).unwrap(); let mut call = self.hub.orgunits().insert(request, opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3166,7 +3166,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3179,7 +3179,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3202,10 +3202,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orgunits_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orgunits_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orgunits().list(opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "type" => { @@ -3224,7 +3224,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["type", "org-unit-path"].iter().map(|v|*v)); @@ -3238,7 +3238,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3261,13 +3261,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orgunits_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orgunits_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3281,8 +3281,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "parent-org-unit-path" => Some(("parentOrgUnitPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3304,8 +3304,8 @@ impl<'n, 'a> Engine<'n, 'a> { } } let mut request: api::OrgUnit = json::value::from_value(object).unwrap(); - let mut call = self.hub.orgunits().patch(request, opt.value_of("customer-id").unwrap_or(""), &opt.values_of("org-unit-path").unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.orgunits().patch(request, opt.value_of("customer-id").unwrap_or(""), &opt.values_of("org-unit-path").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3318,7 +3318,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3331,7 +3331,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3354,13 +3354,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orgunits_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orgunits_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3374,8 +3374,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "parent-org-unit-path" => Some(("parentOrgUnitPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3397,8 +3397,8 @@ impl<'n, 'a> Engine<'n, 'a> { } } let mut request: api::OrgUnit = json::value::from_value(object).unwrap(); - let mut call = self.hub.orgunits().update(request, opt.value_of("customer-id").unwrap_or(""), &opt.values_of("org-unit-path").unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.orgunits().update(request, opt.value_of("customer-id").unwrap_or(""), &opt.values_of("org-unit-path").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3411,7 +3411,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3424,7 +3424,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3447,10 +3447,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _privileges_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _privileges_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.privileges().list(opt.value_of("customer").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3463,7 +3463,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3476,7 +3476,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3499,10 +3499,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _role_assignments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _resources_calendars_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.role_assignments().delete(opt.value_of("customer").unwrap_or(""), opt.value_of("role-assignment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.resources().calendars_delete(opt.value_of("customer").unwrap_or(""), opt.value_of("calendar-resource-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3515,7 +3515,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3528,7 +3528,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3543,10 +3543,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _role_assignments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _resources_calendars_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.role_assignments().get(opt.value_of("customer").unwrap_or(""), opt.value_of("role-assignment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.resources().calendars_get(opt.value_of("customer").unwrap_or(""), opt.value_of("calendar-resource-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3559,7 +3559,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3572,7 +3572,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3595,13 +3595,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _role_assignments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _resources_calendars_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3615,8 +3615,436 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-type" => Some(("resourceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-description" => Some(("resourceDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "etags" => Some(("etags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-email" => Some(("resourceEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-name" => Some(("resourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-id" => Some(("resourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etags", "kind", "resource-description", "resource-email", "resource-id", "resource-name", "resource-type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CalendarResource = json::value::from_value(object).unwrap(); + let mut call = self.hub.resources().calendars_insert(request, opt.value_of("customer").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _resources_calendars_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.resources().calendars_list(opt.value_of("customer").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _resources_calendars_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-type" => Some(("resourceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-description" => Some(("resourceDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "etags" => Some(("etags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-email" => Some(("resourceEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-name" => Some(("resourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-id" => Some(("resourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etags", "kind", "resource-description", "resource-email", "resource-id", "resource-name", "resource-type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CalendarResource = json::value::from_value(object).unwrap(); + let mut call = self.hub.resources().calendars_patch(request, opt.value_of("customer").unwrap_or(""), opt.value_of("calendar-resource-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _resources_calendars_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-type" => Some(("resourceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-description" => Some(("resourceDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "etags" => Some(("etags", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-email" => Some(("resourceEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-name" => Some(("resourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-id" => Some(("resourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etags", "kind", "resource-description", "resource-email", "resource-id", "resource-name", "resource-type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CalendarResource = json::value::from_value(object).unwrap(); + let mut call = self.hub.resources().calendars_update(request, opt.value_of("customer").unwrap_or(""), opt.value_of("calendar-resource-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _role_assignments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.role_assignments().delete(opt.value_of("customer").unwrap_or(""), opt.value_of("role-assignment-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _role_assignments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.role_assignments().get(opt.value_of("customer").unwrap_or(""), opt.value_of("role-assignment-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _role_assignments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role-assignment-id" => Some(("roleAssignmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3637,7 +4065,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RoleAssignment = json::value::from_value(object).unwrap(); let mut call = self.hub.role_assignments().insert(request, opt.value_of("customer").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3650,7 +4078,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3663,7 +4091,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3686,10 +4114,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _role_assignments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _role_assignments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.role_assignments().list(opt.value_of("customer").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-key" => { @@ -3714,7 +4142,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["user-key", "max-results", "page-token", "role-id"].iter().map(|v|*v)); @@ -3728,7 +4156,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3751,10 +4179,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _roles_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _roles_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.roles().delete(opt.value_of("customer").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3767,7 +4195,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3780,7 +4208,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3795,10 +4223,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _roles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _roles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.roles().get(opt.value_of("customer").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3811,7 +4239,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3824,7 +4252,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3847,13 +4275,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _roles_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _roles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3867,8 +4295,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role-id" => Some(("roleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3889,7 +4317,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Role = json::value::from_value(object).unwrap(); let mut call = self.hub.roles().insert(request, opt.value_of("customer").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3902,7 +4330,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3915,7 +4343,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3938,10 +4366,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _roles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _roles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.roles().list(opt.value_of("customer").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3960,7 +4388,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -3974,7 +4402,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3997,13 +4425,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _roles_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _roles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4017,8 +4445,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role-id" => Some(("roleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4039,7 +4467,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Role = json::value::from_value(object).unwrap(); let mut call = self.hub.roles().patch(request, opt.value_of("customer").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4052,7 +4480,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4065,7 +4493,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4088,13 +4516,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _roles_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _roles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4108,8 +4536,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role-id" => Some(("roleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4130,7 +4558,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Role = json::value::from_value(object).unwrap(); let mut call = self.hub.roles().update(request, opt.value_of("customer").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4143,7 +4571,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4156,7 +4584,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4179,10 +4607,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _schemas_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _schemas_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.schemas().delete(opt.value_of("customer-id").unwrap_or(""), opt.value_of("schema-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4195,7 +4623,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4208,7 +4636,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4223,10 +4651,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _schemas_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _schemas_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.schemas().get(opt.value_of("customer-id").unwrap_or(""), opt.value_of("schema-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4239,7 +4667,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4252,7 +4680,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4275,13 +4703,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _schemas_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _schemas_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4295,8 +4723,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4314,7 +4742,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Schema = json::value::from_value(object).unwrap(); let mut call = self.hub.schemas().insert(request, opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4327,7 +4755,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4340,7 +4768,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4363,10 +4791,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _schemas_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _schemas_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.schemas().list(opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4379,7 +4807,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4392,7 +4820,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4415,13 +4843,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _schemas_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _schemas_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4435,8 +4863,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4454,7 +4882,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Schema = json::value::from_value(object).unwrap(); let mut call = self.hub.schemas().patch(request, opt.value_of("customer-id").unwrap_or(""), opt.value_of("schema-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4467,7 +4895,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4480,7 +4908,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4503,13 +4931,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _schemas_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _schemas_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4523,8 +4951,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4542,7 +4970,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Schema = json::value::from_value(object).unwrap(); let mut call = self.hub.schemas().update(request, opt.value_of("customer-id").unwrap_or(""), opt.value_of("schema-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4555,7 +4983,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4568,7 +4996,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4591,10 +5019,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tokens_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tokens_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tokens().delete(opt.value_of("user-key").unwrap_or(""), opt.value_of("client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4607,7 +5035,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4620,7 +5048,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4635,10 +5063,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tokens_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tokens_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tokens().get(opt.value_of("user-key").unwrap_or(""), opt.value_of("client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4651,7 +5079,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4664,7 +5092,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4687,10 +5115,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tokens_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tokens_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tokens().list(opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4703,7 +5131,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4716,7 +5144,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4739,10 +5167,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_aliases_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_aliases_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().aliases_delete(opt.value_of("user-key").unwrap_or(""), opt.value_of("alias").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4755,7 +5183,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4768,7 +5196,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4783,13 +5211,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_aliases_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_aliases_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4803,8 +5231,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "alias" => Some(("alias", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4823,7 +5251,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Alias = json::value::from_value(object).unwrap(); let mut call = self.hub.users().aliases_insert(request, opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4836,7 +5264,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4849,7 +5277,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4872,10 +5300,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_aliases_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_aliases_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().aliases_list(opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "event" => { @@ -4891,7 +5319,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["event"].iter().map(|v|*v)); @@ -4905,7 +5333,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4928,13 +5356,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_aliases_watch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_aliases_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4948,8 +5376,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4973,7 +5401,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.users().aliases_watch(request, opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "event" => { @@ -4989,7 +5417,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["event"].iter().map(|v|*v)); @@ -5003,7 +5431,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5026,10 +5454,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().delete(opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5042,7 +5470,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5055,7 +5483,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -5070,10 +5498,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().get(opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view-type" => { @@ -5095,7 +5523,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["view-type", "custom-field-mask", "projection"].iter().map(|v|*v)); @@ -5109,7 +5537,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5132,13 +5560,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5152,8 +5580,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "is-delegated-admin" => Some(("isDelegatedAdmin", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "thumbnail-photo-etag" => Some(("thumbnailPhotoEtag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5194,7 +5622,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::User = json::value::from_value(object).unwrap(); let mut call = self.hub.users().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5207,7 +5635,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5220,7 +5648,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5243,10 +5671,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view-type" => { @@ -5295,7 +5723,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "customer", "domain", "projection", "page-token", "custom-field-mask", "max-results", "show-deleted", "sort-order", "query", "view-type", "event"].iter().map(|v|*v)); @@ -5309,7 +5737,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5332,13 +5760,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_make_admin(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_make_admin(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5352,8 +5780,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { @@ -5368,7 +5796,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserMakeAdmin = json::value::from_value(object).unwrap(); let mut call = self.hub.users().make_admin(request, opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5381,7 +5809,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5394,7 +5822,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -5409,13 +5837,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5429,8 +5857,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "is-delegated-admin" => Some(("isDelegatedAdmin", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "thumbnail-photo-etag" => Some(("thumbnailPhotoEtag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5471,7 +5899,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::User = json::value::from_value(object).unwrap(); let mut call = self.hub.users().patch(request, opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5484,7 +5912,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5497,7 +5925,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5520,10 +5948,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_photos_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_photos_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().photos_delete(opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5536,7 +5964,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5549,7 +5977,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -5564,10 +5992,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_photos_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_photos_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().photos_get(opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5580,7 +6008,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5593,7 +6021,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5616,13 +6044,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_photos_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_photos_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5636,8 +6064,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5659,7 +6087,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserPhoto = json::value::from_value(object).unwrap(); let mut call = self.hub.users().photos_patch(request, opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5672,7 +6100,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5685,7 +6113,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5708,13 +6136,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_photos_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_photos_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5728,8 +6156,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5751,7 +6179,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserPhoto = json::value::from_value(object).unwrap(); let mut call = self.hub.users().photos_update(request, opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5764,7 +6192,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5777,7 +6205,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5800,13 +6228,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_undelete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_undelete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5820,8 +6248,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "org-unit-path" => Some(("orgUnitPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -5836,7 +6264,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserUndelete = json::value::from_value(object).unwrap(); let mut call = self.hub.users().undelete(request, opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5849,7 +6277,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5862,7 +6290,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -5877,13 +6305,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5897,8 +6325,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "is-delegated-admin" => Some(("isDelegatedAdmin", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "thumbnail-photo-etag" => Some(("thumbnailPhotoEtag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5939,7 +6367,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::User = json::value::from_value(object).unwrap(); let mut call = self.hub.users().update(request, opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5952,7 +6380,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5965,7 +6393,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5988,13 +6416,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_watch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6008,8 +6436,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6033,7 +6461,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.users().watch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view-type" => { @@ -6082,7 +6510,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "customer", "domain", "projection", "page-token", "custom-field-mask", "max-results", "show-deleted", "sort-order", "query", "view-type", "event"].iter().map(|v|*v)); @@ -6096,7 +6524,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6119,10 +6547,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _verification_codes_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _verification_codes_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.verification_codes().generate(opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6135,7 +6563,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6148,7 +6576,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -6163,10 +6591,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _verification_codes_invalidate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _verification_codes_invalidate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.verification_codes().invalidate(opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6179,7 +6607,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6192,7 +6620,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -6207,10 +6635,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _verification_codes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _verification_codes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.verification_codes().list(opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6223,7 +6651,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6236,7 +6664,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6510,6 +6938,32 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, + ("resources", Some(opt)) => { + match opt.subcommand() { + ("calendars-delete", Some(opt)) => { + call_result = self._resources_calendars_delete(opt, dry_run, &mut err); + }, + ("calendars-get", Some(opt)) => { + call_result = self._resources_calendars_get(opt, dry_run, &mut err); + }, + ("calendars-insert", Some(opt)) => { + call_result = self._resources_calendars_insert(opt, dry_run, &mut err); + }, + ("calendars-list", Some(opt)) => { + call_result = self._resources_calendars_list(opt, dry_run, &mut err); + }, + ("calendars-patch", Some(opt)) => { + call_result = self._resources_calendars_patch(opt, dry_run, &mut err); + }, + ("calendars-update", Some(opt)) => { + call_result = self._resources_calendars_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("resources".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("role-assignments", Some(opt)) => { match opt.subcommand() { ("delete", Some(opt)) => { @@ -6692,14 +7146,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "admin1-directory-secret.json", + match cmn::application_secret_from_directory(&config_dir, "admin1-directory-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -6719,7 +7173,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -6758,7 +7212,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("asps", "methods: 'delete', 'get' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Delete an ASP issued by a user."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/asps_delete", vec![ @@ -6780,7 +7234,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Get information about an ASP issued by a user."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/asps_get", vec![ @@ -6808,7 +7262,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List the ASPs issued by a user."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/asps_list", vec![ @@ -6833,7 +7287,7 @@ fn main() { ]), ("channels", "methods: 'stop'", vec![ - ("stop", + ("stop", Some(r##"Stop watching resources through this channel"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/channels_stop", vec![ @@ -6852,7 +7306,7 @@ fn main() { ]), ("chromeosdevices", "methods: 'get', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Retrieve Chrome OS Device"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/chromeosdevices_get", vec![ @@ -6880,7 +7334,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieve all Chrome OS Devices of a customer (paginated)"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/chromeosdevices_list", vec![ @@ -6902,7 +7356,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update Chrome OS Device. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/chromeosdevices_patch", vec![ @@ -6936,7 +7390,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update Chrome OS Device"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/chromeosdevices_update", vec![ @@ -6973,7 +7427,7 @@ fn main() { ]), ("customers", "methods: 'get', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Retrives a customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/customers_get", vec![ @@ -6995,7 +7449,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a customer. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/customers_patch", vec![ @@ -7023,7 +7477,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/customers_update", vec![ @@ -7054,7 +7508,7 @@ fn main() { ]), ("domain-aliases", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes a Domain Alias of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/domain-aliases_delete", vec![ @@ -7076,7 +7530,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves a domain alias of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/domain-aliases_get", vec![ @@ -7104,7 +7558,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a Domain alias of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/domain-aliases_insert", vec![ @@ -7132,7 +7586,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the domain aliases of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/domain-aliases_list", vec![ @@ -7157,7 +7611,7 @@ fn main() { ]), ("domains", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes a domain of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/domains_delete", vec![ @@ -7179,7 +7633,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrives a domain of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/domains_get", vec![ @@ -7207,7 +7661,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a domain of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/domains_insert", vec![ @@ -7235,7 +7689,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the domains of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/domains_list", vec![ @@ -7260,7 +7714,7 @@ fn main() { ]), ("groups", "methods: 'aliases-delete', 'aliases-insert', 'aliases-list', 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("aliases-delete", + ("aliases-delete", Some(r##"Remove a alias for the group"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/groups_aliases-delete", vec![ @@ -7282,7 +7736,7 @@ fn main() { Some(false), Some(true)), ]), - ("aliases-insert", + ("aliases-insert", Some(r##"Add a alias for the group"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/groups_aliases-insert", vec![ @@ -7310,7 +7764,7 @@ fn main() { Some(false), Some(false)), ]), - ("aliases-list", + ("aliases-list", Some(r##"List all aliases for a group"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/groups_aliases-list", vec![ @@ -7332,7 +7786,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete Group"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/groups_delete", vec![ @@ -7348,7 +7802,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieve Group"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/groups_get", vec![ @@ -7370,7 +7824,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Create Group"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/groups_insert", vec![ @@ -7392,7 +7846,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieve all groups in a domain (paginated)"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/groups_list", vec![ @@ -7408,7 +7862,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update Group. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/groups_patch", vec![ @@ -7436,7 +7890,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update Group"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/groups_update", vec![ @@ -7467,7 +7921,7 @@ fn main() { ]), ("members", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Remove membership."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/members_delete", vec![ @@ -7489,7 +7943,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieve Group Member"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/members_get", vec![ @@ -7517,7 +7971,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Add user to the specified group."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/members_insert", vec![ @@ -7545,7 +7999,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieve all members in a group (paginated)"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/members_list", vec![ @@ -7567,7 +8021,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update membership of a user in the specified group. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/members_patch", vec![ @@ -7601,7 +8055,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update membership of a user in the specified group."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/members_update", vec![ @@ -7638,7 +8092,7 @@ fn main() { ]), ("mobiledevices", "methods: 'action', 'delete', 'get' and 'list'", vec![ - ("action", + ("action", Some(r##"Take action on Mobile Device"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/mobiledevices_action", vec![ @@ -7666,7 +8120,7 @@ fn main() { Some(false), Some(true)), ]), - ("delete", + ("delete", Some(r##"Delete Mobile Device"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/mobiledevices_delete", vec![ @@ -7688,7 +8142,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieve Mobile Device"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/mobiledevices_get", vec![ @@ -7716,7 +8170,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieve all Mobile Devices of a customer (paginated)"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/mobiledevices_list", vec![ @@ -7741,7 +8195,7 @@ fn main() { ]), ("notifications", "methods: 'delete', 'get', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a notification"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/notifications_delete", vec![ @@ -7763,7 +8217,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves a notification."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/notifications_get", vec![ @@ -7791,7 +8245,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of notifications."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/notifications_list", vec![ @@ -7813,7 +8267,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a notification. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/notifications_patch", vec![ @@ -7847,7 +8301,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a notification."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/notifications_update", vec![ @@ -7884,7 +8338,7 @@ fn main() { ]), ("orgunits", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Remove Organization Unit"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/orgunits_delete", vec![ @@ -7906,7 +8360,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieve Organization Unit"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/orgunits_get", vec![ @@ -7934,7 +8388,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Add Organization Unit"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/orgunits_insert", vec![ @@ -7962,7 +8416,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieve all Organization Units"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/orgunits_list", vec![ @@ -7984,7 +8438,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update Organization Unit. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/orgunits_patch", vec![ @@ -8018,7 +8472,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update Organization Unit"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/orgunits_update", vec![ @@ -8055,7 +8509,7 @@ fn main() { ]), ("privileges", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a paginated list of all privileges for a customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/privileges_list", vec![ @@ -8079,8 +8533,179 @@ fn main() { ]), ]), + ("resources", "methods: 'calendars-delete', 'calendars-get', 'calendars-insert', 'calendars-list', 'calendars-patch' and 'calendars-update'", vec![ + ("calendars-delete", + Some(r##"Deletes a calendar resource."##), + "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/resources_calendars-delete", + vec![ + (Some(r##"customer"##), + None, + Some(r##"The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID."##), + Some(true), + Some(false)), + + (Some(r##"calendar-resource-id"##), + None, + Some(r##"The unique ID of the calendar resource to delete."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("calendars-get", + Some(r##"Retrieves a calendar resource."##), + "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/resources_calendars-get", + vec![ + (Some(r##"customer"##), + None, + Some(r##"The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID."##), + Some(true), + Some(false)), + + (Some(r##"calendar-resource-id"##), + None, + Some(r##"The unique ID of the calendar resource to retrieve."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("calendars-insert", + Some(r##"Inserts a calendar resource."##), + "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/resources_calendars-insert", + vec![ + (Some(r##"customer"##), + None, + Some(r##"The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("calendars-list", + Some(r##"Retrieves a list of calendar resources for an account."##), + "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/resources_calendars-list", + vec![ + (Some(r##"customer"##), + None, + Some(r##"The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("calendars-patch", + Some(r##"Updates a calendar resource. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/resources_calendars-patch", + vec![ + (Some(r##"customer"##), + None, + Some(r##"The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID."##), + Some(true), + Some(false)), + + (Some(r##"calendar-resource-id"##), + None, + Some(r##"The unique ID of the calendar resource to update."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("calendars-update", + Some(r##"Updates a calendar resource."##), + "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/resources_calendars-update", + vec![ + (Some(r##"customer"##), + None, + Some(r##"The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID."##), + Some(true), + Some(false)), + + (Some(r##"calendar-resource-id"##), + None, + Some(r##"The unique ID of the calendar resource to update."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("role-assignments", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes a role assignment."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/role-assignments_delete", vec![ @@ -8102,7 +8727,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieve a role assignment."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/role-assignments_get", vec![ @@ -8130,7 +8755,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a role assignment."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/role-assignments_insert", vec![ @@ -8158,7 +8783,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a paginated list of all roleAssignments."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/role-assignments_list", vec![ @@ -8183,7 +8808,7 @@ fn main() { ]), ("roles", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a role."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/roles_delete", vec![ @@ -8205,7 +8830,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves a role."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/roles_get", vec![ @@ -8233,7 +8858,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a role."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/roles_insert", vec![ @@ -8261,7 +8886,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a paginated list of all the roles in a domain."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/roles_list", vec![ @@ -8283,7 +8908,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a role. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/roles_patch", vec![ @@ -8317,7 +8942,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a role."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/roles_update", vec![ @@ -8354,7 +8979,7 @@ fn main() { ]), ("schemas", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Delete schema"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/schemas_delete", vec![ @@ -8376,7 +9001,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieve schema"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/schemas_get", vec![ @@ -8404,7 +9029,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Create schema."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/schemas_insert", vec![ @@ -8432,7 +9057,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieve all schemas for a customer"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/schemas_list", vec![ @@ -8454,7 +9079,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update schema. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/schemas_patch", vec![ @@ -8488,7 +9113,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update schema"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/schemas_update", vec![ @@ -8525,7 +9150,7 @@ fn main() { ]), ("tokens", "methods: 'delete', 'get' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Delete all access tokens issued by a user for an application."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/tokens_delete", vec![ @@ -8547,7 +9172,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Get information about an access token issued by a user."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/tokens_get", vec![ @@ -8575,7 +9200,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns the set of tokens specified user has issued to 3rd party applications."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/tokens_list", vec![ @@ -8600,7 +9225,7 @@ fn main() { ]), ("users", "methods: 'aliases-delete', 'aliases-insert', 'aliases-list', 'aliases-watch', 'delete', 'get', 'insert', 'list', 'make-admin', 'patch', 'photos-delete', 'photos-get', 'photos-patch', 'photos-update', 'undelete', 'update' and 'watch'", vec![ - ("aliases-delete", + ("aliases-delete", Some(r##"Remove a alias for the user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_aliases-delete", vec![ @@ -8622,7 +9247,7 @@ fn main() { Some(false), Some(true)), ]), - ("aliases-insert", + ("aliases-insert", Some(r##"Add a alias for the user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_aliases-insert", vec![ @@ -8650,7 +9275,7 @@ fn main() { Some(false), Some(false)), ]), - ("aliases-list", + ("aliases-list", Some(r##"List all aliases for a user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_aliases-list", vec![ @@ -8672,7 +9297,7 @@ fn main() { Some(false), Some(false)), ]), - ("aliases-watch", + ("aliases-watch", Some(r##"Watch for changes in user aliases list"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_aliases-watch", vec![ @@ -8700,7 +9325,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_delete", vec![ @@ -8716,7 +9341,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"retrieve user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_get", vec![ @@ -8738,7 +9363,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"create user."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_insert", vec![ @@ -8760,7 +9385,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieve either deleted users or all users in a domain (paginated)"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_list", vec![ @@ -8776,7 +9401,7 @@ fn main() { Some(false), Some(false)), ]), - ("make-admin", + ("make-admin", Some(r##"change admin status of a user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_make-admin", vec![ @@ -8798,7 +9423,7 @@ fn main() { Some(false), Some(true)), ]), - ("patch", + ("patch", Some(r##"update user. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_patch", vec![ @@ -8826,7 +9451,7 @@ fn main() { Some(false), Some(false)), ]), - ("photos-delete", + ("photos-delete", Some(r##"Remove photos for the user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_photos-delete", vec![ @@ -8842,7 +9467,7 @@ fn main() { Some(false), Some(true)), ]), - ("photos-get", + ("photos-get", Some(r##"Retrieve photo of a user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_photos-get", vec![ @@ -8864,7 +9489,7 @@ fn main() { Some(false), Some(false)), ]), - ("photos-patch", + ("photos-patch", Some(r##"Add a photo for the user. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_photos-patch", vec![ @@ -8892,7 +9517,7 @@ fn main() { Some(false), Some(false)), ]), - ("photos-update", + ("photos-update", Some(r##"Add a photo for the user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_photos-update", vec![ @@ -8920,7 +9545,7 @@ fn main() { Some(false), Some(false)), ]), - ("undelete", + ("undelete", Some(r##"Undelete a deleted user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_undelete", vec![ @@ -8942,7 +9567,7 @@ fn main() { Some(false), Some(true)), ]), - ("update", + ("update", Some(r##"update user"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_update", vec![ @@ -8970,7 +9595,7 @@ fn main() { Some(false), Some(false)), ]), - ("watch", + ("watch", Some(r##"Watch for changes in users list"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/users_watch", vec![ @@ -8995,7 +9620,7 @@ fn main() { ]), ("verification-codes", "methods: 'generate', 'invalidate' and 'list'", vec![ - ("generate", + ("generate", Some(r##"Generate new backup verification codes for the user."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/verification-codes_generate", vec![ @@ -9011,7 +9636,7 @@ fn main() { Some(false), Some(true)), ]), - ("invalidate", + ("invalidate", Some(r##"Invalidate the current backup verification codes for the user."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/verification-codes_invalidate", vec![ @@ -9027,7 +9652,7 @@ fn main() { Some(false), Some(true)), ]), - ("list", + ("list", Some(r##"Returns the current set of valid backup verification codes for the specified user."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_directory_cli/verification-codes_list", vec![ @@ -9055,7 +9680,7 @@ fn main() { let mut app = App::new("admin1-directory") .author("Sebastian Thiel ") - .version("0.3.2+20151005") + .version("0.3.3+20151208") .about("The Admin SDK Directory API lets you view and manage enterprise resources such as users and groups, administrative notifications, security features, and more.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_admin1_directory_cli") .arg(Arg::with_name("url") @@ -9079,7 +9704,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -9090,7 +9715,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/admin1_directory/Cargo.toml b/gen/admin1_directory/Cargo.toml index 0a4532b8cc..1dddffad36 100644 --- a/gen/admin1_directory/Cargo.toml +++ b/gen/admin1_directory/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-admin1_directory" -version = "0.1.10+20151005" +version = "0.1.11+20151208" authors = ["Sebastian Thiel "] description = "A complete library to interact with directory (protocol directory_v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/admin1_directory/LICENSE.md b/gen/admin1_directory/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/admin1_directory/LICENSE.md +++ b/gen/admin1_directory/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/admin1_directory/README.md b/gen/admin1_directory/README.md index 17782129db..60c8b4f7a2 100644 --- a/gen/admin1_directory/README.md +++ b/gen/admin1_directory/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-admin1_directory` library allows access to all features of the *Google directory* service. -This documentation was generated from *directory* crate version *0.1.10+20151005*, where *20151005* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *directory* crate version *0.1.11+20151208*, where *20151208* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *directory* *v1_directory* API can be found at the [official documentation site](https://developers.google.com/admin-sdk/directory/). @@ -37,6 +37,8 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [*delete*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.OrgunitDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.OrgunitGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.OrgunitInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.OrgunitListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.OrgunitPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.OrgunitUpdateCall.html) * [privileges](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.Privilege.html) * [*list*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.PrivilegeListCall.html) +* resources + * [*calendars delete*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ResourceCalendarDeleteCall.html), [*calendars get*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ResourceCalendarGetCall.html), [*calendars insert*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ResourceCalendarInsertCall.html), [*calendars list*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ResourceCalendarListCall.html), [*calendars patch*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ResourceCalendarPatchCall.html) and [*calendars update*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.ResourceCalendarUpdateCall.html) * [role assignments](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.RoleAssignment.html) * [*delete*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.RoleAssignmentDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.RoleAssignmentGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.RoleAssignmentInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.RoleAssignmentListCall.html) * [roles](http://byron.github.io/google-apis-rs/google_admin1_directory/struct.Role.html) diff --git a/gen/admin1_directory/src/cmn.rs b/gen/admin1_directory/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/admin1_directory/src/cmn.rs +++ b/gen/admin1_directory/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/admin1_directory/src/lib.rs b/gen/admin1_directory/src/lib.rs index d6f0d12e82..bdd78c5978 100644 --- a/gen/admin1_directory/src/lib.rs +++ b/gen/admin1_directory/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *directory* crate version *0.1.10+20151005*, where *20151005* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *directory* crate version *0.1.11+20151208*, where *20151208* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *directory* *v1_directory* API can be found at the //! [official documentation site](https://developers.google.com/admin-sdk/directory/). @@ -35,6 +35,8 @@ //! * [*delete*](struct.OrgunitDeleteCall.html), [*get*](struct.OrgunitGetCall.html), [*insert*](struct.OrgunitInsertCall.html), [*list*](struct.OrgunitListCall.html), [*patch*](struct.OrgunitPatchCall.html) and [*update*](struct.OrgunitUpdateCall.html) //! * [privileges](struct.Privilege.html) //! * [*list*](struct.PrivilegeListCall.html) +//! * resources +//! * [*calendars delete*](struct.ResourceCalendarDeleteCall.html), [*calendars get*](struct.ResourceCalendarGetCall.html), [*calendars insert*](struct.ResourceCalendarInsertCall.html), [*calendars list*](struct.ResourceCalendarListCall.html), [*calendars patch*](struct.ResourceCalendarPatchCall.html) and [*calendars update*](struct.ResourceCalendarUpdateCall.html) //! * [role assignments](struct.RoleAssignment.html) //! * [*delete*](struct.RoleAssignmentDeleteCall.html), [*get*](struct.RoleAssignmentGetCall.html), [*insert*](struct.RoleAssignmentInsertCall.html) and [*list*](struct.RoleAssignmentListCall.html) //! * [roles](struct.Role.html) @@ -159,17 +161,17 @@ //! // Values shown here are possibly random and not representative ! //! let result = hub.users().watch(req) //! .view_type("et") -//! .sort_order("Stet") -//! .show_deleted("sed") -//! .query("dolor") -//! .projection("sanctus") -//! .page_token("dolore") -//! .order_by("Lorem") -//! .max_results(-96) -//! .event("consetetur") -//! .domain("eirmod") -//! .customer("labore") -//! .custom_field_mask("gubergren") +//! .sort_order("sadipscing") +//! .show_deleted("accusam") +//! .query("magna") +//! .projection("Lorem") +//! .page_token("rebum.") +//! .order_by("et") +//! .max_results(-64) +//! .event("eos") +//! .domain("dolores") +//! .customer("vero") +//! .custom_field_mask("consetetur") //! .doit(); //! //! match result { diff --git a/gen/admin1_directory/src/lib.rs.in b/gen/admin1_directory/src/lib.rs.in index 5f8145909e..aea30a4aa7 100644 --- a/gen/admin1_directory/src/lib.rs.in +++ b/gen/admin1_directory/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -38,8 +39,8 @@ pub enum Scope { /// View and manage the provisioning of users on your domain DirectoryUser, - /// View and manage notifications received on your domain - DirectoryNotification, + /// View calendar resources on your domain + DirectoryResourceCalendarReadonly, /// Manage data access permissions for users on your domain DirectoryUserSecurity, @@ -59,8 +60,8 @@ pub enum Scope { /// View your Chrome OS devices' metadata DirectoryDeviceChromeoReadonly, - /// View domains related to your customers - DirectoryDomainReadonly, + /// View and manage the provisioning of calendar resources on your domain + DirectoryResourceCalendar, /// View group subscriptions on your domain DirectoryGroupMemberReadonly, @@ -86,12 +87,18 @@ pub enum Scope { /// View customer related information DirectoryCustomerReadonly, + /// View domains related to your customers + DirectoryDomainReadonly, + /// Manage your mobile devices by performing administrative tasks DirectoryDeviceMobileAction, /// View users on your domain DirectoryUserReadonly, + /// View and manage notifications received on your domain + DirectoryNotification, + /// View and manage your Chrome OS devices' metadata DirectoryDeviceChromeo, @@ -115,14 +122,14 @@ impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { Scope::DirectoryUser => "https://www.googleapis.com/auth/admin.directory.user", - Scope::DirectoryNotification => "https://www.googleapis.com/auth/admin.directory.notifications", + Scope::DirectoryResourceCalendarReadonly => "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly", Scope::DirectoryUserSecurity => "https://www.googleapis.com/auth/admin.directory.user.security", Scope::DirectoryRolemanagement => "https://www.googleapis.com/auth/admin.directory.rolemanagement", Scope::DirectoryGroupReadonly => "https://www.googleapis.com/auth/admin.directory.group.readonly", Scope::DirectoryCustomer => "https://www.googleapis.com/auth/admin.directory.customer", Scope::DirectoryDomain => "https://www.googleapis.com/auth/admin.directory.domain", Scope::DirectoryDeviceChromeoReadonly => "https://www.googleapis.com/auth/admin.directory.device.chromeos.readonly", - Scope::DirectoryDomainReadonly => "https://www.googleapis.com/auth/admin.directory.domain.readonly", + Scope::DirectoryResourceCalendar => "https://www.googleapis.com/auth/admin.directory.resource.calendar", Scope::DirectoryGroupMemberReadonly => "https://www.googleapis.com/auth/admin.directory.group.member.readonly", Scope::DirectoryDeviceMobileReadonly => "https://www.googleapis.com/auth/admin.directory.device.mobile.readonly", Scope::DirectoryOrgunitReadonly => "https://www.googleapis.com/auth/admin.directory.orgunit.readonly", @@ -131,8 +138,10 @@ impl AsRef for Scope { Scope::DirectoryUserAlia => "https://www.googleapis.com/auth/admin.directory.user.alias", Scope::DirectoryUserschema => "https://www.googleapis.com/auth/admin.directory.userschema", Scope::DirectoryCustomerReadonly => "https://www.googleapis.com/auth/admin.directory.customer.readonly", + Scope::DirectoryDomainReadonly => "https://www.googleapis.com/auth/admin.directory.domain.readonly", Scope::DirectoryDeviceMobileAction => "https://www.googleapis.com/auth/admin.directory.device.mobile.action", Scope::DirectoryUserReadonly => "https://www.googleapis.com/auth/admin.directory.user.readonly", + Scope::DirectoryNotification => "https://www.googleapis.com/auth/admin.directory.notifications", Scope::DirectoryDeviceChromeo => "https://www.googleapis.com/auth/admin.directory.device.chromeos", Scope::DirectoryUserAliaReadonly => "https://www.googleapis.com/auth/admin.directory.user.alias.readonly", Scope::DirectoryGroup => "https://www.googleapis.com/auth/admin.directory.group", @@ -145,7 +154,7 @@ impl AsRef for Scope { impl Default for Scope { fn default() -> Scope { - Scope::DirectoryGroupReadonly + Scope::DirectoryResourceCalendarReadonly } } @@ -240,7 +249,7 @@ impl<'a, C, A> Directory Directory { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -280,6 +289,9 @@ impl<'a, C, A> Directory pub fn privileges(&'a self) -> PrivilegeMethods<'a, C, A> { PrivilegeMethods { hub: &self } } + pub fn resources(&'a self) -> ResourceMethods<'a, C, A> { + ResourceMethods { hub: &self } + } pub fn role_assignments(&'a self) -> RoleAssignmentMethods<'a, C, A> { RoleAssignmentMethods { hub: &self } } @@ -300,7 +312,7 @@ impl<'a, C, A> Directory } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -669,6 +681,45 @@ pub struct Privilege { impl Resource for Privilege {} +/// JSON template for Calendar Resource object in Directory API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [calendars insert resources](struct.ResourceCalendarInsertCall.html) (request|response) +/// * [calendars get resources](struct.ResourceCalendarGetCall.html) (response) +/// * [calendars patch resources](struct.ResourceCalendarPatchCall.html) (request|response) +/// * [calendars update resources](struct.ResourceCalendarUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CalendarResource { + /// The type of the resource. For calendar resources, the value is admin#directory#resources#calendars#CalendarResource. + pub kind: Option, + /// ETag of the resource. + pub etags: Option, + /// The name of the calendar resource. For example, Training Room 1A + #[serde(rename="resourceName")] + pub resource_name: Option, + /// The read-only email ID for the calendar resource. Generated as part of creating a new calendar resource. + #[serde(rename="resourceEmail")] + pub resource_email: Option, + /// The type of the calendar resource. Used for grouping resources in the calendar user interface. + #[serde(rename="resourceType")] + pub resource_type: Option, + /// The brief description of the calendar resource. + #[serde(rename="resourceDescription")] + pub resource_description: Option, + /// The unique ID for the calendar resource. + #[serde(rename="resourceId")] + pub resource_id: Option, +} + +impl RequestValue for CalendarResource {} +impl ResponseResult for CalendarResource {} + + /// JSON template for postal address of a customer. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1917,6 +1968,31 @@ pub struct Aliases { impl ResponseResult for Aliases {} +/// JSON template for Calendar Resource List Response object in Directory API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [calendars list resources](struct.ResourceCalendarListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CalendarResources { + /// The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The CalendarResources in this page of results. + pub items: Option>, + /// Identifies this as a collection of CalendarResources. This is always admin#directory#resources#calendars#calendarResourcesList. + pub kind: Option, + /// ETag of the resource. + pub etag: Option, +} + +impl ResponseResult for CalendarResources {} + + /// JSON response template for List Schema operation in Directory API. /// /// # Activities @@ -1944,208 +2020,6 @@ impl ResponseResult for Schemas {} // MethodBuilders ### // ################# -/// A builder providing access to all methods supported on *group* resources. -/// It is not used directly, but through the `Directory` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_admin1_directory as admin1_directory; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use admin1_directory::Directory; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Directory::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `aliases_delete(...)`, `aliases_insert(...)`, `aliases_list(...)`, `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.groups(); -/// # } -/// ``` -pub struct GroupMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, -} - -impl<'a, C, A> MethodsBuilder for GroupMethods<'a, C, A> {} - -impl<'a, C, A> GroupMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Delete Group - /// - /// # Arguments - /// - /// * `groupKey` - Email or immutable Id of the group - pub fn delete(&self, group_key: &str) -> GroupDeleteCall<'a, C, A> { - GroupDeleteCall { - hub: self.hub, - _group_key: group_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieve all groups in a domain (paginated) - pub fn list(&self) -> GroupListCall<'a, C, A> { - GroupListCall { - hub: self.hub, - _user_key: Default::default(), - _page_token: Default::default(), - _max_results: Default::default(), - _domain: Default::default(), - _customer: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Update Group - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `groupKey` - Email or immutable Id of the group. If Id, it should match with id of group object - pub fn update(&self, request: Group, group_key: &str) -> GroupUpdateCall<'a, C, A> { - GroupUpdateCall { - hub: self.hub, - _request: request, - _group_key: group_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Create Group - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn insert(&self, request: Group) -> GroupInsertCall<'a, C, A> { - GroupInsertCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Add a alias for the group - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `groupKey` - Email or immutable Id of the group - pub fn aliases_insert(&self, request: Alias, group_key: &str) -> GroupAliaseInsertCall<'a, C, A> { - GroupAliaseInsertCall { - hub: self.hub, - _request: request, - _group_key: group_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// List all aliases for a group - /// - /// # Arguments - /// - /// * `groupKey` - Email or immutable Id of the group - pub fn aliases_list(&self, group_key: &str) -> GroupAliaseListCall<'a, C, A> { - GroupAliaseListCall { - hub: self.hub, - _group_key: group_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieve Group - /// - /// # Arguments - /// - /// * `groupKey` - Email or immutable Id of the group - pub fn get(&self, group_key: &str) -> GroupGetCall<'a, C, A> { - GroupGetCall { - hub: self.hub, - _group_key: group_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Update Group. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `groupKey` - Email or immutable Id of the group. If Id, it should match with id of group object - pub fn patch(&self, request: Group, group_key: &str) -> GroupPatchCall<'a, C, A> { - GroupPatchCall { - hub: self.hub, - _request: request, - _group_key: group_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Remove a alias for the group - /// - /// # Arguments - /// - /// * `groupKey` - Email or immutable Id of the group - /// * `alias` - The alias to be removed - pub fn aliases_delete(&self, group_key: &str, alias: &str) -> GroupAliaseDeleteCall<'a, C, A> { - GroupAliaseDeleteCall { - hub: self.hub, - _group_key: group_key.to_string(), - _alias: alias.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - /// A builder providing access to all methods supported on *verificationCode* resources. /// It is not used directly, but through the `Directory` hub. /// @@ -2493,7 +2367,7 @@ impl<'a, C, A> OrgunitMethods<'a, C, A> { -/// A builder providing access to all methods supported on *user* resources. +/// A builder providing access to all methods supported on *member* resources. /// It is not used directly, but through the `Directory` hub. /// /// # Example @@ -2516,34 +2390,34 @@ impl<'a, C, A> OrgunitMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Directory::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `aliases_delete(...)`, `aliases_insert(...)`, `aliases_list(...)`, `aliases_watch(...)`, `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `make_admin(...)`, `patch(...)`, `photos_delete(...)`, `photos_get(...)`, `photos_patch(...)`, `photos_update(...)`, `undelete(...)`, `update(...)` and `watch(...)` +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` /// // to build up your call. -/// let rb = hub.users(); +/// let rb = hub.members(); /// # } /// ``` -pub struct UserMethods<'a, C, A> +pub struct MemberMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, } -impl<'a, C, A> MethodsBuilder for UserMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for MemberMethods<'a, C, A> {} -impl<'a, C, A> UserMethods<'a, C, A> { +impl<'a, C, A> MemberMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Undelete a deleted user + /// Add user to the specified group. /// /// # Arguments /// /// * `request` - No description provided. - /// * `userKey` - The immutable id of the user - pub fn undelete(&self, request: UserUndelete, user_key: &str) -> UserUndeleteCall<'a, C, A> { - UserUndeleteCall { + /// * `groupKey` - Email or immutable Id of the group + pub fn insert(&self, request: Member, group_key: &str) -> MemberInsertCall<'a, C, A> { + MemberInsertCall { hub: self.hub, _request: request, - _user_key: user_key.to_string(), + _group_key: group_key.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2552,15 +2426,19 @@ impl<'a, C, A> UserMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Remove photos for the user + /// Update membership of a user in the specified group. This method supports patch semantics. /// /// # Arguments /// - /// * `userKey` - Email or immutable Id of the user - pub fn photos_delete(&self, user_key: &str) -> UserPhotoDeleteCall<'a, C, A> { - UserPhotoDeleteCall { + /// * `request` - No description provided. + /// * `groupKey` - Email or immutable Id of the group. If Id, it should match with id of group object + /// * `memberKey` - Email or immutable Id of the user. If Id, it should match with id of member object + pub fn patch(&self, request: Member, group_key: &str, member_key: &str) -> MemberPatchCall<'a, C, A> { + MemberPatchCall { hub: self.hub, - _user_key: user_key.to_string(), + _request: request, + _group_key: group_key.to_string(), + _member_key: member_key.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2569,17 +2447,19 @@ impl<'a, C, A> UserMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Add a photo for the user. This method supports patch semantics. + /// Update membership of a user in the specified group. /// /// # Arguments /// /// * `request` - No description provided. - /// * `userKey` - Email or immutable Id of the user - pub fn photos_patch(&self, request: UserPhoto, user_key: &str) -> UserPhotoPatchCall<'a, C, A> { - UserPhotoPatchCall { + /// * `groupKey` - Email or immutable Id of the group. If Id, it should match with id of group object + /// * `memberKey` - Email or immutable Id of the user. If Id, it should match with id of member object + pub fn update(&self, request: Member, group_key: &str, member_key: &str) -> MemberUpdateCall<'a, C, A> { + MemberUpdateCall { hub: self.hub, _request: request, - _user_key: user_key.to_string(), + _group_key: group_key.to_string(), + _member_key: member_key.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2588,83 +2468,18 @@ impl<'a, C, A> UserMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// create user. + /// Retrieve all members in a group (paginated) /// /// # Arguments /// - /// * `request` - No description provided. - pub fn insert(&self, request: User) -> UserInsertCall<'a, C, A> { - UserInsertCall { + /// * `groupKey` - Email or immutable Id of the group + pub fn list(&self, group_key: &str) -> MemberListCall<'a, C, A> { + MemberListCall { hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Watch for changes in user aliases list - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `userKey` - Email or immutable Id of the user - pub fn aliases_watch(&self, request: Channel, user_key: &str) -> UserAliaseWatchCall<'a, C, A> { - UserAliaseWatchCall { - hub: self.hub, - _request: request, - _user_key: user_key.to_string(), - _event: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Add a photo for the user - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `userKey` - Email or immutable Id of the user - pub fn photos_update(&self, request: UserPhoto, user_key: &str) -> UserPhotoUpdateCall<'a, C, A> { - UserPhotoUpdateCall { - hub: self.hub, - _request: request, - _user_key: user_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Watch for changes in users list - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn watch(&self, request: Channel) -> UserWatchCall<'a, C, A> { - UserWatchCall { - hub: self.hub, - _request: request, - _view_type: Default::default(), - _sort_order: Default::default(), - _show_deleted: Default::default(), - _query: Default::default(), - _projection: Default::default(), + _group_key: group_key.to_string(), + _roles: Default::default(), _page_token: Default::default(), - _order_by: Default::default(), _max_results: Default::default(), - _event: Default::default(), - _domain: Default::default(), - _customer: Default::default(), - _custom_field_mask: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2673,17 +2488,17 @@ impl<'a, C, A> UserMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// update user + /// Retrieve Group Member /// /// # Arguments /// - /// * `request` - No description provided. - /// * `userKey` - Email or immutable Id of the user. If Id, it should match with id of user object - pub fn update(&self, request: User, user_key: &str) -> UserUpdateCall<'a, C, A> { - UserUpdateCall { + /// * `groupKey` - Email or immutable Id of the group + /// * `memberKey` - Email or immutable Id of the member + pub fn get(&self, group_key: &str, member_key: &str) -> MemberGetCall<'a, C, A> { + MemberGetCall { hub: self.hub, - _request: request, - _user_key: user_key.to_string(), + _group_key: group_key.to_string(), + _member_key: member_key.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2692,170 +2507,17 @@ impl<'a, C, A> UserMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieve photo of a user + /// Remove membership. /// /// # Arguments /// - /// * `userKey` - Email or immutable Id of the user - pub fn photos_get(&self, user_key: &str) -> UserPhotoGetCall<'a, C, A> { - UserPhotoGetCall { + /// * `groupKey` - Email or immutable Id of the group + /// * `memberKey` - Email or immutable Id of the member + pub fn delete(&self, group_key: &str, member_key: &str) -> MemberDeleteCall<'a, C, A> { + MemberDeleteCall { hub: self.hub, - _user_key: user_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieve either deleted users or all users in a domain (paginated) - pub fn list(&self) -> UserListCall<'a, C, A> { - UserListCall { - hub: self.hub, - _view_type: Default::default(), - _sort_order: Default::default(), - _show_deleted: Default::default(), - _query: Default::default(), - _projection: Default::default(), - _page_token: Default::default(), - _order_by: Default::default(), - _max_results: Default::default(), - _event: Default::default(), - _domain: Default::default(), - _customer: Default::default(), - _custom_field_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// retrieve user - /// - /// # Arguments - /// - /// * `userKey` - Email or immutable Id of the user - pub fn get(&self, user_key: &str) -> UserGetCall<'a, C, A> { - UserGetCall { - hub: self.hub, - _user_key: user_key.to_string(), - _view_type: Default::default(), - _projection: Default::default(), - _custom_field_mask: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Add a alias for the user - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `userKey` - Email or immutable Id of the user - pub fn aliases_insert(&self, request: Alias, user_key: &str) -> UserAliaseInsertCall<'a, C, A> { - UserAliaseInsertCall { - hub: self.hub, - _request: request, - _user_key: user_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// List all aliases for a user - /// - /// # Arguments - /// - /// * `userKey` - Email or immutable Id of the user - pub fn aliases_list(&self, user_key: &str) -> UserAliaseListCall<'a, C, A> { - UserAliaseListCall { - hub: self.hub, - _user_key: user_key.to_string(), - _event: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// change admin status of a user - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `userKey` - Email or immutable Id of the user as admin - pub fn make_admin(&self, request: UserMakeAdmin, user_key: &str) -> UserMakeAdminCall<'a, C, A> { - UserMakeAdminCall { - hub: self.hub, - _request: request, - _user_key: user_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// update user. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `userKey` - Email or immutable Id of the user. If Id, it should match with id of user object - pub fn patch(&self, request: User, user_key: &str) -> UserPatchCall<'a, C, A> { - UserPatchCall { - hub: self.hub, - _request: request, - _user_key: user_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Remove a alias for the user - /// - /// # Arguments - /// - /// * `userKey` - Email or immutable Id of the user - /// * `alias` - The alias to be removed - pub fn aliases_delete(&self, user_key: &str, alias: &str) -> UserAliaseDeleteCall<'a, C, A> { - UserAliaseDeleteCall { - hub: self.hub, - _user_key: user_key.to_string(), - _alias: alias.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Delete user - /// - /// # Arguments - /// - /// * `userKey` - Email or immutable Id of the user - pub fn delete(&self, user_key: &str) -> UserDeleteCall<'a, C, A> { - UserDeleteCall { - hub: self.hub, - _user_key: user_key.to_string(), + _group_key: group_key.to_string(), + _member_key: member_key.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3024,6 +2686,147 @@ impl<'a, C, A> RoleMethods<'a, C, A> { +/// A builder providing access to all methods supported on *notification* resources. +/// It is not used directly, but through the `Directory` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_admin1_directory as admin1_directory; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use admin1_directory::Directory; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Directory::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.notifications(); +/// # } +/// ``` +pub struct NotificationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, +} + +impl<'a, C, A> MethodsBuilder for NotificationMethods<'a, C, A> {} + +impl<'a, C, A> NotificationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of notifications. + /// + /// # Arguments + /// + /// * `customer` - The unique ID for the customer's Google account. + pub fn list(&self, customer: &str) -> NotificationListCall<'a, C, A> { + NotificationListCall { + hub: self.hub, + _customer: customer.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _language: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a notification. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `customer` - The unique ID for the customer's Google account. + /// * `notificationId` - The unique ID of the notification. + pub fn update(&self, request: Notification, customer: &str, notification_id: &str) -> NotificationUpdateCall<'a, C, A> { + NotificationUpdateCall { + hub: self.hub, + _request: request, + _customer: customer.to_string(), + _notification_id: notification_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a notification + /// + /// # Arguments + /// + /// * `customer` - The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource. + /// * `notificationId` - The unique ID of the notification. + pub fn delete(&self, customer: &str, notification_id: &str) -> NotificationDeleteCall<'a, C, A> { + NotificationDeleteCall { + hub: self.hub, + _customer: customer.to_string(), + _notification_id: notification_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a notification. + /// + /// # Arguments + /// + /// * `customer` - The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource. + /// * `notificationId` - The unique ID of the notification. + pub fn get(&self, customer: &str, notification_id: &str) -> NotificationGetCall<'a, C, A> { + NotificationGetCall { + hub: self.hub, + _customer: customer.to_string(), + _notification_id: notification_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a notification. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `customer` - The unique ID for the customer's Google account. + /// * `notificationId` - The unique ID of the notification. + pub fn patch(&self, request: Notification, customer: &str, notification_id: &str) -> NotificationPatchCall<'a, C, A> { + NotificationPatchCall { + hub: self.hub, + _request: request, + _customer: customer.to_string(), + _notification_id: notification_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *privilege* resources. /// It is not used directly, but through the `Directory` hub. /// @@ -3082,6 +2885,64 @@ impl<'a, C, A> PrivilegeMethods<'a, C, A> { +/// A builder providing access to all methods supported on *channel* resources. +/// It is not used directly, but through the `Directory` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_admin1_directory as admin1_directory; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use admin1_directory::Directory; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Directory::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `stop(...)` +/// // to build up your call. +/// let rb = hub.channels(); +/// # } +/// ``` +pub struct ChannelMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, +} + +impl<'a, C, A> MethodsBuilder for ChannelMethods<'a, C, A> {} + +impl<'a, C, A> ChannelMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Stop watching resources through this channel + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn stop(&self, request: Channel) -> ChannelStopCall<'a, C, A> { + ChannelStopCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *mobiledevice* resources. /// It is not used directly, but through the `Directory` hub. /// @@ -3302,7 +3163,7 @@ impl<'a, C, A> TokenMethods<'a, C, A> { -/// A builder providing access to all methods supported on *notification* resources. +/// A builder providing access to all methods supported on *roleAssignment* resources. /// It is not used directly, but through the `Directory` hub. /// /// # Example @@ -3325,115 +3186,93 @@ impl<'a, C, A> TokenMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Directory::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // like `delete(...)`, `get(...)`, `insert(...)` and `list(...)` /// // to build up your call. -/// let rb = hub.notifications(); +/// let rb = hub.role_assignments(); /// # } /// ``` -pub struct NotificationMethods<'a, C, A> +pub struct RoleAssignmentMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, } -impl<'a, C, A> MethodsBuilder for NotificationMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for RoleAssignmentMethods<'a, C, A> {} -impl<'a, C, A> NotificationMethods<'a, C, A> { +impl<'a, C, A> RoleAssignmentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves a list of notifications. + /// Creates a role assignment. /// /// # Arguments /// - /// * `customer` - The unique ID for the customer's Google account. - pub fn list(&self, customer: &str) -> NotificationListCall<'a, C, A> { - NotificationListCall { + /// * `request` - No description provided. + /// * `customer` - Immutable ID of the Google Apps account. + pub fn insert(&self, request: RoleAssignment, customer: &str) -> RoleAssignmentInsertCall<'a, C, A> { + RoleAssignmentInsertCall { + hub: self.hub, + _request: request, + _customer: customer.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieve a role assignment. + /// + /// # Arguments + /// + /// * `customer` - Immutable ID of the Google Apps account. + /// * `roleAssignmentId` - Immutable ID of the role assignment. + pub fn get(&self, customer: &str, role_assignment_id: &str) -> RoleAssignmentGetCall<'a, C, A> { + RoleAssignmentGetCall { hub: self.hub, _customer: customer.to_string(), + _role_assignment_id: role_assignment_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a role assignment. + /// + /// # Arguments + /// + /// * `customer` - Immutable ID of the Google Apps account. + /// * `roleAssignmentId` - Immutable ID of the role assignment. + pub fn delete(&self, customer: &str, role_assignment_id: &str) -> RoleAssignmentDeleteCall<'a, C, A> { + RoleAssignmentDeleteCall { + hub: self.hub, + _customer: customer.to_string(), + _role_assignment_id: role_assignment_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a paginated list of all roleAssignments. + /// + /// # Arguments + /// + /// * `customer` - Immutable ID of the Google Apps account. + pub fn list(&self, customer: &str) -> RoleAssignmentListCall<'a, C, A> { + RoleAssignmentListCall { + hub: self.hub, + _customer: customer.to_string(), + _user_key: Default::default(), + _role_id: Default::default(), _page_token: Default::default(), _max_results: Default::default(), - _language: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a notification. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `customer` - The unique ID for the customer's Google account. - /// * `notificationId` - The unique ID of the notification. - pub fn update(&self, request: Notification, customer: &str, notification_id: &str) -> NotificationUpdateCall<'a, C, A> { - NotificationUpdateCall { - hub: self.hub, - _request: request, - _customer: customer.to_string(), - _notification_id: notification_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a notification - /// - /// # Arguments - /// - /// * `customer` - The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource. - /// * `notificationId` - The unique ID of the notification. - pub fn delete(&self, customer: &str, notification_id: &str) -> NotificationDeleteCall<'a, C, A> { - NotificationDeleteCall { - hub: self.hub, - _customer: customer.to_string(), - _notification_id: notification_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves a notification. - /// - /// # Arguments - /// - /// * `customer` - The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource. - /// * `notificationId` - The unique ID of the notification. - pub fn get(&self, customer: &str, notification_id: &str) -> NotificationGetCall<'a, C, A> { - NotificationGetCall { - hub: self.hub, - _customer: customer.to_string(), - _notification_id: notification_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a notification. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `customer` - The unique ID for the customer's Google account. - /// * `notificationId` - The unique ID of the notification. - pub fn patch(&self, request: Notification, customer: &str, notification_id: &str) -> NotificationPatchCall<'a, C, A> { - NotificationPatchCall { - hub: self.hub, - _request: request, - _customer: customer.to_string(), - _notification_id: notification_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3571,7 +3410,7 @@ impl<'a, C, A> ChromeosdeviceMethods<'a, C, A> { -/// A builder providing access to all methods supported on *member* resources. +/// A builder providing access to all methods supported on *group* resources. /// It is not used directly, but through the `Directory` hub. /// /// # Example @@ -3594,96 +3433,49 @@ impl<'a, C, A> ChromeosdeviceMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Directory::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // like `aliases_delete(...)`, `aliases_insert(...)`, `aliases_list(...)`, `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` /// // to build up your call. -/// let rb = hub.members(); +/// let rb = hub.groups(); /// # } /// ``` -pub struct MemberMethods<'a, C, A> +pub struct GroupMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, } -impl<'a, C, A> MethodsBuilder for MemberMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for GroupMethods<'a, C, A> {} -impl<'a, C, A> MemberMethods<'a, C, A> { +impl<'a, C, A> GroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Add user to the specified group. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `groupKey` - Email or immutable Id of the group - pub fn insert(&self, request: Member, group_key: &str) -> MemberInsertCall<'a, C, A> { - MemberInsertCall { - hub: self.hub, - _request: request, - _group_key: group_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Update membership of a user in the specified group. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `groupKey` - Email or immutable Id of the group. If Id, it should match with id of group object - /// * `memberKey` - Email or immutable Id of the user. If Id, it should match with id of member object - pub fn patch(&self, request: Member, group_key: &str, member_key: &str) -> MemberPatchCall<'a, C, A> { - MemberPatchCall { - hub: self.hub, - _request: request, - _group_key: group_key.to_string(), - _member_key: member_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Update membership of a user in the specified group. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `groupKey` - Email or immutable Id of the group. If Id, it should match with id of group object - /// * `memberKey` - Email or immutable Id of the user. If Id, it should match with id of member object - pub fn update(&self, request: Member, group_key: &str, member_key: &str) -> MemberUpdateCall<'a, C, A> { - MemberUpdateCall { - hub: self.hub, - _request: request, - _group_key: group_key.to_string(), - _member_key: member_key.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieve all members in a group (paginated) + /// Delete Group /// /// # Arguments /// /// * `groupKey` - Email or immutable Id of the group - pub fn list(&self, group_key: &str) -> MemberListCall<'a, C, A> { - MemberListCall { + pub fn delete(&self, group_key: &str) -> GroupDeleteCall<'a, C, A> { + GroupDeleteCall { hub: self.hub, _group_key: group_key.to_string(), - _roles: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieve all groups in a domain (paginated) + pub fn list(&self) -> GroupListCall<'a, C, A> { + GroupListCall { + hub: self.hub, + _user_key: Default::default(), _page_token: Default::default(), _max_results: Default::default(), + _domain: Default::default(), + _customer: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3692,17 +3484,17 @@ impl<'a, C, A> MemberMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieve Group Member + /// Update Group /// /// # Arguments /// - /// * `groupKey` - Email or immutable Id of the group - /// * `memberKey` - Email or immutable Id of the member - pub fn get(&self, group_key: &str, member_key: &str) -> MemberGetCall<'a, C, A> { - MemberGetCall { + /// * `request` - No description provided. + /// * `groupKey` - Email or immutable Id of the group. If Id, it should match with id of group object + pub fn update(&self, request: Group, group_key: &str) -> GroupUpdateCall<'a, C, A> { + GroupUpdateCall { hub: self.hub, + _request: request, _group_key: group_key.to_string(), - _member_key: member_key.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -3711,17 +3503,106 @@ impl<'a, C, A> MemberMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Remove membership. + /// Create Group + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn insert(&self, request: Group) -> GroupInsertCall<'a, C, A> { + GroupInsertCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Add a alias for the group + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `groupKey` - Email or immutable Id of the group + pub fn aliases_insert(&self, request: Alias, group_key: &str) -> GroupAliaseInsertCall<'a, C, A> { + GroupAliaseInsertCall { + hub: self.hub, + _request: request, + _group_key: group_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// List all aliases for a group /// /// # Arguments /// /// * `groupKey` - Email or immutable Id of the group - /// * `memberKey` - Email or immutable Id of the member - pub fn delete(&self, group_key: &str, member_key: &str) -> MemberDeleteCall<'a, C, A> { - MemberDeleteCall { + pub fn aliases_list(&self, group_key: &str) -> GroupAliaseListCall<'a, C, A> { + GroupAliaseListCall { hub: self.hub, _group_key: group_key.to_string(), - _member_key: member_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieve Group + /// + /// # Arguments + /// + /// * `groupKey` - Email or immutable Id of the group + pub fn get(&self, group_key: &str) -> GroupGetCall<'a, C, A> { + GroupGetCall { + hub: self.hub, + _group_key: group_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Update Group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `groupKey` - Email or immutable Id of the group. If Id, it should match with id of group object + pub fn patch(&self, request: Group, group_key: &str) -> GroupPatchCall<'a, C, A> { + GroupPatchCall { + hub: self.hub, + _request: request, + _group_key: group_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Remove a alias for the group + /// + /// # Arguments + /// + /// * `groupKey` - Email or immutable Id of the group + /// * `alias` - The alias to be removed + pub fn aliases_delete(&self, group_key: &str, alias: &str) -> GroupAliaseDeleteCall<'a, C, A> { + GroupAliaseDeleteCall { + hub: self.hub, + _group_key: group_key.to_string(), + _alias: alias.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -4215,7 +4096,7 @@ impl<'a, C, A> SchemaMethods<'a, C, A> { -/// A builder providing access to all methods supported on *channel* resources. +/// A builder providing access to all methods supported on *resource* resources. /// It is not used directly, but through the `Directory` hub. /// /// # Example @@ -4238,149 +4119,32 @@ impl<'a, C, A> SchemaMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Directory::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `stop(...)` +/// // like `calendars_delete(...)`, `calendars_get(...)`, `calendars_insert(...)`, `calendars_list(...)`, `calendars_patch(...)` and `calendars_update(...)` /// // to build up your call. -/// let rb = hub.channels(); +/// let rb = hub.resources(); /// # } /// ``` -pub struct ChannelMethods<'a, C, A> +pub struct ResourceMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, } -impl<'a, C, A> MethodsBuilder for ChannelMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for ResourceMethods<'a, C, A> {} -impl<'a, C, A> ChannelMethods<'a, C, A> { +impl<'a, C, A> ResourceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Stop watching resources through this channel + /// Retrieves a list of calendar resources for an account. /// /// # Arguments /// - /// * `request` - No description provided. - pub fn stop(&self, request: Channel) -> ChannelStopCall<'a, C, A> { - ChannelStopCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *roleAssignment* resources. -/// It is not used directly, but through the `Directory` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_admin1_directory as admin1_directory; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use admin1_directory::Directory; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Directory::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `get(...)`, `insert(...)` and `list(...)` -/// // to build up your call. -/// let rb = hub.role_assignments(); -/// # } -/// ``` -pub struct RoleAssignmentMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, -} - -impl<'a, C, A> MethodsBuilder for RoleAssignmentMethods<'a, C, A> {} - -impl<'a, C, A> RoleAssignmentMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Creates a role assignment. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `customer` - Immutable ID of the Google Apps account. - pub fn insert(&self, request: RoleAssignment, customer: &str) -> RoleAssignmentInsertCall<'a, C, A> { - RoleAssignmentInsertCall { - hub: self.hub, - _request: request, - _customer: customer.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieve a role assignment. - /// - /// # Arguments - /// - /// * `customer` - Immutable ID of the Google Apps account. - /// * `roleAssignmentId` - Immutable ID of the role assignment. - pub fn get(&self, customer: &str, role_assignment_id: &str) -> RoleAssignmentGetCall<'a, C, A> { - RoleAssignmentGetCall { + /// * `customer` - The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + pub fn calendars_list(&self, customer: &str) -> ResourceCalendarListCall<'a, C, A> { + ResourceCalendarListCall { hub: self.hub, _customer: customer.to_string(), - _role_assignment_id: role_assignment_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a role assignment. - /// - /// # Arguments - /// - /// * `customer` - Immutable ID of the Google Apps account. - /// * `roleAssignmentId` - Immutable ID of the role assignment. - pub fn delete(&self, customer: &str, role_assignment_id: &str) -> RoleAssignmentDeleteCall<'a, C, A> { - RoleAssignmentDeleteCall { - hub: self.hub, - _customer: customer.to_string(), - _role_assignment_id: role_assignment_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Retrieves a paginated list of all roleAssignments. - /// - /// # Arguments - /// - /// * `customer` - Immutable ID of the Google Apps account. - pub fn list(&self, customer: &str) -> RoleAssignmentListCall<'a, C, A> { - RoleAssignmentListCall { - hub: self.hub, - _customer: customer.to_string(), - _user_key: Default::default(), - _role_id: Default::default(), _page_token: Default::default(), _max_results: Default::default(), _delegate: Default::default(), @@ -4388,6 +4152,477 @@ impl<'a, C, A> RoleAssignmentMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a calendar resource. + /// + /// # Arguments + /// + /// * `customer` - The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + /// * `calendarResourceId` - The unique ID of the calendar resource to retrieve. + pub fn calendars_get(&self, customer: &str, calendar_resource_id: &str) -> ResourceCalendarGetCall<'a, C, A> { + ResourceCalendarGetCall { + hub: self.hub, + _customer: customer.to_string(), + _calendar_resource_id: calendar_resource_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a calendar resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `customer` - The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + pub fn calendars_insert(&self, request: CalendarResource, customer: &str) -> ResourceCalendarInsertCall<'a, C, A> { + ResourceCalendarInsertCall { + hub: self.hub, + _request: request, + _customer: customer.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a calendar resource. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `customer` - The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + /// * `calendarResourceId` - The unique ID of the calendar resource to update. + pub fn calendars_patch(&self, request: CalendarResource, customer: &str, calendar_resource_id: &str) -> ResourceCalendarPatchCall<'a, C, A> { + ResourceCalendarPatchCall { + hub: self.hub, + _request: request, + _customer: customer.to_string(), + _calendar_resource_id: calendar_resource_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a calendar resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `customer` - The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + /// * `calendarResourceId` - The unique ID of the calendar resource to update. + pub fn calendars_update(&self, request: CalendarResource, customer: &str, calendar_resource_id: &str) -> ResourceCalendarUpdateCall<'a, C, A> { + ResourceCalendarUpdateCall { + hub: self.hub, + _request: request, + _customer: customer.to_string(), + _calendar_resource_id: calendar_resource_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a calendar resource. + /// + /// # Arguments + /// + /// * `customer` - The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + /// * `calendarResourceId` - The unique ID of the calendar resource to delete. + pub fn calendars_delete(&self, customer: &str, calendar_resource_id: &str) -> ResourceCalendarDeleteCall<'a, C, A> { + ResourceCalendarDeleteCall { + hub: self.hub, + _customer: customer.to_string(), + _calendar_resource_id: calendar_resource_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *user* resources. +/// It is not used directly, but through the `Directory` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_admin1_directory as admin1_directory; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use admin1_directory::Directory; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Directory::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `aliases_delete(...)`, `aliases_insert(...)`, `aliases_list(...)`, `aliases_watch(...)`, `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `make_admin(...)`, `patch(...)`, `photos_delete(...)`, `photos_get(...)`, `photos_patch(...)`, `photos_update(...)`, `undelete(...)`, `update(...)` and `watch(...)` +/// // to build up your call. +/// let rb = hub.users(); +/// # } +/// ``` +pub struct UserMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, +} + +impl<'a, C, A> MethodsBuilder for UserMethods<'a, C, A> {} + +impl<'a, C, A> UserMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Undelete a deleted user + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `userKey` - The immutable id of the user + pub fn undelete(&self, request: UserUndelete, user_key: &str) -> UserUndeleteCall<'a, C, A> { + UserUndeleteCall { + hub: self.hub, + _request: request, + _user_key: user_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Remove photos for the user + /// + /// # Arguments + /// + /// * `userKey` - Email or immutable Id of the user + pub fn photos_delete(&self, user_key: &str) -> UserPhotoDeleteCall<'a, C, A> { + UserPhotoDeleteCall { + hub: self.hub, + _user_key: user_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Add a photo for the user. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `userKey` - Email or immutable Id of the user + pub fn photos_patch(&self, request: UserPhoto, user_key: &str) -> UserPhotoPatchCall<'a, C, A> { + UserPhotoPatchCall { + hub: self.hub, + _request: request, + _user_key: user_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// create user. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn insert(&self, request: User) -> UserInsertCall<'a, C, A> { + UserInsertCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Watch for changes in user aliases list + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `userKey` - Email or immutable Id of the user + pub fn aliases_watch(&self, request: Channel, user_key: &str) -> UserAliaseWatchCall<'a, C, A> { + UserAliaseWatchCall { + hub: self.hub, + _request: request, + _user_key: user_key.to_string(), + _event: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Add a photo for the user + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `userKey` - Email or immutable Id of the user + pub fn photos_update(&self, request: UserPhoto, user_key: &str) -> UserPhotoUpdateCall<'a, C, A> { + UserPhotoUpdateCall { + hub: self.hub, + _request: request, + _user_key: user_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Watch for changes in users list + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn watch(&self, request: Channel) -> UserWatchCall<'a, C, A> { + UserWatchCall { + hub: self.hub, + _request: request, + _view_type: Default::default(), + _sort_order: Default::default(), + _show_deleted: Default::default(), + _query: Default::default(), + _projection: Default::default(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _event: Default::default(), + _domain: Default::default(), + _customer: Default::default(), + _custom_field_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// update user + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `userKey` - Email or immutable Id of the user. If Id, it should match with id of user object + pub fn update(&self, request: User, user_key: &str) -> UserUpdateCall<'a, C, A> { + UserUpdateCall { + hub: self.hub, + _request: request, + _user_key: user_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieve photo of a user + /// + /// # Arguments + /// + /// * `userKey` - Email or immutable Id of the user + pub fn photos_get(&self, user_key: &str) -> UserPhotoGetCall<'a, C, A> { + UserPhotoGetCall { + hub: self.hub, + _user_key: user_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieve either deleted users or all users in a domain (paginated) + pub fn list(&self) -> UserListCall<'a, C, A> { + UserListCall { + hub: self.hub, + _view_type: Default::default(), + _sort_order: Default::default(), + _show_deleted: Default::default(), + _query: Default::default(), + _projection: Default::default(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _event: Default::default(), + _domain: Default::default(), + _customer: Default::default(), + _custom_field_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// retrieve user + /// + /// # Arguments + /// + /// * `userKey` - Email or immutable Id of the user + pub fn get(&self, user_key: &str) -> UserGetCall<'a, C, A> { + UserGetCall { + hub: self.hub, + _user_key: user_key.to_string(), + _view_type: Default::default(), + _projection: Default::default(), + _custom_field_mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Add a alias for the user + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `userKey` - Email or immutable Id of the user + pub fn aliases_insert(&self, request: Alias, user_key: &str) -> UserAliaseInsertCall<'a, C, A> { + UserAliaseInsertCall { + hub: self.hub, + _request: request, + _user_key: user_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// List all aliases for a user + /// + /// # Arguments + /// + /// * `userKey` - Email or immutable Id of the user + pub fn aliases_list(&self, user_key: &str) -> UserAliaseListCall<'a, C, A> { + UserAliaseListCall { + hub: self.hub, + _user_key: user_key.to_string(), + _event: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// change admin status of a user + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `userKey` - Email or immutable Id of the user as admin + pub fn make_admin(&self, request: UserMakeAdmin, user_key: &str) -> UserMakeAdminCall<'a, C, A> { + UserMakeAdminCall { + hub: self.hub, + _request: request, + _user_key: user_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// update user. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `userKey` - Email or immutable Id of the user. If Id, it should match with id of user object + pub fn patch(&self, request: User, user_key: &str) -> UserPatchCall<'a, C, A> { + UserPatchCall { + hub: self.hub, + _request: request, + _user_key: user_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Remove a alias for the user + /// + /// # Arguments + /// + /// * `userKey` - Email or immutable Id of the user + /// * `alias` - The alias to be removed + pub fn aliases_delete(&self, user_key: &str, alias: &str) -> UserAliaseDeleteCall<'a, C, A> { + UserAliaseDeleteCall { + hub: self.hub, + _user_key: user_key.to_string(), + _alias: alias.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Delete user + /// + /// # Arguments + /// + /// * `userKey` - Email or immutable Id of the user + pub fn delete(&self, user_key: &str) -> UserDeleteCall<'a, C, A> { + UserDeleteCall { + hub: self.hub, + _user_key: user_key.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -4398,6 +4633,11966 @@ impl<'a, C, A> RoleAssignmentMethods<'a, C, A> { // CallBuilders ### // ################# +/// Generate new backup verification codes for the user. +/// +/// A builder for the *generate* method supported by a *verificationCode* resource. +/// It is not used directly, but through a `VerificationCodeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.verification_codes().generate("userKey") +/// .doit(); +/// # } +/// ``` +pub struct VerificationCodeGenerateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _user_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VerificationCodeGenerateCall<'a, C, A> {} + +impl<'a, C, A> VerificationCodeGenerateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.verificationCodes.generate", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + params.push(("userKey", self._user_key.to_string())); + for &field in ["userKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/verificationCodes/generate".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{userKey}", "userKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["userKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Email or immutable Id of the user + /// + /// Sets the *user key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_key(mut self, new_value: &str) -> VerificationCodeGenerateCall<'a, C, A> { + self._user_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> VerificationCodeGenerateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VerificationCodeGenerateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserSecurity`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> VerificationCodeGenerateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Invalidate the current backup verification codes for the user. +/// +/// A builder for the *invalidate* method supported by a *verificationCode* resource. +/// It is not used directly, but through a `VerificationCodeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.verification_codes().invalidate("userKey") +/// .doit(); +/// # } +/// ``` +pub struct VerificationCodeInvalidateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _user_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VerificationCodeInvalidateCall<'a, C, A> {} + +impl<'a, C, A> VerificationCodeInvalidateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.verificationCodes.invalidate", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + params.push(("userKey", self._user_key.to_string())); + for &field in ["userKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/verificationCodes/invalidate".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{userKey}", "userKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["userKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Email or immutable Id of the user + /// + /// Sets the *user key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_key(mut self, new_value: &str) -> VerificationCodeInvalidateCall<'a, C, A> { + self._user_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> VerificationCodeInvalidateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VerificationCodeInvalidateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserSecurity`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> VerificationCodeInvalidateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns the current set of valid backup verification codes for the specified user. +/// +/// A builder for the *list* method supported by a *verificationCode* resource. +/// It is not used directly, but through a `VerificationCodeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.verification_codes().list("userKey") +/// .doit(); +/// # } +/// ``` +pub struct VerificationCodeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _user_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VerificationCodeListCall<'a, C, A> {} + +impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VerificationCodes)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.verificationCodes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("userKey", self._user_key.to_string())); + for &field in ["alt", "userKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/verificationCodes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{userKey}", "userKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["userKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. + /// + /// Sets the *user key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_key(mut self, new_value: &str) -> VerificationCodeListCall<'a, C, A> { + self._user_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> VerificationCodeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VerificationCodeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserSecurity`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> VerificationCodeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a customer. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *customer* resource. +/// It is not used directly, but through a `CustomerMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Customer; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Customer::default(); +/// +/// // 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 ! +/// let result = hub.customers().patch(req, "customerKey") +/// .doit(); +/// # } +/// ``` +pub struct CustomerPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Customer, + _customer_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CustomerPatchCall<'a, C, A> {} + +impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Customer)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.customers.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customerKey", self._customer_key.to_string())); + for &field in ["alt", "customerKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customers/{customerKey}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryCustomer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerKey}", "customerKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customerKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Customer) -> CustomerPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Id of the customer to be updated + /// + /// Sets the *customer key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_key(mut self, new_value: &str) -> CustomerPatchCall<'a, C, A> { + self._customer_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CustomerPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CustomerPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryCustomer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CustomerPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrives a customer. +/// +/// A builder for the *get* method supported by a *customer* resource. +/// It is not used directly, but through a `CustomerMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.customers().get("customerKey") +/// .doit(); +/// # } +/// ``` +pub struct CustomerGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CustomerGetCall<'a, C, A> {} + +impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Customer)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.customers.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customerKey", self._customer_key.to_string())); + for &field in ["alt", "customerKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customers/{customerKey}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryCustomerReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerKey}", "customerKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customerKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Id of the customer to be retrieved + /// + /// Sets the *customer key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_key(mut self, new_value: &str) -> CustomerGetCall<'a, C, A> { + self._customer_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CustomerGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CustomerGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryCustomerReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CustomerGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a customer. +/// +/// A builder for the *update* method supported by a *customer* resource. +/// It is not used directly, but through a `CustomerMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Customer; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Customer::default(); +/// +/// // 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 ! +/// let result = hub.customers().update(req, "customerKey") +/// .doit(); +/// # } +/// ``` +pub struct CustomerUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Customer, + _customer_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CustomerUpdateCall<'a, C, A> {} + +impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Customer)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.customers.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customerKey", self._customer_key.to_string())); + for &field in ["alt", "customerKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customers/{customerKey}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryCustomer.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerKey}", "customerKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customerKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Customer) -> CustomerUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Id of the customer to be updated + /// + /// Sets the *customer key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_key(mut self, new_value: &str) -> CustomerUpdateCall<'a, C, A> { + self._customer_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CustomerUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CustomerUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryCustomer`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CustomerUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieve all Organization Units +/// +/// A builder for the *list* method supported by a *orgunit* resource. +/// It is not used directly, but through a `OrgunitMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.orgunits().list("customerId") +/// .type_("sea") +/// .org_unit_path("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct OrgunitListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_id: String, + _type_: Option, + _org_unit_path: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrgunitListCall<'a, C, A> {} + +impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrgUnits)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.orgunits.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + if let Some(value) = self._type_ { + params.push(("type", value.to_string())); + } + if let Some(value) = self._org_unit_path { + params.push(("orgUnitPath", value.to_string())); + } + for &field in ["alt", "customerId", "type", "orgUnitPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryOrgunitReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> OrgunitListCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Whether to return all sub-organizations or just immediate children + /// + /// Sets the *type* query property to the given value. + pub fn type_(mut self, new_value: &str) -> OrgunitListCall<'a, C, A> { + self._type_ = Some(new_value.to_string()); + self + } + /// the URL-encoded organization unit's path or its Id + /// + /// Sets the *org unit path* query property to the given value. + pub fn org_unit_path(mut self, new_value: &str) -> OrgunitListCall<'a, C, A> { + self._org_unit_path = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OrgunitListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrgunitListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryOrgunitReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OrgunitListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Add Organization Unit +/// +/// A builder for the *insert* method supported by a *orgunit* resource. +/// It is not used directly, but through a `OrgunitMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::OrgUnit; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = OrgUnit::default(); +/// +/// // 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 ! +/// let result = hub.orgunits().insert(req, "customerId") +/// .doit(); +/// # } +/// ``` +pub struct OrgunitInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: OrgUnit, + _customer_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrgunitInsertCall<'a, C, A> {} + +impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrgUnit)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.orgunits.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + for &field in ["alt", "customerId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryOrgunit.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: OrgUnit) -> OrgunitInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> OrgunitInsertCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OrgunitInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrgunitInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryOrgunit`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OrgunitInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Update Organization Unit +/// +/// A builder for the *update* method supported by a *orgunit* resource. +/// It is not used directly, but through a `OrgunitMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::OrgUnit; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = OrgUnit::default(); +/// +/// // 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 ! +/// let result = hub.orgunits().update(req, "customerId", "orgUnitPath") +/// .doit(); +/// # } +/// ``` +pub struct OrgunitUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: OrgUnit, + _customer_id: String, + _org_unit_path: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrgunitUpdateCall<'a, C, A> {} + +impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrgUnit)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.orgunits.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + if self._org_unit_path.len() > 0 { + let mut s = String::new(); + for f in self._org_unit_path.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("orgUnitPath", s)); + } + for &field in ["alt", "customerId", "orgUnitPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits{/orgUnitPath*}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryOrgunit.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{/orgUnitPath*}", "orgUnitPath")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["orgUnitPath", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: OrgUnit) -> OrgunitUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> OrgunitUpdateCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Full path of the organization unit or its Id + /// + /// Append the given value to the *org unit path* path property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn add_org_unit_path(mut self, new_value: &str) -> OrgunitUpdateCall<'a, C, A> { + self._org_unit_path.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OrgunitUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrgunitUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryOrgunit`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OrgunitUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Remove Organization Unit +/// +/// A builder for the *delete* method supported by a *orgunit* resource. +/// It is not used directly, but through a `OrgunitMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.orgunits().delete("customerId", "orgUnitPath") +/// .doit(); +/// # } +/// ``` +pub struct OrgunitDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_id: String, + _org_unit_path: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrgunitDeleteCall<'a, C, A> {} + +impl<'a, C, A> OrgunitDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.orgunits.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + if self._org_unit_path.len() > 0 { + let mut s = String::new(); + for f in self._org_unit_path.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("orgUnitPath", s)); + } + for &field in ["customerId", "orgUnitPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits{/orgUnitPath*}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryOrgunit.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{/orgUnitPath*}", "orgUnitPath")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["orgUnitPath", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> OrgunitDeleteCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Full path of the organization unit or its Id + /// + /// Append the given value to the *org unit path* path property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn add_org_unit_path(mut self, new_value: &str) -> OrgunitDeleteCall<'a, C, A> { + self._org_unit_path.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OrgunitDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrgunitDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryOrgunit`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OrgunitDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieve Organization Unit +/// +/// A builder for the *get* method supported by a *orgunit* resource. +/// It is not used directly, but through a `OrgunitMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.orgunits().get("customerId", "orgUnitPath") +/// .doit(); +/// # } +/// ``` +pub struct OrgunitGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_id: String, + _org_unit_path: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrgunitGetCall<'a, C, A> {} + +impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrgUnit)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.orgunits.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + if self._org_unit_path.len() > 0 { + let mut s = String::new(); + for f in self._org_unit_path.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("orgUnitPath", s)); + } + for &field in ["alt", "customerId", "orgUnitPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits{/orgUnitPath*}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryOrgunitReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{/orgUnitPath*}", "orgUnitPath")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["orgUnitPath", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> OrgunitGetCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Full path of the organization unit or its Id + /// + /// Append the given value to the *org unit path* path property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn add_org_unit_path(mut self, new_value: &str) -> OrgunitGetCall<'a, C, A> { + self._org_unit_path.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OrgunitGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrgunitGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryOrgunitReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OrgunitGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Update Organization Unit. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *orgunit* resource. +/// It is not used directly, but through a `OrgunitMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::OrgUnit; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = OrgUnit::default(); +/// +/// // 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 ! +/// let result = hub.orgunits().patch(req, "customerId", "orgUnitPath") +/// .doit(); +/// # } +/// ``` +pub struct OrgunitPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: OrgUnit, + _customer_id: String, + _org_unit_path: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrgunitPatchCall<'a, C, A> {} + +impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrgUnit)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.orgunits.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + if self._org_unit_path.len() > 0 { + let mut s = String::new(); + for f in self._org_unit_path.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("orgUnitPath", s)); + } + for &field in ["alt", "customerId", "orgUnitPath"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits{/orgUnitPath*}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryOrgunit.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{/orgUnitPath*}", "orgUnitPath")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["orgUnitPath", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: OrgUnit) -> OrgunitPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> OrgunitPatchCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Full path of the organization unit or its Id + /// + /// Append the given value to the *org unit path* path property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn add_org_unit_path(mut self, new_value: &str) -> OrgunitPatchCall<'a, C, A> { + self._org_unit_path.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OrgunitPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrgunitPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryOrgunit`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OrgunitPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Add user to the specified group. +/// +/// A builder for the *insert* method supported by a *member* resource. +/// It is not used directly, but through a `MemberMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Member; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Member::default(); +/// +/// // 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 ! +/// let result = hub.members().insert(req, "groupKey") +/// .doit(); +/// # } +/// ``` +pub struct MemberInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Member, + _group_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MemberInsertCall<'a, C, A> {} + +impl<'a, C, A> MemberInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Member)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.members.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("groupKey", self._group_key.to_string())); + for &field in ["alt", "groupKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryGroup.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{groupKey}", "groupKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["groupKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Member) -> MemberInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// Email or immutable Id of the group + /// + /// Sets the *group key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn group_key(mut self, new_value: &str) -> MemberInsertCall<'a, C, A> { + self._group_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MemberInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MemberInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryGroup`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MemberInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Update membership of a user in the specified group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *member* resource. +/// It is not used directly, but through a `MemberMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Member; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Member::default(); +/// +/// // 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 ! +/// let result = hub.members().patch(req, "groupKey", "memberKey") +/// .doit(); +/// # } +/// ``` +pub struct MemberPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Member, + _group_key: String, + _member_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MemberPatchCall<'a, C, A> {} + +impl<'a, C, A> MemberPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Member)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.members.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("groupKey", self._group_key.to_string())); + params.push(("memberKey", self._member_key.to_string())); + for &field in ["alt", "groupKey", "memberKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members/{memberKey}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryGroup.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{groupKey}", "groupKey"), ("{memberKey}", "memberKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["memberKey", "groupKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Member) -> MemberPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Email or immutable Id of the group. If Id, it should match with id of group object + /// + /// Sets the *group key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn group_key(mut self, new_value: &str) -> MemberPatchCall<'a, C, A> { + self._group_key = new_value.to_string(); + self + } + /// Email or immutable Id of the user. If Id, it should match with id of member object + /// + /// Sets the *member key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn member_key(mut self, new_value: &str) -> MemberPatchCall<'a, C, A> { + self._member_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MemberPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MemberPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryGroup`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MemberPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Update membership of a user in the specified group. +/// +/// A builder for the *update* method supported by a *member* resource. +/// It is not used directly, but through a `MemberMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Member; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Member::default(); +/// +/// // 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 ! +/// let result = hub.members().update(req, "groupKey", "memberKey") +/// .doit(); +/// # } +/// ``` +pub struct MemberUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Member, + _group_key: String, + _member_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MemberUpdateCall<'a, C, A> {} + +impl<'a, C, A> MemberUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Member)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.members.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("groupKey", self._group_key.to_string())); + params.push(("memberKey", self._member_key.to_string())); + for &field in ["alt", "groupKey", "memberKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members/{memberKey}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryGroup.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{groupKey}", "groupKey"), ("{memberKey}", "memberKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["memberKey", "groupKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Member) -> MemberUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Email or immutable Id of the group. If Id, it should match with id of group object + /// + /// Sets the *group key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn group_key(mut self, new_value: &str) -> MemberUpdateCall<'a, C, A> { + self._group_key = new_value.to_string(); + self + } + /// Email or immutable Id of the user. If Id, it should match with id of member object + /// + /// Sets the *member key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn member_key(mut self, new_value: &str) -> MemberUpdateCall<'a, C, A> { + self._member_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MemberUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MemberUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryGroup`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MemberUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieve all members in a group (paginated) +/// +/// A builder for the *list* method supported by a *member* resource. +/// It is not used directly, but through a `MemberMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.members().list("groupKey") +/// .roles("sea") +/// .page_token("et") +/// .max_results(-70) +/// .doit(); +/// # } +/// ``` +pub struct MemberListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _group_key: String, + _roles: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MemberListCall<'a, C, A> {} + +impl<'a, C, A> MemberListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Members)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.members.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("groupKey", self._group_key.to_string())); + if let Some(value) = self._roles { + params.push(("roles", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "groupKey", "roles", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryGroupMemberReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{groupKey}", "groupKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["groupKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Email or immutable Id of the group + /// + /// Sets the *group key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn group_key(mut self, new_value: &str) -> MemberListCall<'a, C, A> { + self._group_key = new_value.to_string(); + self + } + /// Comma separated role values to filter list results on. + /// + /// Sets the *roles* query property to the given value. + pub fn roles(mut self, new_value: &str) -> MemberListCall<'a, C, A> { + self._roles = Some(new_value.to_string()); + self + } + /// Token to specify next page in the list + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> MemberListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. Default is 200 + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> MemberListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MemberListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MemberListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryGroupMemberReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MemberListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieve Group Member +/// +/// A builder for the *get* method supported by a *member* resource. +/// It is not used directly, but through a `MemberMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.members().get("groupKey", "memberKey") +/// .doit(); +/// # } +/// ``` +pub struct MemberGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _group_key: String, + _member_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MemberGetCall<'a, C, A> {} + +impl<'a, C, A> MemberGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Member)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.members.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("groupKey", self._group_key.to_string())); + params.push(("memberKey", self._member_key.to_string())); + for &field in ["alt", "groupKey", "memberKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members/{memberKey}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryGroupMemberReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{groupKey}", "groupKey"), ("{memberKey}", "memberKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["memberKey", "groupKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Email or immutable Id of the group + /// + /// Sets the *group key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn group_key(mut self, new_value: &str) -> MemberGetCall<'a, C, A> { + self._group_key = new_value.to_string(); + self + } + /// Email or immutable Id of the member + /// + /// Sets the *member key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn member_key(mut self, new_value: &str) -> MemberGetCall<'a, C, A> { + self._member_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MemberGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MemberGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryGroupMemberReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MemberGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Remove membership. +/// +/// A builder for the *delete* method supported by a *member* resource. +/// It is not used directly, but through a `MemberMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.members().delete("groupKey", "memberKey") +/// .doit(); +/// # } +/// ``` +pub struct MemberDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _group_key: String, + _member_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MemberDeleteCall<'a, C, A> {} + +impl<'a, C, A> MemberDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.members.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("groupKey", self._group_key.to_string())); + params.push(("memberKey", self._member_key.to_string())); + for &field in ["groupKey", "memberKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members/{memberKey}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryGroup.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{groupKey}", "groupKey"), ("{memberKey}", "memberKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["memberKey", "groupKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Email or immutable Id of the group + /// + /// Sets the *group key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn group_key(mut self, new_value: &str) -> MemberDeleteCall<'a, C, A> { + self._group_key = new_value.to_string(); + self + } + /// Email or immutable Id of the member + /// + /// Sets the *member key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn member_key(mut self, new_value: &str) -> MemberDeleteCall<'a, C, A> { + self._member_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MemberDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MemberDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryGroup`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MemberDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a role. +/// +/// A builder for the *update* method supported by a *role* resource. +/// It is not used directly, but through a `RoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Role; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Role::default(); +/// +/// // 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 ! +/// let result = hub.roles().update(req, "customer", "roleId") +/// .doit(); +/// # } +/// ``` +pub struct RoleUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Role, + _customer: String, + _role_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RoleUpdateCall<'a, C, A> {} + +impl<'a, C, A> RoleUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Role)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.roles.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("roleId", self._role_id.to_string())); + for &field in ["alt", "customer", "roleId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles/{roleId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{roleId}", "roleId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["roleId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Role) -> RoleUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable ID of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> RoleUpdateCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Immutable ID of the role. + /// + /// Sets the *role id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn role_id(mut self, new_value: &str) -> RoleUpdateCall<'a, C, A> { + self._role_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RoleUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RoleUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagement`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RoleUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a role. +/// +/// A builder for the *get* method supported by a *role* resource. +/// It is not used directly, but through a `RoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.roles().get("customer", "roleId") +/// .doit(); +/// # } +/// ``` +pub struct RoleGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _role_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RoleGetCall<'a, C, A> {} + +impl<'a, C, A> RoleGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Role)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.roles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("roleId", self._role_id.to_string())); + for &field in ["alt", "customer", "roleId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles/{roleId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagementReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{roleId}", "roleId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["roleId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable ID of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> RoleGetCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Immutable ID of the role. + /// + /// Sets the *role id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn role_id(mut self, new_value: &str) -> RoleGetCall<'a, C, A> { + self._role_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RoleGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RoleGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagementReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RoleGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a role. +/// +/// A builder for the *delete* method supported by a *role* resource. +/// It is not used directly, but through a `RoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.roles().delete("customer", "roleId") +/// .doit(); +/// # } +/// ``` +pub struct RoleDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _role_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RoleDeleteCall<'a, C, A> {} + +impl<'a, C, A> RoleDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.roles.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("roleId", self._role_id.to_string())); + for &field in ["customer", "roleId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles/{roleId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{roleId}", "roleId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["roleId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable ID of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> RoleDeleteCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Immutable ID of the role. + /// + /// Sets the *role id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn role_id(mut self, new_value: &str) -> RoleDeleteCall<'a, C, A> { + self._role_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RoleDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RoleDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagement`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RoleDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a role. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *role* resource. +/// It is not used directly, but through a `RoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Role; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Role::default(); +/// +/// // 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 ! +/// let result = hub.roles().patch(req, "customer", "roleId") +/// .doit(); +/// # } +/// ``` +pub struct RolePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Role, + _customer: String, + _role_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RolePatchCall<'a, C, A> {} + +impl<'a, C, A> RolePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Role)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.roles.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("roleId", self._role_id.to_string())); + for &field in ["alt", "customer", "roleId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles/{roleId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{roleId}", "roleId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["roleId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Role) -> RolePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable ID of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> RolePatchCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Immutable ID of the role. + /// + /// Sets the *role id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn role_id(mut self, new_value: &str) -> RolePatchCall<'a, C, A> { + self._role_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RolePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RolePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagement`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RolePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a role. +/// +/// A builder for the *insert* method supported by a *role* resource. +/// It is not used directly, but through a `RoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Role; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Role::default(); +/// +/// // 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 ! +/// let result = hub.roles().insert(req, "customer") +/// .doit(); +/// # } +/// ``` +pub struct RoleInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Role, + _customer: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RoleInsertCall<'a, C, A> {} + +impl<'a, C, A> RoleInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Role)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.roles.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + for &field in ["alt", "customer"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Role) -> RoleInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable ID of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> RoleInsertCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RoleInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RoleInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagement`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RoleInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a paginated list of all the roles in a domain. +/// +/// A builder for the *list* method supported by a *role* resource. +/// It is not used directly, but through a `RoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.roles().list("customer") +/// .page_token("consetetur") +/// .max_results(-52) +/// .doit(); +/// # } +/// ``` +pub struct RoleListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RoleListCall<'a, C, A> {} + +impl<'a, C, A> RoleListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Roles)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.roles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "customer", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagementReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> RoleListCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Token to specify the next page in the list. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> RoleListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> RoleListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RoleListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RoleListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagementReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RoleListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of notifications. +/// +/// A builder for the *list* method supported by a *notification* resource. +/// It is not used directly, but through a `NotificationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.notifications().list("customer") +/// .page_token("Lorem") +/// .max_results(90) +/// .language("justo") +/// .doit(); +/// # } +/// ``` +pub struct NotificationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _page_token: Option, + _max_results: Option, + _language: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NotificationListCall<'a, C, A> {} + +impl<'a, C, A> NotificationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Notifications)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.notifications.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._language { + params.push(("language", value.to_string())); + } + for &field in ["alt", "customer", "pageToken", "maxResults", "language"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/notifications".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryNotification.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique ID for the customer's Google account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> NotificationListCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The token to specify the page of results to retrieve. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> NotificationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of notifications to return per page. The default is 100. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> NotificationListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The ISO 639-1 code of the language notifications are returned in. The default is English (en). + /// + /// Sets the *language* query property to the given value. + pub fn language(mut self, new_value: &str) -> NotificationListCall<'a, C, A> { + self._language = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> NotificationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NotificationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryNotification`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> NotificationListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a notification. +/// +/// A builder for the *update* method supported by a *notification* resource. +/// It is not used directly, but through a `NotificationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Notification; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Notification::default(); +/// +/// // 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 ! +/// let result = hub.notifications().update(req, "customer", "notificationId") +/// .doit(); +/// # } +/// ``` +pub struct NotificationUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Notification, + _customer: String, + _notification_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NotificationUpdateCall<'a, C, A> {} + +impl<'a, C, A> NotificationUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Notification)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.notifications.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("notificationId", self._notification_id.to_string())); + for &field in ["alt", "customer", "notificationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/notifications/{notificationId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryNotification.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{notificationId}", "notificationId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["notificationId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Notification) -> NotificationUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique ID for the customer's Google account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> NotificationUpdateCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The unique ID of the notification. + /// + /// Sets the *notification id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn notification_id(mut self, new_value: &str) -> NotificationUpdateCall<'a, C, A> { + self._notification_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> NotificationUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NotificationUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryNotification`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> NotificationUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a notification +/// +/// A builder for the *delete* method supported by a *notification* resource. +/// It is not used directly, but through a `NotificationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.notifications().delete("customer", "notificationId") +/// .doit(); +/// # } +/// ``` +pub struct NotificationDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _notification_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NotificationDeleteCall<'a, C, A> {} + +impl<'a, C, A> NotificationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.notifications.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("notificationId", self._notification_id.to_string())); + for &field in ["customer", "notificationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/notifications/{notificationId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryNotification.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{notificationId}", "notificationId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["notificationId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> NotificationDeleteCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The unique ID of the notification. + /// + /// Sets the *notification id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn notification_id(mut self, new_value: &str) -> NotificationDeleteCall<'a, C, A> { + self._notification_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> NotificationDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NotificationDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryNotification`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> NotificationDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a notification. +/// +/// A builder for the *get* method supported by a *notification* resource. +/// It is not used directly, but through a `NotificationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.notifications().get("customer", "notificationId") +/// .doit(); +/// # } +/// ``` +pub struct NotificationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _notification_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NotificationGetCall<'a, C, A> {} + +impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Notification)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.notifications.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("notificationId", self._notification_id.to_string())); + for &field in ["alt", "customer", "notificationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/notifications/{notificationId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryNotification.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{notificationId}", "notificationId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["notificationId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The unique ID of the notification. + /// + /// Sets the *notification id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn notification_id(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { + self._notification_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> NotificationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NotificationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryNotification`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> NotificationGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a notification. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *notification* resource. +/// It is not used directly, but through a `NotificationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Notification; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Notification::default(); +/// +/// // 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 ! +/// let result = hub.notifications().patch(req, "customer", "notificationId") +/// .doit(); +/// # } +/// ``` +pub struct NotificationPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Notification, + _customer: String, + _notification_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NotificationPatchCall<'a, C, A> {} + +impl<'a, C, A> NotificationPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Notification)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.notifications.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("notificationId", self._notification_id.to_string())); + for &field in ["alt", "customer", "notificationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/notifications/{notificationId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryNotification.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{notificationId}", "notificationId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["notificationId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Notification) -> NotificationPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique ID for the customer's Google account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> NotificationPatchCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The unique ID of the notification. + /// + /// Sets the *notification id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn notification_id(mut self, new_value: &str) -> NotificationPatchCall<'a, C, A> { + self._notification_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> NotificationPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NotificationPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryNotification`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> NotificationPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a paginated list of all privileges for a customer. +/// +/// A builder for the *list* method supported by a *privilege* resource. +/// It is not used directly, but through a `PrivilegeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.privileges().list("customer") +/// .doit(); +/// # } +/// ``` +pub struct PrivilegeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PrivilegeListCall<'a, C, A> {} + +impl<'a, C, A> PrivilegeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Privileges)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.privileges.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + for &field in ["alt", "customer"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles/ALL/privileges".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagementReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable ID of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> PrivilegeListCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PrivilegeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PrivilegeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagementReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PrivilegeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Stop watching resources through this channel +/// +/// A builder for the *stop* method supported by a *channel* resource. +/// It is not used directly, but through a `ChannelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Channel; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Channel::default(); +/// +/// // 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 ! +/// let result = hub.channels().stop(req) +/// .doit(); +/// # } +/// ``` +pub struct ChannelStopCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Channel, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChannelStopCall<'a, C, A> {} + +impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "admin.channels.stop", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + for &field in [].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1//admin/directory_v1/channels/stop".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUser.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Channel) -> ChannelStopCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChannelStopCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChannelStopCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUser`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChannelStopCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieve Mobile Device +/// +/// A builder for the *get* method supported by a *mobiledevice* resource. +/// It is not used directly, but through a `MobiledeviceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.mobiledevices().get("customerId", "resourceId") +/// .projection("duo") +/// .doit(); +/// # } +/// ``` +pub struct MobiledeviceGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_id: String, + _resource_id: String, + _projection: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobiledeviceGetCall<'a, C, A> {} + +impl<'a, C, A> MobiledeviceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MobileDevice)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.mobiledevices.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + params.push(("resourceId", self._resource_id.to_string())); + if let Some(value) = self._projection { + params.push(("projection", value.to_string())); + } + for &field in ["alt", "customerId", "resourceId", "projection"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/mobile/{resourceId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDeviceMobileReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{resourceId}", "resourceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resourceId", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> MobiledeviceGetCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Immutable id of Mobile Device + /// + /// Sets the *resource id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource_id(mut self, new_value: &str) -> MobiledeviceGetCall<'a, C, A> { + self._resource_id = new_value.to_string(); + self + } + /// Restrict information returned to a set of selected fields. + /// + /// Sets the *projection* query property to the given value. + pub fn projection(mut self, new_value: &str) -> MobiledeviceGetCall<'a, C, A> { + self._projection = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MobiledeviceGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobiledeviceGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDeviceMobileReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MobiledeviceGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieve all Mobile Devices of a customer (paginated) +/// +/// A builder for the *list* method supported by a *mobiledevice* resource. +/// It is not used directly, but through a `MobiledeviceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.mobiledevices().list("customerId") +/// .sort_order("Lorem") +/// .query("et") +/// .projection("clita") +/// .page_token("consetetur") +/// .order_by("takimata") +/// .max_results(-40) +/// .doit(); +/// # } +/// ``` +pub struct MobiledeviceListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_id: String, + _sort_order: Option, + _query: Option, + _projection: Option, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobiledeviceListCall<'a, C, A> {} + +impl<'a, C, A> MobiledeviceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MobileDevices)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.mobiledevices.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._projection { + params.push(("projection", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "customerId", "sortOrder", "query", "projection", "pageToken", "orderBy", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/mobile".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDeviceMobileReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Whether to return results in ascending or descending order. Only of use when orderBy is also used + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Search string in the format given at http://support.google.com/a/bin/answer.py?hl=en&answer=1408863#search + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// Restrict information returned to a set of selected fields. + /// + /// Sets the *projection* query property to the given value. + pub fn projection(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { + self._projection = Some(new_value.to_string()); + self + } + /// Token to specify next page in the list + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Column to use for sorting results + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. Default is 100 + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> MobiledeviceListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MobiledeviceListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobiledeviceListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDeviceMobileReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MobiledeviceListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Delete Mobile Device +/// +/// A builder for the *delete* method supported by a *mobiledevice* resource. +/// It is not used directly, but through a `MobiledeviceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.mobiledevices().delete("customerId", "resourceId") +/// .doit(); +/// # } +/// ``` +pub struct MobiledeviceDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_id: String, + _resource_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobiledeviceDeleteCall<'a, C, A> {} + +impl<'a, C, A> MobiledeviceDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.mobiledevices.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + params.push(("resourceId", self._resource_id.to_string())); + for &field in ["customerId", "resourceId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/mobile/{resourceId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDeviceMobile.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{resourceId}", "resourceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resourceId", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> MobiledeviceDeleteCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Immutable id of Mobile Device + /// + /// Sets the *resource id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource_id(mut self, new_value: &str) -> MobiledeviceDeleteCall<'a, C, A> { + self._resource_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MobiledeviceDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobiledeviceDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDeviceMobile`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MobiledeviceDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Take action on Mobile Device +/// +/// A builder for the *action* method supported by a *mobiledevice* resource. +/// It is not used directly, but through a `MobiledeviceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::MobileDeviceAction; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = MobileDeviceAction::default(); +/// +/// // 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 ! +/// let result = hub.mobiledevices().action(req, "customerId", "resourceId") +/// .doit(); +/// # } +/// ``` +pub struct MobiledeviceActionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: MobileDeviceAction, + _customer_id: String, + _resource_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobiledeviceActionCall<'a, C, A> {} + +impl<'a, C, A> MobiledeviceActionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.mobiledevices.action", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + params.push(("resourceId", self._resource_id.to_string())); + for &field in ["customerId", "resourceId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/mobile/{resourceId}/action".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDeviceMobile.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{resourceId}", "resourceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["resourceId", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: MobileDeviceAction) -> MobiledeviceActionCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> MobiledeviceActionCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Immutable id of Mobile Device + /// + /// Sets the *resource id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource_id(mut self, new_value: &str) -> MobiledeviceActionCall<'a, C, A> { + self._resource_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MobiledeviceActionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobiledeviceActionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDeviceMobile`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MobiledeviceActionCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Get information about an access token issued by a user. +/// +/// A builder for the *get* method supported by a *token* resource. +/// It is not used directly, but through a `TokenMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.tokens().get("userKey", "clientId") +/// .doit(); +/// # } +/// ``` +pub struct TokenGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _user_key: String, + _client_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TokenGetCall<'a, C, A> {} + +impl<'a, C, A> TokenGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Token)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.tokens.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("userKey", self._user_key.to_string())); + params.push(("clientId", self._client_id.to_string())); + for &field in ["alt", "userKey", "clientId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/tokens/{clientId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{userKey}", "userKey"), ("{clientId}", "clientId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["clientId", "userKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. + /// + /// Sets the *user key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_key(mut self, new_value: &str) -> TokenGetCall<'a, C, A> { + self._user_key = new_value.to_string(); + self + } + /// The Client ID of the application the token is issued to. + /// + /// Sets the *client id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn client_id(mut self, new_value: &str) -> TokenGetCall<'a, C, A> { + self._client_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> TokenGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TokenGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserSecurity`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> TokenGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns the set of tokens specified user has issued to 3rd party applications. +/// +/// A builder for the *list* method supported by a *token* resource. +/// It is not used directly, but through a `TokenMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.tokens().list("userKey") +/// .doit(); +/// # } +/// ``` +pub struct TokenListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _user_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TokenListCall<'a, C, A> {} + +impl<'a, C, A> TokenListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Tokens)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.tokens.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("userKey", self._user_key.to_string())); + for &field in ["alt", "userKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/tokens".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{userKey}", "userKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["userKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. + /// + /// Sets the *user key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_key(mut self, new_value: &str) -> TokenListCall<'a, C, A> { + self._user_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> TokenListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TokenListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserSecurity`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> TokenListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Delete all access tokens issued by a user for an application. +/// +/// A builder for the *delete* method supported by a *token* resource. +/// It is not used directly, but through a `TokenMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.tokens().delete("userKey", "clientId") +/// .doit(); +/// # } +/// ``` +pub struct TokenDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _user_key: String, + _client_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TokenDeleteCall<'a, C, A> {} + +impl<'a, C, A> TokenDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.tokens.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("userKey", self._user_key.to_string())); + params.push(("clientId", self._client_id.to_string())); + for &field in ["userKey", "clientId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/tokens/{clientId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{userKey}", "userKey"), ("{clientId}", "clientId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["clientId", "userKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. + /// + /// Sets the *user key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_key(mut self, new_value: &str) -> TokenDeleteCall<'a, C, A> { + self._user_key = new_value.to_string(); + self + } + /// The Client ID of the application the token is issued to. + /// + /// Sets the *client id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn client_id(mut self, new_value: &str) -> TokenDeleteCall<'a, C, A> { + self._client_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> TokenDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TokenDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserSecurity`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> TokenDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a role assignment. +/// +/// A builder for the *insert* method supported by a *roleAssignment* resource. +/// It is not used directly, but through a `RoleAssignmentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::RoleAssignment; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = RoleAssignment::default(); +/// +/// // 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 ! +/// let result = hub.role_assignments().insert(req, "customer") +/// .doit(); +/// # } +/// ``` +pub struct RoleAssignmentInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: RoleAssignment, + _customer: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RoleAssignmentInsertCall<'a, C, A> {} + +impl<'a, C, A> RoleAssignmentInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RoleAssignment)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.roleAssignments.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + for &field in ["alt", "customer"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roleassignments".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: RoleAssignment) -> RoleAssignmentInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable ID of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> RoleAssignmentInsertCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RoleAssignmentInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RoleAssignmentInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagement`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RoleAssignmentInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieve a role assignment. +/// +/// A builder for the *get* method supported by a *roleAssignment* resource. +/// It is not used directly, but through a `RoleAssignmentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.role_assignments().get("customer", "roleAssignmentId") +/// .doit(); +/// # } +/// ``` +pub struct RoleAssignmentGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _role_assignment_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RoleAssignmentGetCall<'a, C, A> {} + +impl<'a, C, A> RoleAssignmentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RoleAssignment)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.roleAssignments.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("roleAssignmentId", self._role_assignment_id.to_string())); + for &field in ["alt", "customer", "roleAssignmentId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roleassignments/{roleAssignmentId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagementReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{roleAssignmentId}", "roleAssignmentId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["roleAssignmentId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable ID of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> RoleAssignmentGetCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Immutable ID of the role assignment. + /// + /// Sets the *role assignment id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn role_assignment_id(mut self, new_value: &str) -> RoleAssignmentGetCall<'a, C, A> { + self._role_assignment_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RoleAssignmentGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RoleAssignmentGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagementReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RoleAssignmentGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a role assignment. +/// +/// A builder for the *delete* method supported by a *roleAssignment* resource. +/// It is not used directly, but through a `RoleAssignmentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.role_assignments().delete("customer", "roleAssignmentId") +/// .doit(); +/// # } +/// ``` +pub struct RoleAssignmentDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _role_assignment_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RoleAssignmentDeleteCall<'a, C, A> {} + +impl<'a, C, A> RoleAssignmentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.roleAssignments.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("roleAssignmentId", self._role_assignment_id.to_string())); + for &field in ["customer", "roleAssignmentId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roleassignments/{roleAssignmentId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{roleAssignmentId}", "roleAssignmentId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["roleAssignmentId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable ID of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> RoleAssignmentDeleteCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Immutable ID of the role assignment. + /// + /// Sets the *role assignment id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn role_assignment_id(mut self, new_value: &str) -> RoleAssignmentDeleteCall<'a, C, A> { + self._role_assignment_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RoleAssignmentDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RoleAssignmentDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagement`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RoleAssignmentDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a paginated list of all roleAssignments. +/// +/// A builder for the *list* method supported by a *roleAssignment* resource. +/// It is not used directly, but through a `RoleAssignmentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.role_assignments().list("customer") +/// .user_key("consetetur") +/// .role_id("labore") +/// .page_token("sed") +/// .max_results(-16) +/// .doit(); +/// # } +/// ``` +pub struct RoleAssignmentListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _user_key: Option, + _role_id: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RoleAssignmentListCall<'a, C, A> {} + +impl<'a, C, A> RoleAssignmentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RoleAssignments)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.roleAssignments.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + if let Some(value) = self._user_key { + params.push(("userKey", value.to_string())); + } + if let Some(value) = self._role_id { + params.push(("roleId", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "customer", "userKey", "roleId", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roleassignments".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryRolemanagementReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable ID of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> RoleAssignmentListCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The user's primary email address, alias email address, or unique user ID. If included in the request, returns role assignments only for this user. + /// + /// Sets the *user key* query property to the given value. + pub fn user_key(mut self, new_value: &str) -> RoleAssignmentListCall<'a, C, A> { + self._user_key = Some(new_value.to_string()); + self + } + /// Immutable ID of a role. If included in the request, returns only role assignments containing this role ID. + /// + /// Sets the *role id* query property to the given value. + pub fn role_id(mut self, new_value: &str) -> RoleAssignmentListCall<'a, C, A> { + self._role_id = Some(new_value.to_string()); + self + } + /// Token to specify the next page in the list. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> RoleAssignmentListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> RoleAssignmentListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RoleAssignmentListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RoleAssignmentListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryRolemanagementReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RoleAssignmentListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieve all Chrome OS Devices of a customer (paginated) +/// +/// A builder for the *list* method supported by a *chromeosdevice* resource. +/// It is not used directly, but through a `ChromeosdeviceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.chromeosdevices().list("customerId") +/// .sort_order("aliquyam") +/// .query("eos") +/// .projection("tempor") +/// .page_token("sea") +/// .order_by("labore") +/// .max_results(-54) +/// .doit(); +/// # } +/// ``` +pub struct ChromeosdeviceListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_id: String, + _sort_order: Option, + _query: Option, + _projection: Option, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChromeosdeviceListCall<'a, C, A> {} + +impl<'a, C, A> ChromeosdeviceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChromeOsDevices)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.chromeosdevices.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._projection { + params.push(("projection", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "customerId", "sortOrder", "query", "projection", "pageToken", "orderBy", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDeviceChromeoReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Whether to return results in ascending or descending order. Only of use when orderBy is also used + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Search string in the format given at http://support.google.com/chromeos/a/bin/answer.py?hl=en&answer=1698333 + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// Restrict information returned to a set of selected fields. + /// + /// Sets the *projection* query property to the given value. + pub fn projection(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { + self._projection = Some(new_value.to_string()); + self + } + /// Token to specify next page in the list + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Column to use for sorting results + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. Default is 100 + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ChromeosdeviceListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChromeosdeviceListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChromeosdeviceListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDeviceChromeoReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChromeosdeviceListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Update Chrome OS Device. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *chromeosdevice* resource. +/// It is not used directly, but through a `ChromeosdeviceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::ChromeOsDevice; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = ChromeOsDevice::default(); +/// +/// // 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 ! +/// let result = hub.chromeosdevices().patch(req, "customerId", "deviceId") +/// .projection("sit") +/// .doit(); +/// # } +/// ``` +pub struct ChromeosdevicePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: ChromeOsDevice, + _customer_id: String, + _device_id: String, + _projection: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChromeosdevicePatchCall<'a, C, A> {} + +impl<'a, C, A> ChromeosdevicePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChromeOsDevice)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.chromeosdevices.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + params.push(("deviceId", self._device_id.to_string())); + if let Some(value) = self._projection { + params.push(("projection", value.to_string())); + } + for &field in ["alt", "customerId", "deviceId", "projection"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDeviceChromeo.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{deviceId}", "deviceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["deviceId", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: ChromeOsDevice) -> ChromeosdevicePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> ChromeosdevicePatchCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Immutable id of Chrome OS Device + /// + /// Sets the *device id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn device_id(mut self, new_value: &str) -> ChromeosdevicePatchCall<'a, C, A> { + self._device_id = new_value.to_string(); + self + } + /// Restrict information returned to a set of selected fields. + /// + /// Sets the *projection* query property to the given value. + pub fn projection(mut self, new_value: &str) -> ChromeosdevicePatchCall<'a, C, A> { + self._projection = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChromeosdevicePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChromeosdevicePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDeviceChromeo`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChromeosdevicePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Update Chrome OS Device +/// +/// A builder for the *update* method supported by a *chromeosdevice* resource. +/// It is not used directly, but through a `ChromeosdeviceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::ChromeOsDevice; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = ChromeOsDevice::default(); +/// +/// // 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 ! +/// let result = hub.chromeosdevices().update(req, "customerId", "deviceId") +/// .projection("justo") +/// .doit(); +/// # } +/// ``` +pub struct ChromeosdeviceUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: ChromeOsDevice, + _customer_id: String, + _device_id: String, + _projection: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChromeosdeviceUpdateCall<'a, C, A> {} + +impl<'a, C, A> ChromeosdeviceUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChromeOsDevice)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.chromeosdevices.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + params.push(("deviceId", self._device_id.to_string())); + if let Some(value) = self._projection { + params.push(("projection", value.to_string())); + } + for &field in ["alt", "customerId", "deviceId", "projection"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDeviceChromeo.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{deviceId}", "deviceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["deviceId", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: ChromeOsDevice) -> ChromeosdeviceUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> ChromeosdeviceUpdateCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Immutable id of Chrome OS Device + /// + /// Sets the *device id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn device_id(mut self, new_value: &str) -> ChromeosdeviceUpdateCall<'a, C, A> { + self._device_id = new_value.to_string(); + self + } + /// Restrict information returned to a set of selected fields. + /// + /// Sets the *projection* query property to the given value. + pub fn projection(mut self, new_value: &str) -> ChromeosdeviceUpdateCall<'a, C, A> { + self._projection = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChromeosdeviceUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChromeosdeviceUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDeviceChromeo`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChromeosdeviceUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieve Chrome OS Device +/// +/// A builder for the *get* method supported by a *chromeosdevice* resource. +/// It is not used directly, but through a `ChromeosdeviceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.chromeosdevices().get("customerId", "deviceId") +/// .projection("accusam") +/// .doit(); +/// # } +/// ``` +pub struct ChromeosdeviceGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_id: String, + _device_id: String, + _projection: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChromeosdeviceGetCall<'a, C, A> {} + +impl<'a, C, A> ChromeosdeviceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChromeOsDevice)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.chromeosdevices.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + params.push(("deviceId", self._device_id.to_string())); + if let Some(value) = self._projection { + params.push(("projection", value.to_string())); + } + for &field in ["alt", "customerId", "deviceId", "projection"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDeviceChromeoReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{deviceId}", "deviceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["deviceId", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> ChromeosdeviceGetCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Immutable id of Chrome OS Device + /// + /// Sets the *device id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn device_id(mut self, new_value: &str) -> ChromeosdeviceGetCall<'a, C, A> { + self._device_id = new_value.to_string(); + self + } + /// Restrict information returned to a set of selected fields. + /// + /// Sets the *projection* query property to the given value. + pub fn projection(mut self, new_value: &str) -> ChromeosdeviceGetCall<'a, C, A> { + self._projection = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChromeosdeviceGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChromeosdeviceGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDeviceChromeoReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChromeosdeviceGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Delete Group /// /// A builder for the *delete* method supported by a *group* resource. @@ -4452,7 +16647,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.groups.delete", + dlg.begin(MethodInfo { id: "directory.groups.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("groupKey", self._group_key.to_string())); @@ -4493,7 +16688,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4529,7 +16724,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4539,10 +16734,10 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4565,7 +16760,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *group key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_key(mut self, new_value: &str) -> GroupDeleteCall<'a, C, A> { self._group_key = new_value.to_string(); @@ -4583,12 +16778,12 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4605,17 +16800,17 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryGroup`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4651,10 +16846,10 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// // Values shown here are possibly random and not representative ! /// let result = hub.groups().list() /// .user_key("diam") -/// .page_token("ipsum") -/// .max_results(-5) -/// .domain("et") -/// .customer("duo") +/// .page_token("justo") +/// .max_results(-57) +/// .domain("clita") +/// .customer("invidunt") /// .doit(); /// # } /// ``` @@ -4686,7 +16881,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.groups.list", + dlg.begin(MethodInfo { id: "directory.groups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); if let Some(value) = self._user_key { @@ -4721,7 +16916,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::DirectoryGroupReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4757,7 +16952,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4767,10 +16962,10 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4846,12 +17041,12 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4868,17 +17063,17 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryGroupReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4947,7 +17142,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.groups.update", + dlg.begin(MethodInfo { id: "directory.groups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("groupKey", self._group_key.to_string())); @@ -4989,14 +17184,14 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5040,7 +17235,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5050,10 +17245,10 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5085,7 +17280,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Group) -> GroupUpdateCall<'a, C, A> { self._request = new_value; @@ -5095,7 +17290,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *group key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_key(mut self, new_value: &str) -> GroupUpdateCall<'a, C, A> { self._group_key = new_value.to_string(); @@ -5113,12 +17308,12 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5135,17 +17330,17 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryGroup`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5213,7 +17408,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.groups.insert", + dlg.begin(MethodInfo { id: "directory.groups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -5233,14 +17428,14 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::DirectoryGroup.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5284,7 +17479,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5294,10 +17489,10 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5329,7 +17524,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Group) -> GroupInsertCall<'a, C, A> { self._request = new_value; @@ -5347,12 +17542,12 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5369,17 +17564,17 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryGroup`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5448,7 +17643,7 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.groups.aliases.insert", + dlg.begin(MethodInfo { id: "directory.groups.aliases.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("groupKey", self._group_key.to_string())); @@ -5490,14 +17685,14 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5541,7 +17736,7 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5551,10 +17746,10 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5586,7 +17781,7 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Alias) -> GroupAliaseInsertCall<'a, C, A> { self._request = new_value; @@ -5596,7 +17791,7 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *group key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_key(mut self, new_value: &str) -> GroupAliaseInsertCall<'a, C, A> { self._group_key = new_value.to_string(); @@ -5614,12 +17809,12 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5636,17 +17831,17 @@ impl<'a, C, A> GroupAliaseInsertCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryGroup`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupAliaseInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupAliaseInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5708,7 +17903,7 @@ impl<'a, C, A> GroupAliaseListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.groups.aliases.list", + dlg.begin(MethodInfo { id: "directory.groups.aliases.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("groupKey", self._group_key.to_string())); @@ -5750,7 +17945,7 @@ impl<'a, C, A> GroupAliaseListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5786,7 +17981,7 @@ impl<'a, C, A> GroupAliaseListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5796,10 +17991,10 @@ impl<'a, C, A> GroupAliaseListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5832,7 +18027,7 @@ impl<'a, C, A> GroupAliaseListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *group key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_key(mut self, new_value: &str) -> GroupAliaseListCall<'a, C, A> { self._group_key = new_value.to_string(); @@ -5850,12 +18045,12 @@ impl<'a, C, A> GroupAliaseListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5872,17 +18067,17 @@ impl<'a, C, A> GroupAliaseListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryGroupReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupAliaseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupAliaseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5944,7 +18139,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.groups.get", + dlg.begin(MethodInfo { id: "directory.groups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("groupKey", self._group_key.to_string())); @@ -5986,7 +18181,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6022,7 +18217,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6032,10 +18227,10 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6068,7 +18263,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *group key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_key(mut self, new_value: &str) -> GroupGetCall<'a, C, A> { self._group_key = new_value.to_string(); @@ -6086,12 +18281,12 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6108,17 +18303,17 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryGroupReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6187,7 +18382,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.groups.patch", + dlg.begin(MethodInfo { id: "directory.groups.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("groupKey", self._group_key.to_string())); @@ -6229,14 +18424,14 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6280,7 +18475,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6290,10 +18485,10 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6325,7 +18520,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Group) -> GroupPatchCall<'a, C, A> { self._request = new_value; @@ -6335,7 +18530,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *group key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_key(mut self, new_value: &str) -> GroupPatchCall<'a, C, A> { self._group_key = new_value.to_string(); @@ -6353,12 +18548,12 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6375,17 +18570,17 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryGroup`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6448,7 +18643,7 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.groups.aliases.delete", + dlg.begin(MethodInfo { id: "directory.groups.aliases.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("groupKey", self._group_key.to_string())); @@ -6490,7 +18685,7 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6526,7 +18721,7 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6536,10 +18731,10 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6562,7 +18757,7 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *group key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_key(mut self, new_value: &str) -> GroupAliaseDeleteCall<'a, C, A> { self._group_key = new_value.to_string(); @@ -6572,7 +18767,7 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *alias* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn alias(mut self, new_value: &str) -> GroupAliaseDeleteCall<'a, C, A> { self._alias = new_value.to_string(); @@ -6590,12 +18785,12 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6612,17 +18807,17 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryGroup`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupAliaseDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupAliaseDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6630,10 +18825,10 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut } -/// Generate new backup verification codes for the user. +/// Get information about an ASP issued by a user. /// -/// A builder for the *generate* method supported by a *verificationCode* resource. -/// It is not used directly, but through a `VerificationCodeMethods` instance. +/// A builder for the *get* method supported by a *asp* resource. +/// It is not used directly, but through a `AspMethods` instance. /// /// # Example /// @@ -6656,27 +18851,28 @@ impl<'a, C, A> GroupAliaseDeleteCall<'a, C, A> where C: BorrowMut /// // 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 ! -/// let result = hub.verification_codes().generate("userKey") +/// let result = hub.asps().get("userKey", -17) /// .doit(); /// # } /// ``` -pub struct VerificationCodeGenerateCall<'a, C, A> +pub struct AspGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, _user_key: String, + _code_id: i32, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for VerificationCodeGenerateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AspGetCall<'a, C, A> {} -impl<'a, C, A> VerificationCodeGenerateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AspGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { + pub fn doit(mut self) -> Result<(hyper::client::Response, Asp)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -6684,461 +18880,12 @@ impl<'a, C, A> VerificationCodeGenerateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.verificationCodes.generate", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("userKey", self._user_key.to_string())); - for &field in ["userKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/verificationCodes/generate".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userKey}", "userKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["userKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Email or immutable Id of the user - /// - /// Sets the *user key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_key(mut self, new_value: &str) -> VerificationCodeGenerateCall<'a, C, A> { - self._user_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VerificationCodeGenerateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VerificationCodeGenerateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserSecurity`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VerificationCodeGenerateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Invalidate the current backup verification codes for the user. -/// -/// A builder for the *invalidate* method supported by a *verificationCode* resource. -/// It is not used directly, but through a `VerificationCodeMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.verification_codes().invalidate("userKey") -/// .doit(); -/// # } -/// ``` -pub struct VerificationCodeInvalidateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _user_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VerificationCodeInvalidateCall<'a, C, A> {} - -impl<'a, C, A> VerificationCodeInvalidateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.verificationCodes.invalidate", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("userKey", self._user_key.to_string())); - for &field in ["userKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/verificationCodes/invalidate".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userKey}", "userKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["userKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Email or immutable Id of the user - /// - /// Sets the *user key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_key(mut self, new_value: &str) -> VerificationCodeInvalidateCall<'a, C, A> { - self._user_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VerificationCodeInvalidateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VerificationCodeInvalidateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserSecurity`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VerificationCodeInvalidateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns the current set of valid backup verification codes for the specified user. -/// -/// A builder for the *list* method supported by a *verificationCode* resource. -/// It is not used directly, but through a `VerificationCodeMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.verification_codes().list("userKey") -/// .doit(); -/// # } -/// ``` -pub struct VerificationCodeListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _user_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VerificationCodeListCall<'a, C, A> {} - -impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VerificationCodes)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.verificationCodes.list", + dlg.begin(MethodInfo { id: "directory.asps.get", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); - for &field in ["alt", "userKey"].iter() { + params.push(("codeId", self._code_id.to_string())); + for &field in ["alt", "userKey", "codeId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -7150,12 +18897,12 @@ impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -7166,8 +18913,8 @@ impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut = Vec::with_capacity(1); - for param_name in ["userKey"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["codeId", "userKey"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -7176,7 +18923,7 @@ impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7212,7 +18959,7 @@ impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7222,10 +18969,10 @@ impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut VerificationCodeListCall<'a, C, A> where C: BorrowMut VerificationCodeListCall<'a, C, A> { + pub fn user_key(mut self, new_value: &str) -> AspGetCall<'a, C, A> { + self._user_key = new_value.to_string(); + self + } + /// The unique ID of the ASP. + /// + /// Sets the *code id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn code_id(mut self, new_value: i32) -> AspGetCall<'a, C, A> { + self._code_id = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AspGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AspGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserSecurity`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AspGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Delete an ASP issued by a user. +/// +/// A builder for the *delete* method supported by a *asp* resource. +/// It is not used directly, but through a `AspMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.asps().delete("userKey", -48) +/// .doit(); +/// # } +/// ``` +pub struct AspDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _user_key: String, + _code_id: i32, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AspDeleteCall<'a, C, A> {} + +impl<'a, C, A> AspDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.asps.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("userKey", self._user_key.to_string())); + params.push(("codeId", self._code_id.to_string())); + for &field in ["userKey", "codeId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/asps/{codeId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{userKey}", "userKey"), ("{codeId}", "codeId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["codeId", "userKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. + /// + /// Sets the *user key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_key(mut self, new_value: &str) -> AspDeleteCall<'a, C, A> { + self._user_key = new_value.to_string(); + self + } + /// The unique ID of the ASP to be deleted. + /// + /// Sets the *code id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn code_id(mut self, new_value: i32) -> AspDeleteCall<'a, C, A> { + self._code_id = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AspDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AspDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserSecurity`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AspDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// List the ASPs issued by a user. +/// +/// A builder for the *list* method supported by a *asp* resource. +/// It is not used directly, but through a `AspMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.asps().list("userKey") +/// .doit(); +/// # } +/// ``` +pub struct AspListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _user_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AspListCall<'a, C, A> {} + +impl<'a, C, A> AspListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Asps)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.asps.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("userKey", self._user_key.to_string())); + for &field in ["alt", "userKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/asps".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{userKey}", "userKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["userKey"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. + /// + /// Sets the *user key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn user_key(mut self, new_value: &str) -> AspListCall<'a, C, A> { self._user_key = new_value.to_string(); self } @@ -7270,18 +19500,18 @@ impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut VerificationCodeListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AspListCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7291,24 +19521,24 @@ impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> VerificationCodeListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> AspListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUserSecurity`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VerificationCodeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AspListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7316,277 +19546,10 @@ impl<'a, C, A> VerificationCodeListCall<'a, C, A> where C: BorrowMut::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Customer::default(); -/// -/// // 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 ! -/// let result = hub.customers().patch(req, "customerKey") -/// .doit(); -/// # } -/// ``` -pub struct CustomerPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Customer, - _customer_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CustomerPatchCall<'a, C, A> {} - -impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Customer)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.customers.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customerKey", self._customer_key.to_string())); - for &field in ["alt", "customerKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customers/{customerKey}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryCustomer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerKey}", "customerKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customerKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Customer) -> CustomerPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Id of the customer to be updated - /// - /// Sets the *customer key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_key(mut self, new_value: &str) -> CustomerPatchCall<'a, C, A> { - self._customer_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CustomerPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CustomerPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryCustomer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CustomerPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrives a customer. -/// -/// A builder for the *get* method supported by a *customer* resource. -/// It is not used directly, but through a `CustomerMethods` instance. +/// A builder for the *list* method supported by a *domain* resource. +/// It is not used directly, but through a `DomainMethods` instance. /// /// # Example /// @@ -7609,27 +19572,27 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: /// // 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 ! -/// let result = hub.customers().get("customerKey") +/// let result = hub.domains().list("customer") /// .doit(); /// # } /// ``` -pub struct CustomerGetCall<'a, C, A> +pub struct DomainListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, - _customer_key: String, + _customer: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for CustomerGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for DomainListCall<'a, C, A> {} -impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> DomainListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Customer)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Domains2)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -7637,11 +19600,11 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.customers.get", + dlg.begin(MethodInfo { id: "directory.domains.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customerKey", self._customer_key.to_string())); - for &field in ["alt", "customerKey"].iter() { + params.push(("customer", self._customer.to_string())); + for &field in ["alt", "customer"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -7653,12 +19616,12 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/admin/directory/v1/customers/{customerKey}".to_string(); + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domains".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryCustomerReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::DirectoryDomainReadonly.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{customerKey}", "customerKey")].iter() { + for &(find_this, param_name) in [("{customer}", "customer")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -7670,7 +19633,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customerKey"].iter() { + for param_name in ["customer"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -7679,7 +19642,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7715,7 +19678,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7725,10 +19688,10 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7757,14 +19720,14 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o } - /// Id of the customer to be retrieved + /// Immutable id of the Google Apps account. /// - /// Sets the *customer key* path property to the given value. + /// Sets the *customer* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn customer_key(mut self, new_value: &str) -> CustomerGetCall<'a, C, A> { - self._customer_key = new_value.to_string(); + pub fn customer(mut self, new_value: &str) -> DomainListCall<'a, C, A> { + self._customer = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -7773,18 +19736,18 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o /// 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 Delegate) -> CustomerGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DomainListCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7794,24 +19757,24 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CustomerGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> DomainListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryCustomerReadonly`. + /// `Scope::DirectoryDomainReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CustomerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DomainListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7819,277 +19782,10 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o } -/// Updates a customer. +/// Retrives a domain of the customer. /// -/// A builder for the *update* method supported by a *customer* resource. -/// It is not used directly, but through a `CustomerMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Customer; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Customer::default(); -/// -/// // 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 ! -/// let result = hub.customers().update(req, "customerKey") -/// .doit(); -/// # } -/// ``` -pub struct CustomerUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Customer, - _customer_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CustomerUpdateCall<'a, C, A> {} - -impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Customer)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.customers.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customerKey", self._customer_key.to_string())); - for &field in ["alt", "customerKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customers/{customerKey}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryCustomer.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerKey}", "customerKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customerKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Customer) -> CustomerUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// Id of the customer to be updated - /// - /// Sets the *customer key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_key(mut self, new_value: &str) -> CustomerUpdateCall<'a, C, A> { - self._customer_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CustomerUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CustomerUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryCustomer`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CustomerUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve all Organization Units -/// -/// A builder for the *list* method supported by a *orgunit* resource. -/// It is not used directly, but through a `OrgunitMethods` instance. +/// A builder for the *get* method supported by a *domain* resource. +/// It is not used directly, but through a `DomainMethods` instance. /// /// # Example /// @@ -8112,31 +19808,28 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A /// // 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 ! -/// let result = hub.orgunits().list("customerId") -/// .type_("invidunt") -/// .org_unit_path("aliquyam") +/// let result = hub.domains().get("customer", "domainName") /// .doit(); /// # } /// ``` -pub struct OrgunitListCall<'a, C, A> +pub struct DomainGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, - _customer_id: String, - _type_: Option, - _org_unit_path: Option, + _customer: String, + _domain_name: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OrgunitListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for DomainGetCall<'a, C, A> {} -impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> DomainGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, OrgUnits)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Domains)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -8144,17 +19837,12 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.orgunits.list", + dlg.begin(MethodInfo { id: "directory.domains.get", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - if let Some(value) = self._type_ { - params.push(("type", value.to_string())); - } - if let Some(value) = self._org_unit_path { - params.push(("orgUnitPath", value.to_string())); - } - for &field in ["alt", "customerId", "type", "orgUnitPath"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("domainName", self._domain_name.to_string())); + for &field in ["alt", "customer", "domainName"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -8166,12 +19854,12 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits".to_string(); + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domains/{domainName}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryOrgunitReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::DirectoryDomainReadonly.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { + for &(find_this, param_name) in [("{customer}", "customer"), ("{domainName}", "domainName")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -8182,8 +19870,8 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customerId"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["domainName", "customer"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -8192,7 +19880,7 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8228,7 +19916,7 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8238,10 +19926,10 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8270,28 +19958,24 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o } - /// Immutable id of the Google Apps account + /// Immutable id of the Google Apps account. /// - /// Sets the *customer id* path property to the given value. + /// Sets the *customer* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> OrgunitListCall<'a, C, A> { - self._customer_id = new_value.to_string(); + pub fn customer(mut self, new_value: &str) -> DomainGetCall<'a, C, A> { + self._customer = new_value.to_string(); self } - /// Whether to return all sub-organizations or just immediate children + /// Name of domain to be retrieved /// - /// Sets the *type* query property to the given value. - pub fn type_(mut self, new_value: &str) -> OrgunitListCall<'a, C, A> { - self._type_ = Some(new_value.to_string()); - self - } - /// the URL-encoded organization unit's path or its Id + /// Sets the *domain name* path property to the given value. /// - /// Sets the *org unit path* query property to the given value. - pub fn org_unit_path(mut self, new_value: &str) -> OrgunitListCall<'a, C, A> { - self._org_unit_path = Some(new_value.to_string()); + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn domain_name(mut self, new_value: &str) -> DomainGetCall<'a, C, A> { + self._domain_name = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -8300,18 +19984,18 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o /// 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 Delegate) -> OrgunitListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DomainGetCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8321,24 +20005,24 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OrgunitListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> DomainGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryOrgunitReadonly`. + /// `Scope::DirectoryDomainReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrgunitListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DomainGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8346,10 +20030,10 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o } -/// Add Organization Unit +/// Inserts a domain of the customer. /// -/// A builder for the *insert* method supported by a *orgunit* resource. -/// It is not used directly, but through a `OrgunitMethods` instance. +/// A builder for the *insert* method supported by a *domain* resource. +/// It is not used directly, but through a `DomainMethods` instance. /// /// # Example /// @@ -8359,7 +20043,7 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::OrgUnit; +/// use admin1_directory::Domains; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -8373,33 +20057,33 @@ impl<'a, C, A> OrgunitListCall<'a, C, A> where C: BorrowMut, A: o /// // 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 ! -/// let mut req = OrgUnit::default(); +/// let mut req = Domains::default(); /// /// // 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 ! -/// let result = hub.orgunits().insert(req, "customerId") +/// let result = hub.domains().insert(req, "customer") /// .doit(); /// # } /// ``` -pub struct OrgunitInsertCall<'a, C, A> +pub struct DomainInsertCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, - _request: OrgUnit, - _customer_id: String, + _request: Domains, + _customer: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OrgunitInsertCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for DomainInsertCall<'a, C, A> {} -impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> DomainInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, OrgUnit)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Domains)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -8407,11 +20091,11 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.orgunits.insert", + dlg.begin(MethodInfo { id: "directory.domains.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - for &field in ["alt", "customerId"].iter() { + params.push(("customer", self._customer.to_string())); + for &field in ["alt", "customer"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -8423,12 +20107,12 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits".to_string(); + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domains".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryOrgunit.as_ref().to_string(), ()); + self._scopes.insert(Scope::DirectoryDomain.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { + for &(find_this, param_name) in [("{customer}", "customer")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -8440,7 +20124,7 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customerId"].iter() { + for param_name in ["customer"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -8449,14 +20133,14 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8500,7 +20184,7 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8510,10 +20194,10 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8545,20 +20229,20 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrgUnit) -> OrgunitInsertCall<'a, C, A> { + pub fn request(mut self, new_value: Domains) -> DomainInsertCall<'a, C, A> { self._request = new_value; self } - /// Immutable id of the Google Apps account + /// Immutable id of the Google Apps account. /// - /// Sets the *customer id* path property to the given value. + /// Sets the *customer* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> OrgunitInsertCall<'a, C, A> { - self._customer_id = new_value.to_string(); + pub fn customer(mut self, new_value: &str) -> DomainInsertCall<'a, C, A> { + self._customer = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -8567,18 +20251,18 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, 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 Delegate) -> OrgunitInsertCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> DomainInsertCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8588,24 +20272,24 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OrgunitInsertCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> DomainInsertCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryOrgunit`. + /// `Scope::DirectoryDomain`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrgunitInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DomainInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8613,10 +20297,10 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: } -/// Update Organization Unit +/// Deletes a domain of the customer. /// -/// A builder for the *update* method supported by a *orgunit* resource. -/// It is not used directly, but through a `OrgunitMethods` instance. +/// A builder for the *delete* method supported by a *domain* resource. +/// It is not used directly, but through a `DomainMethods` instance. /// /// # Example /// @@ -8626,7 +20310,244 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::OrgUnit; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.domains().delete("customer", "domainName") +/// .doit(); +/// # } +/// ``` +pub struct DomainDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _domain_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DomainDeleteCall<'a, C, A> {} + +impl<'a, C, A> DomainDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.domains.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("domainName", self._domain_name.to_string())); + for &field in ["customer", "domainName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domains/{domainName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDomain.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{domainName}", "domainName")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["domainName", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> DomainDeleteCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Name of domain to be deleted + /// + /// Sets the *domain name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn domain_name(mut self, new_value: &str) -> DomainDeleteCall<'a, C, A> { + self._domain_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DomainDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DomainDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDomain`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DomainDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a Domain alias of the customer. +/// +/// A builder for the *insert* method supported by a *domainAliase* resource. +/// It is not used directly, but through a `DomainAliaseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::DomainAlias; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -8640,34 +20561,33 @@ impl<'a, C, A> OrgunitInsertCall<'a, C, A> where C: BorrowMut, A: /// // 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 ! -/// let mut req = OrgUnit::default(); +/// let mut req = DomainAlias::default(); /// /// // 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 ! -/// let result = hub.orgunits().update(req, "customerId", "orgUnitPath") +/// let result = hub.domain_aliases().insert(req, "customer") /// .doit(); /// # } /// ``` -pub struct OrgunitUpdateCall<'a, C, A> +pub struct DomainAliaseInsertCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, - _request: OrgUnit, - _customer_id: String, - _org_unit_path: Vec, + _request: DomainAlias, + _customer: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OrgunitUpdateCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for DomainAliaseInsertCall<'a, C, A> {} -impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> DomainAliaseInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, OrgUnit)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, DomainAlias)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -8675,18 +20595,11 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.orgunits.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - if self._org_unit_path.len() > 0 { - let mut s = String::new(); - for f in self._org_unit_path.iter() { - s.push_str(&("/".to_string() + &f.to_string())); - } - params.push(("orgUnitPath", s)); - } - for &field in ["alt", "customerId", "orgUnitPath"].iter() { + dlg.begin(MethodInfo { id: "directory.domainAliases.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + for &field in ["alt", "customer"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -8698,12 +20611,274 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits{/orgUnitPath*}".to_string(); + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domainaliases".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryOrgunit.as_ref().to_string(), ()); + self._scopes.insert(Scope::DirectoryDomain.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{/orgUnitPath*}", "orgUnitPath")].iter() { + for &(find_this, param_name) in [("{customer}", "customer")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: DomainAlias) -> DomainAliaseInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable id of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> DomainAliaseInsertCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DomainAliaseInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DomainAliaseInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDomain`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DomainAliaseInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a domain alias of the customer. +/// +/// A builder for the *get* method supported by a *domainAliase* resource. +/// It is not used directly, but through a `DomainAliaseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.domain_aliases().get("customer", "domainAliasName") +/// .doit(); +/// # } +/// ``` +pub struct DomainAliaseGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _domain_alias_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DomainAliaseGetCall<'a, C, A> {} + +impl<'a, C, A> DomainAliaseGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DomainAlias)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.domainAliases.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("domainAliasName", self._domain_alias_name.to_string())); + for &field in ["alt", "customer", "domainAliasName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domainaliases/{domainAliasName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDomainReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{domainAliasName}", "domainAliasName")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -8715,7 +20890,7 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: } { let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["orgUnitPath", "customerId"].iter() { + for param_name in ["domainAliasName", "customer"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -8724,14 +20899,1002 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> DomainAliaseGetCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Name of domain alias to be retrieved. + /// + /// Sets the *domain alias name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn domain_alias_name(mut self, new_value: &str) -> DomainAliaseGetCall<'a, C, A> { + self._domain_alias_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DomainAliaseGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DomainAliaseGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDomainReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DomainAliaseGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists the domain aliases of the customer. +/// +/// A builder for the *list* method supported by a *domainAliase* resource. +/// It is not used directly, but through a `DomainAliaseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.domain_aliases().list("customer") +/// .parent_domain_name("sed") +/// .doit(); +/// # } +/// ``` +pub struct DomainAliaseListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _parent_domain_name: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DomainAliaseListCall<'a, C, A> {} + +impl<'a, C, A> DomainAliaseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DomainAliases)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.domainAliases.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + if let Some(value) = self._parent_domain_name { + params.push(("parentDomainName", value.to_string())); + } + for &field in ["alt", "customer", "parentDomainName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domainaliases".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDomainReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> DomainAliaseListCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Name of the parent domain for which domain aliases are to be fetched. + /// + /// Sets the *parent domain name* query property to the given value. + pub fn parent_domain_name(mut self, new_value: &str) -> DomainAliaseListCall<'a, C, A> { + self._parent_domain_name = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DomainAliaseListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DomainAliaseListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDomainReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DomainAliaseListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a Domain Alias of the customer. +/// +/// A builder for the *delete* method supported by a *domainAliase* resource. +/// It is not used directly, but through a `DomainAliaseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.domain_aliases().delete("customer", "domainAliasName") +/// .doit(); +/// # } +/// ``` +pub struct DomainAliaseDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _domain_alias_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DomainAliaseDeleteCall<'a, C, A> {} + +impl<'a, C, A> DomainAliaseDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.domainAliases.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("domainAliasName", self._domain_alias_name.to_string())); + for &field in ["customer", "domainAliasName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domainaliases/{domainAliasName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryDomain.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{domainAliasName}", "domainAliasName")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["domainAliasName", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> DomainAliaseDeleteCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Name of domain alias to be retrieved. + /// + /// Sets the *domain alias name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn domain_alias_name(mut self, new_value: &str) -> DomainAliaseDeleteCall<'a, C, A> { + self._domain_alias_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DomainAliaseDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DomainAliaseDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryDomain`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DomainAliaseDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieve schema +/// +/// A builder for the *get* method supported by a *schema* resource. +/// It is not used directly, but through a `SchemaMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.schemas().get("customerId", "schemaKey") +/// .doit(); +/// # } +/// ``` +pub struct SchemaGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_id: String, + _schema_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SchemaGetCall<'a, C, A> {} + +impl<'a, C, A> SchemaGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Schema)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.schemas.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + params.push(("schemaKey", self._schema_key.to_string())); + for &field in ["alt", "customerId", "schemaKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas/{schemaKey}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserschemaReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{schemaKey}", "schemaKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["schemaKey", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> SchemaGetCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Name or immutable Id of the schema + /// + /// Sets the *schema key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn schema_key(mut self, new_value: &str) -> SchemaGetCall<'a, C, A> { + self._schema_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SchemaGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SchemaGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserschemaReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SchemaGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Update schema +/// +/// A builder for the *update* method supported by a *schema* resource. +/// It is not used directly, but through a `SchemaMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Schema; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Schema::default(); +/// +/// // 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 ! +/// let result = hub.schemas().update(req, "customerId", "schemaKey") +/// .doit(); +/// # } +/// ``` +pub struct SchemaUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Schema, + _customer_id: String, + _schema_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SchemaUpdateCall<'a, C, A> {} + +impl<'a, C, A> SchemaUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Schema)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.schemas.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + params.push(("schemaKey", self._schema_key.to_string())); + for &field in ["alt", "customerId", "schemaKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas/{schemaKey}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserschema.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{schemaKey}", "schemaKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["schemaKey", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8775,7 +21938,7 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8785,10 +21948,10 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8820,9 +21983,9 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrgUnit) -> OrgunitUpdateCall<'a, C, A> { + pub fn request(mut self, new_value: Schema) -> SchemaUpdateCall<'a, C, A> { self._request = new_value; self } @@ -8830,21 +21993,20 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *customer id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> OrgunitUpdateCall<'a, C, A> { + pub fn customer_id(mut self, new_value: &str) -> SchemaUpdateCall<'a, C, A> { self._customer_id = new_value.to_string(); self } - /// Full path of the organization unit or its Id + /// Name or immutable Id of the schema. /// - /// Append the given value to the *org unit path* path property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + /// Sets the *schema key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn add_org_unit_path(mut self, new_value: &str) -> OrgunitUpdateCall<'a, C, A> { - self._org_unit_path.push(new_value.to_string()); + pub fn schema_key(mut self, new_value: &str) -> SchemaUpdateCall<'a, C, A> { + self._schema_key = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -8853,18 +22015,18 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, 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 Delegate) -> OrgunitUpdateCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SchemaUpdateCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8874,24 +22036,24 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OrgunitUpdateCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> SchemaUpdateCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryOrgunit`. + /// `Scope::DirectoryUserschema`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrgunitUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SchemaUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8899,10 +22061,10 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: } -/// Remove Organization Unit +/// Retrieve all schemas for a customer /// -/// A builder for the *delete* method supported by a *orgunit* resource. -/// It is not used directly, but through a `OrgunitMethods` instance. +/// A builder for the *list* method supported by a *schema* resource. +/// It is not used directly, but through a `SchemaMethods` instance. /// /// # Example /// @@ -8925,28 +22087,27 @@ impl<'a, C, A> OrgunitUpdateCall<'a, C, A> where C: BorrowMut, A: /// // 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 ! -/// let result = hub.orgunits().delete("customerId", "orgUnitPath") +/// let result = hub.schemas().list("customerId") /// .doit(); /// # } /// ``` -pub struct OrgunitDeleteCall<'a, C, A> +pub struct SchemaListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, _customer_id: String, - _org_unit_path: Vec, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OrgunitDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for SchemaListCall<'a, C, A> {} -impl<'a, C, A> OrgunitDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> SchemaListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { + pub fn doit(mut self) -> Result<(hyper::client::Response, Schemas)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -8954,262 +22115,11 @@ impl<'a, C, A> OrgunitDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.orgunits.delete", - http_method: hyper::method::Method::Delete }); + dlg.begin(MethodInfo { id: "directory.schemas.list", + http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); - if self._org_unit_path.len() > 0 { - let mut s = String::new(); - for f in self._org_unit_path.iter() { - s.push_str(&("/".to_string() + &f.to_string())); - } - params.push(("orgUnitPath", s)); - } - for &field in ["customerId", "orgUnitPath"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits{/orgUnitPath*}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryOrgunit.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{/orgUnitPath*}", "orgUnitPath")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["orgUnitPath", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> OrgunitDeleteCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Full path of the organization unit or its Id - /// - /// Append the given value to the *org unit path* path property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn add_org_unit_path(mut self, new_value: &str) -> OrgunitDeleteCall<'a, C, A> { - self._org_unit_path.push(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> OrgunitDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OrgunitDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryOrgunit`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> OrgunitDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve Organization Unit -/// -/// A builder for the *get* method supported by a *orgunit* resource. -/// It is not used directly, but through a `OrgunitMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.orgunits().get("customerId", "orgUnitPath") -/// .doit(); -/// # } -/// ``` -pub struct OrgunitGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer_id: String, - _org_unit_path: Vec, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OrgunitGetCall<'a, C, A> {} - -impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, OrgUnit)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.orgunits.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - if self._org_unit_path.len() > 0 { - let mut s = String::new(); - for f in self._org_unit_path.iter() { - s.push_str(&("/".to_string() + &f.to_string())); - } - params.push(("orgUnitPath", s)); - } - for &field in ["alt", "customerId", "orgUnitPath"].iter() { + for &field in ["alt", "customerId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -9221,12 +22131,12 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits{/orgUnitPath*}".to_string(); + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryOrgunitReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::DirectoryUserschemaReadonly.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{/orgUnitPath*}", "orgUnitPath")].iter() { + for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -9237,8 +22147,8 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["orgUnitPath", "customerId"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customerId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -9247,7 +22157,7 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9283,7 +22193,7 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9293,10 +22203,10 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9329,41 +22239,30 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *customer id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> OrgunitGetCall<'a, C, A> { + pub fn customer_id(mut self, new_value: &str) -> SchemaListCall<'a, C, A> { self._customer_id = new_value.to_string(); self } - /// Full path of the organization unit or its Id - /// - /// Append the given value to the *org unit path* path property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn add_org_unit_path(mut self, new_value: &str) -> OrgunitGetCall<'a, C, A> { - self._org_unit_path.push(new_value.to_string()); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// 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 Delegate) -> OrgunitGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SchemaListCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9373,24 +22272,24 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OrgunitGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> SchemaListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryOrgunitReadonly`. + /// `Scope::DirectoryUserschemaReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrgunitGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SchemaListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9398,10 +22297,10 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Update Organization Unit. This method supports patch semantics. +/// Update schema. This method supports patch semantics. /// -/// A builder for the *patch* method supported by a *orgunit* resource. -/// It is not used directly, but through a `OrgunitMethods` instance. +/// A builder for the *patch* method supported by a *schema* resource. +/// It is not used directly, but through a `SchemaMethods` instance. /// /// # Example /// @@ -9411,7 +22310,7 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::OrgUnit; +/// use admin1_directory::Schema; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -9425,34 +22324,34 @@ impl<'a, C, A> OrgunitGetCall<'a, C, A> where C: BorrowMut, A: oa /// // 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 ! -/// let mut req = OrgUnit::default(); +/// let mut req = Schema::default(); /// /// // 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 ! -/// let result = hub.orgunits().patch(req, "customerId", "orgUnitPath") +/// let result = hub.schemas().patch(req, "customerId", "schemaKey") /// .doit(); /// # } /// ``` -pub struct OrgunitPatchCall<'a, C, A> +pub struct SchemaPatchCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Directory, - _request: OrgUnit, + _request: Schema, _customer_id: String, - _org_unit_path: Vec, + _schema_key: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OrgunitPatchCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for SchemaPatchCall<'a, C, A> {} -impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> SchemaPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, OrgUnit)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Schema)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -9460,18 +22359,12 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.orgunits.patch", + dlg.begin(MethodInfo { id: "directory.schemas.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); - if self._org_unit_path.len() > 0 { - let mut s = String::new(); - for f in self._org_unit_path.iter() { - s.push_str(&("/".to_string() + &f.to_string())); - } - params.push(("orgUnitPath", s)); - } - for &field in ["alt", "customerId", "orgUnitPath"].iter() { + params.push(("schemaKey", self._schema_key.to_string())); + for &field in ["alt", "customerId", "schemaKey"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -9483,12 +22376,12 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits{/orgUnitPath*}".to_string(); + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas/{schemaKey}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryOrgunit.as_ref().to_string(), ()); + self._scopes.insert(Scope::DirectoryUserschema.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{/orgUnitPath*}", "orgUnitPath")].iter() { + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{schemaKey}", "schemaKey")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -9500,7 +22393,7 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: } { let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["orgUnitPath", "customerId"].iter() { + for param_name in ["schemaKey", "customerId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -9509,14 +22402,14 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9560,7 +22453,7 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9570,10 +22463,10 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9605,9 +22498,9 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrgUnit) -> OrgunitPatchCall<'a, C, A> { + pub fn request(mut self, new_value: Schema) -> SchemaPatchCall<'a, C, A> { self._request = new_value; self } @@ -9615,21 +22508,20 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *customer id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> OrgunitPatchCall<'a, C, A> { + pub fn customer_id(mut self, new_value: &str) -> SchemaPatchCall<'a, C, A> { self._customer_id = new_value.to_string(); self } - /// Full path of the organization unit or its Id + /// Name or immutable Id of the schema. /// - /// Append the given value to the *org unit path* path property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + /// Sets the *schema key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn add_org_unit_path(mut self, new_value: &str) -> OrgunitPatchCall<'a, C, A> { - self._org_unit_path.push(new_value.to_string()); + pub fn schema_key(mut self, new_value: &str) -> SchemaPatchCall<'a, C, A> { + self._schema_key = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -9638,18 +22530,18 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, 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 Delegate) -> OrgunitPatchCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SchemaPatchCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9659,24 +22551,2098 @@ impl<'a, C, A> OrgunitPatchCall<'a, C, A> where C: BorrowMut, A: /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OrgunitPatchCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> SchemaPatchCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryOrgunit`. + /// `Scope::DirectoryUserschema`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrgunitPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SchemaPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Delete schema +/// +/// A builder for the *delete* method supported by a *schema* resource. +/// It is not used directly, but through a `SchemaMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.schemas().delete("customerId", "schemaKey") +/// .doit(); +/// # } +/// ``` +pub struct SchemaDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer_id: String, + _schema_key: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SchemaDeleteCall<'a, C, A> {} + +impl<'a, C, A> SchemaDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.schemas.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + params.push(("schemaKey", self._schema_key.to_string())); + for &field in ["customerId", "schemaKey"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas/{schemaKey}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserschema.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId"), ("{schemaKey}", "schemaKey")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["schemaKey", "customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> SchemaDeleteCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// Name or immutable Id of the schema + /// + /// Sets the *schema key* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn schema_key(mut self, new_value: &str) -> SchemaDeleteCall<'a, C, A> { + self._schema_key = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SchemaDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SchemaDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserschema`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SchemaDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Create schema. +/// +/// A builder for the *insert* method supported by a *schema* resource. +/// It is not used directly, but through a `SchemaMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::Schema; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = Schema::default(); +/// +/// // 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 ! +/// let result = hub.schemas().insert(req, "customerId") +/// .doit(); +/// # } +/// ``` +pub struct SchemaInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: Schema, + _customer_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SchemaInsertCall<'a, C, A> {} + +impl<'a, C, A> SchemaInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Schema)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.schemas.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customerId", self._customer_id.to_string())); + for &field in ["alt", "customerId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryUserschema.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customerId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Schema) -> SchemaInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// Immutable id of the Google Apps account + /// + /// Sets the *customer id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer_id(mut self, new_value: &str) -> SchemaInsertCall<'a, C, A> { + self._customer_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SchemaInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SchemaInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryUserschema`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SchemaInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of calendar resources for an account. +/// +/// A builder for the *calendars.list* method supported by a *resource* resource. +/// It is not used directly, but through a `ResourceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.resources().calendars_list("customer") +/// .page_token("dolor") +/// .max_results(-9) +/// .doit(); +/// # } +/// ``` +pub struct ResourceCalendarListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ResourceCalendarListCall<'a, C, A> {} + +impl<'a, C, A> ResourceCalendarListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CalendarResources)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.resources.calendars.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "customer", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/resources/calendars".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryResourceCalendarReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> ResourceCalendarListCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// Token to specify the next page in the list. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ResourceCalendarListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ResourceCalendarListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ResourceCalendarListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ResourceCalendarListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryResourceCalendarReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ResourceCalendarListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a calendar resource. +/// +/// A builder for the *calendars.get* method supported by a *resource* resource. +/// It is not used directly, but through a `ResourceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.resources().calendars_get("customer", "calendarResourceId") +/// .doit(); +/// # } +/// ``` +pub struct ResourceCalendarGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _calendar_resource_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ResourceCalendarGetCall<'a, C, A> {} + +impl<'a, C, A> ResourceCalendarGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CalendarResource)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.resources.calendars.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("calendarResourceId", self._calendar_resource_id.to_string())); + for &field in ["alt", "customer", "calendarResourceId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/resources/calendars/{calendarResourceId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryResourceCalendarReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{calendarResourceId}", "calendarResourceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["calendarResourceId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> ResourceCalendarGetCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The unique ID of the calendar resource to retrieve. + /// + /// Sets the *calendar resource id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn calendar_resource_id(mut self, new_value: &str) -> ResourceCalendarGetCall<'a, C, A> { + self._calendar_resource_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ResourceCalendarGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ResourceCalendarGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryResourceCalendarReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ResourceCalendarGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a calendar resource. +/// +/// A builder for the *calendars.insert* method supported by a *resource* resource. +/// It is not used directly, but through a `ResourceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::CalendarResource; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = CalendarResource::default(); +/// +/// // 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 ! +/// let result = hub.resources().calendars_insert(req, "customer") +/// .doit(); +/// # } +/// ``` +pub struct ResourceCalendarInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: CalendarResource, + _customer: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ResourceCalendarInsertCall<'a, C, A> {} + +impl<'a, C, A> ResourceCalendarInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CalendarResource)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.resources.calendars.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + for &field in ["alt", "customer"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/resources/calendars".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryResourceCalendar.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CalendarResource) -> ResourceCalendarInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> ResourceCalendarInsertCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ResourceCalendarInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ResourceCalendarInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryResourceCalendar`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ResourceCalendarInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a calendar resource. This method supports patch semantics. +/// +/// A builder for the *calendars.patch* method supported by a *resource* resource. +/// It is not used directly, but through a `ResourceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::CalendarResource; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = CalendarResource::default(); +/// +/// // 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 ! +/// let result = hub.resources().calendars_patch(req, "customer", "calendarResourceId") +/// .doit(); +/// # } +/// ``` +pub struct ResourceCalendarPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: CalendarResource, + _customer: String, + _calendar_resource_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ResourceCalendarPatchCall<'a, C, A> {} + +impl<'a, C, A> ResourceCalendarPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CalendarResource)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.resources.calendars.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("calendarResourceId", self._calendar_resource_id.to_string())); + for &field in ["alt", "customer", "calendarResourceId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/resources/calendars/{calendarResourceId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryResourceCalendar.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{calendarResourceId}", "calendarResourceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["calendarResourceId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CalendarResource) -> ResourceCalendarPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> ResourceCalendarPatchCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The unique ID of the calendar resource to update. + /// + /// Sets the *calendar resource id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn calendar_resource_id(mut self, new_value: &str) -> ResourceCalendarPatchCall<'a, C, A> { + self._calendar_resource_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ResourceCalendarPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ResourceCalendarPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryResourceCalendar`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ResourceCalendarPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a calendar resource. +/// +/// A builder for the *calendars.update* method supported by a *resource* resource. +/// It is not used directly, but through a `ResourceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// use admin1_directory::CalendarResource; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let mut req = CalendarResource::default(); +/// +/// // 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 ! +/// let result = hub.resources().calendars_update(req, "customer", "calendarResourceId") +/// .doit(); +/// # } +/// ``` +pub struct ResourceCalendarUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _request: CalendarResource, + _customer: String, + _calendar_resource_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ResourceCalendarUpdateCall<'a, C, A> {} + +impl<'a, C, A> ResourceCalendarUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CalendarResource)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.resources.calendars.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("calendarResourceId", self._calendar_resource_id.to_string())); + for &field in ["alt", "customer", "calendarResourceId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/resources/calendars/{calendarResourceId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryResourceCalendar.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{calendarResourceId}", "calendarResourceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["calendarResourceId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CalendarResource) -> ResourceCalendarUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> ResourceCalendarUpdateCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The unique ID of the calendar resource to update. + /// + /// Sets the *calendar resource id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn calendar_resource_id(mut self, new_value: &str) -> ResourceCalendarUpdateCall<'a, C, A> { + self._calendar_resource_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ResourceCalendarUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ResourceCalendarUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryResourceCalendar`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ResourceCalendarUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a calendar resource. +/// +/// A builder for the *calendars.delete* method supported by a *resource* resource. +/// It is not used directly, but through a `ResourceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_admin1_directory as admin1_directory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use admin1_directory::Directory; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! +/// let result = hub.resources().calendars_delete("customer", "calendarResourceId") +/// .doit(); +/// # } +/// ``` +pub struct ResourceCalendarDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Directory, + _customer: String, + _calendar_resource_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ResourceCalendarDeleteCall<'a, C, A> {} + +impl<'a, C, A> ResourceCalendarDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "directory.resources.calendars.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("customer", self._customer.to_string())); + params.push(("calendarResourceId", self._calendar_resource_id.to_string())); + for &field in ["customer", "calendarResourceId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/resources/calendars/{calendarResourceId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::DirectoryResourceCalendar.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{customer}", "customer"), ("{calendarResourceId}", "calendarResourceId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["calendarResourceId", "customer"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The unique ID for the customer's Google account. As an account administrator, you can also use the my_customer alias to represent your account's customer ID. + /// + /// Sets the *customer* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn customer(mut self, new_value: &str) -> ResourceCalendarDeleteCall<'a, C, A> { + self._customer = new_value.to_string(); + self + } + /// The unique ID of the calendar resource to delete. + /// + /// Sets the *calendar resource id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn calendar_resource_id(mut self, new_value: &str) -> ResourceCalendarDeleteCall<'a, C, A> { + self._calendar_resource_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ResourceCalendarDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ResourceCalendarDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::DirectoryResourceCalendar`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ResourceCalendarDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9745,7 +24711,7 @@ impl<'a, C, A> UserUndeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.undelete", + dlg.begin(MethodInfo { id: "directory.users.undelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -9786,14 +24752,14 @@ impl<'a, C, A> UserUndeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9837,7 +24803,7 @@ impl<'a, C, A> UserUndeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9847,10 +24813,10 @@ impl<'a, C, A> UserUndeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9872,7 +24838,7 @@ impl<'a, C, A> UserUndeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UserUndelete) -> UserUndeleteCall<'a, C, A> { self._request = new_value; @@ -9882,7 +24848,7 @@ impl<'a, C, A> UserUndeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserUndeleteCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -9900,12 +24866,12 @@ impl<'a, C, A> UserUndeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9922,17 +24888,17 @@ impl<'a, C, A> UserUndeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserUndeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserUndeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9994,7 +24960,7 @@ impl<'a, C, A> UserPhotoDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.photos.delete", + dlg.begin(MethodInfo { id: "directory.users.photos.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -10035,7 +25001,7 @@ impl<'a, C, A> UserPhotoDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10071,7 +25037,7 @@ impl<'a, C, A> UserPhotoDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10081,10 +25047,10 @@ impl<'a, C, A> UserPhotoDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10107,7 +25073,7 @@ impl<'a, C, A> UserPhotoDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserPhotoDeleteCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -10125,12 +25091,12 @@ impl<'a, C, A> UserPhotoDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10147,17 +25113,17 @@ impl<'a, C, A> UserPhotoDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserPhotoDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserPhotoDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10226,7 +25192,7 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.photos.patch", + dlg.begin(MethodInfo { id: "directory.users.photos.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -10268,14 +25234,14 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10319,7 +25285,7 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10329,10 +25295,10 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10364,7 +25330,7 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UserPhoto) -> UserPhotoPatchCall<'a, C, A> { self._request = new_value; @@ -10374,7 +25340,7 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserPhotoPatchCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -10392,12 +25358,12 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10414,17 +25380,17 @@ impl<'a, C, A> UserPhotoPatchCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserPhotoPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserPhotoPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10492,7 +25458,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.insert", + dlg.begin(MethodInfo { id: "directory.users.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -10512,14 +25478,14 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa self._scopes.insert(Scope::DirectoryUser.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10563,7 +25529,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10573,10 +25539,10 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10608,7 +25574,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: User) -> UserInsertCall<'a, C, A> { self._request = new_value; @@ -10626,12 +25592,12 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10648,17 +25614,17 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10699,7 +25665,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().aliases_watch(req, "userKey") -/// .event("ea") +/// .event("dolore") /// .doit(); /// # } /// ``` @@ -10729,7 +25695,7 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.aliases.watch", + dlg.begin(MethodInfo { id: "directory.users.aliases.watch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -10774,14 +25740,14 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10825,7 +25791,7 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10835,10 +25801,10 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10870,7 +25836,7 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> UserAliaseWatchCall<'a, C, A> { self._request = new_value; @@ -10880,7 +25846,7 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserAliaseWatchCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -10905,12 +25871,12 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10927,17 +25893,17 @@ impl<'a, C, A> UserAliaseWatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserAliaseWatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserAliaseWatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11006,7 +25972,7 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.photos.update", + dlg.begin(MethodInfo { id: "directory.users.photos.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -11048,14 +26014,14 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11099,7 +26065,7 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11109,10 +26075,10 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11144,7 +26110,7 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UserPhoto) -> UserPhotoUpdateCall<'a, C, A> { self._request = new_value; @@ -11154,7 +26120,7 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserPhotoUpdateCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -11172,12 +26138,12 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11194,17 +26160,17 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserPhotoUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserPhotoUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11246,17 +26212,17 @@ impl<'a, C, A> UserPhotoUpdateCall<'a, C, A> where C: BorrowMut, /// // Values shown here are possibly random and not representative ! /// let result = hub.users().watch(req) /// .view_type("dolor") -/// .sort_order("dolor") -/// .show_deleted("dolor") -/// .query("et") -/// .projection("consetetur") -/// .page_token("amet.") -/// .order_by("voluptua.") -/// .max_results(-56) -/// .event("gubergren") -/// .domain("justo") -/// .customer("sit") -/// .custom_field_mask("vero") +/// .sort_order("takimata") +/// .show_deleted("et") +/// .query("nonumy") +/// .projection("et") +/// .page_token("sed") +/// .order_by("no") +/// .max_results(-38) +/// .event("rebum.") +/// .domain("labore") +/// .customer("aliquyam") +/// .custom_field_mask("elitr") /// .doit(); /// # } /// ``` @@ -11296,7 +26262,7 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.watch", + dlg.begin(MethodInfo { id: "directory.users.watch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); if let Some(value) = self._view_type { @@ -11352,14 +26318,14 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::DirectoryUser.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11403,7 +26369,7 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11413,10 +26379,10 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11448,7 +26414,7 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> UserWatchCall<'a, C, A> { self._request = new_value; @@ -11550,12 +26516,12 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11572,17 +26538,17 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserWatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserWatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11651,7 +26617,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.update", + dlg.begin(MethodInfo { id: "directory.users.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -11693,14 +26659,14 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11744,7 +26710,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11754,10 +26720,10 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11789,7 +26755,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: User) -> UserUpdateCall<'a, C, A> { self._request = new_value; @@ -11799,7 +26765,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserUpdateCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -11817,12 +26783,12 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11839,17 +26805,17 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11911,7 +26877,7 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.photos.get", + dlg.begin(MethodInfo { id: "directory.users.photos.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -11953,7 +26919,7 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11989,7 +26955,7 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11999,10 +26965,10 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12035,7 +27001,7 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserPhotoGetCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -12053,12 +27019,12 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12075,17 +27041,17 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUserReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserPhotoGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserPhotoGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12120,18 +27086,18 @@ impl<'a, C, A> UserPhotoGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().list() -/// .view_type("consetetur") -/// .sort_order("sadipscing") -/// .show_deleted("vero") -/// .query("sadipscing") -/// .projection("invidunt") -/// .page_token("consetetur") -/// .order_by("dolore") -/// .max_results(-19) -/// .event("aliquyam") -/// .domain("Lorem") -/// .customer("et") -/// .custom_field_mask("clita") +/// .view_type("elitr") +/// .sort_order("At") +/// .show_deleted("sea") +/// .query("consetetur") +/// .projection("diam") +/// .page_token("accusam") +/// .order_by("dolores") +/// .max_results(-46) +/// .event("dolor") +/// .domain("aliquyam") +/// .customer("elitr") +/// .custom_field_mask("ea") /// .doit(); /// # } /// ``` @@ -12170,7 +27136,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.list", + dlg.begin(MethodInfo { id: "directory.users.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((14 + self._additional_params.len())); if let Some(value) = self._view_type { @@ -12226,7 +27192,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut self._scopes.insert(Scope::DirectoryUserReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12262,7 +27228,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12272,10 +27238,10 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12400,12 +27366,12 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12422,17 +27388,17 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUserReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12467,9 +27433,9 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().get("userKey") -/// .view_type("takimata") -/// .projection("nonumy") -/// .custom_field_mask("kasd") +/// .view_type("Stet") +/// .projection("sed") +/// .custom_field_mask("dolor") /// .doit(); /// # } /// ``` @@ -12500,7 +27466,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.get", + dlg.begin(MethodInfo { id: "directory.users.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -12551,7 +27517,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12587,7 +27553,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12597,10 +27563,10 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12633,7 +27599,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserGetCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -12672,12 +27638,12 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12694,17 +27660,17 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUserReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12773,7 +27739,7 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.aliases.insert", + dlg.begin(MethodInfo { id: "directory.users.aliases.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -12815,14 +27781,14 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12866,7 +27832,7 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12876,10 +27842,10 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12911,7 +27877,7 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Alias) -> UserAliaseInsertCall<'a, C, A> { self._request = new_value; @@ -12921,7 +27887,7 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserAliaseInsertCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -12939,12 +27905,12 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12961,17 +27927,17 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserAliaseInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserAliaseInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13006,7 +27972,7 @@ impl<'a, C, A> UserAliaseInsertCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.users().aliases_list("userKey") -/// .event("At") +/// .event("Lorem") /// .doit(); /// # } /// ``` @@ -13035,7 +28001,7 @@ impl<'a, C, A> UserAliaseListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.aliases.list", + dlg.begin(MethodInfo { id: "directory.users.aliases.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -13080,7 +28046,7 @@ impl<'a, C, A> UserAliaseListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13116,7 +28082,7 @@ impl<'a, C, A> UserAliaseListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13126,10 +28092,10 @@ impl<'a, C, A> UserAliaseListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13162,7 +28128,7 @@ impl<'a, C, A> UserAliaseListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserAliaseListCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -13187,12 +28153,12 @@ impl<'a, C, A> UserAliaseListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13209,17 +28175,17 @@ impl<'a, C, A> UserAliaseListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUserAliaReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserAliaseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserAliaseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13288,7 +28254,7 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.makeAdmin", + dlg.begin(MethodInfo { id: "directory.users.makeAdmin", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -13329,14 +28295,14 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13380,7 +28346,7 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13390,10 +28356,10 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13415,7 +28381,7 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UserMakeAdmin) -> UserMakeAdminCall<'a, C, A> { self._request = new_value; @@ -13425,7 +28391,7 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserMakeAdminCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -13443,12 +28409,12 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13465,17 +28431,17 @@ impl<'a, C, A> UserMakeAdminCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserMakeAdminCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMakeAdminCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13544,7 +28510,7 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.patch", + dlg.begin(MethodInfo { id: "directory.users.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -13586,14 +28552,14 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13637,7 +28603,7 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13647,10 +28613,10 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13682,7 +28648,7 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: User) -> UserPatchCall<'a, C, A> { self._request = new_value; @@ -13692,7 +28658,7 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserPatchCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -13710,12 +28676,12 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13732,17 +28698,17 @@ impl<'a, C, A> UserPatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13805,7 +28771,7 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.aliases.delete", + dlg.begin(MethodInfo { id: "directory.users.aliases.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -13847,7 +28813,7 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13883,7 +28849,7 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13893,10 +28859,10 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13919,7 +28885,7 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserAliaseDeleteCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -13929,7 +28895,7 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *alias* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn alias(mut self, new_value: &str) -> UserAliaseDeleteCall<'a, C, A> { self._alias = new_value.to_string(); @@ -13947,12 +28913,12 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13969,17 +28935,17 @@ impl<'a, C, A> UserAliaseDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserAliaseDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserAliaseDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14041,7 +29007,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "directory.users.delete", + dlg.begin(MethodInfo { id: "directory.users.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -14082,7 +29048,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14118,7 +29084,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14128,10 +29094,10 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14154,7 +29120,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> UserDeleteCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -14172,12 +29138,12 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14194,13178 +29160,17 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DirectoryUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a role. -/// -/// A builder for the *update* method supported by a *role* resource. -/// It is not used directly, but through a `RoleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Role; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Role::default(); -/// -/// // 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 ! -/// let result = hub.roles().update(req, "customer", "roleId") -/// .doit(); -/// # } -/// ``` -pub struct RoleUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Role, - _customer: String, - _role_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RoleUpdateCall<'a, C, A> {} - -impl<'a, C, A> RoleUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Role)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.roles.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("roleId", self._role_id.to_string())); - for &field in ["alt", "customer", "roleId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles/{roleId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{roleId}", "roleId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["roleId", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Role) -> RoleUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable ID of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> RoleUpdateCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Immutable ID of the role. - /// - /// Sets the *role id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn role_id(mut self, new_value: &str) -> RoleUpdateCall<'a, C, A> { - self._role_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> RoleUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RoleUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagement`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> RoleUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieves a role. -/// -/// A builder for the *get* method supported by a *role* resource. -/// It is not used directly, but through a `RoleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.roles().get("customer", "roleId") -/// .doit(); -/// # } -/// ``` -pub struct RoleGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _role_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RoleGetCall<'a, C, A> {} - -impl<'a, C, A> RoleGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Role)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.roles.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("roleId", self._role_id.to_string())); - for &field in ["alt", "customer", "roleId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles/{roleId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagementReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{roleId}", "roleId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["roleId", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable ID of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> RoleGetCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Immutable ID of the role. - /// - /// Sets the *role id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn role_id(mut self, new_value: &str) -> RoleGetCall<'a, C, A> { - self._role_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> RoleGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RoleGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagementReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> RoleGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a role. -/// -/// A builder for the *delete* method supported by a *role* resource. -/// It is not used directly, but through a `RoleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.roles().delete("customer", "roleId") -/// .doit(); -/// # } -/// ``` -pub struct RoleDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _role_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RoleDeleteCall<'a, C, A> {} - -impl<'a, C, A> RoleDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.roles.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("roleId", self._role_id.to_string())); - for &field in ["customer", "roleId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles/{roleId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{roleId}", "roleId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["roleId", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable ID of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> RoleDeleteCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Immutable ID of the role. - /// - /// Sets the *role id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn role_id(mut self, new_value: &str) -> RoleDeleteCall<'a, C, A> { - self._role_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> RoleDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RoleDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagement`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> RoleDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a role. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *role* resource. -/// It is not used directly, but through a `RoleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Role; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Role::default(); -/// -/// // 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 ! -/// let result = hub.roles().patch(req, "customer", "roleId") -/// .doit(); -/// # } -/// ``` -pub struct RolePatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Role, - _customer: String, - _role_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RolePatchCall<'a, C, A> {} - -impl<'a, C, A> RolePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Role)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.roles.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("roleId", self._role_id.to_string())); - for &field in ["alt", "customer", "roleId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles/{roleId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{roleId}", "roleId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["roleId", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Role) -> RolePatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable ID of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> RolePatchCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Immutable ID of the role. - /// - /// Sets the *role id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn role_id(mut self, new_value: &str) -> RolePatchCall<'a, C, A> { - self._role_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> RolePatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RolePatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagement`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> RolePatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a role. -/// -/// A builder for the *insert* method supported by a *role* resource. -/// It is not used directly, but through a `RoleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Role; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Role::default(); -/// -/// // 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 ! -/// let result = hub.roles().insert(req, "customer") -/// .doit(); -/// # } -/// ``` -pub struct RoleInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Role, - _customer: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RoleInsertCall<'a, C, A> {} - -impl<'a, C, A> RoleInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Role)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.roles.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - for &field in ["alt", "customer"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Role) -> RoleInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable ID of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> RoleInsertCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> RoleInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RoleInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagement`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> RoleInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieves a paginated list of all the roles in a domain. -/// -/// A builder for the *list* method supported by a *role* resource. -/// It is not used directly, but through a `RoleMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.roles().list("customer") -/// .page_token("gubergren") -/// .max_results(-82) -/// .doit(); -/// # } -/// ``` -pub struct RoleListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _page_token: Option, - _max_results: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RoleListCall<'a, C, A> {} - -impl<'a, C, A> RoleListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Roles)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.roles.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - for &field in ["alt", "customer", "pageToken", "maxResults"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagementReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> RoleListCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Token to specify the next page in the list. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> RoleListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Maximum number of results to return. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: i32) -> RoleListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> RoleListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RoleListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagementReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> RoleListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieves a paginated list of all privileges for a customer. -/// -/// A builder for the *list* method supported by a *privilege* resource. -/// It is not used directly, but through a `PrivilegeMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.privileges().list("customer") -/// .doit(); -/// # } -/// ``` -pub struct PrivilegeListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for PrivilegeListCall<'a, C, A> {} - -impl<'a, C, A> PrivilegeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Privileges)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.privileges.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - for &field in ["alt", "customer"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roles/ALL/privileges".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagementReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable ID of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> PrivilegeListCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> PrivilegeListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> PrivilegeListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagementReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> PrivilegeListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve Mobile Device -/// -/// A builder for the *get* method supported by a *mobiledevice* resource. -/// It is not used directly, but through a `MobiledeviceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.mobiledevices().get("customerId", "resourceId") -/// .projection("labore") -/// .doit(); -/// # } -/// ``` -pub struct MobiledeviceGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer_id: String, - _resource_id: String, - _projection: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MobiledeviceGetCall<'a, C, A> {} - -impl<'a, C, A> MobiledeviceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, MobileDevice)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.mobiledevices.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - params.push(("resourceId", self._resource_id.to_string())); - if let Some(value) = self._projection { - params.push(("projection", value.to_string())); - } - for &field in ["alt", "customerId", "resourceId", "projection"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/mobile/{resourceId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDeviceMobileReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{resourceId}", "resourceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["resourceId", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> MobiledeviceGetCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Immutable id of Mobile Device - /// - /// Sets the *resource id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource_id(mut self, new_value: &str) -> MobiledeviceGetCall<'a, C, A> { - self._resource_id = new_value.to_string(); - self - } - /// Restrict information returned to a set of selected fields. - /// - /// Sets the *projection* query property to the given value. - pub fn projection(mut self, new_value: &str) -> MobiledeviceGetCall<'a, C, A> { - self._projection = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MobiledeviceGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MobiledeviceGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDeviceMobileReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MobiledeviceGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve all Mobile Devices of a customer (paginated) -/// -/// A builder for the *list* method supported by a *mobiledevice* resource. -/// It is not used directly, but through a `MobiledeviceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.mobiledevices().list("customerId") -/// .sort_order("aliquyam") -/// .query("dolores") -/// .projection("sit") -/// .page_token("diam") -/// .order_by("ut") -/// .max_results(-70) -/// .doit(); -/// # } -/// ``` -pub struct MobiledeviceListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer_id: String, - _sort_order: Option, - _query: Option, - _projection: Option, - _page_token: Option, - _order_by: Option, - _max_results: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MobiledeviceListCall<'a, C, A> {} - -impl<'a, C, A> MobiledeviceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, MobileDevices)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.mobiledevices.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - if let Some(value) = self._sort_order { - params.push(("sortOrder", value.to_string())); - } - if let Some(value) = self._query { - params.push(("query", value.to_string())); - } - if let Some(value) = self._projection { - params.push(("projection", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._order_by { - params.push(("orderBy", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - for &field in ["alt", "customerId", "sortOrder", "query", "projection", "pageToken", "orderBy", "maxResults"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/mobile".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDeviceMobileReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Whether to return results in ascending or descending order. Only of use when orderBy is also used - /// - /// Sets the *sort order* query property to the given value. - pub fn sort_order(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { - self._sort_order = Some(new_value.to_string()); - self - } - /// Search string in the format given at http://support.google.com/a/bin/answer.py?hl=en&answer=1408863#search - /// - /// Sets the *query* query property to the given value. - pub fn query(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { - self._query = Some(new_value.to_string()); - self - } - /// Restrict information returned to a set of selected fields. - /// - /// Sets the *projection* query property to the given value. - pub fn projection(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { - self._projection = Some(new_value.to_string()); - self - } - /// Token to specify next page in the list - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Column to use for sorting results - /// - /// Sets the *order by* query property to the given value. - pub fn order_by(mut self, new_value: &str) -> MobiledeviceListCall<'a, C, A> { - self._order_by = Some(new_value.to_string()); - self - } - /// Maximum number of results to return. Default is 100 - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: i32) -> MobiledeviceListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MobiledeviceListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MobiledeviceListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDeviceMobileReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MobiledeviceListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Delete Mobile Device -/// -/// A builder for the *delete* method supported by a *mobiledevice* resource. -/// It is not used directly, but through a `MobiledeviceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.mobiledevices().delete("customerId", "resourceId") -/// .doit(); -/// # } -/// ``` -pub struct MobiledeviceDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer_id: String, - _resource_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MobiledeviceDeleteCall<'a, C, A> {} - -impl<'a, C, A> MobiledeviceDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.mobiledevices.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - params.push(("resourceId", self._resource_id.to_string())); - for &field in ["customerId", "resourceId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/mobile/{resourceId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDeviceMobile.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{resourceId}", "resourceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["resourceId", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> MobiledeviceDeleteCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Immutable id of Mobile Device - /// - /// Sets the *resource id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource_id(mut self, new_value: &str) -> MobiledeviceDeleteCall<'a, C, A> { - self._resource_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MobiledeviceDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MobiledeviceDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDeviceMobile`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MobiledeviceDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Take action on Mobile Device -/// -/// A builder for the *action* method supported by a *mobiledevice* resource. -/// It is not used directly, but through a `MobiledeviceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::MobileDeviceAction; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = MobileDeviceAction::default(); -/// -/// // 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 ! -/// let result = hub.mobiledevices().action(req, "customerId", "resourceId") -/// .doit(); -/// # } -/// ``` -pub struct MobiledeviceActionCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: MobileDeviceAction, - _customer_id: String, - _resource_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MobiledeviceActionCall<'a, C, A> {} - -impl<'a, C, A> MobiledeviceActionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.mobiledevices.action", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - params.push(("resourceId", self._resource_id.to_string())); - for &field in ["customerId", "resourceId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/mobile/{resourceId}/action".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDeviceMobile.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{resourceId}", "resourceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["resourceId", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: MobileDeviceAction) -> MobiledeviceActionCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> MobiledeviceActionCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Immutable id of Mobile Device - /// - /// Sets the *resource id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource_id(mut self, new_value: &str) -> MobiledeviceActionCall<'a, C, A> { - self._resource_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MobiledeviceActionCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MobiledeviceActionCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDeviceMobile`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MobiledeviceActionCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Get information about an access token issued by a user. -/// -/// A builder for the *get* method supported by a *token* resource. -/// It is not used directly, but through a `TokenMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.tokens().get("userKey", "clientId") -/// .doit(); -/// # } -/// ``` -pub struct TokenGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _user_key: String, - _client_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for TokenGetCall<'a, C, A> {} - -impl<'a, C, A> TokenGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Token)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.tokens.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("userKey", self._user_key.to_string())); - params.push(("clientId", self._client_id.to_string())); - for &field in ["alt", "userKey", "clientId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/tokens/{clientId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userKey}", "userKey"), ("{clientId}", "clientId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["clientId", "userKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. - /// - /// Sets the *user key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_key(mut self, new_value: &str) -> TokenGetCall<'a, C, A> { - self._user_key = new_value.to_string(); - self - } - /// The Client ID of the application the token is issued to. - /// - /// Sets the *client id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn client_id(mut self, new_value: &str) -> TokenGetCall<'a, C, A> { - self._client_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> TokenGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> TokenGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserSecurity`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> TokenGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns the set of tokens specified user has issued to 3rd party applications. -/// -/// A builder for the *list* method supported by a *token* resource. -/// It is not used directly, but through a `TokenMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.tokens().list("userKey") -/// .doit(); -/// # } -/// ``` -pub struct TokenListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _user_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for TokenListCall<'a, C, A> {} - -impl<'a, C, A> TokenListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Tokens)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.tokens.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("userKey", self._user_key.to_string())); - for &field in ["alt", "userKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/tokens".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userKey}", "userKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["userKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. - /// - /// Sets the *user key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_key(mut self, new_value: &str) -> TokenListCall<'a, C, A> { - self._user_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> TokenListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> TokenListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserSecurity`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> TokenListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Delete all access tokens issued by a user for an application. -/// -/// A builder for the *delete* method supported by a *token* resource. -/// It is not used directly, but through a `TokenMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.tokens().delete("userKey", "clientId") -/// .doit(); -/// # } -/// ``` -pub struct TokenDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _user_key: String, - _client_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for TokenDeleteCall<'a, C, A> {} - -impl<'a, C, A> TokenDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.tokens.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("userKey", self._user_key.to_string())); - params.push(("clientId", self._client_id.to_string())); - for &field in ["userKey", "clientId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/tokens/{clientId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userKey}", "userKey"), ("{clientId}", "clientId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["clientId", "userKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. - /// - /// Sets the *user key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_key(mut self, new_value: &str) -> TokenDeleteCall<'a, C, A> { - self._user_key = new_value.to_string(); - self - } - /// The Client ID of the application the token is issued to. - /// - /// Sets the *client id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn client_id(mut self, new_value: &str) -> TokenDeleteCall<'a, C, A> { - self._client_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> TokenDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> TokenDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserSecurity`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> TokenDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieves a list of notifications. -/// -/// A builder for the *list* method supported by a *notification* resource. -/// It is not used directly, but through a `NotificationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.notifications().list("customer") -/// .page_token("dolores") -/// .max_results(77) -/// .language("voluptua.") -/// .doit(); -/// # } -/// ``` -pub struct NotificationListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _page_token: Option, - _max_results: Option, - _language: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for NotificationListCall<'a, C, A> {} - -impl<'a, C, A> NotificationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Notifications)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.notifications.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._language { - params.push(("language", value.to_string())); - } - for &field in ["alt", "customer", "pageToken", "maxResults", "language"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/notifications".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryNotification.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The unique ID for the customer's Google account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> NotificationListCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The token to specify the page of results to retrieve. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> NotificationListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Maximum number of notifications to return per page. The default is 100. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> NotificationListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The ISO 639-1 code of the language notifications are returned in. The default is English (en). - /// - /// Sets the *language* query property to the given value. - pub fn language(mut self, new_value: &str) -> NotificationListCall<'a, C, A> { - self._language = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> NotificationListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> NotificationListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryNotification`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> NotificationListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a notification. -/// -/// A builder for the *update* method supported by a *notification* resource. -/// It is not used directly, but through a `NotificationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Notification; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Notification::default(); -/// -/// // 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 ! -/// let result = hub.notifications().update(req, "customer", "notificationId") -/// .doit(); -/// # } -/// ``` -pub struct NotificationUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Notification, - _customer: String, - _notification_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for NotificationUpdateCall<'a, C, A> {} - -impl<'a, C, A> NotificationUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Notification)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.notifications.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("notificationId", self._notification_id.to_string())); - for &field in ["alt", "customer", "notificationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/notifications/{notificationId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryNotification.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{notificationId}", "notificationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["notificationId", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Notification) -> NotificationUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The unique ID for the customer's Google account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> NotificationUpdateCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The unique ID of the notification. - /// - /// Sets the *notification id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn notification_id(mut self, new_value: &str) -> NotificationUpdateCall<'a, C, A> { - self._notification_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> NotificationUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> NotificationUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryNotification`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> NotificationUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a notification -/// -/// A builder for the *delete* method supported by a *notification* resource. -/// It is not used directly, but through a `NotificationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.notifications().delete("customer", "notificationId") -/// .doit(); -/// # } -/// ``` -pub struct NotificationDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _notification_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for NotificationDeleteCall<'a, C, A> {} - -impl<'a, C, A> NotificationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.notifications.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("notificationId", self._notification_id.to_string())); - for &field in ["customer", "notificationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/notifications/{notificationId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryNotification.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{notificationId}", "notificationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["notificationId", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> NotificationDeleteCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The unique ID of the notification. - /// - /// Sets the *notification id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn notification_id(mut self, new_value: &str) -> NotificationDeleteCall<'a, C, A> { - self._notification_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> NotificationDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> NotificationDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryNotification`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> NotificationDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieves a notification. -/// -/// A builder for the *get* method supported by a *notification* resource. -/// It is not used directly, but through a `NotificationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.notifications().get("customer", "notificationId") -/// .doit(); -/// # } -/// ``` -pub struct NotificationGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _notification_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for NotificationGetCall<'a, C, A> {} - -impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Notification)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.notifications.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("notificationId", self._notification_id.to_string())); - for &field in ["alt", "customer", "notificationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/notifications/{notificationId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryNotification.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{notificationId}", "notificationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["notificationId", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The unique ID for the customer's Google account. The customerId is also returned as part of the Users resource. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The unique ID of the notification. - /// - /// Sets the *notification id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn notification_id(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { - self._notification_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> NotificationGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> NotificationGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryNotification`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> NotificationGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a notification. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *notification* resource. -/// It is not used directly, but through a `NotificationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Notification; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Notification::default(); -/// -/// // 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 ! -/// let result = hub.notifications().patch(req, "customer", "notificationId") -/// .doit(); -/// # } -/// ``` -pub struct NotificationPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Notification, - _customer: String, - _notification_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for NotificationPatchCall<'a, C, A> {} - -impl<'a, C, A> NotificationPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Notification)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.notifications.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("notificationId", self._notification_id.to_string())); - for &field in ["alt", "customer", "notificationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/notifications/{notificationId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryNotification.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{notificationId}", "notificationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["notificationId", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Notification) -> NotificationPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The unique ID for the customer's Google account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> NotificationPatchCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The unique ID of the notification. - /// - /// Sets the *notification id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn notification_id(mut self, new_value: &str) -> NotificationPatchCall<'a, C, A> { - self._notification_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> NotificationPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> NotificationPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryNotification`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> NotificationPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve all Chrome OS Devices of a customer (paginated) -/// -/// A builder for the *list* method supported by a *chromeosdevice* resource. -/// It is not used directly, but through a `ChromeosdeviceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.chromeosdevices().list("customerId") -/// .sort_order("invidunt") -/// .query("rebum.") -/// .projection("Lorem") -/// .page_token("clita") -/// .order_by("invidunt") -/// .max_results(-90) -/// .doit(); -/// # } -/// ``` -pub struct ChromeosdeviceListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer_id: String, - _sort_order: Option, - _query: Option, - _projection: Option, - _page_token: Option, - _order_by: Option, - _max_results: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ChromeosdeviceListCall<'a, C, A> {} - -impl<'a, C, A> ChromeosdeviceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ChromeOsDevices)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.chromeosdevices.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - if let Some(value) = self._sort_order { - params.push(("sortOrder", value.to_string())); - } - if let Some(value) = self._query { - params.push(("query", value.to_string())); - } - if let Some(value) = self._projection { - params.push(("projection", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._order_by { - params.push(("orderBy", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - for &field in ["alt", "customerId", "sortOrder", "query", "projection", "pageToken", "orderBy", "maxResults"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDeviceChromeoReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Whether to return results in ascending or descending order. Only of use when orderBy is also used - /// - /// Sets the *sort order* query property to the given value. - pub fn sort_order(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { - self._sort_order = Some(new_value.to_string()); - self - } - /// Search string in the format given at http://support.google.com/chromeos/a/bin/answer.py?hl=en&answer=1698333 - /// - /// Sets the *query* query property to the given value. - pub fn query(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { - self._query = Some(new_value.to_string()); - self - } - /// Restrict information returned to a set of selected fields. - /// - /// Sets the *projection* query property to the given value. - pub fn projection(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { - self._projection = Some(new_value.to_string()); - self - } - /// Token to specify next page in the list - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Column to use for sorting results - /// - /// Sets the *order by* query property to the given value. - pub fn order_by(mut self, new_value: &str) -> ChromeosdeviceListCall<'a, C, A> { - self._order_by = Some(new_value.to_string()); - self - } - /// Maximum number of results to return. Default is 100 - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: i32) -> ChromeosdeviceListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ChromeosdeviceListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ChromeosdeviceListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDeviceChromeoReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ChromeosdeviceListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Update Chrome OS Device. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *chromeosdevice* resource. -/// It is not used directly, but through a `ChromeosdeviceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::ChromeOsDevice; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = ChromeOsDevice::default(); -/// -/// // 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 ! -/// let result = hub.chromeosdevices().patch(req, "customerId", "deviceId") -/// .projection("et") -/// .doit(); -/// # } -/// ``` -pub struct ChromeosdevicePatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: ChromeOsDevice, - _customer_id: String, - _device_id: String, - _projection: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ChromeosdevicePatchCall<'a, C, A> {} - -impl<'a, C, A> ChromeosdevicePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ChromeOsDevice)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.chromeosdevices.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - params.push(("deviceId", self._device_id.to_string())); - if let Some(value) = self._projection { - params.push(("projection", value.to_string())); - } - for &field in ["alt", "customerId", "deviceId", "projection"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDeviceChromeo.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{deviceId}", "deviceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["deviceId", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ChromeOsDevice) -> ChromeosdevicePatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> ChromeosdevicePatchCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Immutable id of Chrome OS Device - /// - /// Sets the *device id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn device_id(mut self, new_value: &str) -> ChromeosdevicePatchCall<'a, C, A> { - self._device_id = new_value.to_string(); - self - } - /// Restrict information returned to a set of selected fields. - /// - /// Sets the *projection* query property to the given value. - pub fn projection(mut self, new_value: &str) -> ChromeosdevicePatchCall<'a, C, A> { - self._projection = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ChromeosdevicePatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ChromeosdevicePatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDeviceChromeo`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ChromeosdevicePatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Update Chrome OS Device -/// -/// A builder for the *update* method supported by a *chromeosdevice* resource. -/// It is not used directly, but through a `ChromeosdeviceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::ChromeOsDevice; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = ChromeOsDevice::default(); -/// -/// // 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 ! -/// let result = hub.chromeosdevices().update(req, "customerId", "deviceId") -/// .projection("takimata") -/// .doit(); -/// # } -/// ``` -pub struct ChromeosdeviceUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: ChromeOsDevice, - _customer_id: String, - _device_id: String, - _projection: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ChromeosdeviceUpdateCall<'a, C, A> {} - -impl<'a, C, A> ChromeosdeviceUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ChromeOsDevice)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.chromeosdevices.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - params.push(("deviceId", self._device_id.to_string())); - if let Some(value) = self._projection { - params.push(("projection", value.to_string())); - } - for &field in ["alt", "customerId", "deviceId", "projection"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDeviceChromeo.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{deviceId}", "deviceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["deviceId", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ChromeOsDevice) -> ChromeosdeviceUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> ChromeosdeviceUpdateCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Immutable id of Chrome OS Device - /// - /// Sets the *device id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn device_id(mut self, new_value: &str) -> ChromeosdeviceUpdateCall<'a, C, A> { - self._device_id = new_value.to_string(); - self - } - /// Restrict information returned to a set of selected fields. - /// - /// Sets the *projection* query property to the given value. - pub fn projection(mut self, new_value: &str) -> ChromeosdeviceUpdateCall<'a, C, A> { - self._projection = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ChromeosdeviceUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ChromeosdeviceUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDeviceChromeo`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ChromeosdeviceUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve Chrome OS Device -/// -/// A builder for the *get* method supported by a *chromeosdevice* resource. -/// It is not used directly, but through a `ChromeosdeviceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.chromeosdevices().get("customerId", "deviceId") -/// .projection("rebum.") -/// .doit(); -/// # } -/// ``` -pub struct ChromeosdeviceGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer_id: String, - _device_id: String, - _projection: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ChromeosdeviceGetCall<'a, C, A> {} - -impl<'a, C, A> ChromeosdeviceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ChromeOsDevice)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.chromeosdevices.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - params.push(("deviceId", self._device_id.to_string())); - if let Some(value) = self._projection { - params.push(("projection", value.to_string())); - } - for &field in ["alt", "customerId", "deviceId", "projection"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDeviceChromeoReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{deviceId}", "deviceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["deviceId", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> ChromeosdeviceGetCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Immutable id of Chrome OS Device - /// - /// Sets the *device id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn device_id(mut self, new_value: &str) -> ChromeosdeviceGetCall<'a, C, A> { - self._device_id = new_value.to_string(); - self - } - /// Restrict information returned to a set of selected fields. - /// - /// Sets the *projection* query property to the given value. - pub fn projection(mut self, new_value: &str) -> ChromeosdeviceGetCall<'a, C, A> { - self._projection = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ChromeosdeviceGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ChromeosdeviceGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDeviceChromeoReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ChromeosdeviceGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Add user to the specified group. -/// -/// A builder for the *insert* method supported by a *member* resource. -/// It is not used directly, but through a `MemberMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Member; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Member::default(); -/// -/// // 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 ! -/// let result = hub.members().insert(req, "groupKey") -/// .doit(); -/// # } -/// ``` -pub struct MemberInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Member, - _group_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MemberInsertCall<'a, C, A> {} - -impl<'a, C, A> MemberInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Member)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.members.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("groupKey", self._group_key.to_string())); - for &field in ["alt", "groupKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryGroup.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{groupKey}", "groupKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["groupKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Member) -> MemberInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// Email or immutable Id of the group - /// - /// Sets the *group key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn group_key(mut self, new_value: &str) -> MemberInsertCall<'a, C, A> { - self._group_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MemberInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MemberInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryGroup`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MemberInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Update membership of a user in the specified group. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *member* resource. -/// It is not used directly, but through a `MemberMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Member; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Member::default(); -/// -/// // 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 ! -/// let result = hub.members().patch(req, "groupKey", "memberKey") -/// .doit(); -/// # } -/// ``` -pub struct MemberPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Member, - _group_key: String, - _member_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MemberPatchCall<'a, C, A> {} - -impl<'a, C, A> MemberPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Member)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.members.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("groupKey", self._group_key.to_string())); - params.push(("memberKey", self._member_key.to_string())); - for &field in ["alt", "groupKey", "memberKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members/{memberKey}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryGroup.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{groupKey}", "groupKey"), ("{memberKey}", "memberKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["memberKey", "groupKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Member) -> MemberPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Email or immutable Id of the group. If Id, it should match with id of group object - /// - /// Sets the *group key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn group_key(mut self, new_value: &str) -> MemberPatchCall<'a, C, A> { - self._group_key = new_value.to_string(); - self - } - /// Email or immutable Id of the user. If Id, it should match with id of member object - /// - /// Sets the *member key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn member_key(mut self, new_value: &str) -> MemberPatchCall<'a, C, A> { - self._member_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MemberPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MemberPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryGroup`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MemberPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Update membership of a user in the specified group. -/// -/// A builder for the *update* method supported by a *member* resource. -/// It is not used directly, but through a `MemberMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Member; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Member::default(); -/// -/// // 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 ! -/// let result = hub.members().update(req, "groupKey", "memberKey") -/// .doit(); -/// # } -/// ``` -pub struct MemberUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Member, - _group_key: String, - _member_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MemberUpdateCall<'a, C, A> {} - -impl<'a, C, A> MemberUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Member)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.members.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("groupKey", self._group_key.to_string())); - params.push(("memberKey", self._member_key.to_string())); - for &field in ["alt", "groupKey", "memberKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members/{memberKey}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryGroup.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{groupKey}", "groupKey"), ("{memberKey}", "memberKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["memberKey", "groupKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Member) -> MemberUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// Email or immutable Id of the group. If Id, it should match with id of group object - /// - /// Sets the *group key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn group_key(mut self, new_value: &str) -> MemberUpdateCall<'a, C, A> { - self._group_key = new_value.to_string(); - self - } - /// Email or immutable Id of the user. If Id, it should match with id of member object - /// - /// Sets the *member key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn member_key(mut self, new_value: &str) -> MemberUpdateCall<'a, C, A> { - self._member_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MemberUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MemberUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryGroup`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MemberUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve all members in a group (paginated) -/// -/// A builder for the *list* method supported by a *member* resource. -/// It is not used directly, but through a `MemberMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.members().list("groupKey") -/// .roles("ipsum") -/// .page_token("ut") -/// .max_results(-3) -/// .doit(); -/// # } -/// ``` -pub struct MemberListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _group_key: String, - _roles: Option, - _page_token: Option, - _max_results: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MemberListCall<'a, C, A> {} - -impl<'a, C, A> MemberListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Members)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.members.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("groupKey", self._group_key.to_string())); - if let Some(value) = self._roles { - params.push(("roles", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - for &field in ["alt", "groupKey", "roles", "pageToken", "maxResults"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryGroupMemberReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{groupKey}", "groupKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["groupKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Email or immutable Id of the group - /// - /// Sets the *group key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn group_key(mut self, new_value: &str) -> MemberListCall<'a, C, A> { - self._group_key = new_value.to_string(); - self - } - /// Comma separated role values to filter list results on. - /// - /// Sets the *roles* query property to the given value. - pub fn roles(mut self, new_value: &str) -> MemberListCall<'a, C, A> { - self._roles = Some(new_value.to_string()); - self - } - /// Token to specify next page in the list - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> MemberListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Maximum number of results to return. Default is 200 - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: i32) -> MemberListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MemberListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MemberListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryGroupMemberReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MemberListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve Group Member -/// -/// A builder for the *get* method supported by a *member* resource. -/// It is not used directly, but through a `MemberMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.members().get("groupKey", "memberKey") -/// .doit(); -/// # } -/// ``` -pub struct MemberGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _group_key: String, - _member_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MemberGetCall<'a, C, A> {} - -impl<'a, C, A> MemberGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Member)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.members.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("groupKey", self._group_key.to_string())); - params.push(("memberKey", self._member_key.to_string())); - for &field in ["alt", "groupKey", "memberKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members/{memberKey}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryGroupMemberReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{groupKey}", "groupKey"), ("{memberKey}", "memberKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["memberKey", "groupKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Email or immutable Id of the group - /// - /// Sets the *group key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn group_key(mut self, new_value: &str) -> MemberGetCall<'a, C, A> { - self._group_key = new_value.to_string(); - self - } - /// Email or immutable Id of the member - /// - /// Sets the *member key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn member_key(mut self, new_value: &str) -> MemberGetCall<'a, C, A> { - self._member_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MemberGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MemberGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryGroupMemberReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MemberGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Remove membership. -/// -/// A builder for the *delete* method supported by a *member* resource. -/// It is not used directly, but through a `MemberMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.members().delete("groupKey", "memberKey") -/// .doit(); -/// # } -/// ``` -pub struct MemberDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _group_key: String, - _member_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MemberDeleteCall<'a, C, A> {} - -impl<'a, C, A> MemberDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.members.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("groupKey", self._group_key.to_string())); - params.push(("memberKey", self._member_key.to_string())); - for &field in ["groupKey", "memberKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/groups/{groupKey}/members/{memberKey}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryGroup.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{groupKey}", "groupKey"), ("{memberKey}", "memberKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["memberKey", "groupKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Email or immutable Id of the group - /// - /// Sets the *group key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn group_key(mut self, new_value: &str) -> MemberDeleteCall<'a, C, A> { - self._group_key = new_value.to_string(); - self - } - /// Email or immutable Id of the member - /// - /// Sets the *member key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn member_key(mut self, new_value: &str) -> MemberDeleteCall<'a, C, A> { - self._member_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MemberDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MemberDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryGroup`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MemberDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Get information about an ASP issued by a user. -/// -/// A builder for the *get* method supported by a *asp* resource. -/// It is not used directly, but through a `AspMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.asps().get("userKey", -99) -/// .doit(); -/// # } -/// ``` -pub struct AspGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _user_key: String, - _code_id: i32, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AspGetCall<'a, C, A> {} - -impl<'a, C, A> AspGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Asp)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.asps.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("userKey", self._user_key.to_string())); - params.push(("codeId", self._code_id.to_string())); - for &field in ["alt", "userKey", "codeId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/asps/{codeId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userKey}", "userKey"), ("{codeId}", "codeId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["codeId", "userKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. - /// - /// Sets the *user key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_key(mut self, new_value: &str) -> AspGetCall<'a, C, A> { - self._user_key = new_value.to_string(); - self - } - /// The unique ID of the ASP. - /// - /// Sets the *code id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn code_id(mut self, new_value: i32) -> AspGetCall<'a, C, A> { - self._code_id = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AspGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AspGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserSecurity`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AspGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Delete an ASP issued by a user. -/// -/// A builder for the *delete* method supported by a *asp* resource. -/// It is not used directly, but through a `AspMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.asps().delete("userKey", -85) -/// .doit(); -/// # } -/// ``` -pub struct AspDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _user_key: String, - _code_id: i32, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AspDeleteCall<'a, C, A> {} - -impl<'a, C, A> AspDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.asps.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("userKey", self._user_key.to_string())); - params.push(("codeId", self._code_id.to_string())); - for &field in ["userKey", "codeId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/asps/{codeId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userKey}", "userKey"), ("{codeId}", "codeId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["codeId", "userKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. - /// - /// Sets the *user key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_key(mut self, new_value: &str) -> AspDeleteCall<'a, C, A> { - self._user_key = new_value.to_string(); - self - } - /// The unique ID of the ASP to be deleted. - /// - /// Sets the *code id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn code_id(mut self, new_value: i32) -> AspDeleteCall<'a, C, A> { - self._code_id = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AspDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AspDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserSecurity`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AspDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// List the ASPs issued by a user. -/// -/// A builder for the *list* method supported by a *asp* resource. -/// It is not used directly, but through a `AspMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.asps().list("userKey") -/// .doit(); -/// # } -/// ``` -pub struct AspListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _user_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AspListCall<'a, C, A> {} - -impl<'a, C, A> AspListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Asps)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.asps.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("userKey", self._user_key.to_string())); - for &field in ["alt", "userKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/users/{userKey}/asps".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserSecurity.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userKey}", "userKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["userKey"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID. - /// - /// Sets the *user key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_key(mut self, new_value: &str) -> AspListCall<'a, C, A> { - self._user_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AspListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AspListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserSecurity`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AspListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Lists the domains of the customer. -/// -/// A builder for the *list* method supported by a *domain* resource. -/// It is not used directly, but through a `DomainMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.domains().list("customer") -/// .doit(); -/// # } -/// ``` -pub struct DomainListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DomainListCall<'a, C, A> {} - -impl<'a, C, A> DomainListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Domains2)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.domains.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - for &field in ["alt", "customer"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domains".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDomainReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> DomainListCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DomainListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DomainListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDomainReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DomainListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrives a domain of the customer. -/// -/// A builder for the *get* method supported by a *domain* resource. -/// It is not used directly, but through a `DomainMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.domains().get("customer", "domainName") -/// .doit(); -/// # } -/// ``` -pub struct DomainGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _domain_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DomainGetCall<'a, C, A> {} - -impl<'a, C, A> DomainGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Domains)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.domains.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("domainName", self._domain_name.to_string())); - for &field in ["alt", "customer", "domainName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domains/{domainName}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDomainReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{domainName}", "domainName")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["domainName", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> DomainGetCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Name of domain to be retrieved - /// - /// Sets the *domain name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn domain_name(mut self, new_value: &str) -> DomainGetCall<'a, C, A> { - self._domain_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DomainGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DomainGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDomainReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DomainGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Inserts a domain of the customer. -/// -/// A builder for the *insert* method supported by a *domain* resource. -/// It is not used directly, but through a `DomainMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Domains; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Domains::default(); -/// -/// // 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 ! -/// let result = hub.domains().insert(req, "customer") -/// .doit(); -/// # } -/// ``` -pub struct DomainInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Domains, - _customer: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DomainInsertCall<'a, C, A> {} - -impl<'a, C, A> DomainInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Domains)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.domains.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - for &field in ["alt", "customer"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domains".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDomain.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Domains) -> DomainInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable id of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> DomainInsertCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DomainInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DomainInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDomain`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DomainInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a domain of the customer. -/// -/// A builder for the *delete* method supported by a *domain* resource. -/// It is not used directly, but through a `DomainMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.domains().delete("customer", "domainName") -/// .doit(); -/// # } -/// ``` -pub struct DomainDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _domain_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DomainDeleteCall<'a, C, A> {} - -impl<'a, C, A> DomainDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.domains.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("domainName", self._domain_name.to_string())); - for &field in ["customer", "domainName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domains/{domainName}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDomain.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{domainName}", "domainName")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["domainName", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> DomainDeleteCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Name of domain to be deleted - /// - /// Sets the *domain name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn domain_name(mut self, new_value: &str) -> DomainDeleteCall<'a, C, A> { - self._domain_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DomainDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DomainDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDomain`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DomainDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Inserts a Domain alias of the customer. -/// -/// A builder for the *insert* method supported by a *domainAliase* resource. -/// It is not used directly, but through a `DomainAliaseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::DomainAlias; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = DomainAlias::default(); -/// -/// // 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 ! -/// let result = hub.domain_aliases().insert(req, "customer") -/// .doit(); -/// # } -/// ``` -pub struct DomainAliaseInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: DomainAlias, - _customer: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DomainAliaseInsertCall<'a, C, A> {} - -impl<'a, C, A> DomainAliaseInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, DomainAlias)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.domainAliases.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - for &field in ["alt", "customer"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domainaliases".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDomain.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: DomainAlias) -> DomainAliaseInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable id of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> DomainAliaseInsertCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DomainAliaseInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DomainAliaseInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDomain`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DomainAliaseInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieves a domain alias of the customer. -/// -/// A builder for the *get* method supported by a *domainAliase* resource. -/// It is not used directly, but through a `DomainAliaseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.domain_aliases().get("customer", "domainAliasName") -/// .doit(); -/// # } -/// ``` -pub struct DomainAliaseGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _domain_alias_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DomainAliaseGetCall<'a, C, A> {} - -impl<'a, C, A> DomainAliaseGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, DomainAlias)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.domainAliases.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("domainAliasName", self._domain_alias_name.to_string())); - for &field in ["alt", "customer", "domainAliasName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domainaliases/{domainAliasName}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDomainReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{domainAliasName}", "domainAliasName")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["domainAliasName", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> DomainAliaseGetCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Name of domain alias to be retrieved. - /// - /// Sets the *domain alias name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn domain_alias_name(mut self, new_value: &str) -> DomainAliaseGetCall<'a, C, A> { - self._domain_alias_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DomainAliaseGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DomainAliaseGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDomainReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DomainAliaseGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Lists the domain aliases of the customer. -/// -/// A builder for the *list* method supported by a *domainAliase* resource. -/// It is not used directly, but through a `DomainAliaseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.domain_aliases().list("customer") -/// .parent_domain_name("nonumy") -/// .doit(); -/// # } -/// ``` -pub struct DomainAliaseListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _parent_domain_name: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DomainAliaseListCall<'a, C, A> {} - -impl<'a, C, A> DomainAliaseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, DomainAliases)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.domainAliases.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - if let Some(value) = self._parent_domain_name { - params.push(("parentDomainName", value.to_string())); - } - for &field in ["alt", "customer", "parentDomainName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domainaliases".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDomainReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> DomainAliaseListCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Name of the parent domain for which domain aliases are to be fetched. - /// - /// Sets the *parent domain name* query property to the given value. - pub fn parent_domain_name(mut self, new_value: &str) -> DomainAliaseListCall<'a, C, A> { - self._parent_domain_name = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DomainAliaseListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DomainAliaseListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDomainReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DomainAliaseListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a Domain Alias of the customer. -/// -/// A builder for the *delete* method supported by a *domainAliase* resource. -/// It is not used directly, but through a `DomainAliaseMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.domain_aliases().delete("customer", "domainAliasName") -/// .doit(); -/// # } -/// ``` -pub struct DomainAliaseDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _domain_alias_name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DomainAliaseDeleteCall<'a, C, A> {} - -impl<'a, C, A> DomainAliaseDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.domainAliases.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("domainAliasName", self._domain_alias_name.to_string())); - for &field in ["customer", "domainAliasName"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/domainaliases/{domainAliasName}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryDomain.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{domainAliasName}", "domainAliasName")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["domainAliasName", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> DomainAliaseDeleteCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Name of domain alias to be retrieved. - /// - /// Sets the *domain alias name* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn domain_alias_name(mut self, new_value: &str) -> DomainAliaseDeleteCall<'a, C, A> { - self._domain_alias_name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DomainAliaseDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DomainAliaseDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryDomain`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DomainAliaseDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve schema -/// -/// A builder for the *get* method supported by a *schema* resource. -/// It is not used directly, but through a `SchemaMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.schemas().get("customerId", "schemaKey") -/// .doit(); -/// # } -/// ``` -pub struct SchemaGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer_id: String, - _schema_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for SchemaGetCall<'a, C, A> {} - -impl<'a, C, A> SchemaGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Schema)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.schemas.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - params.push(("schemaKey", self._schema_key.to_string())); - for &field in ["alt", "customerId", "schemaKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas/{schemaKey}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserschemaReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{schemaKey}", "schemaKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["schemaKey", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> SchemaGetCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Name or immutable Id of the schema - /// - /// Sets the *schema key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn schema_key(mut self, new_value: &str) -> SchemaGetCall<'a, C, A> { - self._schema_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> SchemaGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> SchemaGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserschemaReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> SchemaGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Update schema -/// -/// A builder for the *update* method supported by a *schema* resource. -/// It is not used directly, but through a `SchemaMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Schema; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Schema::default(); -/// -/// // 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 ! -/// let result = hub.schemas().update(req, "customerId", "schemaKey") -/// .doit(); -/// # } -/// ``` -pub struct SchemaUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Schema, - _customer_id: String, - _schema_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for SchemaUpdateCall<'a, C, A> {} - -impl<'a, C, A> SchemaUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Schema)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.schemas.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - params.push(("schemaKey", self._schema_key.to_string())); - for &field in ["alt", "customerId", "schemaKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas/{schemaKey}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserschema.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{schemaKey}", "schemaKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["schemaKey", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Schema) -> SchemaUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> SchemaUpdateCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Name or immutable Id of the schema. - /// - /// Sets the *schema key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn schema_key(mut self, new_value: &str) -> SchemaUpdateCall<'a, C, A> { - self._schema_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> SchemaUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> SchemaUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserschema`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> SchemaUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve all schemas for a customer -/// -/// A builder for the *list* method supported by a *schema* resource. -/// It is not used directly, but through a `SchemaMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.schemas().list("customerId") -/// .doit(); -/// # } -/// ``` -pub struct SchemaListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for SchemaListCall<'a, C, A> {} - -impl<'a, C, A> SchemaListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Schemas)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.schemas.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - for &field in ["alt", "customerId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserschemaReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> SchemaListCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> SchemaListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> SchemaListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserschemaReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> SchemaListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Update schema. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *schema* resource. -/// It is not used directly, but through a `SchemaMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Schema; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Schema::default(); -/// -/// // 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 ! -/// let result = hub.schemas().patch(req, "customerId", "schemaKey") -/// .doit(); -/// # } -/// ``` -pub struct SchemaPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Schema, - _customer_id: String, - _schema_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for SchemaPatchCall<'a, C, A> {} - -impl<'a, C, A> SchemaPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Schema)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.schemas.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - params.push(("schemaKey", self._schema_key.to_string())); - for &field in ["alt", "customerId", "schemaKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas/{schemaKey}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserschema.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{schemaKey}", "schemaKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["schemaKey", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Schema) -> SchemaPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> SchemaPatchCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Name or immutable Id of the schema. - /// - /// Sets the *schema key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn schema_key(mut self, new_value: &str) -> SchemaPatchCall<'a, C, A> { - self._schema_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> SchemaPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> SchemaPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserschema`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> SchemaPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Delete schema -/// -/// A builder for the *delete* method supported by a *schema* resource. -/// It is not used directly, but through a `SchemaMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.schemas().delete("customerId", "schemaKey") -/// .doit(); -/// # } -/// ``` -pub struct SchemaDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer_id: String, - _schema_key: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for SchemaDeleteCall<'a, C, A> {} - -impl<'a, C, A> SchemaDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.schemas.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - params.push(("schemaKey", self._schema_key.to_string())); - for &field in ["customerId", "schemaKey"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas/{schemaKey}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserschema.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId"), ("{schemaKey}", "schemaKey")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["schemaKey", "customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> SchemaDeleteCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// Name or immutable Id of the schema - /// - /// Sets the *schema key* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn schema_key(mut self, new_value: &str) -> SchemaDeleteCall<'a, C, A> { - self._schema_key = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> SchemaDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> SchemaDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserschema`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> SchemaDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Create schema. -/// -/// A builder for the *insert* method supported by a *schema* resource. -/// It is not used directly, but through a `SchemaMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Schema; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Schema::default(); -/// -/// // 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 ! -/// let result = hub.schemas().insert(req, "customerId") -/// .doit(); -/// # } -/// ``` -pub struct SchemaInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Schema, - _customer_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for SchemaInsertCall<'a, C, A> {} - -impl<'a, C, A> SchemaInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Schema)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.schemas.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customerId", self._customer_id.to_string())); - for &field in ["alt", "customerId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customerId}/schemas".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUserschema.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customerId}", "customerId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customerId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Schema) -> SchemaInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable id of the Google Apps account - /// - /// Sets the *customer id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer_id(mut self, new_value: &str) -> SchemaInsertCall<'a, C, A> { - self._customer_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> SchemaInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> SchemaInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUserschema`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> SchemaInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Stop watching resources through this channel -/// -/// A builder for the *stop* method supported by a *channel* resource. -/// It is not used directly, but through a `ChannelMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::Channel; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = Channel::default(); -/// -/// // 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 ! -/// let result = hub.channels().stop(req) -/// .doit(); -/// # } -/// ``` -pub struct ChannelStopCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: Channel, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ChannelStopCall<'a, C, A> {} - -impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "admin.channels.stop", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - for &field in [].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1//admin/directory_v1/channels/stop".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryUser.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Channel) -> ChannelStopCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ChannelStopCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ChannelStopCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryUser`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ChannelStopCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a role assignment. -/// -/// A builder for the *insert* method supported by a *roleAssignment* resource. -/// It is not used directly, but through a `RoleAssignmentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// use admin1_directory::RoleAssignment; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let mut req = RoleAssignment::default(); -/// -/// // 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 ! -/// let result = hub.role_assignments().insert(req, "customer") -/// .doit(); -/// # } -/// ``` -pub struct RoleAssignmentInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _request: RoleAssignment, - _customer: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RoleAssignmentInsertCall<'a, C, A> {} - -impl<'a, C, A> RoleAssignmentInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, RoleAssignment)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.roleAssignments.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - for &field in ["alt", "customer"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roleassignments".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: RoleAssignment) -> RoleAssignmentInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// Immutable ID of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> RoleAssignmentInsertCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> RoleAssignmentInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RoleAssignmentInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagement`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> RoleAssignmentInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieve a role assignment. -/// -/// A builder for the *get* method supported by a *roleAssignment* resource. -/// It is not used directly, but through a `RoleAssignmentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.role_assignments().get("customer", "roleAssignmentId") -/// .doit(); -/// # } -/// ``` -pub struct RoleAssignmentGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _role_assignment_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RoleAssignmentGetCall<'a, C, A> {} - -impl<'a, C, A> RoleAssignmentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, RoleAssignment)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.roleAssignments.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("roleAssignmentId", self._role_assignment_id.to_string())); - for &field in ["alt", "customer", "roleAssignmentId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roleassignments/{roleAssignmentId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagementReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{roleAssignmentId}", "roleAssignmentId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["roleAssignmentId", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable ID of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> RoleAssignmentGetCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Immutable ID of the role assignment. - /// - /// Sets the *role assignment id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn role_assignment_id(mut self, new_value: &str) -> RoleAssignmentGetCall<'a, C, A> { - self._role_assignment_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> RoleAssignmentGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RoleAssignmentGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagementReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> RoleAssignmentGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a role assignment. -/// -/// A builder for the *delete* method supported by a *roleAssignment* resource. -/// It is not used directly, but through a `RoleAssignmentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.role_assignments().delete("customer", "roleAssignmentId") -/// .doit(); -/// # } -/// ``` -pub struct RoleAssignmentDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _role_assignment_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RoleAssignmentDeleteCall<'a, C, A> {} - -impl<'a, C, A> RoleAssignmentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.roleAssignments.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - params.push(("roleAssignmentId", self._role_assignment_id.to_string())); - for &field in ["customer", "roleAssignmentId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roleassignments/{roleAssignmentId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagement.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer"), ("{roleAssignmentId}", "roleAssignmentId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["roleAssignmentId", "customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable ID of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> RoleAssignmentDeleteCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// Immutable ID of the role assignment. - /// - /// Sets the *role assignment id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn role_assignment_id(mut self, new_value: &str) -> RoleAssignmentDeleteCall<'a, C, A> { - self._role_assignment_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> RoleAssignmentDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RoleAssignmentDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagement`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> RoleAssignmentDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieves a paginated list of all roleAssignments. -/// -/// A builder for the *list* method supported by a *roleAssignment* resource. -/// It is not used directly, but through a `RoleAssignmentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_admin1_directory as admin1_directory; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use admin1_directory::Directory; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Directory::new(hyper::Client::new(), 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 ! -/// let result = hub.role_assignments().list("customer") -/// .user_key("dolor") -/// .role_id("aliquyam") -/// .page_token("elitr") -/// .max_results(-16) -/// .doit(); -/// # } -/// ``` -pub struct RoleAssignmentListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Directory, - _customer: String, - _user_key: Option, - _role_id: Option, - _page_token: Option, - _max_results: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for RoleAssignmentListCall<'a, C, A> {} - -impl<'a, C, A> RoleAssignmentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, RoleAssignments)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "directory.roleAssignments.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); - params.push(("customer", self._customer.to_string())); - if let Some(value) = self._user_key { - params.push(("userKey", value.to_string())); - } - if let Some(value) = self._role_id { - params.push(("roleId", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - for &field in ["alt", "customer", "userKey", "roleId", "pageToken", "maxResults"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/admin/directory/v1/customer/{customer}/roleassignments".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DirectoryRolemanagementReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{customer}", "customer")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["customer"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Immutable ID of the Google Apps account. - /// - /// Sets the *customer* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn customer(mut self, new_value: &str) -> RoleAssignmentListCall<'a, C, A> { - self._customer = new_value.to_string(); - self - } - /// The user's primary email address, alias email address, or unique user ID. If included in the request, returns role assignments only for this user. - /// - /// Sets the *user key* query property to the given value. - pub fn user_key(mut self, new_value: &str) -> RoleAssignmentListCall<'a, C, A> { - self._user_key = Some(new_value.to_string()); - self - } - /// Immutable ID of a role. If included in the request, returns only role assignments containing this role ID. - /// - /// Sets the *role id* query property to the given value. - pub fn role_id(mut self, new_value: &str) -> RoleAssignmentListCall<'a, C, A> { - self._role_id = Some(new_value.to_string()); - self - } - /// Token to specify the next page in the list. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> RoleAssignmentListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Maximum number of results to return. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: i32) -> RoleAssignmentListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> RoleAssignmentListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> RoleAssignmentListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DirectoryRolemanagementReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> RoleAssignmentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/admin1_reports-cli/Cargo.toml b/gen/admin1_reports-cli/Cargo.toml index 29f1a3548b..22085b91c5 100644 --- a/gen/admin1_reports-cli/Cargo.toml +++ b/gen/admin1_reports-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-admin1_reports-cli" -version = "0.3.2+20150907" +version = "0.3.3+20151113" authors = ["Sebastian Thiel "] description = "A complete library to interact with reports (protocol reports_v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_reports-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/admin1_reports-cli/LICENSE.md b/gen/admin1_reports-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/admin1_reports-cli/LICENSE.md +++ b/gen/admin1_reports-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/admin1_reports-cli/README.md b/gen/admin1_reports-cli/README.md index bbee7cd5b7..78b2112f1f 100644 --- a/gen/admin1_reports-cli/README.md +++ b/gen/admin1_reports-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *reports* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/admin1-reports.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/admin1-reports.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/admin1-reports.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/admin1-reports.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_reports-cli). # Usage -This documentation was generated from the *reports* API at revision *20150907*. The CLI is at version *0.3.2*. +This documentation was generated from the *reports* API at revision *20151113*. The CLI is at version *0.3.3*. ```bash admin1-reports [options] @@ -41,18 +41,18 @@ admin1-reports [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/admin1_reports-cli/mkdocs.yml b/gen/admin1_reports-cli/mkdocs.yml index d681d09f00..040d4ccc8a 100644 --- a/gen/admin1_reports-cli/mkdocs.yml +++ b/gen/admin1_reports-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: reports v0.3.2+20150907 +site_name: reports v0.3.3+20151113 site_url: http://byron.github.io/google-apis-rs/google-admin1_reports-cli site_description: Write integrating applications with bcore @@ -17,5 +17,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/admin1_reports-cli/src/main.rs b/gen/admin1_reports-cli/src/main.rs index 1fe4a97fac..605c512da6 100644 --- a/gen/admin1_reports-cli/src/main.rs +++ b/gen/admin1_reports-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Reports>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _activities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.activities().list(opt.value_of("user-key").unwrap_or(""), opt.value_of("application-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-time" => { @@ -85,7 +85,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-time", "actor-ip-address", "max-results", "event-name", "page-token", "filters", "end-time", "customer-id"].iter().map(|v|*v)); @@ -99,7 +99,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -122,13 +122,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _activities_watch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _activities_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -142,8 +142,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -167,7 +167,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.activities().watch(request, opt.value_of("user-key").unwrap_or(""), opt.value_of("application-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-time" => { @@ -204,7 +204,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-time", "actor-ip-address", "max-results", "event-name", "page-token", "filters", "end-time", "customer-id"].iter().map(|v|*v)); @@ -218,7 +218,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -241,13 +241,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channels_stop(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channels_stop(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -261,8 +261,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -286,7 +286,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.channels().stop(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -299,7 +299,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -312,7 +312,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -327,10 +327,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customer_usage_reports_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customer_usage_reports_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.customer_usage_reports().get(opt.value_of("date").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "parameters" => { @@ -352,7 +352,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "customer-id", "parameters"].iter().map(|v|*v)); @@ -366,7 +366,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -389,10 +389,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_usage_report_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_usage_report_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_usage_report().get(opt.value_of("user-key").unwrap_or(""), opt.value_of("date").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "parameters" => { @@ -420,7 +420,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "filters", "max-results", "parameters", "customer-id"].iter().map(|v|*v)); @@ -434,7 +434,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -526,14 +526,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "admin1-reports-secret.json", + match cmn::application_secret_from_directory(&config_dir, "admin1-reports-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -553,7 +553,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -592,7 +592,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("activities", "methods: 'list' and 'watch'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of activities for a specific customer and application."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_reports_cli/activities_list", vec![ @@ -620,7 +620,7 @@ fn main() { Some(false), Some(false)), ]), - ("watch", + ("watch", Some(r##"Push changes to activities"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_reports_cli/activities_watch", vec![ @@ -657,7 +657,7 @@ fn main() { ]), ("channels", "methods: 'stop'", vec![ - ("stop", + ("stop", Some(r##"Stop watching resources through this channel"##), "Details at http://byron.github.io/google-apis-rs/google_admin1_reports_cli/channels_stop", vec![ @@ -676,7 +676,7 @@ fn main() { ]), ("customer-usage-reports", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Retrieves a report which is a collection of properties / statistics for a specific customer."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_reports_cli/customer-usage-reports_get", vec![ @@ -701,7 +701,7 @@ fn main() { ]), ("user-usage-report", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Retrieves a report which is a collection of properties / statistics for a set of users."##), "Details at http://byron.github.io/google-apis-rs/google_admin1_reports_cli/user-usage-report_get", vec![ @@ -735,7 +735,7 @@ fn main() { let mut app = App::new("admin1-reports") .author("Sebastian Thiel ") - .version("0.3.2+20150907") + .version("0.3.3+20151113") .about("Allows the administrators of Google Apps customers to fetch reports about the usage, collaboration, security and risk for their users.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_admin1_reports_cli") .arg(Arg::with_name("url") @@ -759,7 +759,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -770,7 +770,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/admin1_reports/Cargo.toml b/gen/admin1_reports/Cargo.toml index 4a11c59dc7..3afe13591a 100644 --- a/gen/admin1_reports/Cargo.toml +++ b/gen/admin1_reports/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-admin1_reports" -version = "0.1.10+20150907" +version = "0.1.11+20151113" authors = ["Sebastian Thiel "] description = "A complete library to interact with reports (protocol reports_v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_reports" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/admin1_reports/LICENSE.md b/gen/admin1_reports/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/admin1_reports/LICENSE.md +++ b/gen/admin1_reports/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/admin1_reports/README.md b/gen/admin1_reports/README.md index 719869caba..b047a6f162 100644 --- a/gen/admin1_reports/README.md +++ b/gen/admin1_reports/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-admin1_reports` library allows access to all features of the *Google reports* service. -This documentation was generated from *reports* crate version *0.1.10+20150907*, where *20150907* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *reports* crate version *0.1.11+20151113*, where *20151113* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *reports* *v1_reports* API can be found at the [official documentation site](https://developers.google.com/admin-sdk/reports/). diff --git a/gen/admin1_reports/src/cmn.rs b/gen/admin1_reports/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/admin1_reports/src/cmn.rs +++ b/gen/admin1_reports/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/admin1_reports/src/lib.rs b/gen/admin1_reports/src/lib.rs index e7c60fd5f4..564da11156 100644 --- a/gen/admin1_reports/src/lib.rs +++ b/gen/admin1_reports/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *reports* crate version *0.1.10+20150907*, where *20150907* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *reports* crate version *0.1.11+20151113*, where *20151113* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *reports* *v1_reports* API can be found at the //! [official documentation site](https://developers.google.com/admin-sdk/reports/). diff --git a/gen/admin1_reports/src/lib.rs.in b/gen/admin1_reports/src/lib.rs.in index 8e403d9a87..9b969d0259 100644 --- a/gen/admin1_reports/src/lib.rs.in +++ b/gen/admin1_reports/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -144,7 +145,7 @@ impl<'a, C, A> Reports Reports { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -162,7 +163,7 @@ impl<'a, C, A> Reports } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -851,7 +852,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "admin.channels.stop", + dlg.begin(MethodInfo { id: "admin.channels.stop", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in [].iter() { @@ -870,14 +871,14 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::ReportAuditReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -921,7 +922,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -931,10 +932,10 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -956,7 +957,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> ChannelStopCall<'a, C, A> { self._request = new_value; @@ -974,12 +975,12 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -996,17 +997,17 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ReportAuditReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChannelStopCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChannelStopCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1092,7 +1093,7 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reports.activities.watch", + dlg.begin(MethodInfo { id: "reports.activities.watch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -1159,14 +1160,14 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1210,7 +1211,7 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1220,10 +1221,10 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1255,7 +1256,7 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> ActivityWatchCall<'a, C, A> { self._request = new_value; @@ -1265,7 +1266,7 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -1275,7 +1276,7 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *application name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn application_name(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> { self._application_name = new_value.to_string(); @@ -1349,12 +1350,12 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1371,17 +1372,17 @@ impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ReportAuditReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ActivityWatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ActivityWatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1460,7 +1461,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reports.activities.list", + dlg.begin(MethodInfo { id: "reports.activities.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -1527,7 +1528,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1563,7 +1564,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1573,10 +1574,10 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1609,7 +1610,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -1619,7 +1620,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *application name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn application_name(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { self._application_name = new_value.to_string(); @@ -1693,12 +1694,12 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1715,17 +1716,17 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ReportAuditReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ActivityListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ActivityListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1793,7 +1794,7 @@ impl<'a, C, A> CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reports.customerUsageReports.get", + dlg.begin(MethodInfo { id: "reports.customerUsageReports.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("date", self._date.to_string())); @@ -1844,7 +1845,7 @@ impl<'a, C, A> CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1880,7 +1881,7 @@ impl<'a, C, A> CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1890,10 +1891,10 @@ impl<'a, C, A> CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut CustomerUsageReportGetCall<'a, C, A> { self._date = new_value.to_string(); @@ -1965,12 +1966,12 @@ impl<'a, C, A> CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CustomerUsageReportGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomerUsageReportGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2070,7 +2071,7 @@ impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reports.userUsageReport.get", + dlg.begin(MethodInfo { id: "reports.userUsageReport.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -2128,7 +2129,7 @@ impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2164,7 +2165,7 @@ impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2174,10 +2175,10 @@ impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut UserUsageReportGetCall<'a, C, A> where C: BorrowMut UserUsageReportGetCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -2220,7 +2221,7 @@ impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut UserUsageReportGetCall<'a, C, A> { self._date = new_value.to_string(); @@ -2273,12 +2274,12 @@ impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut UserUsageReportGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserUsageReportGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserUsageReportGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/admin2_email_migration-cli/Cargo.toml b/gen/admin2_email_migration-cli/Cargo.toml index 7f06a0eb27..e17c4f456f 100644 --- a/gen/admin2_email_migration-cli/Cargo.toml +++ b/gen/admin2_email_migration-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-admin2_email_migration-cli" -version = "0.3.2+20150303" +version = "0.3.3+20150303" authors = ["Sebastian Thiel "] description = "A complete library to interact with admin (protocol email_migration_v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin2_email_migration-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/admin2_email_migration-cli/LICENSE.md b/gen/admin2_email_migration-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/admin2_email_migration-cli/LICENSE.md +++ b/gen/admin2_email_migration-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/admin2_email_migration-cli/README.md b/gen/admin2_email_migration-cli/README.md index 37c248eb3e..39beda91c0 100644 --- a/gen/admin2_email_migration-cli/README.md +++ b/gen/admin2_email_migration-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *admin* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/admin2-email-migration.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/admin2-email-migration.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/admin2-email-migration.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/admin2-email-migration.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/admin2_email_migration-cli). # Usage -This documentation was generated from the *admin* API at revision *20150303*. The CLI is at version *0.3.2*. +This documentation was generated from the *admin* API at revision *20150303*. The CLI is at version *0.3.3*. ```bash admin2-email-migration [options] @@ -34,18 +34,18 @@ admin2-email-migration [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/admin2_email_migration-cli/mkdocs.yml b/gen/admin2_email_migration-cli/mkdocs.yml index 08f22981ed..540b69ee53 100644 --- a/gen/admin2_email_migration-cli/mkdocs.yml +++ b/gen/admin2_email_migration-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: admin v0.3.2+20150303 +site_name: admin v0.3.3+20150303 site_url: http://byron.github.io/google-apis-rs/google-admin2_email_migration-cli site_description: Write integrating applications with bcore @@ -13,5 +13,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/admin2_email_migration-cli/src/main.rs b/gen/admin2_email_migration-cli/src/main.rs index d4f5031033..787d088a57 100644 --- a/gen/admin2_email_migration-cli/src/main.rs +++ b/gen/admin2_email_migration-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Admin>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _mail_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _mail_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "is-trash" => Some(("isTrash", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -89,7 +89,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::MailItem = json::value::from_value(object).unwrap(); let mut call = self.hub.mail().insert(request, opt.value_of("user-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -102,7 +102,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -110,7 +110,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -167,14 +167,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "admin2-email-migration-secret.json", + match cmn::application_secret_from_directory(&config_dir, "admin2-email-migration-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -194,7 +194,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -234,7 +234,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("mail", "methods: 'insert'", vec![ - ("insert", + ("insert", Some(r##"Insert Mail into Google's Gmail backends"##), "Details at http://byron.github.io/google-apis-rs/google_admin2_email_migration_cli/mail_insert", vec![ @@ -268,7 +268,7 @@ fn main() { let mut app = App::new("admin2-email-migration") .author("Sebastian Thiel ") - .version("0.3.2+20150303") + .version("0.3.3+20150303") .about("Email Migration API lets you migrate emails of users to Google backends.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_admin2_email_migration_cli") .arg(Arg::with_name("url") @@ -292,7 +292,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -303,7 +303,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/admin2_email_migration/Cargo.toml b/gen/admin2_email_migration/Cargo.toml index bc30369b24..c5ceb808cc 100644 --- a/gen/admin2_email_migration/Cargo.toml +++ b/gen/admin2_email_migration/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-admin2_email_migration" -version = "0.1.10+20150303" +version = "0.1.11+20150303" authors = ["Sebastian Thiel "] description = "A complete library to interact with admin (protocol email_migration_v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin2_email_migration" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/admin2_email_migration/LICENSE.md b/gen/admin2_email_migration/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/admin2_email_migration/LICENSE.md +++ b/gen/admin2_email_migration/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/admin2_email_migration/README.md b/gen/admin2_email_migration/README.md index 3a754124de..e78166f061 100644 --- a/gen/admin2_email_migration/README.md +++ b/gen/admin2_email_migration/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-admin2_email_migration` library allows access to all features of the *Google admin* service. -This documentation was generated from *admin* crate version *0.1.10+20150303*, where *20150303* is the exact revision of the *admin:email_migration_v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *admin* crate version *0.1.11+20150303*, where *20150303* is the exact revision of the *admin:email_migration_v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *admin* *v2_email_migration* API can be found at the [official documentation site](https://developers.google.com/admin-sdk/email-migration/v2/). diff --git a/gen/admin2_email_migration/src/cmn.rs b/gen/admin2_email_migration/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/admin2_email_migration/src/cmn.rs +++ b/gen/admin2_email_migration/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/admin2_email_migration/src/lib.rs b/gen/admin2_email_migration/src/lib.rs index ef92efaaa9..b4e0754a1b 100644 --- a/gen/admin2_email_migration/src/lib.rs +++ b/gen/admin2_email_migration/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *admin* crate version *0.1.10+20150303*, where *20150303* is the exact revision of the *admin:email_migration_v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *admin* crate version *0.1.11+20150303*, where *20150303* is the exact revision of the *admin:email_migration_v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *admin* *v2_email_migration* API can be found at the //! [official documentation site](https://developers.google.com/admin-sdk/email-migration/v2/). diff --git a/gen/admin2_email_migration/src/lib.rs.in b/gen/admin2_email_migration/src/lib.rs.in index 49706ab178..05efcded8b 100644 --- a/gen/admin2_email_migration/src/lib.rs.in +++ b/gen/admin2_email_migration/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -133,7 +134,7 @@ impl<'a, C, A> Admin Admin { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -142,7 +143,7 @@ impl<'a, C, A> Admin } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -331,7 +332,7 @@ impl<'a, C, A> MailInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "emailMigration.mail.insert", + dlg.begin(MethodInfo { id: "emailMigration.mail.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userKey", self._user_key.to_string())); @@ -346,13 +347,13 @@ impl<'a, C, A> MailInsertCall<'a, C, A> where C: BorrowMut, A: oa } - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/email/v2/users/{userKey}/mail".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/email/v2/users/{userKey}/mail".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -380,14 +381,14 @@ impl<'a, C, A> MailInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -464,7 +465,7 @@ impl<'a, C, A> MailInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -474,10 +475,10 @@ impl<'a, C, A> MailInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -570,7 +571,7 @@ impl<'a, C, A> MailInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: MailItem) -> MailInsertCall<'a, C, A> { self._request = new_value; @@ -580,7 +581,7 @@ impl<'a, C, A> MailInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *user key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_key(mut self, new_value: &str) -> MailInsertCall<'a, C, A> { self._user_key = new_value.to_string(); @@ -598,12 +599,12 @@ impl<'a, C, A> MailInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -620,17 +621,17 @@ impl<'a, C, A> MailInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::EmailMigration`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MailInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MailInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/adsense1d4-cli/Cargo.toml b/gen/adsense1d4-cli/Cargo.toml index 1c88526b66..9c11c7c10d 100644 --- a/gen/adsense1d4-cli/Cargo.toml +++ b/gen/adsense1d4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adsense1d4-cli" -version = "0.3.2+20151013" +version = "0.3.3+20160127" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdSense (protocol v1.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsense1d4-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/adsense1d4-cli/LICENSE.md b/gen/adsense1d4-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/adsense1d4-cli/LICENSE.md +++ b/gen/adsense1d4-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/adsense1d4-cli/README.md b/gen/adsense1d4-cli/README.md index e2b9c4baa0..6c4d07c3e3 100644 --- a/gen/adsense1d4-cli/README.md +++ b/gen/adsense1d4-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *AdSense* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/adsense1d4.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/adsense1d4.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/adsense1d4.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/adsense1d4.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/adsense1d4-cli). # Usage -This documentation was generated from the *AdSense* API at revision *20151013*. The CLI is at version *0.3.2*. +This documentation was generated from the *AdSense* API at revision *20160127*. The CLI is at version *0.3.3*. ```bash adsense1d4 [options] @@ -80,18 +80,18 @@ adsense1d4 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/adsense1d4-cli/mkdocs.yml b/gen/adsense1d4-cli/mkdocs.yml index b368f110e7..3549005a4d 100644 --- a/gen/adsense1d4-cli/mkdocs.yml +++ b/gen/adsense1d4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AdSense v0.3.2+20151013 +site_name: AdSense v0.3.3+20160127 site_url: http://byron.github.io/google-apis-rs/google-adsense1d4-cli site_description: Write integrating applications with bcore @@ -50,5 +50,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/adsense1d4-cli/src/main.rs b/gen/adsense1d4-cli/src/main.rs index 1802d2bce7..890cd457bb 100644 --- a/gen/adsense1d4-cli/src/main.rs +++ b/gen/adsense1d4-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::AdSense>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _accounts_adclients_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _accounts_adclients_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adclients_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -67,7 +67,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -81,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -104,10 +104,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_customchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_customchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adunits_customchannels_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("ad-unit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -140,7 +140,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -163,10 +163,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adunits_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("ad-unit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -179,7 +179,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -192,7 +192,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -215,10 +215,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_get_ad_code(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_get_ad_code(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adunits_get_ad_code(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("ad-unit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -231,7 +231,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -244,7 +244,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -267,10 +267,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adunits_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -292,7 +292,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-inactive", "page-token", "max-results"].iter().map(|v|*v)); @@ -306,7 +306,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -329,10 +329,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_alerts_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_alerts_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().alerts_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("alert-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -345,7 +345,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -358,7 +358,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -373,10 +373,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_alerts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_alerts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().alerts_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "locale" => { @@ -392,7 +392,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale"].iter().map(|v|*v)); @@ -406,7 +406,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -429,10 +429,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_customchannels_adunits_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_customchannels_adunits_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().customchannels_adunits_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("custom-channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -454,7 +454,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-inactive", "page-token", "max-results"].iter().map(|v|*v)); @@ -468,7 +468,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -491,10 +491,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_customchannels_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_customchannels_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().customchannels_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("custom-channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -507,7 +507,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -520,7 +520,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -543,10 +543,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_customchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_customchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().customchannels_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -565,7 +565,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -579,7 +579,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -602,10 +602,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().get(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tree" => { @@ -621,7 +621,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["tree"].iter().map(|v|*v)); @@ -635,7 +635,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -658,10 +658,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -680,7 +680,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -694,7 +694,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -717,10 +717,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_payments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_payments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().payments_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -733,7 +733,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -746,7 +746,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -769,11 +769,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_reports_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_reports_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.accounts().reports_generate(opt.value_of("account-id").unwrap_or(""), opt.value_of("start-date").unwrap_or(""), opt.value_of("end-date").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "use-timezone-reporting" => { @@ -816,7 +816,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort", "locale", "metric", "max-results", "filter", "currency", "start-index", "use-timezone-reporting", "dimension"].iter().map(|v|*v)); @@ -830,7 +830,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -858,10 +858,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_reports_saved_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_reports_saved_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().reports_saved_generate(opt.value_of("account-id").unwrap_or(""), opt.value_of("saved-report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -883,7 +883,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "start-index", "max-results"].iter().map(|v|*v)); @@ -897,7 +897,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -920,10 +920,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_reports_saved_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_reports_saved_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().reports_saved_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -942,7 +942,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -956,7 +956,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -979,10 +979,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_savedadstyles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_savedadstyles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().savedadstyles_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("saved-ad-style-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -995,7 +995,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1008,7 +1008,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1031,10 +1031,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_savedadstyles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_savedadstyles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().savedadstyles_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1053,7 +1053,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1067,7 +1067,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1090,10 +1090,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_urlchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_urlchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().urlchannels_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1112,7 +1112,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1126,7 +1126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1149,10 +1149,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _adclients_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _adclients_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.adclients().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1171,7 +1171,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1185,7 +1185,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1208,10 +1208,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _adunits_customchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _adunits_customchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.adunits().customchannels_list(opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("ad-unit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1230,7 +1230,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1244,7 +1244,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1267,10 +1267,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _adunits_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _adunits_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.adunits().get(opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("ad-unit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1283,7 +1283,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1296,7 +1296,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1319,10 +1319,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _adunits_get_ad_code(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _adunits_get_ad_code(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.adunits().get_ad_code(opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("ad-unit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1335,7 +1335,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1348,7 +1348,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1371,10 +1371,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _adunits_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _adunits_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.adunits().list(opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1396,7 +1396,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-inactive", "page-token", "max-results"].iter().map(|v|*v)); @@ -1410,7 +1410,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1433,10 +1433,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _alerts_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _alerts_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.alerts().delete(opt.value_of("alert-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1449,7 +1449,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1462,7 +1462,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1477,10 +1477,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _alerts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _alerts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.alerts().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "locale" => { @@ -1496,7 +1496,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale"].iter().map(|v|*v)); @@ -1510,7 +1510,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1533,10 +1533,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customchannels_adunits_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customchannels_adunits_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.customchannels().adunits_list(opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("custom-channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1558,7 +1558,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-inactive", "page-token", "max-results"].iter().map(|v|*v)); @@ -1572,7 +1572,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1595,10 +1595,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customchannels_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customchannels_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.customchannels().get(opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("custom-channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1611,7 +1611,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1624,7 +1624,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1647,10 +1647,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.customchannels().list(opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1669,7 +1669,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1683,7 +1683,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1706,10 +1706,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _metadata_dimensions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _metadata_dimensions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.metadata().dimensions_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1722,7 +1722,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1735,7 +1735,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1758,10 +1758,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _metadata_metrics_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _metadata_metrics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.metadata().metrics_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1774,7 +1774,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1787,7 +1787,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1810,10 +1810,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _payments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _payments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.payments().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1826,7 +1826,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1839,7 +1839,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1862,11 +1862,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.reports().generate(opt.value_of("start-date").unwrap_or(""), opt.value_of("end-date").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "use-timezone-reporting" => { @@ -1912,7 +1912,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort", "locale", "metric", "max-results", "filter", "currency", "start-index", "use-timezone-reporting", "dimension", "account-id"].iter().map(|v|*v)); @@ -1926,7 +1926,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1954,10 +1954,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_saved_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_saved_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().saved_generate(opt.value_of("saved-report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -1979,7 +1979,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "start-index", "max-results"].iter().map(|v|*v)); @@ -1993,7 +1993,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2016,10 +2016,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_saved_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_saved_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().saved_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2038,7 +2038,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -2052,7 +2052,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2075,10 +2075,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _savedadstyles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _savedadstyles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.savedadstyles().get(opt.value_of("saved-ad-style-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2091,7 +2091,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2104,7 +2104,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2127,10 +2127,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _savedadstyles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _savedadstyles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.savedadstyles().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2149,7 +2149,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -2163,7 +2163,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2186,10 +2186,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _urlchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _urlchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.urlchannels().list(opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2208,7 +2208,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -2222,7 +2222,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2461,14 +2461,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "adsense1d4-secret.json", + match cmn::application_secret_from_directory(&config_dir, "adsense1d4-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -2488,7 +2488,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -2527,7 +2527,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("accounts", "methods: 'adclients-list', 'adunits-customchannels-list', 'adunits-get', 'adunits-get-ad-code', 'adunits-list', 'alerts-delete', 'alerts-list', 'customchannels-adunits-list', 'customchannels-get', 'customchannels-list', 'get', 'list', 'payments-list', 'reports-generate', 'reports-saved-generate', 'reports-saved-list', 'savedadstyles-get', 'savedadstyles-list' and 'urlchannels-list'", vec![ - ("adclients-list", + ("adclients-list", Some(r##"List all ad clients in the specified account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_adclients-list", vec![ @@ -2549,7 +2549,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-customchannels-list", + ("adunits-customchannels-list", Some(r##"List all custom channels which the specified ad unit belongs to."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_adunits-customchannels-list", vec![ @@ -2583,7 +2583,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-get", + ("adunits-get", Some(r##"Gets the specified ad unit in the specified ad client for the specified account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_adunits-get", vec![ @@ -2617,7 +2617,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-get-ad-code", + ("adunits-get-ad-code", Some(r##"Get ad code for the specified ad unit."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_adunits-get-ad-code", vec![ @@ -2651,7 +2651,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-list", + ("adunits-list", Some(r##"List all ad units in the specified ad client for the specified account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_adunits-list", vec![ @@ -2679,7 +2679,7 @@ fn main() { Some(false), Some(false)), ]), - ("alerts-delete", + ("alerts-delete", Some(r##"Dismiss (delete) the specified alert from the specified publisher AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_alerts-delete", vec![ @@ -2701,7 +2701,7 @@ fn main() { Some(false), Some(true)), ]), - ("alerts-list", + ("alerts-list", Some(r##"List the alerts for the specified AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_alerts-list", vec![ @@ -2723,7 +2723,7 @@ fn main() { Some(false), Some(false)), ]), - ("customchannels-adunits-list", + ("customchannels-adunits-list", Some(r##"List all ad units in the specified custom channel."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_customchannels-adunits-list", vec![ @@ -2757,7 +2757,7 @@ fn main() { Some(false), Some(false)), ]), - ("customchannels-get", + ("customchannels-get", Some(r##"Get the specified custom channel from the specified ad client for the specified account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_customchannels-get", vec![ @@ -2791,7 +2791,7 @@ fn main() { Some(false), Some(false)), ]), - ("customchannels-list", + ("customchannels-list", Some(r##"List all custom channels in the specified ad client for the specified account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_customchannels-list", vec![ @@ -2819,7 +2819,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Get information about the selected AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_get", vec![ @@ -2841,7 +2841,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all accounts available to this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_list", vec![ @@ -2857,7 +2857,7 @@ fn main() { Some(false), Some(false)), ]), - ("payments-list", + ("payments-list", Some(r##"List the payments for the specified AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_payments-list", vec![ @@ -2879,7 +2879,7 @@ fn main() { Some(false), Some(false)), ]), - ("reports-generate", + ("reports-generate", Some(r##"Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_reports-generate", vec![ @@ -2913,7 +2913,7 @@ fn main() { Some(false), Some(false)), ]), - ("reports-saved-generate", + ("reports-saved-generate", Some(r##"Generate an AdSense report based on the saved report ID sent in the query parameters."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_reports-saved-generate", vec![ @@ -2941,7 +2941,7 @@ fn main() { Some(false), Some(false)), ]), - ("reports-saved-list", + ("reports-saved-list", Some(r##"List all saved reports in the specified AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_reports-saved-list", vec![ @@ -2963,7 +2963,7 @@ fn main() { Some(false), Some(false)), ]), - ("savedadstyles-get", + ("savedadstyles-get", Some(r##"List a specific saved ad style for the specified account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_savedadstyles-get", vec![ @@ -2991,7 +2991,7 @@ fn main() { Some(false), Some(false)), ]), - ("savedadstyles-list", + ("savedadstyles-list", Some(r##"List all saved ad styles in the specified account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_savedadstyles-list", vec![ @@ -3013,7 +3013,7 @@ fn main() { Some(false), Some(false)), ]), - ("urlchannels-list", + ("urlchannels-list", Some(r##"List all URL channels in the specified ad client for the specified account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/accounts_urlchannels-list", vec![ @@ -3044,7 +3044,7 @@ fn main() { ]), ("adclients", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"List all ad clients in this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/adclients_list", vec![ @@ -3063,7 +3063,7 @@ fn main() { ]), ("adunits", "methods: 'customchannels-list', 'get', 'get-ad-code' and 'list'", vec![ - ("customchannels-list", + ("customchannels-list", Some(r##"List all custom channels which the specified ad unit belongs to."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/adunits_customchannels-list", vec![ @@ -3091,7 +3091,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets the specified ad unit in the specified ad client."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/adunits_get", vec![ @@ -3119,7 +3119,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-ad-code", + ("get-ad-code", Some(r##"Get ad code for the specified ad unit."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/adunits_get-ad-code", vec![ @@ -3147,7 +3147,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all ad units in the specified ad client for this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/adunits_list", vec![ @@ -3172,7 +3172,7 @@ fn main() { ]), ("alerts", "methods: 'delete' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Dismiss (delete) the specified alert from the publisher's AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/alerts_delete", vec![ @@ -3188,7 +3188,7 @@ fn main() { Some(false), Some(true)), ]), - ("list", + ("list", Some(r##"List the alerts for this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/alerts_list", vec![ @@ -3207,7 +3207,7 @@ fn main() { ]), ("customchannels", "methods: 'adunits-list', 'get' and 'list'", vec![ - ("adunits-list", + ("adunits-list", Some(r##"List all ad units in the specified custom channel."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/customchannels_adunits-list", vec![ @@ -3235,7 +3235,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Get the specified custom channel from the specified ad client."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/customchannels_get", vec![ @@ -3263,7 +3263,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all custom channels in the specified ad client for this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/customchannels_list", vec![ @@ -3288,7 +3288,7 @@ fn main() { ]), ("metadata", "methods: 'dimensions-list' and 'metrics-list'", vec![ - ("dimensions-list", + ("dimensions-list", Some(r##"List the metadata for the dimensions available to this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/metadata_dimensions-list", vec![ @@ -3304,7 +3304,7 @@ fn main() { Some(false), Some(false)), ]), - ("metrics-list", + ("metrics-list", Some(r##"List the metadata for the metrics available to this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/metadata_metrics-list", vec![ @@ -3323,7 +3323,7 @@ fn main() { ]), ("payments", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"List the payments for this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/payments_list", vec![ @@ -3342,7 +3342,7 @@ fn main() { ]), ("reports", "methods: 'generate', 'saved-generate' and 'saved-list'", vec![ - ("generate", + ("generate", Some(r##"Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/reports_generate", vec![ @@ -3370,7 +3370,7 @@ fn main() { Some(false), Some(false)), ]), - ("saved-generate", + ("saved-generate", Some(r##"Generate an AdSense report based on the saved report ID sent in the query parameters."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/reports_saved-generate", vec![ @@ -3392,7 +3392,7 @@ fn main() { Some(false), Some(false)), ]), - ("saved-list", + ("saved-list", Some(r##"List all saved reports in this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/reports_saved-list", vec![ @@ -3411,7 +3411,7 @@ fn main() { ]), ("savedadstyles", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Get a specific saved ad style from the user's account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/savedadstyles_get", vec![ @@ -3433,7 +3433,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all saved ad styles in the user's account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/savedadstyles_list", vec![ @@ -3452,7 +3452,7 @@ fn main() { ]), ("urlchannels", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"List all URL channels in the specified ad client for this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsense1d4_cli/urlchannels_list", vec![ @@ -3480,7 +3480,7 @@ fn main() { let mut app = App::new("adsense1d4") .author("Sebastian Thiel ") - .version("0.3.2+20151013") + .version("0.3.3+20160127") .about("Gives AdSense publishers access to their inventory and the ability to generate reports") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adsense1d4_cli") .arg(Arg::with_name("url") @@ -3504,7 +3504,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -3515,7 +3515,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/adsense1d4/Cargo.toml b/gen/adsense1d4/Cargo.toml index 266b0d158d..5be4081185 100644 --- a/gen/adsense1d4/Cargo.toml +++ b/gen/adsense1d4/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adsense1d4" -version = "0.1.10+20151013" +version = "0.1.11+20160127" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdSense (protocol v1.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsense1d4" diff --git a/gen/adsense1d4/LICENSE.md b/gen/adsense1d4/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/adsense1d4/LICENSE.md +++ b/gen/adsense1d4/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/adsense1d4/README.md b/gen/adsense1d4/README.md index a4389ad183..8337453c03 100644 --- a/gen/adsense1d4/README.md +++ b/gen/adsense1d4/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-adsense1d4` library allows access to all features of the *Google AdSense* service. -This documentation was generated from *AdSense* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *AdSense* crate version *0.1.11+20160127*, where *20160127* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *AdSense* *v1d4* API can be found at the [official documentation site](https://developers.google.com/adsense/management/). diff --git a/gen/adsense1d4/src/cmn.rs b/gen/adsense1d4/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/adsense1d4/src/cmn.rs +++ b/gen/adsense1d4/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/adsense1d4/src/lib.rs b/gen/adsense1d4/src/lib.rs index 747ada5472..cd4b33fa1f 100644 --- a/gen/adsense1d4/src/lib.rs +++ b/gen/adsense1d4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *AdSense* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *AdSense* crate version *0.1.11+20160127*, where *20160127* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *AdSense* *v1d4* API can be found at the //! [official documentation site](https://developers.google.com/adsense/management/). diff --git a/gen/adsense1d4/src/lib.rs.in b/gen/adsense1d4/src/lib.rs.in index 9d4e948180..c77fae0533 100644 --- a/gen/adsense1d4/src/lib.rs.in +++ b/gen/adsense1d4/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -139,7 +140,7 @@ impl<'a, C, A> AdSense AdSense { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -175,7 +176,7 @@ impl<'a, C, A> AdSense } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -368,7 +369,7 @@ impl NestedType for AdsenseReportsGenerateResponseHeaders {} impl Part for AdsenseReportsGenerateResponseHeaders {} -/// Settings specific to WAP mobile content ads (AFMC). +/// Settings specific to WAP mobile content ads (AFMC) - deprecated. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -475,7 +476,7 @@ impl NestedType for AdUnitContentAdsSettingsBackupOption {} impl Part for AdUnitContentAdsSettingsBackupOption {} -/// Settings specific to feed ads (AFF). +/// Settings specific to feed ads (AFF) - deprecated. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -560,7 +561,7 @@ pub struct CustomChannelTargetingInfo { /// The language of the sites ads will be displayed on. #[serde(rename="siteLanguage")] pub site_language: Option, - /// The locations in which ads appear. (Only valid for content and mobile content ads). Acceptable values for content ads are: TOP_LEFT, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER, MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, MULTIPLE_LOCATIONS. Acceptable values for mobile content ads are: TOP, MIDDLE, BOTTOM, MULTIPLE_LOCATIONS. + /// The locations in which ads appear. (Only valid for content and mobile content ads (deprecated)). Acceptable values for content ads are: TOP_LEFT, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER, MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, MULTIPLE_LOCATIONS. Acceptable values for mobile content ads (deprecated) are: TOP, MIDDLE, BOTTOM, MULTIPLE_LOCATIONS. pub location: Option, /// The name used to describe this channel externally. #[serde(rename="adsAppearOn")] @@ -642,18 +643,18 @@ pub struct AdUnit { pub code: Option, /// Name of this ad unit. pub name: Option, - /// Settings specific to feed ads (AFF). + /// Settings specific to feed ads (AFF) - deprecated. #[serde(rename="feedAdsSettings")] pub feed_ads_settings: Option, /// ID of the saved ad style which holds this ad unit's style information. #[serde(rename="savedStyleId")] pub saved_style_id: Option, - /// Settings specific to content ads (AFC) and highend mobile content ads (AFMC). + /// Settings specific to content ads (AFC) and highend mobile content ads (AFMC - deprecated). #[serde(rename="contentAdsSettings")] pub content_ads_settings: Option, /// Unique identifier of this ad unit. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format. pub id: Option, - /// Settings specific to WAP mobile content ads (AFMC). + /// Settings specific to WAP mobile content ads (AFMC) - deprecated. #[serde(rename="mobileContentAdsSettings")] pub mobile_content_ads_settings: Option, /// Custom style information specific to this ad unit. @@ -869,7 +870,7 @@ pub struct Accounts { impl ResponseResult for Accounts {} -/// Settings specific to content ads (AFC) and highend mobile content ads (AFMC). +/// Settings specific to content ads (AFC) and highend mobile content ads (AFMC - deprecated). /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -2187,7 +2188,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.urlchannels.list", + dlg.begin(MethodInfo { id: "adsense.urlchannels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -2235,7 +2236,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2271,7 +2272,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2281,10 +2282,10 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2317,7 +2318,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> UrlchannelListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -2349,12 +2350,12 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2371,17 +2372,17 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlchannelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlchannelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2448,7 +2449,7 @@ impl<'a, C, A> AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.adunits.customchannels.list", + dlg.begin(MethodInfo { id: "adsense.adunits.customchannels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -2497,7 +2498,7 @@ impl<'a, C, A> AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2533,7 +2534,7 @@ impl<'a, C, A> AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2543,10 +2544,10 @@ impl<'a, C, A> AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AdunitCustomchannelListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -2589,7 +2590,7 @@ impl<'a, C, A> AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AdunitCustomchannelListCall<'a, C, A> { self._ad_unit_id = new_value.to_string(); @@ -2621,12 +2622,12 @@ impl<'a, C, A> AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AdunitCustomchannelListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdunitCustomchannelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdunitCustomchannelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2716,7 +2717,7 @@ impl<'a, C, A> AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.adunits.get", + dlg.begin(MethodInfo { id: "adsense.adunits.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -2759,7 +2760,7 @@ impl<'a, C, A> AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2795,7 +2796,7 @@ impl<'a, C, A> AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2805,10 +2806,10 @@ impl<'a, C, A> AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2841,7 +2842,7 @@ impl<'a, C, A> AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> AdunitGetCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -2851,7 +2852,7 @@ impl<'a, C, A> AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *ad unit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_unit_id(mut self, new_value: &str) -> AdunitGetCall<'a, C, A> { self._ad_unit_id = new_value.to_string(); @@ -2869,12 +2870,12 @@ impl<'a, C, A> AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2891,17 +2892,17 @@ impl<'a, C, A> AdunitGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdunitGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdunitGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2969,7 +2970,7 @@ impl<'a, C, A> AdunitListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.adunits.list", + dlg.begin(MethodInfo { id: "adsense.adunits.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -3020,7 +3021,7 @@ impl<'a, C, A> AdunitListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3056,7 +3057,7 @@ impl<'a, C, A> AdunitListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3066,10 +3067,10 @@ impl<'a, C, A> AdunitListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3102,7 +3103,7 @@ impl<'a, C, A> AdunitListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> AdunitListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -3141,12 +3142,12 @@ impl<'a, C, A> AdunitListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3163,17 +3164,17 @@ impl<'a, C, A> AdunitListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdunitListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdunitListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3236,7 +3237,7 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.adunits.getAdCode", + dlg.begin(MethodInfo { id: "adsense.adunits.getAdCode", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -3279,7 +3280,7 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3315,7 +3316,7 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3325,10 +3326,10 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3361,7 +3362,7 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> AdunitGetAdCodeCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -3371,7 +3372,7 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ad unit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_unit_id(mut self, new_value: &str) -> AdunitGetAdCodeCall<'a, C, A> { self._ad_unit_id = new_value.to_string(); @@ -3389,12 +3390,12 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3411,17 +3412,17 @@ impl<'a, C, A> AdunitGetAdCodeCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdunitGetAdCodeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdunitGetAdCodeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3486,7 +3487,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.adclients.list", + dlg.begin(MethodInfo { id: "adsense.adclients.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -3512,7 +3513,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3548,7 +3549,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3558,10 +3559,10 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3616,12 +3617,12 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3638,17 +3639,17 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdclientListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdclientListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3710,7 +3711,7 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.alerts.delete", + dlg.begin(MethodInfo { id: "adsense.alerts.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("alertId", self._alert_id.to_string())); @@ -3751,7 +3752,7 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3787,7 +3788,7 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3797,10 +3798,10 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3823,7 +3824,7 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *alert id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn alert_id(mut self, new_value: &str) -> AlertDeleteCall<'a, C, A> { self._alert_id = new_value.to_string(); @@ -3841,12 +3842,12 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3863,17 +3864,17 @@ impl<'a, C, A> AlertDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AlertDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AlertDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3936,7 +3937,7 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.alerts.list", + dlg.begin(MethodInfo { id: "adsense.alerts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if let Some(value) = self._locale { @@ -3959,7 +3960,7 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3995,7 +3996,7 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4005,10 +4006,10 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4056,12 +4057,12 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4078,17 +4079,17 @@ impl<'a, C, A> AlertListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AlertListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AlertListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4153,7 +4154,7 @@ impl<'a, C, A> SavedadstyleListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.savedadstyles.list", + dlg.begin(MethodInfo { id: "adsense.savedadstyles.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -4179,7 +4180,7 @@ impl<'a, C, A> SavedadstyleListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4215,7 +4216,7 @@ impl<'a, C, A> SavedadstyleListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4225,10 +4226,10 @@ impl<'a, C, A> SavedadstyleListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4283,12 +4284,12 @@ impl<'a, C, A> SavedadstyleListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4305,17 +4306,17 @@ impl<'a, C, A> SavedadstyleListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SavedadstyleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SavedadstyleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4377,7 +4378,7 @@ impl<'a, C, A> SavedadstyleGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.savedadstyles.get", + dlg.begin(MethodInfo { id: "adsense.savedadstyles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("savedAdStyleId", self._saved_ad_style_id.to_string())); @@ -4419,7 +4420,7 @@ impl<'a, C, A> SavedadstyleGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4455,7 +4456,7 @@ impl<'a, C, A> SavedadstyleGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4465,10 +4466,10 @@ impl<'a, C, A> SavedadstyleGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4501,7 +4502,7 @@ impl<'a, C, A> SavedadstyleGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *saved ad style id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn saved_ad_style_id(mut self, new_value: &str) -> SavedadstyleGetCall<'a, C, A> { self._saved_ad_style_id = new_value.to_string(); @@ -4519,12 +4520,12 @@ impl<'a, C, A> SavedadstyleGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4541,17 +4542,17 @@ impl<'a, C, A> SavedadstyleGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SavedadstyleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SavedadstyleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4616,7 +4617,7 @@ impl<'a, C, A> ReportSavedListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.reports.saved.list", + dlg.begin(MethodInfo { id: "adsense.reports.saved.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -4642,7 +4643,7 @@ impl<'a, C, A> ReportSavedListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4678,7 +4679,7 @@ impl<'a, C, A> ReportSavedListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4688,10 +4689,10 @@ impl<'a, C, A> ReportSavedListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4746,12 +4747,12 @@ impl<'a, C, A> ReportSavedListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4768,17 +4769,17 @@ impl<'a, C, A> ReportSavedListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportSavedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportSavedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4866,7 +4867,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.reports.generate", + dlg.begin(MethodInfo { id: "adsense.reports.generate", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("startDate", self._start_date.to_string())); @@ -4954,7 +4955,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4990,7 +4991,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5000,10 +5001,10 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5036,7 +5037,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *start date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn start_date(mut self, new_value: &str) -> ReportGenerateCall<'a, C, A> { self._start_date = new_value.to_string(); @@ -5046,7 +5047,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *end date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn end_date(mut self, new_value: &str) -> ReportGenerateCall<'a, C, A> { self._end_date = new_value.to_string(); @@ -5139,12 +5140,12 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5161,17 +5162,17 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportGenerateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportGenerateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5239,7 +5240,7 @@ impl<'a, C, A> ReportSavedGenerateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.reports.saved.generate", + dlg.begin(MethodInfo { id: "adsense.reports.saved.generate", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("savedReportId", self._saved_report_id.to_string())); @@ -5290,7 +5291,7 @@ impl<'a, C, A> ReportSavedGenerateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5326,7 +5327,7 @@ impl<'a, C, A> ReportSavedGenerateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5336,10 +5337,10 @@ impl<'a, C, A> ReportSavedGenerateCall<'a, C, A> where C: BorrowMut ReportSavedGenerateCall<'a, C, A> where C: BorrowMut ReportSavedGenerateCall<'a, C, A> { self._saved_report_id = new_value.to_string(); @@ -5411,12 +5412,12 @@ impl<'a, C, A> ReportSavedGenerateCall<'a, C, A> where C: BorrowMut ReportSavedGenerateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ReportSavedGenerateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportSavedGenerateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5506,7 +5507,7 @@ impl<'a, C, A> AccountAlertDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.alerts.delete", + dlg.begin(MethodInfo { id: "adsense.accounts.alerts.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5548,7 +5549,7 @@ impl<'a, C, A> AccountAlertDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5584,7 +5585,7 @@ impl<'a, C, A> AccountAlertDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5594,10 +5595,10 @@ impl<'a, C, A> AccountAlertDeleteCall<'a, C, A> where C: BorrowMut AccountAlertDeleteCall<'a, C, A> where C: BorrowMut AccountAlertDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5630,7 +5631,7 @@ impl<'a, C, A> AccountAlertDeleteCall<'a, C, A> where C: BorrowMut AccountAlertDeleteCall<'a, C, A> { self._alert_id = new_value.to_string(); @@ -5648,12 +5649,12 @@ impl<'a, C, A> AccountAlertDeleteCall<'a, C, A> where C: BorrowMut AccountAlertDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAlertDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAlertDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5744,7 +5745,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.alerts.list", + dlg.begin(MethodInfo { id: "adsense.accounts.alerts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5789,7 +5790,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5825,7 +5826,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5835,10 +5836,10 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5871,7 +5872,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountAlertListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5896,12 +5897,12 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5918,17 +5919,17 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountAlertListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAlertListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5997,7 +5998,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.reports.saved.generate", + dlg.begin(MethodInfo { id: "adsense.accounts.reports.saved.generate", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6049,7 +6050,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6085,7 +6086,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6095,10 +6096,10 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountReportSavedGenerateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6141,7 +6142,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountReportSavedGenerateCall<'a, C, A> { self._saved_report_id = new_value.to_string(); @@ -6180,12 +6181,12 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountReportSavedGenerateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountReportSavedGenerateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6277,7 +6278,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.list", + dlg.begin(MethodInfo { id: "adsense.accounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -6303,7 +6304,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6339,7 +6340,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6349,10 +6350,10 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6407,12 +6408,12 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6429,17 +6430,17 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6501,7 +6502,7 @@ impl<'a, C, A> AccountPaymentListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.payments.list", + dlg.begin(MethodInfo { id: "adsense.accounts.payments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6543,7 +6544,7 @@ impl<'a, C, A> AccountPaymentListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6579,7 +6580,7 @@ impl<'a, C, A> AccountPaymentListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6589,10 +6590,10 @@ impl<'a, C, A> AccountPaymentListCall<'a, C, A> where C: BorrowMut AccountPaymentListCall<'a, C, A> where C: BorrowMut AccountPaymentListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6643,12 +6644,12 @@ impl<'a, C, A> AccountPaymentListCall<'a, C, A> where C: BorrowMut AccountPaymentListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPaymentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPaymentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6738,7 +6739,7 @@ impl<'a, C, A> AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.savedadstyles.get", + dlg.begin(MethodInfo { id: "adsense.accounts.savedadstyles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6781,7 +6782,7 @@ impl<'a, C, A> AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6817,7 +6818,7 @@ impl<'a, C, A> AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6827,10 +6828,10 @@ impl<'a, C, A> AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut AccountSavedadstyleGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6873,7 +6874,7 @@ impl<'a, C, A> AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut AccountSavedadstyleGetCall<'a, C, A> { self._saved_ad_style_id = new_value.to_string(); @@ -6891,12 +6892,12 @@ impl<'a, C, A> AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut AccountSavedadstyleGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountSavedadstyleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountSavedadstyleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6987,7 +6988,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.adunits.get", + dlg.begin(MethodInfo { id: "adsense.accounts.adunits.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -7031,7 +7032,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7067,7 +7068,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7077,10 +7078,10 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7113,7 +7114,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountAdunitGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7123,7 +7124,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> AccountAdunitGetCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -7133,7 +7134,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ad unit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_unit_id(mut self, new_value: &str) -> AccountAdunitGetCall<'a, C, A> { self._ad_unit_id = new_value.to_string(); @@ -7151,12 +7152,12 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7173,17 +7174,17 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountAdunitGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7247,7 +7248,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.customchannels.get", + dlg.begin(MethodInfo { id: "adsense.accounts.customchannels.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -7291,7 +7292,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7327,7 +7328,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7337,10 +7338,10 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7383,7 +7384,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -7393,7 +7394,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> { self._custom_channel_id = new_value.to_string(); @@ -7411,12 +7412,12 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountCustomchannelGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountCustomchannelGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7513,7 +7514,7 @@ impl<'a, C, A> AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.customchannels.adunits.list", + dlg.begin(MethodInfo { id: "adsense.accounts.customchannels.adunits.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -7566,7 +7567,7 @@ impl<'a, C, A> AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7602,7 +7603,7 @@ impl<'a, C, A> AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7612,10 +7613,10 @@ impl<'a, C, A> AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut AccountCustomchannelAdunitListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7658,7 +7659,7 @@ impl<'a, C, A> AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut AccountCustomchannelAdunitListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -7668,7 +7669,7 @@ impl<'a, C, A> AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut AccountCustomchannelAdunitListCall<'a, C, A> { self._custom_channel_id = new_value.to_string(); @@ -7707,12 +7708,12 @@ impl<'a, C, A> AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut AccountCustomchannelAdunitListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountCustomchannelAdunitListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountCustomchannelAdunitListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7805,7 +7806,7 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.reports.saved.list", + dlg.begin(MethodInfo { id: "adsense.accounts.reports.saved.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -7853,7 +7854,7 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7889,7 +7890,7 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7899,10 +7900,10 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut AccountReportSavedListCall<'a, C, A> where C: BorrowMut AccountReportSavedListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7967,12 +7968,12 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut AccountReportSavedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountReportSavedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountReportSavedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8066,7 +8067,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.urlchannels.list", + dlg.begin(MethodInfo { id: "adsense.accounts.urlchannels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8115,7 +8116,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8151,7 +8152,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8161,10 +8162,10 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8207,7 +8208,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -8239,12 +8240,12 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut AccountUrlchannelListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUrlchannelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUrlchannelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8340,7 +8341,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.adunits.list", + dlg.begin(MethodInfo { id: "adsense.accounts.adunits.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8392,7 +8393,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8428,7 +8429,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8438,10 +8439,10 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8474,7 +8475,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountAdunitListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8484,7 +8485,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> AccountAdunitListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -8523,12 +8524,12 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8545,17 +8546,17 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountAdunitListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8642,7 +8643,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.reports.generate", + dlg.begin(MethodInfo { id: "adsense.accounts.reports.generate", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8745,7 +8746,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8781,7 +8782,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8791,10 +8792,10 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8837,7 +8838,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> { self._start_date = new_value.to_string(); @@ -8847,7 +8848,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> { self._end_date = new_value.to_string(); @@ -8932,12 +8933,12 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountReportGenerateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountReportGenerateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9030,7 +9031,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.adclients.list", + dlg.begin(MethodInfo { id: "adsense.accounts.adclients.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9078,7 +9079,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9114,7 +9115,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9124,10 +9125,10 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9192,12 +9193,12 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdclientListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdclientListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9291,7 +9292,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.customchannels.list", + dlg.begin(MethodInfo { id: "adsense.accounts.customchannels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9340,7 +9341,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9376,7 +9377,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9386,10 +9387,10 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9432,7 +9433,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -9464,12 +9465,12 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut AccountCustomchannelListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountCustomchannelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountCustomchannelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9562,7 +9563,7 @@ impl<'a, C, A> AccountSavedadstyleListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.savedadstyles.list", + dlg.begin(MethodInfo { id: "adsense.accounts.savedadstyles.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9610,7 +9611,7 @@ impl<'a, C, A> AccountSavedadstyleListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9646,7 +9647,7 @@ impl<'a, C, A> AccountSavedadstyleListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9656,10 +9657,10 @@ impl<'a, C, A> AccountSavedadstyleListCall<'a, C, A> where C: BorrowMut AccountSavedadstyleListCall<'a, C, A> where C: BorrowMut AccountSavedadstyleListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9724,12 +9725,12 @@ impl<'a, C, A> AccountSavedadstyleListCall<'a, C, A> where C: BorrowMut AccountSavedadstyleListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountSavedadstyleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountSavedadstyleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9820,7 +9821,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.adunits.getAdCode", + dlg.begin(MethodInfo { id: "adsense.accounts.adunits.getAdCode", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9864,7 +9865,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9900,7 +9901,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9910,10 +9911,10 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9956,7 +9957,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -9966,7 +9967,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> { self._ad_unit_id = new_value.to_string(); @@ -9984,12 +9985,12 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdunitGetAdCodeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitGetAdCodeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10084,7 +10085,7 @@ impl<'a, C, A> AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.adunits.customchannels.list", + dlg.begin(MethodInfo { id: "adsense.accounts.adunits.customchannels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -10134,7 +10135,7 @@ impl<'a, C, A> AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10170,7 +10171,7 @@ impl<'a, C, A> AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10180,10 +10181,10 @@ impl<'a, C, A> AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AccountAdunitCustomchannelListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10226,7 +10227,7 @@ impl<'a, C, A> AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AccountAdunitCustomchannelListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -10236,7 +10237,7 @@ impl<'a, C, A> AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AccountAdunitCustomchannelListCall<'a, C, A> { self._ad_unit_id = new_value.to_string(); @@ -10268,12 +10269,12 @@ impl<'a, C, A> AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut AccountAdunitCustomchannelListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdunitCustomchannelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitCustomchannelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10364,7 +10365,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.accounts.get", + dlg.begin(MethodInfo { id: "adsense.accounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -10409,7 +10410,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10445,7 +10446,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10455,10 +10456,10 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10491,7 +10492,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10516,12 +10517,12 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10538,17 +10539,17 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10609,7 +10610,7 @@ impl<'a, C, A> PaymentListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.payments.list", + dlg.begin(MethodInfo { id: "adsense.payments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -10629,7 +10630,7 @@ impl<'a, C, A> PaymentListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10665,7 +10666,7 @@ impl<'a, C, A> PaymentListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10675,10 +10676,10 @@ impl<'a, C, A> PaymentListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10719,12 +10720,12 @@ impl<'a, C, A> PaymentListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10741,17 +10742,17 @@ impl<'a, C, A> PaymentListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PaymentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PaymentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10812,7 +10813,7 @@ impl<'a, C, A> MetadataDimensionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.metadata.dimensions.list", + dlg.begin(MethodInfo { id: "adsense.metadata.dimensions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -10832,7 +10833,7 @@ impl<'a, C, A> MetadataDimensionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10868,7 +10869,7 @@ impl<'a, C, A> MetadataDimensionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10878,10 +10879,10 @@ impl<'a, C, A> MetadataDimensionListCall<'a, C, A> where C: BorrowMut MetadataDimensionListCall<'a, C, A> where C: BorrowMut MetadataDimensionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MetadataDimensionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MetadataDimensionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11015,7 +11016,7 @@ impl<'a, C, A> MetadataMetricListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.metadata.metrics.list", + dlg.begin(MethodInfo { id: "adsense.metadata.metrics.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -11035,7 +11036,7 @@ impl<'a, C, A> MetadataMetricListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11071,7 +11072,7 @@ impl<'a, C, A> MetadataMetricListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11081,10 +11082,10 @@ impl<'a, C, A> MetadataMetricListCall<'a, C, A> where C: BorrowMut MetadataMetricListCall<'a, C, A> where C: BorrowMut MetadataMetricListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MetadataMetricListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MetadataMetricListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11220,7 +11221,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.customchannels.get", + dlg.begin(MethodInfo { id: "adsense.customchannels.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -11263,7 +11264,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11299,7 +11300,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11309,10 +11310,10 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11345,7 +11346,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> CustomchannelGetCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -11355,7 +11356,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *custom channel id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn custom_channel_id(mut self, new_value: &str) -> CustomchannelGetCall<'a, C, A> { self._custom_channel_id = new_value.to_string(); @@ -11373,12 +11374,12 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11395,17 +11396,17 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CustomchannelGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomchannelGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11471,7 +11472,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.customchannels.list", + dlg.begin(MethodInfo { id: "adsense.customchannels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -11519,7 +11520,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11555,7 +11556,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11565,10 +11566,10 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11601,7 +11602,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> CustomchannelListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -11633,12 +11634,12 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11655,17 +11656,17 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CustomchannelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomchannelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11734,7 +11735,7 @@ impl<'a, C, A> CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsense.customchannels.adunits.list", + dlg.begin(MethodInfo { id: "adsense.customchannels.adunits.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -11786,7 +11787,7 @@ impl<'a, C, A> CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11822,7 +11823,7 @@ impl<'a, C, A> CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11832,10 +11833,10 @@ impl<'a, C, A> CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut CustomchannelAdunitListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -11878,7 +11879,7 @@ impl<'a, C, A> CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut CustomchannelAdunitListCall<'a, C, A> { self._custom_channel_id = new_value.to_string(); @@ -11917,12 +11918,12 @@ impl<'a, C, A> CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut CustomchannelAdunitListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CustomchannelAdunitListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomchannelAdunitListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/adsensehost4d1-cli/Cargo.toml b/gen/adsensehost4d1-cli/Cargo.toml index 07a714c76d..7c3a7de83e 100644 --- a/gen/adsensehost4d1-cli/Cargo.toml +++ b/gen/adsensehost4d1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adsensehost4d1-cli" -version = "0.3.2+20151013" +version = "0.3.3+20160127" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdSense Host (protocol v4.1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsensehost4d1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/adsensehost4d1-cli/LICENSE.md b/gen/adsensehost4d1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/adsensehost4d1-cli/LICENSE.md +++ b/gen/adsensehost4d1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/adsensehost4d1-cli/README.md b/gen/adsensehost4d1-cli/README.md index 0e0f60b2fb..03f7ee3c70 100644 --- a/gen/adsensehost4d1-cli/README.md +++ b/gen/adsensehost4d1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *AdSense Host* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/adsensehost4d1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/adsensehost4d1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/adsensehost4d1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/adsensehost4d1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/adsensehost4d1-cli). # Usage -This documentation was generated from the *AdSense Host* API at revision *20151013*. The CLI is at version *0.3.2*. +This documentation was generated from the *AdSense Host* API at revision *20160127*. The CLI is at version *0.3.3*. ```bash adsensehost4d1 [options] @@ -64,18 +64,18 @@ adsensehost4d1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/adsensehost4d1-cli/mkdocs.yml b/gen/adsensehost4d1-cli/mkdocs.yml index b15ee327f7..45feff907e 100644 --- a/gen/adsensehost4d1-cli/mkdocs.yml +++ b/gen/adsensehost4d1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AdSense Host v0.3.2+20151013 +site_name: AdSense Host v0.3.3+20160127 site_url: http://byron.github.io/google-apis-rs/google-adsensehost4d1-cli site_description: Write integrating applications with bcore @@ -38,5 +38,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/adsensehost4d1-cli/src/main.rs b/gen/adsensehost4d1-cli/src/main.rs index 189f96f79c..0764fe5e45 100644 --- a/gen/adsensehost4d1-cli/src/main.rs +++ b/gen/adsensehost4d1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::AdSenseHost>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _accounts_adclients_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _accounts_adclients_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adclients_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adclients_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adclients_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adclients_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -119,7 +119,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -133,7 +133,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -156,10 +156,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adunits_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("ad-unit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -172,7 +172,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -185,7 +185,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -208,10 +208,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adunits_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("ad-unit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -224,7 +224,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -237,7 +237,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -260,10 +260,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_get_ad_code(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_get_ad_code(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adunits_get_ad_code(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("ad-unit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "host-custom-channel-id" => { @@ -279,7 +279,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["host-custom-channel-id"].iter().map(|v|*v)); @@ -293,7 +293,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -316,13 +316,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -336,8 +336,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -374,7 +374,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AdUnit = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().adunits_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -387,7 +387,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -400,7 +400,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -423,10 +423,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().adunits_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -448,7 +448,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-inactive", "page-token", "max-results"].iter().map(|v|*v)); @@ -462,7 +462,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -485,13 +485,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -505,8 +505,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -543,7 +543,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AdUnit = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().adunits_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("ad-unit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -556,7 +556,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -569,7 +569,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -592,13 +592,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_adunits_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_adunits_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -612,8 +612,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -650,7 +650,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AdUnit = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().adunits_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -663,7 +663,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -676,7 +676,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -699,10 +699,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().get(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -715,7 +715,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -728,7 +728,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -751,10 +751,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.accounts().list(&opt.values_of("filter-ad-client-id").unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.accounts().list(&opt.values_of("filter-ad-client-id").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -767,7 +767,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -780,7 +780,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -803,10 +803,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_reports_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_reports_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().reports_generate(opt.value_of("account-id").unwrap_or(""), opt.value_of("start-date").unwrap_or(""), opt.value_of("end-date").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -840,7 +840,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort", "locale", "metric", "max-results", "filter", "start-index", "dimension"].iter().map(|v|*v)); @@ -854,7 +854,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -877,10 +877,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _adclients_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _adclients_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.adclients().get(opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -893,7 +893,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -906,7 +906,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -929,10 +929,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _adclients_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _adclients_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.adclients().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -951,7 +951,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -965,7 +965,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -988,10 +988,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _associationsessions_start(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _associationsessions_start(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.associationsessions().start(&opt.values_of("product-code").unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>(), opt.value_of("website-url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.associationsessions().start(&opt.values_of("product-code").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>(), opt.value_of("website-url").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "website-locale" => { @@ -1010,7 +1010,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["website-locale", "user-locale"].iter().map(|v|*v)); @@ -1024,7 +1024,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1047,10 +1047,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _associationsessions_verify(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _associationsessions_verify(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.associationsessions().verify(opt.value_of("token").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1063,7 +1063,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1076,7 +1076,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1099,10 +1099,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customchannels_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customchannels_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.customchannels().delete(opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("custom-channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1115,7 +1115,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1128,7 +1128,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1151,10 +1151,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customchannels_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customchannels_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.customchannels().get(opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("custom-channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1167,7 +1167,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1180,7 +1180,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1203,13 +1203,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customchannels_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customchannels_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1223,8 +1223,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "code" => Some(("code", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1242,7 +1242,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CustomChannel = json::value::from_value(object).unwrap(); let mut call = self.hub.customchannels().insert(request, opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1255,7 +1255,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1268,7 +1268,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1291,10 +1291,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.customchannels().list(opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1313,7 +1313,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1327,7 +1327,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1350,13 +1350,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customchannels_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customchannels_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1370,8 +1370,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "code" => Some(("code", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1389,7 +1389,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CustomChannel = json::value::from_value(object).unwrap(); let mut call = self.hub.customchannels().patch(request, opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("custom-channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1402,7 +1402,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1415,7 +1415,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1438,13 +1438,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customchannels_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customchannels_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1458,8 +1458,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "code" => Some(("code", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1477,7 +1477,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CustomChannel = json::value::from_value(object).unwrap(); let mut call = self.hub.customchannels().update(request, opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1490,7 +1490,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1503,7 +1503,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1526,10 +1526,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().generate(opt.value_of("start-date").unwrap_or(""), opt.value_of("end-date").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -1563,7 +1563,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort", "locale", "metric", "max-results", "filter", "start-index", "dimension"].iter().map(|v|*v)); @@ -1577,7 +1577,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1600,10 +1600,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _urlchannels_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _urlchannels_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.urlchannels().delete(opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("url-channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1616,7 +1616,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1629,7 +1629,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1652,13 +1652,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _urlchannels_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _urlchannels_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1672,8 +1672,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1690,7 +1690,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UrlChannel = json::value::from_value(object).unwrap(); let mut call = self.hub.urlchannels().insert(request, opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1703,7 +1703,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1716,7 +1716,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1739,10 +1739,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _urlchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _urlchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.urlchannels().list(opt.value_of("ad-client-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1761,7 +1761,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1775,7 +1775,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1946,14 +1946,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "adsensehost4d1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "adsensehost4d1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1973,7 +1973,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -2012,7 +2012,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("accounts", "methods: 'adclients-get', 'adclients-list', 'adunits-delete', 'adunits-get', 'adunits-get-ad-code', 'adunits-insert', 'adunits-list', 'adunits-patch', 'adunits-update', 'get', 'list' and 'reports-generate'", vec![ - ("adclients-get", + ("adclients-get", Some(r##"Get information about one of the ad clients in the specified publisher's AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_adclients-get", vec![ @@ -2040,7 +2040,7 @@ fn main() { Some(false), Some(false)), ]), - ("adclients-list", + ("adclients-list", Some(r##"List all hosted ad clients in the specified hosted account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_adclients-list", vec![ @@ -2062,7 +2062,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-delete", + ("adunits-delete", Some(r##"Delete the specified ad unit from the specified publisher AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_adunits-delete", vec![ @@ -2096,7 +2096,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-get", + ("adunits-get", Some(r##"Get the specified host ad unit in this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_adunits-get", vec![ @@ -2130,7 +2130,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-get-ad-code", + ("adunits-get-ad-code", Some(r##"Get ad code for the specified ad unit, attaching the specified host custom channels."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_adunits-get-ad-code", vec![ @@ -2164,7 +2164,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-insert", + ("adunits-insert", Some(r##"Insert the supplied ad unit into the specified publisher AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_adunits-insert", vec![ @@ -2198,7 +2198,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-list", + ("adunits-list", Some(r##"List all ad units in the specified publisher's AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_adunits-list", vec![ @@ -2226,7 +2226,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-patch", + ("adunits-patch", Some(r##"Update the supplied ad unit in the specified publisher AdSense account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_adunits-patch", vec![ @@ -2266,7 +2266,7 @@ fn main() { Some(false), Some(false)), ]), - ("adunits-update", + ("adunits-update", Some(r##"Update the supplied ad unit in the specified publisher AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_adunits-update", vec![ @@ -2300,7 +2300,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Get information about the selected associated AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_get", vec![ @@ -2322,7 +2322,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List hosted accounts associated with this AdSense account by ad client id."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_list", vec![ @@ -2344,7 +2344,7 @@ fn main() { Some(false), Some(false)), ]), - ("reports-generate", + ("reports-generate", Some(r##"Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/accounts_reports-generate", vec![ @@ -2381,7 +2381,7 @@ fn main() { ]), ("adclients", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Get information about one of the ad clients in the Host AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/adclients_get", vec![ @@ -2403,7 +2403,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all host ad clients in this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/adclients_list", vec![ @@ -2422,7 +2422,7 @@ fn main() { ]), ("associationsessions", "methods: 'start' and 'verify'", vec![ - ("start", + ("start", Some(r##"Create an association session for initiating an association with an AdSense user."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/associationsessions_start", vec![ @@ -2450,7 +2450,7 @@ fn main() { Some(false), Some(false)), ]), - ("verify", + ("verify", Some(r##"Verify an association session after the association callback returns from AdSense signup."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/associationsessions_verify", vec![ @@ -2475,7 +2475,7 @@ fn main() { ]), ("customchannels", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Delete a specific custom channel from the host AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/customchannels_delete", vec![ @@ -2503,7 +2503,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Get a specific custom channel from the host AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/customchannels_get", vec![ @@ -2531,7 +2531,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Add a new custom channel to the host AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/customchannels_insert", vec![ @@ -2559,7 +2559,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all host custom channels in this AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/customchannels_list", vec![ @@ -2581,7 +2581,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update a custom channel in the host AdSense account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/customchannels_patch", vec![ @@ -2615,7 +2615,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update a custom channel in the host AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/customchannels_update", vec![ @@ -2646,7 +2646,7 @@ fn main() { ]), ("reports", "methods: 'generate'", vec![ - ("generate", + ("generate", Some(r##"Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/reports_generate", vec![ @@ -2677,7 +2677,7 @@ fn main() { ]), ("urlchannels", "methods: 'delete', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Delete a URL channel from the host AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/urlchannels_delete", vec![ @@ -2705,7 +2705,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Add a new URL channel to the host AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/urlchannels_insert", vec![ @@ -2733,7 +2733,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all host URL channels in the host AdSense account."##), "Details at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli/urlchannels_list", vec![ @@ -2761,7 +2761,7 @@ fn main() { let mut app = App::new("adsensehost4d1") .author("Sebastian Thiel ") - .version("0.3.2+20151013") + .version("0.3.3+20160127") .about("Gives AdSense Hosts access to report generation, ad code generation, and publisher management capabilities.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli") .arg(Arg::with_name("url") @@ -2785,7 +2785,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -2796,7 +2796,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/adsensehost4d1/Cargo.toml b/gen/adsensehost4d1/Cargo.toml index 63dd37295c..b25a3fc615 100644 --- a/gen/adsensehost4d1/Cargo.toml +++ b/gen/adsensehost4d1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adsensehost4d1" -version = "0.1.10+20151013" +version = "0.1.11+20160127" authors = ["Sebastian Thiel "] description = "A complete library to interact with AdSense Host (protocol v4.1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adsensehost4d1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/adsensehost4d1/LICENSE.md b/gen/adsensehost4d1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/adsensehost4d1/LICENSE.md +++ b/gen/adsensehost4d1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/adsensehost4d1/README.md b/gen/adsensehost4d1/README.md index e4304fd412..2780da7a1a 100644 --- a/gen/adsensehost4d1/README.md +++ b/gen/adsensehost4d1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-adsensehost4d1` library allows access to all features of the *Google AdSense Host* service. -This documentation was generated from *AdSense Host* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *AdSense Host* crate version *0.1.11+20160127*, where *20160127* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *AdSense Host* *v4d1* API can be found at the [official documentation site](https://developers.google.com/adsense/host/). diff --git a/gen/adsensehost4d1/src/cmn.rs b/gen/adsensehost4d1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/adsensehost4d1/src/cmn.rs +++ b/gen/adsensehost4d1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/adsensehost4d1/src/lib.rs b/gen/adsensehost4d1/src/lib.rs index 99087b526f..1c47452188 100644 --- a/gen/adsensehost4d1/src/lib.rs +++ b/gen/adsensehost4d1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *AdSense Host* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *AdSense Host* crate version *0.1.11+20160127*, where *20160127* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *AdSense Host* *v4d1* API can be found at the //! [official documentation site](https://developers.google.com/adsense/host/). diff --git a/gen/adsensehost4d1/src/lib.rs.in b/gen/adsensehost4d1/src/lib.rs.in index 5c3f875a22..97fef74bd4 100644 --- a/gen/adsensehost4d1/src/lib.rs.in +++ b/gen/adsensehost4d1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -133,7 +134,7 @@ impl<'a, C, A> AdSenseHost AdSenseHost { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -157,7 +158,7 @@ impl<'a, C, A> AdSenseHost } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -343,7 +344,7 @@ impl NestedType for AdStyleColors {} impl Part for AdStyleColors {} -/// Settings specific to WAP mobile content ads (AFMC). +/// Settings specific to WAP mobile content ads (AFMC - deprecated). /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -415,12 +416,12 @@ pub struct AdUnit { pub code: Option, /// Name of this ad unit. pub name: Option, - /// Settings specific to content ads (AFC) and highend mobile content ads (AFMC). + /// Settings specific to content ads (AFC) and highend mobile content ads (AFMC - deprecated). #[serde(rename="contentAdsSettings")] pub content_ads_settings: Option, /// Unique identifier of this ad unit. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format. pub id: Option, - /// Settings specific to WAP mobile content ads (AFMC). + /// Settings specific to WAP mobile content ads (AFMC - deprecated). #[serde(rename="mobileContentAdsSettings")] pub mobile_content_ads_settings: Option, /// Custom style information specific to this ad unit. @@ -522,7 +523,7 @@ impl Part for AdUnitContentAdsSettingsBackupOption {} pub struct AssociationSession { /// Status of the completed association, available once the association callback token has been verified. One of ACCEPTED, REJECTED, or ERROR. pub status: Option, - /// The products to associate with the user. Options: AFC, AFF, AFS, AFMC + /// The products to associate with the user. Options: AFC, AFG, AFV, AFS (deprecated), AFMC (deprecated) #[serde(rename="productCodes")] pub product_codes: Option>, /// Kind of resource this is, in this case adsensehost#associationSession. @@ -572,7 +573,7 @@ pub struct Accounts { impl ResponseResult for Accounts {} -/// Settings specific to content ads (AFC) and highend mobile content ads (AFMC). +/// Settings specific to content ads (AFC) and highend mobile content ads (AFMC - deprecated). /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -1533,7 +1534,7 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.urlchannels.insert", + dlg.begin(MethodInfo { id: "adsensehost.urlchannels.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -1575,14 +1576,14 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1626,7 +1627,7 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1636,10 +1637,10 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1671,7 +1672,7 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UrlChannel) -> UrlchannelInsertCall<'a, C, A> { self._request = new_value; @@ -1681,7 +1682,7 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> UrlchannelInsertCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -1699,12 +1700,12 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1721,17 +1722,17 @@ impl<'a, C, A> UrlchannelInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlchannelInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlchannelInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1794,7 +1795,7 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.urlchannels.delete", + dlg.begin(MethodInfo { id: "adsensehost.urlchannels.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -1837,7 +1838,7 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1873,7 +1874,7 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1883,10 +1884,10 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1919,7 +1920,7 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> UrlchannelDeleteCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -1929,7 +1930,7 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *url channel id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn url_channel_id(mut self, new_value: &str) -> UrlchannelDeleteCall<'a, C, A> { self._url_channel_id = new_value.to_string(); @@ -1947,12 +1948,12 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1969,17 +1970,17 @@ impl<'a, C, A> UrlchannelDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlchannelDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlchannelDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2045,7 +2046,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.urlchannels.list", + dlg.begin(MethodInfo { id: "adsensehost.urlchannels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -2093,7 +2094,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2129,7 +2130,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2139,10 +2140,10 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2175,7 +2176,7 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> UrlchannelListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -2207,12 +2208,12 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2229,17 +2230,17 @@ impl<'a, C, A> UrlchannelListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlchannelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlchannelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2304,7 +2305,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.adclients.list", + dlg.begin(MethodInfo { id: "adsensehost.adclients.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -2330,7 +2331,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2366,7 +2367,7 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2376,10 +2377,10 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2434,12 +2435,12 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2456,17 +2457,17 @@ impl<'a, C, A> AdclientListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdclientListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdclientListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2528,7 +2529,7 @@ impl<'a, C, A> AdclientGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.adclients.get", + dlg.begin(MethodInfo { id: "adsensehost.adclients.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -2570,7 +2571,7 @@ impl<'a, C, A> AdclientGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2606,7 +2607,7 @@ impl<'a, C, A> AdclientGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2616,10 +2617,10 @@ impl<'a, C, A> AdclientGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2652,7 +2653,7 @@ impl<'a, C, A> AdclientGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> AdclientGetCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -2670,12 +2671,12 @@ impl<'a, C, A> AdclientGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2692,17 +2693,17 @@ impl<'a, C, A> AdclientGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdclientGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdclientGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2769,7 +2770,7 @@ impl<'a, C, A> AssociationsessionStartCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.associationsessions.start", + dlg.begin(MethodInfo { id: "adsensehost.associationsessions.start", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._product_code.len() > 0 { @@ -2803,7 +2804,7 @@ impl<'a, C, A> AssociationsessionStartCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2839,7 +2840,7 @@ impl<'a, C, A> AssociationsessionStartCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2849,10 +2850,10 @@ impl<'a, C, A> AssociationsessionStartCall<'a, C, A> where C: BorrowMut AssociationsessionStartCall<'a, C, A> where C: BorrowMut AssociationsessionStartCall<'a, C, A> { self._product_code.push(new_value.to_string()); @@ -2896,7 +2897,7 @@ impl<'a, C, A> AssociationsessionStartCall<'a, C, A> where C: BorrowMut AssociationsessionStartCall<'a, C, A> { self._website_url = new_value.to_string(); @@ -2928,12 +2929,12 @@ impl<'a, C, A> AssociationsessionStartCall<'a, C, A> where C: BorrowMut AssociationsessionStartCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AssociationsessionStartCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AssociationsessionStartCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3022,7 +3023,7 @@ impl<'a, C, A> AssociationsessionVerifyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.associationsessions.verify", + dlg.begin(MethodInfo { id: "adsensehost.associationsessions.verify", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("token", self._token.to_string())); @@ -3043,7 +3044,7 @@ impl<'a, C, A> AssociationsessionVerifyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3079,7 +3080,7 @@ impl<'a, C, A> AssociationsessionVerifyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3089,10 +3090,10 @@ impl<'a, C, A> AssociationsessionVerifyCall<'a, C, A> where C: BorrowMut AssociationsessionVerifyCall<'a, C, A> where C: BorrowMut AssociationsessionVerifyCall<'a, C, A> { self._token = new_value.to_string(); @@ -3143,12 +3144,12 @@ impl<'a, C, A> AssociationsessionVerifyCall<'a, C, A> where C: BorrowMut AssociationsessionVerifyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AssociationsessionVerifyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AssociationsessionVerifyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3252,7 +3253,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.reports.generate", + dlg.begin(MethodInfo { id: "adsensehost.reports.generate", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("startDate", self._start_date.to_string())); @@ -3311,7 +3312,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3347,7 +3348,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3357,10 +3358,10 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3393,7 +3394,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *start date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn start_date(mut self, new_value: &str) -> ReportGenerateCall<'a, C, A> { self._start_date = new_value.to_string(); @@ -3403,7 +3404,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *end date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn end_date(mut self, new_value: &str) -> ReportGenerateCall<'a, C, A> { self._end_date = new_value.to_string(); @@ -3474,12 +3475,12 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3496,17 +3497,17 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportGenerateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportGenerateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3575,7 +3576,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.list", + dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -3627,7 +3628,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3663,7 +3664,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3673,10 +3674,10 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3709,7 +3710,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountAdunitListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -3719,7 +3720,7 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> AccountAdunitListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -3758,12 +3759,12 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3780,17 +3781,17 @@ impl<'a, C, A> AccountAdunitListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountAdunitListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3852,7 +3853,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.list", + dlg.begin(MethodInfo { id: "adsensehost.accounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if self._filter_ad_client_id.len() > 0 { @@ -3879,7 +3880,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3915,7 +3916,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3925,10 +3926,10 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3962,7 +3963,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// Append the given value to the *filter ad client id* query property. /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn add_filter_ad_client_id(mut self, new_value: &str) -> AccountListCall<'a, C, A> { self._filter_ad_client_id.push(new_value.to_string()); @@ -3980,12 +3981,12 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4002,17 +4003,17 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4078,7 +4079,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.getAdCode", + dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.getAdCode", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -4129,7 +4130,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4165,7 +4166,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4175,10 +4176,10 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -4221,7 +4222,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -4231,7 +4232,7 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> { self._ad_unit_id = new_value.to_string(); @@ -4257,12 +4258,12 @@ impl<'a, C, A> AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut AccountAdunitGetAdCodeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdunitGetAdCodeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitGetAdCodeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4367,7 +4368,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.reports.generate", + dlg.begin(MethodInfo { id: "adsensehost.accounts.reports.generate", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -4448,7 +4449,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4484,7 +4485,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4494,10 +4495,10 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -4540,7 +4541,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> { self._start_date = new_value.to_string(); @@ -4550,7 +4551,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> { self._end_date = new_value.to_string(); @@ -4621,12 +4622,12 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut AccountReportGenerateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountReportGenerateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountReportGenerateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4717,7 +4718,7 @@ impl<'a, C, A> AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.delete", + dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -4761,7 +4762,7 @@ impl<'a, C, A> AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4797,7 +4798,7 @@ impl<'a, C, A> AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4807,10 +4808,10 @@ impl<'a, C, A> AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut AccountAdunitDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -4853,7 +4854,7 @@ impl<'a, C, A> AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut AccountAdunitDeleteCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -4863,7 +4864,7 @@ impl<'a, C, A> AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut AccountAdunitDeleteCall<'a, C, A> { self._ad_unit_id = new_value.to_string(); @@ -4881,12 +4882,12 @@ impl<'a, C, A> AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut AccountAdunitDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdunitDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4979,7 +4980,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.adclients.list", + dlg.begin(MethodInfo { id: "adsensehost.accounts.adclients.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5027,7 +5028,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5063,7 +5064,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5073,10 +5074,10 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5141,12 +5142,12 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut AccountAdclientListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdclientListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdclientListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5244,7 +5245,7 @@ impl<'a, C, A> AccountAdunitPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.patch", + dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5288,14 +5289,14 @@ impl<'a, C, A> AccountAdunitPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5339,7 +5340,7 @@ impl<'a, C, A> AccountAdunitPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5349,10 +5350,10 @@ impl<'a, C, A> AccountAdunitPatchCall<'a, C, A> where C: BorrowMut AccountAdunitPatchCall<'a, C, A> where C: BorrowMut AccountAdunitPatchCall<'a, C, A> { self._request = new_value; @@ -5394,7 +5395,7 @@ impl<'a, C, A> AccountAdunitPatchCall<'a, C, A> where C: BorrowMut AccountAdunitPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5404,7 +5405,7 @@ impl<'a, C, A> AccountAdunitPatchCall<'a, C, A> where C: BorrowMut AccountAdunitPatchCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -5414,7 +5415,7 @@ impl<'a, C, A> AccountAdunitPatchCall<'a, C, A> where C: BorrowMut AccountAdunitPatchCall<'a, C, A> { self._ad_unit_id = new_value.to_string(); @@ -5432,12 +5433,12 @@ impl<'a, C, A> AccountAdunitPatchCall<'a, C, A> where C: BorrowMut AccountAdunitPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdunitPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5527,7 +5528,7 @@ impl<'a, C, A> AccountAdclientGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.adclients.get", + dlg.begin(MethodInfo { id: "adsensehost.accounts.adclients.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5570,7 +5571,7 @@ impl<'a, C, A> AccountAdclientGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5606,7 +5607,7 @@ impl<'a, C, A> AccountAdclientGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5616,10 +5617,10 @@ impl<'a, C, A> AccountAdclientGetCall<'a, C, A> where C: BorrowMut AccountAdclientGetCall<'a, C, A> where C: BorrowMut AccountAdclientGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5662,7 +5663,7 @@ impl<'a, C, A> AccountAdclientGetCall<'a, C, A> where C: BorrowMut AccountAdclientGetCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -5680,12 +5681,12 @@ impl<'a, C, A> AccountAdclientGetCall<'a, C, A> where C: BorrowMut AccountAdclientGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdclientGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdclientGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5774,7 +5775,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.get", + dlg.begin(MethodInfo { id: "adsensehost.accounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5816,7 +5817,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5852,7 +5853,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5862,10 +5863,10 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5898,7 +5899,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5916,12 +5917,12 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5938,17 +5939,17 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6018,7 +6019,7 @@ impl<'a, C, A> AccountAdunitInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.insert", + dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6061,14 +6062,14 @@ impl<'a, C, A> AccountAdunitInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6112,7 +6113,7 @@ impl<'a, C, A> AccountAdunitInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6122,10 +6123,10 @@ impl<'a, C, A> AccountAdunitInsertCall<'a, C, A> where C: BorrowMut AccountAdunitInsertCall<'a, C, A> where C: BorrowMut AccountAdunitInsertCall<'a, C, A> { self._request = new_value; @@ -6167,7 +6168,7 @@ impl<'a, C, A> AccountAdunitInsertCall<'a, C, A> where C: BorrowMut AccountAdunitInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6177,7 +6178,7 @@ impl<'a, C, A> AccountAdunitInsertCall<'a, C, A> where C: BorrowMut AccountAdunitInsertCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -6195,12 +6196,12 @@ impl<'a, C, A> AccountAdunitInsertCall<'a, C, A> where C: BorrowMut AccountAdunitInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdunitInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6291,7 +6292,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.get", + dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6335,7 +6336,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6371,7 +6372,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6381,10 +6382,10 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6417,7 +6418,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountAdunitGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6427,7 +6428,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> AccountAdunitGetCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -6437,7 +6438,7 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ad unit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_unit_id(mut self, new_value: &str) -> AccountAdunitGetCall<'a, C, A> { self._ad_unit_id = new_value.to_string(); @@ -6455,12 +6456,12 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6477,17 +6478,17 @@ impl<'a, C, A> AccountAdunitGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountAdunitGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6557,7 +6558,7 @@ impl<'a, C, A> AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.update", + dlg.begin(MethodInfo { id: "adsensehost.accounts.adunits.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6600,14 +6601,14 @@ impl<'a, C, A> AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6651,7 +6652,7 @@ impl<'a, C, A> AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6661,10 +6662,10 @@ impl<'a, C, A> AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut AccountAdunitUpdateCall<'a, C, A> { self._request = new_value; @@ -6706,7 +6707,7 @@ impl<'a, C, A> AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut AccountAdunitUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6716,7 +6717,7 @@ impl<'a, C, A> AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut AccountAdunitUpdateCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -6734,12 +6735,12 @@ impl<'a, C, A> AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut AccountAdunitUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountAdunitUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAdunitUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6829,7 +6830,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.customchannels.get", + dlg.begin(MethodInfo { id: "adsensehost.customchannels.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -6872,7 +6873,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6908,7 +6909,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6918,10 +6919,10 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6954,7 +6955,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> CustomchannelGetCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -6964,7 +6965,7 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *custom channel id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn custom_channel_id(mut self, new_value: &str) -> CustomchannelGetCall<'a, C, A> { self._custom_channel_id = new_value.to_string(); @@ -6982,12 +6983,12 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7004,17 +7005,17 @@ impl<'a, C, A> CustomchannelGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CustomchannelGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomchannelGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7077,7 +7078,7 @@ impl<'a, C, A> CustomchannelDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.customchannels.delete", + dlg.begin(MethodInfo { id: "adsensehost.customchannels.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -7120,7 +7121,7 @@ impl<'a, C, A> CustomchannelDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7156,7 +7157,7 @@ impl<'a, C, A> CustomchannelDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7166,10 +7167,10 @@ impl<'a, C, A> CustomchannelDeleteCall<'a, C, A> where C: BorrowMut CustomchannelDeleteCall<'a, C, A> where C: BorrowMut CustomchannelDeleteCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -7212,7 +7213,7 @@ impl<'a, C, A> CustomchannelDeleteCall<'a, C, A> where C: BorrowMut CustomchannelDeleteCall<'a, C, A> { self._custom_channel_id = new_value.to_string(); @@ -7230,12 +7231,12 @@ impl<'a, C, A> CustomchannelDeleteCall<'a, C, A> where C: BorrowMut CustomchannelDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CustomchannelDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomchannelDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7331,7 +7332,7 @@ impl<'a, C, A> CustomchannelUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.customchannels.update", + dlg.begin(MethodInfo { id: "adsensehost.customchannels.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -7373,14 +7374,14 @@ impl<'a, C, A> CustomchannelUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7424,7 +7425,7 @@ impl<'a, C, A> CustomchannelUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7434,10 +7435,10 @@ impl<'a, C, A> CustomchannelUpdateCall<'a, C, A> where C: BorrowMut CustomchannelUpdateCall<'a, C, A> where C: BorrowMut CustomchannelUpdateCall<'a, C, A> { self._request = new_value; @@ -7479,7 +7480,7 @@ impl<'a, C, A> CustomchannelUpdateCall<'a, C, A> where C: BorrowMut CustomchannelUpdateCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -7497,12 +7498,12 @@ impl<'a, C, A> CustomchannelUpdateCall<'a, C, A> where C: BorrowMut CustomchannelUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CustomchannelUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomchannelUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7595,7 +7596,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.customchannels.list", + dlg.begin(MethodInfo { id: "adsensehost.customchannels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -7643,7 +7644,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7679,7 +7680,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7689,10 +7690,10 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7725,7 +7726,7 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut /// /// Sets the *ad client id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ad_client_id(mut self, new_value: &str) -> CustomchannelListCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -7757,12 +7758,12 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7779,17 +7780,17 @@ impl<'a, C, A> CustomchannelListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CustomchannelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomchannelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7859,7 +7860,7 @@ impl<'a, C, A> CustomchannelPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.customchannels.patch", + dlg.begin(MethodInfo { id: "adsensehost.customchannels.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -7902,14 +7903,14 @@ impl<'a, C, A> CustomchannelPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7953,7 +7954,7 @@ impl<'a, C, A> CustomchannelPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7963,10 +7964,10 @@ impl<'a, C, A> CustomchannelPatchCall<'a, C, A> where C: BorrowMut CustomchannelPatchCall<'a, C, A> where C: BorrowMut CustomchannelPatchCall<'a, C, A> { self._request = new_value; @@ -8008,7 +8009,7 @@ impl<'a, C, A> CustomchannelPatchCall<'a, C, A> where C: BorrowMut CustomchannelPatchCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -8018,7 +8019,7 @@ impl<'a, C, A> CustomchannelPatchCall<'a, C, A> where C: BorrowMut CustomchannelPatchCall<'a, C, A> { self._custom_channel_id = new_value.to_string(); @@ -8036,12 +8037,12 @@ impl<'a, C, A> CustomchannelPatchCall<'a, C, A> where C: BorrowMut CustomchannelPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CustomchannelPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomchannelPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8137,7 +8138,7 @@ impl<'a, C, A> CustomchannelInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "adsensehost.customchannels.insert", + dlg.begin(MethodInfo { id: "adsensehost.customchannels.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("adClientId", self._ad_client_id.to_string())); @@ -8179,14 +8180,14 @@ impl<'a, C, A> CustomchannelInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8230,7 +8231,7 @@ impl<'a, C, A> CustomchannelInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8240,10 +8241,10 @@ impl<'a, C, A> CustomchannelInsertCall<'a, C, A> where C: BorrowMut CustomchannelInsertCall<'a, C, A> where C: BorrowMut CustomchannelInsertCall<'a, C, A> { self._request = new_value; @@ -8285,7 +8286,7 @@ impl<'a, C, A> CustomchannelInsertCall<'a, C, A> where C: BorrowMut CustomchannelInsertCall<'a, C, A> { self._ad_client_id = new_value.to_string(); @@ -8303,12 +8304,12 @@ impl<'a, C, A> CustomchannelInsertCall<'a, C, A> where C: BorrowMut CustomchannelInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CustomchannelInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomchannelInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/analytics3-cli/Cargo.toml b/gen/analytics3-cli/Cargo.toml index 01804f78bd..32bffd1050 100644 --- a/gen/analytics3-cli/Cargo.toml +++ b/gen/analytics3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-analytics3-cli" -version = "0.3.2+20150901" +version = "0.3.3+20151215" authors = ["Sebastian Thiel "] description = "A complete library to interact with analytics (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/analytics3-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/analytics3-cli/LICENSE.md b/gen/analytics3-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/analytics3-cli/LICENSE.md +++ b/gen/analytics3-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/analytics3-cli/README.md b/gen/analytics3-cli/README.md index 64297fa1c1..d5e248cf4d 100644 --- a/gen/analytics3-cli/README.md +++ b/gen/analytics3-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *analytics* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/analytics3.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/analytics3.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/analytics3.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/analytics3.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/analytics3-cli). # Usage -This documentation was generated from the *analytics* API at revision *20150901*. The CLI is at version *0.3.2*. +This documentation was generated from the *analytics* API at revision *20151215*. The CLI is at version *0.3.3*. ```bash analytics3 [options] @@ -84,6 +84,7 @@ analytics3 [options] profiles-patch (-r )... [-p ]... [-o ] profiles-update (-r )... [-p ]... [-o ] segments-list [-p ]... [-o ] + unsampled-reports-delete [-p ]... unsampled-reports-get [-p ]... [-o ] unsampled-reports-insert (-r )... [-p ]... [-o ] unsampled-reports-list [-p ]... [-o ] @@ -114,18 +115,18 @@ analytics3 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/analytics3-cli/mkdocs.yml b/gen/analytics3-cli/mkdocs.yml index c71b01028f..fa9fb1f24a 100644 --- a/gen/analytics3-cli/mkdocs.yml +++ b/gen/analytics3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: analytics v0.3.2+20150901 +site_name: analytics v0.3.3+20151215 site_url: http://byron.github.io/google-apis-rs/google-analytics3-cli site_description: Write integrating applications with bcore @@ -63,6 +63,7 @@ pages: - ['management_profiles-patch.md', 'Management', 'Profiles Patch'] - ['management_profiles-update.md', 'Management', 'Profiles Update'] - ['management_segments-list.md', 'Management', 'Segments List'] +- ['management_unsampled-reports-delete.md', 'Management', 'Unsampled Reports Delete'] - ['management_unsampled-reports-get.md', 'Management', 'Unsampled Reports Get'] - ['management_unsampled-reports-insert.md', 'Management', 'Unsampled Reports Insert'] - ['management_unsampled-reports-list.md', 'Management', 'Unsampled Reports List'] @@ -90,5 +91,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/analytics3-cli/src/main.rs b/gen/analytics3-cli/src/main.rs index 4ddb2a265b..e84cc89bd1 100644 --- a/gen/analytics3-cli/src/main.rs +++ b/gen/analytics3-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Analytics>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _data_ga_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _data_ga_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.data().ga_get(opt.value_of("ids").unwrap_or(""), opt.value_of("start-date").unwrap_or(""), opt.value_of("end-date").unwrap_or(""), opt.value_of("metrics").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -69,6 +69,9 @@ impl<'n, 'a> Engine<'n, 'a> { "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, + "include-empty-rows" => { + call = call.include_empty_rows(arg_from_str(value.unwrap_or("false"), err, "include-empty-rows", "boolean")); + }, "filters" => { call = call.filters(value.unwrap_or("")); }, @@ -85,10 +88,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["sort", "max-results", "dimensions", "start-index", "sampling-level", "filters", "output", "segment"].iter().map(|v|*v)); + v.extend(["sort", "max-results", "dimensions", "start-index", "include-empty-rows", "sampling-level", "filters", "output", "segment"].iter().map(|v|*v)); v } )); } } @@ -99,7 +102,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -122,10 +125,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _data_mcf_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _data_mcf_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.data().mcf_get(opt.value_of("ids").unwrap_or(""), opt.value_of("start-date").unwrap_or(""), opt.value_of("end-date").unwrap_or(""), opt.value_of("metrics").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -156,7 +159,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort", "max-results", "dimensions", "start-index", "sampling-level", "filters"].iter().map(|v|*v)); @@ -170,7 +173,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -193,10 +196,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _data_realtime_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _data_realtime_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.data().realtime_get(opt.value_of("ids").unwrap_or(""), opt.value_of("metrics").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort" => { @@ -221,7 +224,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort", "max-results", "dimensions", "filters"].iter().map(|v|*v)); @@ -235,7 +238,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -258,10 +261,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_account_summaries_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_account_summaries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().account_summaries_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -280,7 +283,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -294,7 +297,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -317,10 +320,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_account_user_links_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_account_user_links_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().account_user_links_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -333,7 +336,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -346,7 +349,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -361,13 +364,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_account_user_links_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_account_user_links_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -381,8 +384,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entity.account-ref.kind" => Some(("entity.accountRef.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -421,7 +424,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EntityUserLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().account_user_links_insert(request, opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -434,7 +437,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -447,7 +450,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -470,10 +473,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_account_user_links_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_account_user_links_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().account_user_links_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -492,7 +495,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -506,7 +509,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -529,13 +532,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_account_user_links_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_account_user_links_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -549,8 +552,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entity.account-ref.kind" => Some(("entity.accountRef.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -589,7 +592,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EntityUserLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().account_user_links_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -602,7 +605,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -615,7 +618,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -638,10 +641,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().accounts_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -660,7 +663,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -674,7 +677,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -697,10 +700,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_data_sources_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_data_sources_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().custom_data_sources_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -719,7 +722,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -733,7 +736,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -756,10 +759,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_dimensions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_dimensions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().custom_dimensions_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("custom-dimension-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -772,7 +775,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -785,7 +788,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -808,13 +811,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_dimensions_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_dimensions_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -828,8 +831,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "index" => Some(("index", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -856,7 +859,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CustomDimension = json::value::from_value(object).unwrap(); let mut call = self.hub.management().custom_dimensions_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -869,7 +872,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -882,7 +885,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -905,10 +908,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_dimensions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_dimensions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().custom_dimensions_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -927,7 +930,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -941,7 +944,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -964,13 +967,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_dimensions_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_dimensions_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -984,8 +987,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "index" => Some(("index", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1012,7 +1015,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CustomDimension = json::value::from_value(object).unwrap(); let mut call = self.hub.management().custom_dimensions_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("custom-dimension-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "ignore-custom-data-source-links" => { @@ -1028,7 +1031,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ignore-custom-data-source-links"].iter().map(|v|*v)); @@ -1042,7 +1045,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1065,13 +1068,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_dimensions_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_dimensions_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1085,8 +1088,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "index" => Some(("index", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1113,7 +1116,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CustomDimension = json::value::from_value(object).unwrap(); let mut call = self.hub.management().custom_dimensions_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("custom-dimension-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "ignore-custom-data-source-links" => { @@ -1129,7 +1132,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ignore-custom-data-source-links"].iter().map(|v|*v)); @@ -1143,7 +1146,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1166,10 +1169,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_metrics_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_metrics_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().custom_metrics_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("custom-metric-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1182,7 +1185,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1195,7 +1198,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1218,13 +1221,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_metrics_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_metrics_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1238,8 +1241,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "index" => Some(("index", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1269,7 +1272,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CustomMetric = json::value::from_value(object).unwrap(); let mut call = self.hub.management().custom_metrics_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1282,7 +1285,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1295,7 +1298,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1318,10 +1321,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_metrics_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_metrics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().custom_metrics_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -1340,7 +1343,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -1354,7 +1357,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1377,13 +1380,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_metrics_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_metrics_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1397,8 +1400,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "index" => Some(("index", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1428,7 +1431,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CustomMetric = json::value::from_value(object).unwrap(); let mut call = self.hub.management().custom_metrics_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("custom-metric-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "ignore-custom-data-source-links" => { @@ -1444,7 +1447,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ignore-custom-data-source-links"].iter().map(|v|*v)); @@ -1458,7 +1461,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1481,13 +1484,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_custom_metrics_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_custom_metrics_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1501,8 +1504,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "index" => Some(("index", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1532,7 +1535,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CustomMetric = json::value::from_value(object).unwrap(); let mut call = self.hub.management().custom_metrics_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("custom-metric-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "ignore-custom-data-source-links" => { @@ -1548,7 +1551,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ignore-custom-data-source-links"].iter().map(|v|*v)); @@ -1562,7 +1565,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1585,10 +1588,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_experiments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_experiments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().experiments_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("experiment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1601,7 +1604,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1614,7 +1617,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1629,10 +1632,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_experiments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_experiments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().experiments_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("experiment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1645,7 +1648,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1658,7 +1661,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1681,13 +1684,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_experiments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_experiments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1701,8 +1704,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "traffic-coverage" => Some(("trafficCoverage", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "web-property-id" => Some(("webPropertyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1744,7 +1747,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Experiment = json::value::from_value(object).unwrap(); let mut call = self.hub.management().experiments_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1757,7 +1760,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1770,7 +1773,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1793,10 +1796,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_experiments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_experiments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().experiments_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -1815,7 +1818,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -1829,7 +1832,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1852,13 +1855,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_experiments_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_experiments_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1872,8 +1875,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "traffic-coverage" => Some(("trafficCoverage", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "web-property-id" => Some(("webPropertyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1915,7 +1918,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Experiment = json::value::from_value(object).unwrap(); let mut call = self.hub.management().experiments_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("experiment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1928,7 +1931,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1941,7 +1944,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1964,13 +1967,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_experiments_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_experiments_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1984,8 +1987,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "traffic-coverage" => Some(("trafficCoverage", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "web-property-id" => Some(("webPropertyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2027,7 +2030,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Experiment = json::value::from_value(object).unwrap(); let mut call = self.hub.management().experiments_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("experiment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2040,7 +2043,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2053,7 +2056,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2076,10 +2079,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_filters_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_filters_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().filters_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("filter-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2092,7 +2095,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2105,7 +2108,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2128,10 +2131,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_filters_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_filters_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().filters_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("filter-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2144,7 +2147,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2157,7 +2160,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2180,13 +2183,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_filters_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_filters_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2200,8 +2203,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2259,7 +2262,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Filter = json::value::from_value(object).unwrap(); let mut call = self.hub.management().filters_insert(request, opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2272,7 +2275,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2285,7 +2288,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2308,10 +2311,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_filters_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_filters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().filters_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -2330,7 +2333,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -2344,7 +2347,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2367,13 +2370,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_filters_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_filters_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2387,8 +2390,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2446,7 +2449,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Filter = json::value::from_value(object).unwrap(); let mut call = self.hub.management().filters_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("filter-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2459,7 +2462,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2472,7 +2475,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2495,13 +2498,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_filters_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_filters_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2515,8 +2518,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2574,7 +2577,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Filter = json::value::from_value(object).unwrap(); let mut call = self.hub.management().filters_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("filter-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2587,7 +2590,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2600,7 +2603,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2623,10 +2626,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_goals_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_goals_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().goals_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("goal-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2639,7 +2642,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2652,7 +2655,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2675,13 +2678,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_goals_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_goals_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2695,8 +2698,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "visit-time-on-site-details.comparison-type" => Some(("visitTimeOnSiteDetails.comparisonType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2734,7 +2737,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Goal = json::value::from_value(object).unwrap(); let mut call = self.hub.management().goals_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2747,7 +2750,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2760,7 +2763,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2783,10 +2786,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_goals_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_goals_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().goals_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -2805,7 +2808,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -2819,7 +2822,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2842,13 +2845,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_goals_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_goals_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2862,8 +2865,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "visit-time-on-site-details.comparison-type" => Some(("visitTimeOnSiteDetails.comparisonType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2901,7 +2904,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Goal = json::value::from_value(object).unwrap(); let mut call = self.hub.management().goals_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("goal-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2914,7 +2917,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2927,7 +2930,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2950,13 +2953,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_goals_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_goals_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2970,8 +2973,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "visit-time-on-site-details.comparison-type" => Some(("visitTimeOnSiteDetails.comparisonType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3009,7 +3012,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Goal = json::value::from_value(object).unwrap(); let mut call = self.hub.management().goals_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("goal-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3022,7 +3025,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3035,7 +3038,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3058,10 +3061,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profile_filter_links_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profile_filter_links_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().profile_filter_links_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3074,7 +3077,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3087,7 +3090,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3102,10 +3105,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profile_filter_links_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profile_filter_links_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().profile_filter_links_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3118,7 +3121,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3131,7 +3134,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3154,13 +3157,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profile_filter_links_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profile_filter_links_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3174,8 +3177,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "rank" => Some(("rank", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -3205,7 +3208,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ProfileFilterLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().profile_filter_links_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3218,7 +3221,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3231,7 +3234,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3254,10 +3257,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profile_filter_links_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profile_filter_links_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().profile_filter_links_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -3276,7 +3279,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -3290,7 +3293,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3313,13 +3316,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profile_filter_links_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profile_filter_links_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3333,8 +3336,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "rank" => Some(("rank", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -3364,7 +3367,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ProfileFilterLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().profile_filter_links_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3377,7 +3380,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3390,7 +3393,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3413,13 +3416,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profile_filter_links_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profile_filter_links_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3433,8 +3436,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "rank" => Some(("rank", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -3464,7 +3467,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ProfileFilterLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().profile_filter_links_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3477,7 +3480,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3490,7 +3493,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3513,10 +3516,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profile_user_links_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profile_user_links_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().profile_user_links_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3529,7 +3532,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3542,7 +3545,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3557,13 +3560,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profile_user_links_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profile_user_links_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3577,8 +3580,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entity.account-ref.kind" => Some(("entity.accountRef.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3617,7 +3620,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EntityUserLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().profile_user_links_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3630,7 +3633,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3643,7 +3646,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3666,10 +3669,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profile_user_links_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profile_user_links_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().profile_user_links_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -3688,7 +3691,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -3702,7 +3705,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3725,13 +3728,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profile_user_links_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profile_user_links_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3745,8 +3748,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entity.account-ref.kind" => Some(("entity.accountRef.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3785,7 +3788,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EntityUserLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().profile_user_links_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3798,7 +3801,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3811,7 +3814,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3834,10 +3837,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profiles_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profiles_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().profiles_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3850,7 +3853,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3863,7 +3866,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3878,10 +3881,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profiles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().profiles_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3894,7 +3897,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3907,7 +3910,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3930,13 +3933,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profiles_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profiles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3950,8 +3953,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "currency" => Some(("currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "e-commerce-tracking" => Some(("eCommerceTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -3959,6 +3962,7 @@ impl<'n, 'a> Engine<'n, 'a> { "timezone" => Some(("timezone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "bot-filtering-enabled" => Some(("botFilteringEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "strip-site-search-category-parameters" => Some(("stripSiteSearchCategoryParameters", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "site-search-category-parameters" => Some(("siteSearchCategoryParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3980,7 +3984,7 @@ impl<'n, 'a> Engine<'n, 'a> { "parent-link.type" => Some(("parentLink.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "child-link", "created", "currency", "default-page", "e-commerce-tracking", "effective", "enhanced-e-commerce-tracking", "exclude-query-parameters", "href", "id", "internal-web-property-id", "kind", "name", "parent-link", "permissions", "self-link", "site-search-category-parameters", "site-search-query-parameters", "strip-site-search-category-parameters", "strip-site-search-query-parameters", "timezone", "type", "updated", "web-property-id", "website-url"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "bot-filtering-enabled", "child-link", "created", "currency", "default-page", "e-commerce-tracking", "effective", "enhanced-e-commerce-tracking", "exclude-query-parameters", "href", "id", "internal-web-property-id", "kind", "name", "parent-link", "permissions", "self-link", "site-search-category-parameters", "site-search-query-parameters", "strip-site-search-category-parameters", "strip-site-search-query-parameters", "timezone", "type", "updated", "web-property-id", "website-url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3991,7 +3995,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Profile = json::value::from_value(object).unwrap(); let mut call = self.hub.management().profiles_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4004,7 +4008,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4017,7 +4021,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4040,10 +4044,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profiles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().profiles_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -4062,7 +4066,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -4076,7 +4080,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4099,13 +4103,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profiles_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profiles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4119,8 +4123,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "currency" => Some(("currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "e-commerce-tracking" => Some(("eCommerceTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -4128,6 +4132,7 @@ impl<'n, 'a> Engine<'n, 'a> { "timezone" => Some(("timezone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "bot-filtering-enabled" => Some(("botFilteringEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "strip-site-search-category-parameters" => Some(("stripSiteSearchCategoryParameters", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "site-search-category-parameters" => Some(("siteSearchCategoryParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4149,7 +4154,7 @@ impl<'n, 'a> Engine<'n, 'a> { "parent-link.type" => Some(("parentLink.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "child-link", "created", "currency", "default-page", "e-commerce-tracking", "effective", "enhanced-e-commerce-tracking", "exclude-query-parameters", "href", "id", "internal-web-property-id", "kind", "name", "parent-link", "permissions", "self-link", "site-search-category-parameters", "site-search-query-parameters", "strip-site-search-category-parameters", "strip-site-search-query-parameters", "timezone", "type", "updated", "web-property-id", "website-url"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "bot-filtering-enabled", "child-link", "created", "currency", "default-page", "e-commerce-tracking", "effective", "enhanced-e-commerce-tracking", "exclude-query-parameters", "href", "id", "internal-web-property-id", "kind", "name", "parent-link", "permissions", "self-link", "site-search-category-parameters", "site-search-query-parameters", "strip-site-search-category-parameters", "strip-site-search-query-parameters", "timezone", "type", "updated", "web-property-id", "website-url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4160,7 +4165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Profile = json::value::from_value(object).unwrap(); let mut call = self.hub.management().profiles_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4173,7 +4178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4186,7 +4191,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4209,13 +4214,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_profiles_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_profiles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4229,8 +4234,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "currency" => Some(("currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "e-commerce-tracking" => Some(("eCommerceTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -4238,6 +4243,7 @@ impl<'n, 'a> Engine<'n, 'a> { "timezone" => Some(("timezone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "bot-filtering-enabled" => Some(("botFilteringEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "strip-site-search-category-parameters" => Some(("stripSiteSearchCategoryParameters", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "site-search-category-parameters" => Some(("siteSearchCategoryParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4259,7 +4265,7 @@ impl<'n, 'a> Engine<'n, 'a> { "parent-link.type" => Some(("parentLink.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "child-link", "created", "currency", "default-page", "e-commerce-tracking", "effective", "enhanced-e-commerce-tracking", "exclude-query-parameters", "href", "id", "internal-web-property-id", "kind", "name", "parent-link", "permissions", "self-link", "site-search-category-parameters", "site-search-query-parameters", "strip-site-search-category-parameters", "strip-site-search-query-parameters", "timezone", "type", "updated", "web-property-id", "website-url"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "bot-filtering-enabled", "child-link", "created", "currency", "default-page", "e-commerce-tracking", "effective", "enhanced-e-commerce-tracking", "exclude-query-parameters", "href", "id", "internal-web-property-id", "kind", "name", "parent-link", "permissions", "self-link", "site-search-category-parameters", "site-search-query-parameters", "strip-site-search-category-parameters", "strip-site-search-query-parameters", "timezone", "type", "updated", "web-property-id", "website-url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4270,7 +4276,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Profile = json::value::from_value(object).unwrap(); let mut call = self.hub.management().profiles_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4283,7 +4289,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4296,7 +4302,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4319,10 +4325,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_segments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_segments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().segments_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -4341,7 +4347,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -4355,7 +4361,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4378,10 +4384,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_unsampled_reports_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_unsampled_reports_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.management().unsampled_reports_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("unsampled-report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.management().unsampled_reports_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("unsampled-report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4394,7 +4400,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4407,7 +4413,51 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _management_unsampled_reports_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.management().unsampled_reports_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or(""), opt.value_of("unsampled-report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4430,13 +4480,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_unsampled_reports_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_unsampled_reports_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4450,8 +4500,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4485,7 +4535,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UnsampledReport = json::value::from_value(object).unwrap(); let mut call = self.hub.management().unsampled_reports_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4498,7 +4548,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4511,7 +4561,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4534,10 +4584,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_unsampled_reports_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_unsampled_reports_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().unsampled_reports_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -4556,7 +4606,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -4570,7 +4620,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4593,13 +4643,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_uploads_delete_upload_data(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_uploads_delete_upload_data(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4613,8 +4663,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "custom-data-import-uids" => Some(("customDataImportUids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -4629,7 +4679,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AnalyticsDataimportDeleteUploadDataRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.management().uploads_delete_upload_data(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("custom-data-source-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4642,7 +4692,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4655,7 +4705,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4670,10 +4720,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_uploads_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_uploads_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().uploads_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("custom-data-source-id").unwrap_or(""), opt.value_of("upload-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4686,7 +4736,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4699,7 +4749,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4722,10 +4772,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_uploads_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_uploads_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().uploads_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("custom-data-source-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -4744,7 +4794,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -4758,7 +4808,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4781,10 +4831,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_uploads_upload_data(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_uploads_upload_data(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().uploads_upload_data(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("custom-data-source-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4797,7 +4847,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4805,7 +4855,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -4813,7 +4863,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4837,10 +4887,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_web_property_ad_words_links_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_web_property_ad_words_links_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().web_property_ad_words_links_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("web-property-ad-words-link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4853,7 +4903,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4866,7 +4916,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4881,10 +4931,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_web_property_ad_words_links_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_web_property_ad_words_links_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().web_property_ad_words_links_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("web-property-ad-words-link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4897,7 +4947,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4910,7 +4960,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4933,13 +4983,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_web_property_ad_words_links_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_web_property_ad_words_links_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4953,8 +5003,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4979,7 +5029,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EntityAdWordsLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().web_property_ad_words_links_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4992,7 +5042,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5005,7 +5055,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5028,10 +5078,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_web_property_ad_words_links_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_web_property_ad_words_links_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().web_property_ad_words_links_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -5050,7 +5100,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -5064,7 +5114,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5087,13 +5137,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_web_property_ad_words_links_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_web_property_ad_words_links_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5107,8 +5157,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5133,7 +5183,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EntityAdWordsLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().web_property_ad_words_links_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("web-property-ad-words-link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5146,7 +5196,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5159,7 +5209,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5182,13 +5232,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_web_property_ad_words_links_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_web_property_ad_words_links_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5202,8 +5252,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5228,7 +5278,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EntityAdWordsLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().web_property_ad_words_links_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("web-property-ad-words-link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5241,7 +5291,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5254,7 +5304,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5277,10 +5327,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_webproperties_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_webproperties_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().webproperties_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5293,7 +5343,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5306,7 +5356,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5329,13 +5379,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_webproperties_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_webproperties_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5349,8 +5399,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "website-url" => Some(("websiteUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5382,7 +5432,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Webproperty = json::value::from_value(object).unwrap(); let mut call = self.hub.management().webproperties_insert(request, opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5395,7 +5445,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5408,7 +5458,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5431,10 +5481,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_webproperties_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_webproperties_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().webproperties_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -5453,7 +5503,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -5467,7 +5517,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5490,13 +5540,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_webproperties_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_webproperties_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5510,8 +5560,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "website-url" => Some(("websiteUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5543,7 +5593,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Webproperty = json::value::from_value(object).unwrap(); let mut call = self.hub.management().webproperties_patch(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5556,7 +5606,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5569,7 +5619,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5592,13 +5642,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_webproperties_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_webproperties_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5612,8 +5662,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "website-url" => Some(("websiteUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5645,7 +5695,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Webproperty = json::value::from_value(object).unwrap(); let mut call = self.hub.management().webproperties_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5658,7 +5708,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5671,7 +5721,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5694,10 +5744,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_webproperty_user_links_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_webproperty_user_links_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().webproperty_user_links_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5710,7 +5760,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5723,7 +5773,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -5738,13 +5788,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_webproperty_user_links_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_webproperty_user_links_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5758,8 +5808,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entity.account-ref.kind" => Some(("entity.accountRef.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5798,7 +5848,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EntityUserLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().webproperty_user_links_insert(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5811,7 +5861,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5824,7 +5874,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5847,10 +5897,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_webproperty_user_links_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_webproperty_user_links_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.management().webproperty_user_links_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -5869,7 +5919,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-index", "max-results"].iter().map(|v|*v)); @@ -5883,7 +5933,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5906,13 +5956,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _management_webproperty_user_links_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _management_webproperty_user_links_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5926,8 +5976,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "entity.account-ref.kind" => Some(("entity.accountRef.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5966,7 +6016,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EntityUserLink = json::value::from_value(object).unwrap(); let mut call = self.hub.management().webproperty_user_links_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("web-property-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5979,7 +6029,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5992,7 +6042,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6015,10 +6065,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _metadata_columns_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _metadata_columns_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.metadata().columns_list(opt.value_of("report-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6031,7 +6081,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6044,7 +6094,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6067,13 +6117,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _provisioning_create_account_ticket(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _provisioning_create_account_ticket(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6087,8 +6137,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "profile.currency" => Some(("profile.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.e-commerce-tracking" => Some(("profile.eCommerceTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -6096,6 +6146,7 @@ impl<'n, 'a> Engine<'n, 'a> { "profile.timezone" => Some(("profile.timezone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.id" => Some(("profile.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.account-id" => Some(("profile.accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "profile.bot-filtering-enabled" => Some(("profile.botFilteringEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "profile.strip-site-search-category-parameters" => Some(("profile.stripSiteSearchCategoryParameters", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "profile.site-search-category-parameters" => Some(("profile.siteSearchCategoryParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.type" => Some(("profile.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6147,7 +6198,7 @@ impl<'n, 'a> Engine<'n, 'a> { "redirect-uri" => Some(("redirectUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["account", "account-id", "child-link", "created", "currency", "default-page", "default-profile-id", "e-commerce-tracking", "effective", "enhanced-e-commerce-tracking", "exclude-query-parameters", "href", "id", "industry-vertical", "internal-web-property-id", "kind", "level", "name", "parent-link", "permissions", "profile", "profile-count", "redirect-uri", "self-link", "site-search-category-parameters", "site-search-query-parameters", "strip-site-search-category-parameters", "strip-site-search-query-parameters", "timezone", "type", "updated", "web-property-id", "webproperty", "website-url"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["account", "account-id", "bot-filtering-enabled", "child-link", "created", "currency", "default-page", "default-profile-id", "e-commerce-tracking", "effective", "enhanced-e-commerce-tracking", "exclude-query-parameters", "href", "id", "industry-vertical", "internal-web-property-id", "kind", "level", "name", "parent-link", "permissions", "profile", "profile-count", "redirect-uri", "self-link", "site-search-category-parameters", "site-search-query-parameters", "strip-site-search-category-parameters", "strip-site-search-query-parameters", "timezone", "type", "updated", "web-property-id", "webproperty", "website-url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -6158,7 +6209,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountTicket = json::value::from_value(object).unwrap(); let mut call = self.hub.provisioning().create_account_ticket(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6171,7 +6222,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6184,7 +6235,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6384,6 +6435,9 @@ impl<'n, 'a> Engine<'n, 'a> { ("segments-list", Some(opt)) => { call_result = self._management_segments_list(opt, dry_run, &mut err); }, + ("unsampled-reports-delete", Some(opt)) => { + call_result = self._management_unsampled_reports_delete(opt, dry_run, &mut err); + }, ("unsampled-reports-get", Some(opt)) => { call_result = self._management_unsampled_reports_get(opt, dry_run, &mut err); }, @@ -6495,14 +6549,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "analytics3-secret.json", + match cmn::application_secret_from_directory(&config_dir, "analytics3-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -6522,7 +6576,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -6562,7 +6616,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("data", "methods: 'ga-get', 'mcf-get' and 'realtime-get'", vec![ - ("ga-get", + ("ga-get", Some(r##"Returns Analytics data for a view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/data_ga-get", vec![ @@ -6602,7 +6656,7 @@ fn main() { Some(false), Some(false)), ]), - ("mcf-get", + ("mcf-get", Some(r##"Returns Analytics Multi-Channel Funnels data for a view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/data_mcf-get", vec![ @@ -6642,7 +6696,7 @@ fn main() { Some(false), Some(false)), ]), - ("realtime-get", + ("realtime-get", Some(r##"Returns real time data for a view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/data_realtime-get", vec![ @@ -6672,8 +6726,8 @@ fn main() { ]), ]), - ("management", "methods: 'account-summaries-list', 'account-user-links-delete', 'account-user-links-insert', 'account-user-links-list', 'account-user-links-update', 'accounts-list', 'custom-data-sources-list', 'custom-dimensions-get', 'custom-dimensions-insert', 'custom-dimensions-list', 'custom-dimensions-patch', 'custom-dimensions-update', 'custom-metrics-get', 'custom-metrics-insert', 'custom-metrics-list', 'custom-metrics-patch', 'custom-metrics-update', 'experiments-delete', 'experiments-get', 'experiments-insert', 'experiments-list', 'experiments-patch', 'experiments-update', 'filters-delete', 'filters-get', 'filters-insert', 'filters-list', 'filters-patch', 'filters-update', 'goals-get', 'goals-insert', 'goals-list', 'goals-patch', 'goals-update', 'profile-filter-links-delete', 'profile-filter-links-get', 'profile-filter-links-insert', 'profile-filter-links-list', 'profile-filter-links-patch', 'profile-filter-links-update', 'profile-user-links-delete', 'profile-user-links-insert', 'profile-user-links-list', 'profile-user-links-update', 'profiles-delete', 'profiles-get', 'profiles-insert', 'profiles-list', 'profiles-patch', 'profiles-update', 'segments-list', 'unsampled-reports-get', 'unsampled-reports-insert', 'unsampled-reports-list', 'uploads-delete-upload-data', 'uploads-get', 'uploads-list', 'uploads-upload-data', 'web-property-ad-words-links-delete', 'web-property-ad-words-links-get', 'web-property-ad-words-links-insert', 'web-property-ad-words-links-list', 'web-property-ad-words-links-patch', 'web-property-ad-words-links-update', 'webproperties-get', 'webproperties-insert', 'webproperties-list', 'webproperties-patch', 'webproperties-update', 'webproperty-user-links-delete', 'webproperty-user-links-insert', 'webproperty-user-links-list' and 'webproperty-user-links-update'", vec![ - ("account-summaries-list", + ("management", "methods: 'account-summaries-list', 'account-user-links-delete', 'account-user-links-insert', 'account-user-links-list', 'account-user-links-update', 'accounts-list', 'custom-data-sources-list', 'custom-dimensions-get', 'custom-dimensions-insert', 'custom-dimensions-list', 'custom-dimensions-patch', 'custom-dimensions-update', 'custom-metrics-get', 'custom-metrics-insert', 'custom-metrics-list', 'custom-metrics-patch', 'custom-metrics-update', 'experiments-delete', 'experiments-get', 'experiments-insert', 'experiments-list', 'experiments-patch', 'experiments-update', 'filters-delete', 'filters-get', 'filters-insert', 'filters-list', 'filters-patch', 'filters-update', 'goals-get', 'goals-insert', 'goals-list', 'goals-patch', 'goals-update', 'profile-filter-links-delete', 'profile-filter-links-get', 'profile-filter-links-insert', 'profile-filter-links-list', 'profile-filter-links-patch', 'profile-filter-links-update', 'profile-user-links-delete', 'profile-user-links-insert', 'profile-user-links-list', 'profile-user-links-update', 'profiles-delete', 'profiles-get', 'profiles-insert', 'profiles-list', 'profiles-patch', 'profiles-update', 'segments-list', 'unsampled-reports-delete', 'unsampled-reports-get', 'unsampled-reports-insert', 'unsampled-reports-list', 'uploads-delete-upload-data', 'uploads-get', 'uploads-list', 'uploads-upload-data', 'web-property-ad-words-links-delete', 'web-property-ad-words-links-get', 'web-property-ad-words-links-insert', 'web-property-ad-words-links-list', 'web-property-ad-words-links-patch', 'web-property-ad-words-links-update', 'webproperties-get', 'webproperties-insert', 'webproperties-list', 'webproperties-patch', 'webproperties-update', 'webproperty-user-links-delete', 'webproperty-user-links-insert', 'webproperty-user-links-list' and 'webproperty-user-links-update'", vec![ + ("account-summaries-list", Some(r##"Lists account summaries (lightweight tree comprised of accounts/properties/profiles) to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_account-summaries-list", vec![ @@ -6689,7 +6743,7 @@ fn main() { Some(false), Some(false)), ]), - ("account-user-links-delete", + ("account-user-links-delete", Some(r##"Removes a user from the given account."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_account-user-links-delete", vec![ @@ -6711,7 +6765,7 @@ fn main() { Some(false), Some(true)), ]), - ("account-user-links-insert", + ("account-user-links-insert", Some(r##"Adds a new user to the given account."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_account-user-links-insert", vec![ @@ -6739,7 +6793,7 @@ fn main() { Some(false), Some(false)), ]), - ("account-user-links-list", + ("account-user-links-list", Some(r##"Lists account-user links for a given account."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_account-user-links-list", vec![ @@ -6761,7 +6815,7 @@ fn main() { Some(false), Some(false)), ]), - ("account-user-links-update", + ("account-user-links-update", Some(r##"Updates permissions for an existing user on the given account."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_account-user-links-update", vec![ @@ -6795,7 +6849,7 @@ fn main() { Some(false), Some(false)), ]), - ("accounts-list", + ("accounts-list", Some(r##"Lists all accounts to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_accounts-list", vec![ @@ -6811,7 +6865,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-data-sources-list", + ("custom-data-sources-list", Some(r##"List custom data sources to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-data-sources-list", vec![ @@ -6839,7 +6893,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-dimensions-get", + ("custom-dimensions-get", Some(r##"Get a custom dimension to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-dimensions-get", vec![ @@ -6873,7 +6927,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-dimensions-insert", + ("custom-dimensions-insert", Some(r##"Create a new custom dimension."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-dimensions-insert", vec![ @@ -6907,7 +6961,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-dimensions-list", + ("custom-dimensions-list", Some(r##"Lists custom dimensions to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-dimensions-list", vec![ @@ -6935,7 +6989,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-dimensions-patch", + ("custom-dimensions-patch", Some(r##"Updates an existing custom dimension. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-dimensions-patch", vec![ @@ -6975,7 +7029,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-dimensions-update", + ("custom-dimensions-update", Some(r##"Updates an existing custom dimension."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-dimensions-update", vec![ @@ -7015,7 +7069,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-metrics-get", + ("custom-metrics-get", Some(r##"Get a custom metric to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-metrics-get", vec![ @@ -7049,7 +7103,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-metrics-insert", + ("custom-metrics-insert", Some(r##"Create a new custom metric."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-metrics-insert", vec![ @@ -7083,7 +7137,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-metrics-list", + ("custom-metrics-list", Some(r##"Lists custom metrics to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-metrics-list", vec![ @@ -7111,7 +7165,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-metrics-patch", + ("custom-metrics-patch", Some(r##"Updates an existing custom metric. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-metrics-patch", vec![ @@ -7151,7 +7205,7 @@ fn main() { Some(false), Some(false)), ]), - ("custom-metrics-update", + ("custom-metrics-update", Some(r##"Updates an existing custom metric."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_custom-metrics-update", vec![ @@ -7191,7 +7245,7 @@ fn main() { Some(false), Some(false)), ]), - ("experiments-delete", + ("experiments-delete", Some(r##"Delete an experiment."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_experiments-delete", vec![ @@ -7225,7 +7279,7 @@ fn main() { Some(false), Some(true)), ]), - ("experiments-get", + ("experiments-get", Some(r##"Returns an experiment to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_experiments-get", vec![ @@ -7265,7 +7319,7 @@ fn main() { Some(false), Some(false)), ]), - ("experiments-insert", + ("experiments-insert", Some(r##"Create a new experiment."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_experiments-insert", vec![ @@ -7305,7 +7359,7 @@ fn main() { Some(false), Some(false)), ]), - ("experiments-list", + ("experiments-list", Some(r##"Lists experiments to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_experiments-list", vec![ @@ -7339,7 +7393,7 @@ fn main() { Some(false), Some(false)), ]), - ("experiments-patch", + ("experiments-patch", Some(r##"Update an existing experiment. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_experiments-patch", vec![ @@ -7385,7 +7439,7 @@ fn main() { Some(false), Some(false)), ]), - ("experiments-update", + ("experiments-update", Some(r##"Update an existing experiment."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_experiments-update", vec![ @@ -7431,7 +7485,7 @@ fn main() { Some(false), Some(false)), ]), - ("filters-delete", + ("filters-delete", Some(r##"Delete a filter."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_filters-delete", vec![ @@ -7459,7 +7513,7 @@ fn main() { Some(false), Some(false)), ]), - ("filters-get", + ("filters-get", Some(r##"Returns a filters to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_filters-get", vec![ @@ -7487,7 +7541,7 @@ fn main() { Some(false), Some(false)), ]), - ("filters-insert", + ("filters-insert", Some(r##"Create a new filter."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_filters-insert", vec![ @@ -7515,7 +7569,7 @@ fn main() { Some(false), Some(false)), ]), - ("filters-list", + ("filters-list", Some(r##"Lists all filters for an account"##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_filters-list", vec![ @@ -7537,7 +7591,7 @@ fn main() { Some(false), Some(false)), ]), - ("filters-patch", + ("filters-patch", Some(r##"Updates an existing filter. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_filters-patch", vec![ @@ -7571,7 +7625,7 @@ fn main() { Some(false), Some(false)), ]), - ("filters-update", + ("filters-update", Some(r##"Updates an existing filter."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_filters-update", vec![ @@ -7605,7 +7659,7 @@ fn main() { Some(false), Some(false)), ]), - ("goals-get", + ("goals-get", Some(r##"Gets a goal to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_goals-get", vec![ @@ -7645,7 +7699,7 @@ fn main() { Some(false), Some(false)), ]), - ("goals-insert", + ("goals-insert", Some(r##"Create a new goal."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_goals-insert", vec![ @@ -7685,7 +7739,7 @@ fn main() { Some(false), Some(false)), ]), - ("goals-list", + ("goals-list", Some(r##"Lists goals to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_goals-list", vec![ @@ -7719,7 +7773,7 @@ fn main() { Some(false), Some(false)), ]), - ("goals-patch", + ("goals-patch", Some(r##"Updates an existing view (profile). This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_goals-patch", vec![ @@ -7765,7 +7819,7 @@ fn main() { Some(false), Some(false)), ]), - ("goals-update", + ("goals-update", Some(r##"Updates an existing view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_goals-update", vec![ @@ -7811,7 +7865,7 @@ fn main() { Some(false), Some(false)), ]), - ("profile-filter-links-delete", + ("profile-filter-links-delete", Some(r##"Delete a profile filter link."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profile-filter-links-delete", vec![ @@ -7845,7 +7899,7 @@ fn main() { Some(false), Some(true)), ]), - ("profile-filter-links-get", + ("profile-filter-links-get", Some(r##"Returns a single profile filter link."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profile-filter-links-get", vec![ @@ -7885,7 +7939,7 @@ fn main() { Some(false), Some(false)), ]), - ("profile-filter-links-insert", + ("profile-filter-links-insert", Some(r##"Create a new profile filter link."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profile-filter-links-insert", vec![ @@ -7925,7 +7979,7 @@ fn main() { Some(false), Some(false)), ]), - ("profile-filter-links-list", + ("profile-filter-links-list", Some(r##"Lists all profile filter links for a profile."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profile-filter-links-list", vec![ @@ -7959,7 +8013,7 @@ fn main() { Some(false), Some(false)), ]), - ("profile-filter-links-patch", + ("profile-filter-links-patch", Some(r##"Update an existing profile filter link. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profile-filter-links-patch", vec![ @@ -8005,7 +8059,7 @@ fn main() { Some(false), Some(false)), ]), - ("profile-filter-links-update", + ("profile-filter-links-update", Some(r##"Update an existing profile filter link."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profile-filter-links-update", vec![ @@ -8051,7 +8105,7 @@ fn main() { Some(false), Some(false)), ]), - ("profile-user-links-delete", + ("profile-user-links-delete", Some(r##"Removes a user from the given view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profile-user-links-delete", vec![ @@ -8085,7 +8139,7 @@ fn main() { Some(false), Some(true)), ]), - ("profile-user-links-insert", + ("profile-user-links-insert", Some(r##"Adds a new user to the given view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profile-user-links-insert", vec![ @@ -8125,7 +8179,7 @@ fn main() { Some(false), Some(false)), ]), - ("profile-user-links-list", + ("profile-user-links-list", Some(r##"Lists profile-user links for a given view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profile-user-links-list", vec![ @@ -8159,7 +8213,7 @@ fn main() { Some(false), Some(false)), ]), - ("profile-user-links-update", + ("profile-user-links-update", Some(r##"Updates permissions for an existing user on the given view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profile-user-links-update", vec![ @@ -8205,7 +8259,7 @@ fn main() { Some(false), Some(false)), ]), - ("profiles-delete", + ("profiles-delete", Some(r##"Deletes a view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profiles-delete", vec![ @@ -8233,7 +8287,7 @@ fn main() { Some(false), Some(true)), ]), - ("profiles-get", + ("profiles-get", Some(r##"Gets a view (profile) to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profiles-get", vec![ @@ -8267,7 +8321,7 @@ fn main() { Some(false), Some(false)), ]), - ("profiles-insert", + ("profiles-insert", Some(r##"Create a new view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profiles-insert", vec![ @@ -8301,7 +8355,7 @@ fn main() { Some(false), Some(false)), ]), - ("profiles-list", + ("profiles-list", Some(r##"Lists views (profiles) to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profiles-list", vec![ @@ -8329,7 +8383,7 @@ fn main() { Some(false), Some(false)), ]), - ("profiles-patch", + ("profiles-patch", Some(r##"Updates an existing view (profile). This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profiles-patch", vec![ @@ -8369,7 +8423,7 @@ fn main() { Some(false), Some(false)), ]), - ("profiles-update", + ("profiles-update", Some(r##"Updates an existing view (profile)."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_profiles-update", vec![ @@ -8409,7 +8463,7 @@ fn main() { Some(false), Some(false)), ]), - ("segments-list", + ("segments-list", Some(r##"Lists segments to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_segments-list", vec![ @@ -8425,7 +8479,41 @@ fn main() { Some(false), Some(false)), ]), - ("unsampled-reports-get", + ("unsampled-reports-delete", + Some(r##"Deletes an unsampled report."##), + "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_unsampled-reports-delete", + vec![ + (Some(r##"account-id"##), + None, + Some(r##"Account ID to delete the unsampled report for."##), + Some(true), + Some(false)), + + (Some(r##"web-property-id"##), + None, + Some(r##"Web property ID to delete the unsampled reports for."##), + Some(true), + Some(false)), + + (Some(r##"profile-id"##), + None, + Some(r##"View (Profile) ID to delete the unsampled report for."##), + Some(true), + Some(false)), + + (Some(r##"unsampled-report-id"##), + None, + Some(r##"ID of the unsampled report to be deleted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("unsampled-reports-get", Some(r##"Returns a single unsampled report."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_unsampled-reports-get", vec![ @@ -8465,7 +8553,7 @@ fn main() { Some(false), Some(false)), ]), - ("unsampled-reports-insert", + ("unsampled-reports-insert", Some(r##"Create a new unsampled report."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_unsampled-reports-insert", vec![ @@ -8505,7 +8593,7 @@ fn main() { Some(false), Some(false)), ]), - ("unsampled-reports-list", + ("unsampled-reports-list", Some(r##"Lists unsampled reports to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_unsampled-reports-list", vec![ @@ -8539,7 +8627,7 @@ fn main() { Some(false), Some(false)), ]), - ("uploads-delete-upload-data", + ("uploads-delete-upload-data", Some(r##"Delete data associated with a previous upload."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_uploads-delete-upload-data", vec![ @@ -8573,7 +8661,7 @@ fn main() { Some(false), Some(true)), ]), - ("uploads-get", + ("uploads-get", Some(r##"List uploads to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_uploads-get", vec![ @@ -8613,7 +8701,7 @@ fn main() { Some(false), Some(false)), ]), - ("uploads-list", + ("uploads-list", Some(r##"List uploads to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_uploads-list", vec![ @@ -8647,7 +8735,7 @@ fn main() { Some(false), Some(false)), ]), - ("uploads-upload-data", + ("uploads-upload-data", Some(r##"Upload data for a custom data source."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_uploads-upload-data", vec![ @@ -8687,7 +8775,7 @@ fn main() { Some(false), Some(false)), ]), - ("web-property-ad-words-links-delete", + ("web-property-ad-words-links-delete", Some(r##"Deletes a web property-AdWords link."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-delete", vec![ @@ -8715,7 +8803,7 @@ fn main() { Some(false), Some(true)), ]), - ("web-property-ad-words-links-get", + ("web-property-ad-words-links-get", Some(r##"Returns a web property-AdWords link to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-get", vec![ @@ -8749,7 +8837,7 @@ fn main() { Some(false), Some(false)), ]), - ("web-property-ad-words-links-insert", + ("web-property-ad-words-links-insert", Some(r##"Creates a webProperty-AdWords link."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-insert", vec![ @@ -8783,7 +8871,7 @@ fn main() { Some(false), Some(false)), ]), - ("web-property-ad-words-links-list", + ("web-property-ad-words-links-list", Some(r##"Lists webProperty-AdWords links for a given web property."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-list", vec![ @@ -8811,7 +8899,7 @@ fn main() { Some(false), Some(false)), ]), - ("web-property-ad-words-links-patch", + ("web-property-ad-words-links-patch", Some(r##"Updates an existing webProperty-AdWords link. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-patch", vec![ @@ -8851,7 +8939,7 @@ fn main() { Some(false), Some(false)), ]), - ("web-property-ad-words-links-update", + ("web-property-ad-words-links-update", Some(r##"Updates an existing webProperty-AdWords link."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_web-property-ad-words-links-update", vec![ @@ -8891,7 +8979,7 @@ fn main() { Some(false), Some(false)), ]), - ("webproperties-get", + ("webproperties-get", Some(r##"Gets a web property to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_webproperties-get", vec![ @@ -8919,7 +9007,7 @@ fn main() { Some(false), Some(false)), ]), - ("webproperties-insert", + ("webproperties-insert", Some(r##"Create a new property if the account has fewer than 20 properties. Web properties are visible in the Google Analytics interface only if they have at least one profile."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_webproperties-insert", vec![ @@ -8947,7 +9035,7 @@ fn main() { Some(false), Some(false)), ]), - ("webproperties-list", + ("webproperties-list", Some(r##"Lists web properties to which the user has access."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_webproperties-list", vec![ @@ -8969,7 +9057,7 @@ fn main() { Some(false), Some(false)), ]), - ("webproperties-patch", + ("webproperties-patch", Some(r##"Updates an existing web property. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_webproperties-patch", vec![ @@ -9003,7 +9091,7 @@ fn main() { Some(false), Some(false)), ]), - ("webproperties-update", + ("webproperties-update", Some(r##"Updates an existing web property."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_webproperties-update", vec![ @@ -9037,7 +9125,7 @@ fn main() { Some(false), Some(false)), ]), - ("webproperty-user-links-delete", + ("webproperty-user-links-delete", Some(r##"Removes a user from the given web property."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_webproperty-user-links-delete", vec![ @@ -9065,7 +9153,7 @@ fn main() { Some(false), Some(true)), ]), - ("webproperty-user-links-insert", + ("webproperty-user-links-insert", Some(r##"Adds a new user to the given web property."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_webproperty-user-links-insert", vec![ @@ -9099,7 +9187,7 @@ fn main() { Some(false), Some(false)), ]), - ("webproperty-user-links-list", + ("webproperty-user-links-list", Some(r##"Lists webProperty-user links for a given web property."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_webproperty-user-links-list", vec![ @@ -9127,7 +9215,7 @@ fn main() { Some(false), Some(false)), ]), - ("webproperty-user-links-update", + ("webproperty-user-links-update", Some(r##"Updates permissions for an existing user on the given web property."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/management_webproperty-user-links-update", vec![ @@ -9170,7 +9258,7 @@ fn main() { ]), ("metadata", "methods: 'columns-list'", vec![ - ("columns-list", + ("columns-list", Some(r##"Lists all columns for a report type"##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/metadata_columns-list", vec![ @@ -9195,7 +9283,7 @@ fn main() { ]), ("provisioning", "methods: 'create-account-ticket'", vec![ - ("create-account-ticket", + ("create-account-ticket", Some(r##"Creates an account ticket."##), "Details at http://byron.github.io/google-apis-rs/google_analytics3_cli/provisioning_create-account-ticket", vec![ @@ -9223,7 +9311,7 @@ fn main() { let mut app = App::new("analytics3") .author("Sebastian Thiel ") - .version("0.3.2+20150901") + .version("0.3.3+20151215") .about("View and manage your Google Analytics data") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_analytics3_cli") .arg(Arg::with_name("url") @@ -9247,7 +9335,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -9258,7 +9346,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/analytics3/Cargo.toml b/gen/analytics3/Cargo.toml index 05fd0517fa..d7be916f60 100644 --- a/gen/analytics3/Cargo.toml +++ b/gen/analytics3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-analytics3" -version = "0.1.10+20150901" +version = "0.1.11+20151215" authors = ["Sebastian Thiel "] description = "A complete library to interact with analytics (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/analytics3" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/analytics3/LICENSE.md b/gen/analytics3/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/analytics3/LICENSE.md +++ b/gen/analytics3/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/analytics3/README.md b/gen/analytics3/README.md index 9f16b2d914..5635edb410 100644 --- a/gen/analytics3/README.md +++ b/gen/analytics3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-analytics3` library allows access to all features of the *Google analytics* service. -This documentation was generated from *analytics* crate version *0.1.10+20150901*, where *20150901* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *analytics* crate version *0.1.11+20151215*, where *20151215* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *analytics* *v3* API can be found at the [official documentation site](https://developers.google.com/analytics/). @@ -16,7 +16,7 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * data * [*ga get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.DataGaGetCall.html), [*mcf get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.DataMcfGetCall.html) and [*realtime get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.DataRealtimeGetCall.html) * management - * [*account summaries list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountSummaryListCall.html), [*account user links delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountUserLinkDeleteCall.html), [*account user links insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountUserLinkInsertCall.html), [*account user links list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountUserLinkListCall.html), [*account user links update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountUserLinkUpdateCall.html), [*accounts list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountListCall.html), [*custom data sources list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDataSourceListCall.html), [*custom dimensions get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDimensionGetCall.html), [*custom dimensions insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDimensionInsertCall.html), [*custom dimensions list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDimensionListCall.html), [*custom dimensions patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDimensionPatchCall.html), [*custom dimensions update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDimensionUpdateCall.html), [*custom metrics get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomMetricGetCall.html), [*custom metrics insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomMetricInsertCall.html), [*custom metrics list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomMetricListCall.html), [*custom metrics patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomMetricPatchCall.html), [*custom metrics update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomMetricUpdateCall.html), [*experiments delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentDeleteCall.html), [*experiments get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentGetCall.html), [*experiments insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentInsertCall.html), [*experiments list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentListCall.html), [*experiments patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentPatchCall.html), [*experiments update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentUpdateCall.html), [*filters delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterDeleteCall.html), [*filters get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterGetCall.html), [*filters insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterInsertCall.html), [*filters list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterListCall.html), [*filters patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterPatchCall.html), [*filters update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterUpdateCall.html), [*goals get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementGoalGetCall.html), [*goals insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementGoalInsertCall.html), [*goals list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementGoalListCall.html), [*goals patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementGoalPatchCall.html), [*goals update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementGoalUpdateCall.html), [*profile filter links delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkDeleteCall.html), [*profile filter links get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkGetCall.html), [*profile filter links insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkInsertCall.html), [*profile filter links list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkListCall.html), [*profile filter links patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkPatchCall.html), [*profile filter links update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkUpdateCall.html), [*profile user links delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileUserLinkDeleteCall.html), [*profile user links insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileUserLinkInsertCall.html), [*profile user links list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileUserLinkListCall.html), [*profile user links update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileUserLinkUpdateCall.html), [*profiles delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileDeleteCall.html), [*profiles get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileGetCall.html), [*profiles insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileInsertCall.html), [*profiles list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileListCall.html), [*profiles patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfilePatchCall.html), [*profiles update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileUpdateCall.html), [*segments list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementSegmentListCall.html), [*unsampled reports get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUnsampledReportGetCall.html), [*unsampled reports insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUnsampledReportInsertCall.html), [*unsampled reports list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUnsampledReportListCall.html), [*uploads delete upload data*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUploadDeleteUploadDataCall.html), [*uploads get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUploadGetCall.html), [*uploads list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUploadListCall.html), [*uploads upload data*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUploadUploadDataCall.html), [*web property ad words links delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkDeleteCall.html), [*web property ad words links get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkGetCall.html), [*web property ad words links insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkInsertCall.html), [*web property ad words links list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkListCall.html), [*web property ad words links patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkPatchCall.html), [*web property ad words links update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkUpdateCall.html), [*webproperties get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyGetCall.html), [*webproperties insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyInsertCall.html), [*webproperties list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyListCall.html), [*webproperties patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyPatchCall.html), [*webproperties update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyUpdateCall.html), [*webproperty user links delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyUserLinkDeleteCall.html), [*webproperty user links insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyUserLinkInsertCall.html), [*webproperty user links list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyUserLinkListCall.html) and [*webproperty user links update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyUserLinkUpdateCall.html) + * [*account summaries list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountSummaryListCall.html), [*account user links delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountUserLinkDeleteCall.html), [*account user links insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountUserLinkInsertCall.html), [*account user links list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountUserLinkListCall.html), [*account user links update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountUserLinkUpdateCall.html), [*accounts list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementAccountListCall.html), [*custom data sources list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDataSourceListCall.html), [*custom dimensions get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDimensionGetCall.html), [*custom dimensions insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDimensionInsertCall.html), [*custom dimensions list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDimensionListCall.html), [*custom dimensions patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDimensionPatchCall.html), [*custom dimensions update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomDimensionUpdateCall.html), [*custom metrics get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomMetricGetCall.html), [*custom metrics insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomMetricInsertCall.html), [*custom metrics list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomMetricListCall.html), [*custom metrics patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomMetricPatchCall.html), [*custom metrics update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementCustomMetricUpdateCall.html), [*experiments delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentDeleteCall.html), [*experiments get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentGetCall.html), [*experiments insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentInsertCall.html), [*experiments list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentListCall.html), [*experiments patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentPatchCall.html), [*experiments update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementExperimentUpdateCall.html), [*filters delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterDeleteCall.html), [*filters get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterGetCall.html), [*filters insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterInsertCall.html), [*filters list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterListCall.html), [*filters patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterPatchCall.html), [*filters update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementFilterUpdateCall.html), [*goals get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementGoalGetCall.html), [*goals insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementGoalInsertCall.html), [*goals list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementGoalListCall.html), [*goals patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementGoalPatchCall.html), [*goals update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementGoalUpdateCall.html), [*profile filter links delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkDeleteCall.html), [*profile filter links get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkGetCall.html), [*profile filter links insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkInsertCall.html), [*profile filter links list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkListCall.html), [*profile filter links patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkPatchCall.html), [*profile filter links update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileFilterLinkUpdateCall.html), [*profile user links delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileUserLinkDeleteCall.html), [*profile user links insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileUserLinkInsertCall.html), [*profile user links list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileUserLinkListCall.html), [*profile user links update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileUserLinkUpdateCall.html), [*profiles delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileDeleteCall.html), [*profiles get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileGetCall.html), [*profiles insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileInsertCall.html), [*profiles list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileListCall.html), [*profiles patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfilePatchCall.html), [*profiles update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementProfileUpdateCall.html), [*segments list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementSegmentListCall.html), [*unsampled reports delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUnsampledReportDeleteCall.html), [*unsampled reports get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUnsampledReportGetCall.html), [*unsampled reports insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUnsampledReportInsertCall.html), [*unsampled reports list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUnsampledReportListCall.html), [*uploads delete upload data*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUploadDeleteUploadDataCall.html), [*uploads get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUploadGetCall.html), [*uploads list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUploadListCall.html), [*uploads upload data*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementUploadUploadDataCall.html), [*web property ad words links delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkDeleteCall.html), [*web property ad words links get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkGetCall.html), [*web property ad words links insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkInsertCall.html), [*web property ad words links list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkListCall.html), [*web property ad words links patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkPatchCall.html), [*web property ad words links update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebPropertyAdWordsLinkUpdateCall.html), [*webproperties get*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyGetCall.html), [*webproperties insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyInsertCall.html), [*webproperties list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyListCall.html), [*webproperties patch*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyPatchCall.html), [*webproperties update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyUpdateCall.html), [*webproperty user links delete*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyUserLinkDeleteCall.html), [*webproperty user links insert*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyUserLinkInsertCall.html), [*webproperty user links list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyUserLinkListCall.html) and [*webproperty user links update*](http://byron.github.io/google-apis-rs/google_analytics3/struct.ManagementWebpropertyUserLinkUpdateCall.html) * metadata * [*columns list*](http://byron.github.io/google-apis-rs/google_analytics3/struct.MetadataColumnListCall.html) * provisioning diff --git a/gen/analytics3/src/cmn.rs b/gen/analytics3/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/analytics3/src/cmn.rs +++ b/gen/analytics3/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/analytics3/src/lib.rs b/gen/analytics3/src/lib.rs index 3b9f1f5263..5cfa03fe13 100644 --- a/gen/analytics3/src/lib.rs +++ b/gen/analytics3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *analytics* crate version *0.1.10+20150901*, where *20150901* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *analytics* crate version *0.1.11+20151215*, where *20151215* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *analytics* *v3* API can be found at the //! [official documentation site](https://developers.google.com/analytics/). @@ -14,7 +14,7 @@ //! * data //! * [*ga get*](struct.DataGaGetCall.html), [*mcf get*](struct.DataMcfGetCall.html) and [*realtime get*](struct.DataRealtimeGetCall.html) //! * management -//! * [*account summaries list*](struct.ManagementAccountSummaryListCall.html), [*account user links delete*](struct.ManagementAccountUserLinkDeleteCall.html), [*account user links insert*](struct.ManagementAccountUserLinkInsertCall.html), [*account user links list*](struct.ManagementAccountUserLinkListCall.html), [*account user links update*](struct.ManagementAccountUserLinkUpdateCall.html), [*accounts list*](struct.ManagementAccountListCall.html), [*custom data sources list*](struct.ManagementCustomDataSourceListCall.html), [*custom dimensions get*](struct.ManagementCustomDimensionGetCall.html), [*custom dimensions insert*](struct.ManagementCustomDimensionInsertCall.html), [*custom dimensions list*](struct.ManagementCustomDimensionListCall.html), [*custom dimensions patch*](struct.ManagementCustomDimensionPatchCall.html), [*custom dimensions update*](struct.ManagementCustomDimensionUpdateCall.html), [*custom metrics get*](struct.ManagementCustomMetricGetCall.html), [*custom metrics insert*](struct.ManagementCustomMetricInsertCall.html), [*custom metrics list*](struct.ManagementCustomMetricListCall.html), [*custom metrics patch*](struct.ManagementCustomMetricPatchCall.html), [*custom metrics update*](struct.ManagementCustomMetricUpdateCall.html), [*experiments delete*](struct.ManagementExperimentDeleteCall.html), [*experiments get*](struct.ManagementExperimentGetCall.html), [*experiments insert*](struct.ManagementExperimentInsertCall.html), [*experiments list*](struct.ManagementExperimentListCall.html), [*experiments patch*](struct.ManagementExperimentPatchCall.html), [*experiments update*](struct.ManagementExperimentUpdateCall.html), [*filters delete*](struct.ManagementFilterDeleteCall.html), [*filters get*](struct.ManagementFilterGetCall.html), [*filters insert*](struct.ManagementFilterInsertCall.html), [*filters list*](struct.ManagementFilterListCall.html), [*filters patch*](struct.ManagementFilterPatchCall.html), [*filters update*](struct.ManagementFilterUpdateCall.html), [*goals get*](struct.ManagementGoalGetCall.html), [*goals insert*](struct.ManagementGoalInsertCall.html), [*goals list*](struct.ManagementGoalListCall.html), [*goals patch*](struct.ManagementGoalPatchCall.html), [*goals update*](struct.ManagementGoalUpdateCall.html), [*profile filter links delete*](struct.ManagementProfileFilterLinkDeleteCall.html), [*profile filter links get*](struct.ManagementProfileFilterLinkGetCall.html), [*profile filter links insert*](struct.ManagementProfileFilterLinkInsertCall.html), [*profile filter links list*](struct.ManagementProfileFilterLinkListCall.html), [*profile filter links patch*](struct.ManagementProfileFilterLinkPatchCall.html), [*profile filter links update*](struct.ManagementProfileFilterLinkUpdateCall.html), [*profile user links delete*](struct.ManagementProfileUserLinkDeleteCall.html), [*profile user links insert*](struct.ManagementProfileUserLinkInsertCall.html), [*profile user links list*](struct.ManagementProfileUserLinkListCall.html), [*profile user links update*](struct.ManagementProfileUserLinkUpdateCall.html), [*profiles delete*](struct.ManagementProfileDeleteCall.html), [*profiles get*](struct.ManagementProfileGetCall.html), [*profiles insert*](struct.ManagementProfileInsertCall.html), [*profiles list*](struct.ManagementProfileListCall.html), [*profiles patch*](struct.ManagementProfilePatchCall.html), [*profiles update*](struct.ManagementProfileUpdateCall.html), [*segments list*](struct.ManagementSegmentListCall.html), [*unsampled reports get*](struct.ManagementUnsampledReportGetCall.html), [*unsampled reports insert*](struct.ManagementUnsampledReportInsertCall.html), [*unsampled reports list*](struct.ManagementUnsampledReportListCall.html), [*uploads delete upload data*](struct.ManagementUploadDeleteUploadDataCall.html), [*uploads get*](struct.ManagementUploadGetCall.html), [*uploads list*](struct.ManagementUploadListCall.html), [*uploads upload data*](struct.ManagementUploadUploadDataCall.html), [*web property ad words links delete*](struct.ManagementWebPropertyAdWordsLinkDeleteCall.html), [*web property ad words links get*](struct.ManagementWebPropertyAdWordsLinkGetCall.html), [*web property ad words links insert*](struct.ManagementWebPropertyAdWordsLinkInsertCall.html), [*web property ad words links list*](struct.ManagementWebPropertyAdWordsLinkListCall.html), [*web property ad words links patch*](struct.ManagementWebPropertyAdWordsLinkPatchCall.html), [*web property ad words links update*](struct.ManagementWebPropertyAdWordsLinkUpdateCall.html), [*webproperties get*](struct.ManagementWebpropertyGetCall.html), [*webproperties insert*](struct.ManagementWebpropertyInsertCall.html), [*webproperties list*](struct.ManagementWebpropertyListCall.html), [*webproperties patch*](struct.ManagementWebpropertyPatchCall.html), [*webproperties update*](struct.ManagementWebpropertyUpdateCall.html), [*webproperty user links delete*](struct.ManagementWebpropertyUserLinkDeleteCall.html), [*webproperty user links insert*](struct.ManagementWebpropertyUserLinkInsertCall.html), [*webproperty user links list*](struct.ManagementWebpropertyUserLinkListCall.html) and [*webproperty user links update*](struct.ManagementWebpropertyUserLinkUpdateCall.html) +//! * [*account summaries list*](struct.ManagementAccountSummaryListCall.html), [*account user links delete*](struct.ManagementAccountUserLinkDeleteCall.html), [*account user links insert*](struct.ManagementAccountUserLinkInsertCall.html), [*account user links list*](struct.ManagementAccountUserLinkListCall.html), [*account user links update*](struct.ManagementAccountUserLinkUpdateCall.html), [*accounts list*](struct.ManagementAccountListCall.html), [*custom data sources list*](struct.ManagementCustomDataSourceListCall.html), [*custom dimensions get*](struct.ManagementCustomDimensionGetCall.html), [*custom dimensions insert*](struct.ManagementCustomDimensionInsertCall.html), [*custom dimensions list*](struct.ManagementCustomDimensionListCall.html), [*custom dimensions patch*](struct.ManagementCustomDimensionPatchCall.html), [*custom dimensions update*](struct.ManagementCustomDimensionUpdateCall.html), [*custom metrics get*](struct.ManagementCustomMetricGetCall.html), [*custom metrics insert*](struct.ManagementCustomMetricInsertCall.html), [*custom metrics list*](struct.ManagementCustomMetricListCall.html), [*custom metrics patch*](struct.ManagementCustomMetricPatchCall.html), [*custom metrics update*](struct.ManagementCustomMetricUpdateCall.html), [*experiments delete*](struct.ManagementExperimentDeleteCall.html), [*experiments get*](struct.ManagementExperimentGetCall.html), [*experiments insert*](struct.ManagementExperimentInsertCall.html), [*experiments list*](struct.ManagementExperimentListCall.html), [*experiments patch*](struct.ManagementExperimentPatchCall.html), [*experiments update*](struct.ManagementExperimentUpdateCall.html), [*filters delete*](struct.ManagementFilterDeleteCall.html), [*filters get*](struct.ManagementFilterGetCall.html), [*filters insert*](struct.ManagementFilterInsertCall.html), [*filters list*](struct.ManagementFilterListCall.html), [*filters patch*](struct.ManagementFilterPatchCall.html), [*filters update*](struct.ManagementFilterUpdateCall.html), [*goals get*](struct.ManagementGoalGetCall.html), [*goals insert*](struct.ManagementGoalInsertCall.html), [*goals list*](struct.ManagementGoalListCall.html), [*goals patch*](struct.ManagementGoalPatchCall.html), [*goals update*](struct.ManagementGoalUpdateCall.html), [*profile filter links delete*](struct.ManagementProfileFilterLinkDeleteCall.html), [*profile filter links get*](struct.ManagementProfileFilterLinkGetCall.html), [*profile filter links insert*](struct.ManagementProfileFilterLinkInsertCall.html), [*profile filter links list*](struct.ManagementProfileFilterLinkListCall.html), [*profile filter links patch*](struct.ManagementProfileFilterLinkPatchCall.html), [*profile filter links update*](struct.ManagementProfileFilterLinkUpdateCall.html), [*profile user links delete*](struct.ManagementProfileUserLinkDeleteCall.html), [*profile user links insert*](struct.ManagementProfileUserLinkInsertCall.html), [*profile user links list*](struct.ManagementProfileUserLinkListCall.html), [*profile user links update*](struct.ManagementProfileUserLinkUpdateCall.html), [*profiles delete*](struct.ManagementProfileDeleteCall.html), [*profiles get*](struct.ManagementProfileGetCall.html), [*profiles insert*](struct.ManagementProfileInsertCall.html), [*profiles list*](struct.ManagementProfileListCall.html), [*profiles patch*](struct.ManagementProfilePatchCall.html), [*profiles update*](struct.ManagementProfileUpdateCall.html), [*segments list*](struct.ManagementSegmentListCall.html), [*unsampled reports delete*](struct.ManagementUnsampledReportDeleteCall.html), [*unsampled reports get*](struct.ManagementUnsampledReportGetCall.html), [*unsampled reports insert*](struct.ManagementUnsampledReportInsertCall.html), [*unsampled reports list*](struct.ManagementUnsampledReportListCall.html), [*uploads delete upload data*](struct.ManagementUploadDeleteUploadDataCall.html), [*uploads get*](struct.ManagementUploadGetCall.html), [*uploads list*](struct.ManagementUploadListCall.html), [*uploads upload data*](struct.ManagementUploadUploadDataCall.html), [*web property ad words links delete*](struct.ManagementWebPropertyAdWordsLinkDeleteCall.html), [*web property ad words links get*](struct.ManagementWebPropertyAdWordsLinkGetCall.html), [*web property ad words links insert*](struct.ManagementWebPropertyAdWordsLinkInsertCall.html), [*web property ad words links list*](struct.ManagementWebPropertyAdWordsLinkListCall.html), [*web property ad words links patch*](struct.ManagementWebPropertyAdWordsLinkPatchCall.html), [*web property ad words links update*](struct.ManagementWebPropertyAdWordsLinkUpdateCall.html), [*webproperties get*](struct.ManagementWebpropertyGetCall.html), [*webproperties insert*](struct.ManagementWebpropertyInsertCall.html), [*webproperties list*](struct.ManagementWebpropertyListCall.html), [*webproperties patch*](struct.ManagementWebpropertyPatchCall.html), [*webproperties update*](struct.ManagementWebpropertyUpdateCall.html), [*webproperty user links delete*](struct.ManagementWebpropertyUserLinkDeleteCall.html), [*webproperty user links insert*](struct.ManagementWebpropertyUserLinkInsertCall.html), [*webproperty user links list*](struct.ManagementWebpropertyUserLinkListCall.html) and [*webproperty user links update*](struct.ManagementWebpropertyUserLinkUpdateCall.html) //! * metadata //! * [*columns list*](struct.MetadataColumnListCall.html) //! * provisioning diff --git a/gen/analytics3/src/lib.rs.in b/gen/analytics3/src/lib.rs.in index bf0816ea25..dc45cb8064 100644 --- a/gen/analytics3/src/lib.rs.in +++ b/gen/analytics3/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -152,7 +153,7 @@ impl<'a, C, A> Analytics Analytics { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -170,7 +171,7 @@ impl<'a, C, A> Analytics } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -2709,13 +2710,16 @@ pub struct Profile { /// Whether or not Analytics will strip search query parameters from the URLs in your reports. #[serde(rename="stripSiteSearchQueryParameters")] pub strip_site_search_query_parameters: Option, - /// Name of this view (profile). - pub name: Option, + /// Indicates whether bot filtering is enabled for this view (profile). + #[serde(rename="botFilteringEnabled")] + pub bot_filtering_enabled: Option, /// Time this view (profile) was created. pub created: Option, /// The site search query parameters for this view (profile). #[serde(rename="siteSearchQueryParameters")] pub site_search_query_parameters: Option, + /// Name of this view (profile). + pub name: Option, /// Website URL for this view (profile). #[serde(rename="websiteUrl")] pub website_url: Option, @@ -3091,7 +3095,7 @@ impl Part for ProfileChildLink {} /// ::default(), None); /// let mut hub = Analytics::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `account_summaries_list(...)`, `account_user_links_delete(...)`, `account_user_links_insert(...)`, `account_user_links_list(...)`, `account_user_links_update(...)`, `accounts_list(...)`, `custom_data_sources_list(...)`, `custom_dimensions_get(...)`, `custom_dimensions_insert(...)`, `custom_dimensions_list(...)`, `custom_dimensions_patch(...)`, `custom_dimensions_update(...)`, `custom_metrics_get(...)`, `custom_metrics_insert(...)`, `custom_metrics_list(...)`, `custom_metrics_patch(...)`, `custom_metrics_update(...)`, `experiments_delete(...)`, `experiments_get(...)`, `experiments_insert(...)`, `experiments_list(...)`, `experiments_patch(...)`, `experiments_update(...)`, `filters_delete(...)`, `filters_get(...)`, `filters_insert(...)`, `filters_list(...)`, `filters_patch(...)`, `filters_update(...)`, `goals_get(...)`, `goals_insert(...)`, `goals_list(...)`, `goals_patch(...)`, `goals_update(...)`, `profile_filter_links_delete(...)`, `profile_filter_links_get(...)`, `profile_filter_links_insert(...)`, `profile_filter_links_list(...)`, `profile_filter_links_patch(...)`, `profile_filter_links_update(...)`, `profile_user_links_delete(...)`, `profile_user_links_insert(...)`, `profile_user_links_list(...)`, `profile_user_links_update(...)`, `profiles_delete(...)`, `profiles_get(...)`, `profiles_insert(...)`, `profiles_list(...)`, `profiles_patch(...)`, `profiles_update(...)`, `segments_list(...)`, `unsampled_reports_get(...)`, `unsampled_reports_insert(...)`, `unsampled_reports_list(...)`, `uploads_delete_upload_data(...)`, `uploads_get(...)`, `uploads_list(...)`, `uploads_upload_data(...)`, `web_property_ad_words_links_delete(...)`, `web_property_ad_words_links_get(...)`, `web_property_ad_words_links_insert(...)`, `web_property_ad_words_links_list(...)`, `web_property_ad_words_links_patch(...)`, `web_property_ad_words_links_update(...)`, `webproperties_get(...)`, `webproperties_insert(...)`, `webproperties_list(...)`, `webproperties_patch(...)`, `webproperties_update(...)`, `webproperty_user_links_delete(...)`, `webproperty_user_links_insert(...)`, `webproperty_user_links_list(...)` and `webproperty_user_links_update(...)` +/// // like `account_summaries_list(...)`, `account_user_links_delete(...)`, `account_user_links_insert(...)`, `account_user_links_list(...)`, `account_user_links_update(...)`, `accounts_list(...)`, `custom_data_sources_list(...)`, `custom_dimensions_get(...)`, `custom_dimensions_insert(...)`, `custom_dimensions_list(...)`, `custom_dimensions_patch(...)`, `custom_dimensions_update(...)`, `custom_metrics_get(...)`, `custom_metrics_insert(...)`, `custom_metrics_list(...)`, `custom_metrics_patch(...)`, `custom_metrics_update(...)`, `experiments_delete(...)`, `experiments_get(...)`, `experiments_insert(...)`, `experiments_list(...)`, `experiments_patch(...)`, `experiments_update(...)`, `filters_delete(...)`, `filters_get(...)`, `filters_insert(...)`, `filters_list(...)`, `filters_patch(...)`, `filters_update(...)`, `goals_get(...)`, `goals_insert(...)`, `goals_list(...)`, `goals_patch(...)`, `goals_update(...)`, `profile_filter_links_delete(...)`, `profile_filter_links_get(...)`, `profile_filter_links_insert(...)`, `profile_filter_links_list(...)`, `profile_filter_links_patch(...)`, `profile_filter_links_update(...)`, `profile_user_links_delete(...)`, `profile_user_links_insert(...)`, `profile_user_links_list(...)`, `profile_user_links_update(...)`, `profiles_delete(...)`, `profiles_get(...)`, `profiles_insert(...)`, `profiles_list(...)`, `profiles_patch(...)`, `profiles_update(...)`, `segments_list(...)`, `unsampled_reports_delete(...)`, `unsampled_reports_get(...)`, `unsampled_reports_insert(...)`, `unsampled_reports_list(...)`, `uploads_delete_upload_data(...)`, `uploads_get(...)`, `uploads_list(...)`, `uploads_upload_data(...)`, `web_property_ad_words_links_delete(...)`, `web_property_ad_words_links_get(...)`, `web_property_ad_words_links_insert(...)`, `web_property_ad_words_links_list(...)`, `web_property_ad_words_links_patch(...)`, `web_property_ad_words_links_update(...)`, `webproperties_get(...)`, `webproperties_insert(...)`, `webproperties_list(...)`, `webproperties_patch(...)`, `webproperties_update(...)`, `webproperty_user_links_delete(...)`, `webproperty_user_links_insert(...)`, `webproperty_user_links_list(...)` and `webproperty_user_links_update(...)` /// // to build up your call. /// let rb = hub.management(); /// # } @@ -3916,6 +3920,29 @@ impl<'a, C, A> ManagementMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes an unsampled report. + /// + /// # Arguments + /// + /// * `accountId` - Account ID to delete the unsampled report for. + /// * `webPropertyId` - Web property ID to delete the unsampled reports for. + /// * `profileId` - View (Profile) ID to delete the unsampled report for. + /// * `unsampledReportId` - ID of the unsampled report to be deleted. + pub fn unsampled_reports_delete(&self, account_id: &str, web_property_id: &str, profile_id: &str, unsampled_report_id: &str) -> ManagementUnsampledReportDeleteCall<'a, C, A> { + ManagementUnsampledReportDeleteCall { + hub: self.hub, + _account_id: account_id.to_string(), + _web_property_id: web_property_id.to_string(), + _profile_id: profile_id.to_string(), + _unsampled_report_id: unsampled_report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates an existing view (profile). This method supports patch semantics. @@ -4781,6 +4808,7 @@ impl<'a, C, A> DataMethods<'a, C, A> { _sampling_level: Default::default(), _output: Default::default(), _max_results: Default::default(), + _include_empty_rows: Default::default(), _filters: Default::default(), _dimensions: Default::default(), _delegate: Default::default(), @@ -4998,7 +5026,7 @@ impl<'a, C, A> ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webproperties.insert", + dlg.begin(MethodInfo { id: "analytics.management.webproperties.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5040,14 +5068,14 @@ impl<'a, C, A> ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5091,7 +5119,7 @@ impl<'a, C, A> ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5101,10 +5129,10 @@ impl<'a, C, A> ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut ManagementWebpropertyInsertCall<'a, C, A> { self._request = new_value; @@ -5146,7 +5174,7 @@ impl<'a, C, A> ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut ManagementWebpropertyInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5164,12 +5192,12 @@ impl<'a, C, A> ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut ManagementWebpropertyInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementWebpropertyInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebpropertyInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5260,7 +5288,7 @@ impl<'a, C, A> ManagementProfileGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profiles.get", + dlg.begin(MethodInfo { id: "analytics.management.profiles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5304,7 +5332,7 @@ impl<'a, C, A> ManagementProfileGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5340,7 +5368,7 @@ impl<'a, C, A> ManagementProfileGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5350,10 +5378,10 @@ impl<'a, C, A> ManagementProfileGetCall<'a, C, A> where C: BorrowMut ManagementProfileGetCall<'a, C, A> where C: BorrowMut ManagementProfileGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5396,7 +5424,7 @@ impl<'a, C, A> ManagementProfileGetCall<'a, C, A> where C: BorrowMut ManagementProfileGetCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -5406,7 +5434,7 @@ impl<'a, C, A> ManagementProfileGetCall<'a, C, A> where C: BorrowMut ManagementProfileGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -5424,12 +5452,12 @@ impl<'a, C, A> ManagementProfileGetCall<'a, C, A> where C: BorrowMut ManagementProfileGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementProfileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5521,7 +5549,7 @@ impl<'a, C, A> ManagementAccountListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.accounts.list", + dlg.begin(MethodInfo { id: "analytics.management.accounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._start_index { @@ -5547,7 +5575,7 @@ impl<'a, C, A> ManagementAccountListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5583,7 +5611,7 @@ impl<'a, C, A> ManagementAccountListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5593,10 +5621,10 @@ impl<'a, C, A> ManagementAccountListCall<'a, C, A> where C: BorrowMut ManagementAccountListCall<'a, C, A> where C: BorrowMut ManagementAccountListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementAccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementAccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5755,7 +5783,7 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.patch", + dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5800,14 +5828,14 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5851,7 +5879,7 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5861,10 +5889,10 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5896,7 +5924,7 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ProfileFilterLink) -> ManagementProfileFilterLinkPatchCall<'a, C, A> { self._request = new_value; @@ -5906,7 +5934,7 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementProfileFilterLinkPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5916,7 +5944,7 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementProfileFilterLinkPatchCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -5926,7 +5954,7 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ManagementProfileFilterLinkPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -5936,7 +5964,7 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn link_id(mut self, new_value: &str) -> ManagementProfileFilterLinkPatchCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -5954,12 +5982,12 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5976,17 +6004,17 @@ impl<'a, C, A> ManagementProfileFilterLinkPatchCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Edit`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementProfileFilterLinkPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileFilterLinkPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6050,7 +6078,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webpropertyUserLinks.delete", + dlg.begin(MethodInfo { id: "analytics.management.webpropertyUserLinks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6093,7 +6121,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6129,7 +6157,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6139,10 +6167,10 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6165,7 +6193,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6175,7 +6203,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -6185,7 +6213,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow /// /// Sets the *link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn link_id(mut self, new_value: &str) -> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -6203,12 +6231,12 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6225,17 +6253,17 @@ impl<'a, C, A> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where C: Borrow } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebpropertyUserLinkDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6300,7 +6328,7 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profileUserLinks.delete", + dlg.begin(MethodInfo { id: "analytics.management.profileUserLinks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6344,7 +6372,7 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6380,7 +6408,7 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6390,10 +6418,10 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6416,7 +6444,7 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementProfileUserLinkDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6426,7 +6454,7 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementProfileUserLinkDeleteCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -6436,7 +6464,7 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ManagementProfileUserLinkDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -6446,7 +6474,7 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< /// /// Sets the *link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn link_id(mut self, new_value: &str) -> ManagementProfileUserLinkDeleteCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -6464,12 +6492,12 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6486,17 +6514,17 @@ impl<'a, C, A> ManagementProfileUserLinkDeleteCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementProfileUserLinkDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileUserLinkDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6568,7 +6596,7 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profileUserLinks.update", + dlg.begin(MethodInfo { id: "analytics.management.profileUserLinks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6613,14 +6641,14 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6664,7 +6692,7 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6674,10 +6702,10 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6709,7 +6737,7 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EntityUserLink) -> ManagementProfileUserLinkUpdateCall<'a, C, A> { self._request = new_value; @@ -6719,7 +6747,7 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementProfileUserLinkUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6729,7 +6757,7 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementProfileUserLinkUpdateCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -6739,7 +6767,7 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ManagementProfileUserLinkUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -6749,7 +6777,7 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn link_id(mut self, new_value: &str) -> ManagementProfileUserLinkUpdateCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -6767,12 +6795,12 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6789,17 +6817,17 @@ impl<'a, C, A> ManagementProfileUserLinkUpdateCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementProfileUserLinkUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileUserLinkUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6868,7 +6896,7 @@ impl<'a, C, A> ManagementFilterInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.filters.insert", + dlg.begin(MethodInfo { id: "analytics.management.filters.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6910,14 +6938,14 @@ impl<'a, C, A> ManagementFilterInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6961,7 +6989,7 @@ impl<'a, C, A> ManagementFilterInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6971,10 +6999,10 @@ impl<'a, C, A> ManagementFilterInsertCall<'a, C, A> where C: BorrowMut ManagementFilterInsertCall<'a, C, A> where C: BorrowMut ManagementFilterInsertCall<'a, C, A> { self._request = new_value; @@ -7016,7 +7044,7 @@ impl<'a, C, A> ManagementFilterInsertCall<'a, C, A> where C: BorrowMut ManagementFilterInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7034,12 +7062,12 @@ impl<'a, C, A> ManagementFilterInsertCall<'a, C, A> where C: BorrowMut ManagementFilterInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementFilterInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementFilterInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7136,7 +7164,7 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.accountUserLinks.update", + dlg.begin(MethodInfo { id: "analytics.management.accountUserLinks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -7179,14 +7207,14 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7230,7 +7258,7 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7240,10 +7268,10 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7275,7 +7303,7 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EntityUserLink) -> ManagementAccountUserLinkUpdateCall<'a, C, A> { self._request = new_value; @@ -7285,7 +7313,7 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementAccountUserLinkUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7295,7 +7323,7 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn link_id(mut self, new_value: &str) -> ManagementAccountUserLinkUpdateCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -7313,12 +7341,12 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7335,17 +7363,17 @@ impl<'a, C, A> ManagementAccountUserLinkUpdateCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementAccountUserLinkUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementAccountUserLinkUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7415,7 +7443,7 @@ impl<'a, C, A> ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webproperties.update", + dlg.begin(MethodInfo { id: "analytics.management.webproperties.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -7458,14 +7486,14 @@ impl<'a, C, A> ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7509,7 +7537,7 @@ impl<'a, C, A> ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7519,10 +7547,10 @@ impl<'a, C, A> ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUpdateCall<'a, C, A> { self._request = new_value; @@ -7564,7 +7592,7 @@ impl<'a, C, A> ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7574,7 +7602,7 @@ impl<'a, C, A> ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUpdateCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -7592,12 +7620,12 @@ impl<'a, C, A> ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut ManagementWebpropertyUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementWebpropertyUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebpropertyUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7695,7 +7723,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webpropertyUserLinks.update", + dlg.begin(MethodInfo { id: "analytics.management.webpropertyUserLinks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -7739,14 +7767,14 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7790,7 +7818,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7800,10 +7828,10 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7835,7 +7863,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EntityUserLink) -> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> { self._request = new_value; @@ -7845,7 +7873,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7855,7 +7883,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -7865,7 +7893,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow /// /// Sets the *link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn link_id(mut self, new_value: &str) -> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -7883,12 +7911,12 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7905,17 +7933,17 @@ impl<'a, C, A> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where C: Borrow } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebpropertyUserLinkUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7986,7 +8014,7 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.unsampledReports.insert", + dlg.begin(MethodInfo { id: "analytics.management.unsampledReports.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8030,14 +8058,14 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8081,7 +8109,7 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8091,10 +8119,10 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8126,7 +8154,7 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UnsampledReport) -> ManagementUnsampledReportInsertCall<'a, C, A> { self._request = new_value; @@ -8136,7 +8164,7 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementUnsampledReportInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8146,7 +8174,7 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementUnsampledReportInsertCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -8156,7 +8184,7 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ManagementUnsampledReportInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -8174,12 +8202,12 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8196,17 +8224,17 @@ impl<'a, C, A> ManagementUnsampledReportInsertCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementUnsampledReportInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementUnsampledReportInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8270,7 +8298,7 @@ impl<'a, C, A> ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customMetrics.get", + dlg.begin(MethodInfo { id: "analytics.management.customMetrics.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8314,7 +8342,7 @@ impl<'a, C, A> ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8350,7 +8378,7 @@ impl<'a, C, A> ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8360,10 +8388,10 @@ impl<'a, C, A> ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut ManagementCustomMetricGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8406,7 +8434,7 @@ impl<'a, C, A> ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut ManagementCustomMetricGetCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -8416,7 +8444,7 @@ impl<'a, C, A> ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut ManagementCustomMetricGetCall<'a, C, A> { self._custom_metric_id = new_value.to_string(); @@ -8434,12 +8462,12 @@ impl<'a, C, A> ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut ManagementCustomMetricGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementCustomMetricGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomMetricGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8531,7 +8559,7 @@ impl<'a, C, A> ManagementUploadGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.uploads.get", + dlg.begin(MethodInfo { id: "analytics.management.uploads.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8576,7 +8604,7 @@ impl<'a, C, A> ManagementUploadGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8612,7 +8640,7 @@ impl<'a, C, A> ManagementUploadGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8622,10 +8650,10 @@ impl<'a, C, A> ManagementUploadGetCall<'a, C, A> where C: BorrowMut ManagementUploadGetCall<'a, C, A> where C: BorrowMut ManagementUploadGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8668,7 +8696,7 @@ impl<'a, C, A> ManagementUploadGetCall<'a, C, A> where C: BorrowMut ManagementUploadGetCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -8678,7 +8706,7 @@ impl<'a, C, A> ManagementUploadGetCall<'a, C, A> where C: BorrowMut ManagementUploadGetCall<'a, C, A> { self._custom_data_source_id = new_value.to_string(); @@ -8688,7 +8716,7 @@ impl<'a, C, A> ManagementUploadGetCall<'a, C, A> where C: BorrowMut ManagementUploadGetCall<'a, C, A> { self._upload_id = new_value.to_string(); @@ -8706,12 +8734,12 @@ impl<'a, C, A> ManagementUploadGetCall<'a, C, A> where C: BorrowMut ManagementUploadGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementUploadGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementUploadGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8802,7 +8830,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.get", + dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8846,7 +8874,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8882,7 +8910,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8892,10 +8920,10 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8928,7 +8956,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8938,7 +8966,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -8948,7 +8976,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow /// /// Sets the *web property ad words link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_ad_words_link_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> { self._web_property_ad_words_link_id = new_value.to_string(); @@ -8966,12 +8994,12 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8988,17 +9016,17 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where C: Borrow } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9065,7 +9093,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webpropertyUserLinks.list", + dlg.begin(MethodInfo { id: "analytics.management.webpropertyUserLinks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9114,7 +9142,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9150,7 +9178,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9160,10 +9188,10 @@ impl<'a, C, A> ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9196,7 +9224,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementWebpropertyUserLinkListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9206,7 +9234,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementWebpropertyUserLinkListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -9238,12 +9266,12 @@ impl<'a, C, A> ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9260,17 +9288,17 @@ impl<'a, C, A> ManagementWebpropertyUserLinkListCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageUserReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementWebpropertyUserLinkListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebpropertyUserLinkListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9342,7 +9370,7 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.update", + dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9387,14 +9415,14 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9438,7 +9466,7 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9448,10 +9476,10 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9483,7 +9511,7 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ProfileFilterLink) -> ManagementProfileFilterLinkUpdateCall<'a, C, A> { self._request = new_value; @@ -9493,7 +9521,7 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementProfileFilterLinkUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9503,7 +9531,7 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementProfileFilterLinkUpdateCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -9513,7 +9541,7 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ManagementProfileFilterLinkUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -9523,7 +9551,7 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu /// /// Sets the *link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn link_id(mut self, new_value: &str) -> ManagementProfileFilterLinkUpdateCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -9541,12 +9569,12 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9563,17 +9591,17 @@ impl<'a, C, A> ManagementProfileFilterLinkUpdateCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Edit`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementProfileFilterLinkUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileFilterLinkUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9638,7 +9666,7 @@ impl<'a, C, A> ManagementExperimentGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.experiments.get", + dlg.begin(MethodInfo { id: "analytics.management.experiments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9683,7 +9711,7 @@ impl<'a, C, A> ManagementExperimentGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9719,7 +9747,7 @@ impl<'a, C, A> ManagementExperimentGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9729,10 +9757,10 @@ impl<'a, C, A> ManagementExperimentGetCall<'a, C, A> where C: BorrowMut ManagementExperimentGetCall<'a, C, A> where C: BorrowMut ManagementExperimentGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9775,7 +9803,7 @@ impl<'a, C, A> ManagementExperimentGetCall<'a, C, A> where C: BorrowMut ManagementExperimentGetCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -9785,7 +9813,7 @@ impl<'a, C, A> ManagementExperimentGetCall<'a, C, A> where C: BorrowMut ManagementExperimentGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -9795,7 +9823,7 @@ impl<'a, C, A> ManagementExperimentGetCall<'a, C, A> where C: BorrowMut ManagementExperimentGetCall<'a, C, A> { self._experiment_id = new_value.to_string(); @@ -9813,12 +9841,12 @@ impl<'a, C, A> ManagementExperimentGetCall<'a, C, A> where C: BorrowMut ManagementExperimentGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementExperimentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementExperimentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9918,7 +9946,7 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customDimensions.update", + dlg.begin(MethodInfo { id: "analytics.management.customDimensions.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9965,14 +9993,14 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10016,7 +10044,7 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10026,10 +10054,10 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10061,7 +10089,7 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CustomDimension) -> ManagementCustomDimensionUpdateCall<'a, C, A> { self._request = new_value; @@ -10071,7 +10099,7 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementCustomDimensionUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10081,7 +10109,7 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementCustomDimensionUpdateCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -10091,7 +10119,7 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *custom dimension id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn custom_dimension_id(mut self, new_value: &str) -> ManagementCustomDimensionUpdateCall<'a, C, A> { self._custom_dimension_id = new_value.to_string(); @@ -10116,12 +10144,12 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10138,17 +10166,17 @@ impl<'a, C, A> ManagementCustomDimensionUpdateCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Edit`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementCustomDimensionUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomDimensionUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10213,7 +10241,7 @@ impl<'a, C, A> ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.unsampledReports.get", + dlg.begin(MethodInfo { id: "analytics.management.unsampledReports.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -10258,7 +10286,7 @@ impl<'a, C, A> ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10294,7 +10322,7 @@ impl<'a, C, A> ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10304,10 +10332,10 @@ impl<'a, C, A> ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10350,7 +10378,7 @@ impl<'a, C, A> ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportGetCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -10360,7 +10388,7 @@ impl<'a, C, A> ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -10370,7 +10398,7 @@ impl<'a, C, A> ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportGetCall<'a, C, A> { self._unsampled_report_id = new_value.to_string(); @@ -10388,12 +10416,12 @@ impl<'a, C, A> ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementUnsampledReportGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementUnsampledReportGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10491,7 +10519,7 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.insert", + dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -10535,14 +10563,14 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10586,7 +10614,7 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10596,10 +10624,10 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10631,7 +10659,7 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ProfileFilterLink) -> ManagementProfileFilterLinkInsertCall<'a, C, A> { self._request = new_value; @@ -10641,7 +10669,7 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementProfileFilterLinkInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10651,7 +10679,7 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementProfileFilterLinkInsertCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -10661,7 +10689,7 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ManagementProfileFilterLinkInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -10679,12 +10707,12 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10701,17 +10729,17 @@ impl<'a, C, A> ManagementProfileFilterLinkInsertCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Edit`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementProfileFilterLinkInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileFilterLinkInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10781,7 +10809,7 @@ impl<'a, C, A> ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.filters.update", + dlg.begin(MethodInfo { id: "analytics.management.filters.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -10824,14 +10852,14 @@ impl<'a, C, A> ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10875,7 +10903,7 @@ impl<'a, C, A> ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10885,10 +10913,10 @@ impl<'a, C, A> ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut ManagementFilterUpdateCall<'a, C, A> { self._request = new_value; @@ -10930,7 +10958,7 @@ impl<'a, C, A> ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut ManagementFilterUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10940,7 +10968,7 @@ impl<'a, C, A> ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut ManagementFilterUpdateCall<'a, C, A> { self._filter_id = new_value.to_string(); @@ -10958,12 +10986,12 @@ impl<'a, C, A> ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut ManagementFilterUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementFilterUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementFilterUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11055,7 +11083,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.delete", + dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -11099,7 +11127,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11135,7 +11163,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11145,10 +11173,10 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11171,7 +11199,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementProfileFilterLinkDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -11181,7 +11209,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementProfileFilterLinkDeleteCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -11191,7 +11219,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ManagementProfileFilterLinkDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -11201,7 +11229,7 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu /// /// Sets the *link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn link_id(mut self, new_value: &str) -> ManagementProfileFilterLinkDeleteCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -11219,12 +11247,12 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11241,17 +11269,17 @@ impl<'a, C, A> ManagementProfileFilterLinkDeleteCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Edit`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementProfileFilterLinkDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileFilterLinkDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11316,7 +11344,7 @@ impl<'a, C, A> ManagementSegmentListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.segments.list", + dlg.begin(MethodInfo { id: "analytics.management.segments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._start_index { @@ -11342,7 +11370,7 @@ impl<'a, C, A> ManagementSegmentListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11378,7 +11406,7 @@ impl<'a, C, A> ManagementSegmentListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11388,10 +11416,10 @@ impl<'a, C, A> ManagementSegmentListCall<'a, C, A> where C: BorrowMut ManagementSegmentListCall<'a, C, A> where C: BorrowMut ManagementSegmentListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementSegmentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementSegmentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11542,7 +11570,7 @@ impl<'a, C, A> ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profiles.delete", + dlg.begin(MethodInfo { id: "analytics.management.profiles.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -11585,7 +11613,7 @@ impl<'a, C, A> ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11621,7 +11649,7 @@ impl<'a, C, A> ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11631,10 +11659,10 @@ impl<'a, C, A> ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut ManagementProfileDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -11667,7 +11695,7 @@ impl<'a, C, A> ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut ManagementProfileDeleteCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -11677,7 +11705,7 @@ impl<'a, C, A> ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut ManagementProfileDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -11695,12 +11723,12 @@ impl<'a, C, A> ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut ManagementProfileDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementProfileDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11799,7 +11827,7 @@ impl<'a, C, A> ManagementGoalPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.goals.patch", + dlg.begin(MethodInfo { id: "analytics.management.goals.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -11844,14 +11872,14 @@ impl<'a, C, A> ManagementGoalPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11895,7 +11923,7 @@ impl<'a, C, A> ManagementGoalPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11905,10 +11933,10 @@ impl<'a, C, A> ManagementGoalPatchCall<'a, C, A> where C: BorrowMut ManagementGoalPatchCall<'a, C, A> where C: BorrowMut ManagementGoalPatchCall<'a, C, A> { self._request = new_value; @@ -11950,7 +11978,7 @@ impl<'a, C, A> ManagementGoalPatchCall<'a, C, A> where C: BorrowMut ManagementGoalPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -11960,7 +11988,7 @@ impl<'a, C, A> ManagementGoalPatchCall<'a, C, A> where C: BorrowMut ManagementGoalPatchCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -11970,7 +11998,7 @@ impl<'a, C, A> ManagementGoalPatchCall<'a, C, A> where C: BorrowMut ManagementGoalPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -11980,7 +12008,7 @@ impl<'a, C, A> ManagementGoalPatchCall<'a, C, A> where C: BorrowMut ManagementGoalPatchCall<'a, C, A> { self._goal_id = new_value.to_string(); @@ -11998,12 +12026,12 @@ impl<'a, C, A> ManagementGoalPatchCall<'a, C, A> where C: BorrowMut ManagementGoalPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementGoalPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementGoalPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12103,7 +12131,7 @@ impl<'a, C, A> ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customDimensions.patch", + dlg.begin(MethodInfo { id: "analytics.management.customDimensions.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -12150,14 +12178,14 @@ impl<'a, C, A> ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12201,7 +12229,7 @@ impl<'a, C, A> ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12211,10 +12239,10 @@ impl<'a, C, A> ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionPatchCall<'a, C, A> { self._request = new_value; @@ -12256,7 +12284,7 @@ impl<'a, C, A> ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12266,7 +12294,7 @@ impl<'a, C, A> ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionPatchCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -12276,7 +12304,7 @@ impl<'a, C, A> ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionPatchCall<'a, C, A> { self._custom_dimension_id = new_value.to_string(); @@ -12301,12 +12329,12 @@ impl<'a, C, A> ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementCustomDimensionPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomDimensionPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12405,7 +12433,7 @@ impl<'a, C, A> ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.experiments.patch", + dlg.begin(MethodInfo { id: "analytics.management.experiments.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -12450,14 +12478,14 @@ impl<'a, C, A> ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12501,7 +12529,7 @@ impl<'a, C, A> ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12511,10 +12539,10 @@ impl<'a, C, A> ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut ManagementExperimentPatchCall<'a, C, A> { self._request = new_value; @@ -12556,7 +12584,7 @@ impl<'a, C, A> ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut ManagementExperimentPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12566,7 +12594,7 @@ impl<'a, C, A> ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut ManagementExperimentPatchCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -12576,7 +12604,7 @@ impl<'a, C, A> ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut ManagementExperimentPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -12586,7 +12614,7 @@ impl<'a, C, A> ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut ManagementExperimentPatchCall<'a, C, A> { self._experiment_id = new_value.to_string(); @@ -12604,12 +12632,12 @@ impl<'a, C, A> ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut ManagementExperimentPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementExperimentPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementExperimentPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12704,7 +12732,7 @@ impl<'a, C, A> ManagementExperimentListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.experiments.list", + dlg.begin(MethodInfo { id: "analytics.management.experiments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -12754,7 +12782,7 @@ impl<'a, C, A> ManagementExperimentListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12790,7 +12818,7 @@ impl<'a, C, A> ManagementExperimentListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12800,10 +12828,10 @@ impl<'a, C, A> ManagementExperimentListCall<'a, C, A> where C: BorrowMut ManagementExperimentListCall<'a, C, A> where C: BorrowMut ManagementExperimentListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12846,7 +12874,7 @@ impl<'a, C, A> ManagementExperimentListCall<'a, C, A> where C: BorrowMut ManagementExperimentListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -12856,7 +12884,7 @@ impl<'a, C, A> ManagementExperimentListCall<'a, C, A> where C: BorrowMut ManagementExperimentListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -12888,12 +12916,12 @@ impl<'a, C, A> ManagementExperimentListCall<'a, C, A> where C: BorrowMut ManagementExperimentListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementExperimentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementExperimentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12987,7 +13015,7 @@ impl<'a, C, A> ManagementProfileListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profiles.list", + dlg.begin(MethodInfo { id: "analytics.management.profiles.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -13036,7 +13064,7 @@ impl<'a, C, A> ManagementProfileListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13072,7 +13100,7 @@ impl<'a, C, A> ManagementProfileListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13082,10 +13110,10 @@ impl<'a, C, A> ManagementProfileListCall<'a, C, A> where C: BorrowMut ManagementProfileListCall<'a, C, A> where C: BorrowMut ManagementProfileListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -13128,7 +13156,7 @@ impl<'a, C, A> ManagementProfileListCall<'a, C, A> where C: BorrowMut ManagementProfileListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -13160,12 +13188,12 @@ impl<'a, C, A> ManagementProfileListCall<'a, C, A> where C: BorrowMut ManagementProfileListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementProfileListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13260,7 +13288,7 @@ impl<'a, C, A> ManagementGoalListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.goals.list", + dlg.begin(MethodInfo { id: "analytics.management.goals.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -13310,7 +13338,7 @@ impl<'a, C, A> ManagementGoalListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13346,7 +13374,7 @@ impl<'a, C, A> ManagementGoalListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13356,10 +13384,10 @@ impl<'a, C, A> ManagementGoalListCall<'a, C, A> where C: BorrowMut ManagementGoalListCall<'a, C, A> where C: BorrowMut ManagementGoalListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -13402,7 +13430,7 @@ impl<'a, C, A> ManagementGoalListCall<'a, C, A> where C: BorrowMut ManagementGoalListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -13412,7 +13440,7 @@ impl<'a, C, A> ManagementGoalListCall<'a, C, A> where C: BorrowMut ManagementGoalListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -13444,12 +13472,12 @@ impl<'a, C, A> ManagementGoalListCall<'a, C, A> where C: BorrowMut ManagementGoalListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementGoalListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementGoalListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13547,7 +13575,7 @@ impl<'a, C, A> ManagementGoalInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.goals.insert", + dlg.begin(MethodInfo { id: "analytics.management.goals.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -13591,14 +13619,14 @@ impl<'a, C, A> ManagementGoalInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13642,7 +13670,7 @@ impl<'a, C, A> ManagementGoalInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13652,10 +13680,10 @@ impl<'a, C, A> ManagementGoalInsertCall<'a, C, A> where C: BorrowMut ManagementGoalInsertCall<'a, C, A> where C: BorrowMut ManagementGoalInsertCall<'a, C, A> { self._request = new_value; @@ -13697,7 +13725,7 @@ impl<'a, C, A> ManagementGoalInsertCall<'a, C, A> where C: BorrowMut ManagementGoalInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -13707,7 +13735,7 @@ impl<'a, C, A> ManagementGoalInsertCall<'a, C, A> where C: BorrowMut ManagementGoalInsertCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -13717,7 +13745,7 @@ impl<'a, C, A> ManagementGoalInsertCall<'a, C, A> where C: BorrowMut ManagementGoalInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -13735,12 +13763,12 @@ impl<'a, C, A> ManagementGoalInsertCall<'a, C, A> where C: BorrowMut ManagementGoalInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementGoalInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementGoalInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13840,7 +13868,7 @@ impl<'a, C, A> ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customMetrics.patch", + dlg.begin(MethodInfo { id: "analytics.management.customMetrics.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -13887,14 +13915,14 @@ impl<'a, C, A> ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13938,7 +13966,7 @@ impl<'a, C, A> ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13948,10 +13976,10 @@ impl<'a, C, A> ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut ManagementCustomMetricPatchCall<'a, C, A> { self._request = new_value; @@ -13993,7 +14021,7 @@ impl<'a, C, A> ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut ManagementCustomMetricPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -14003,7 +14031,7 @@ impl<'a, C, A> ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut ManagementCustomMetricPatchCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -14013,7 +14041,7 @@ impl<'a, C, A> ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut ManagementCustomMetricPatchCall<'a, C, A> { self._custom_metric_id = new_value.to_string(); @@ -14038,12 +14066,12 @@ impl<'a, C, A> ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut ManagementCustomMetricPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementCustomMetricPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomMetricPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14136,7 +14164,7 @@ impl<'a, C, A> ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.uploads.uploadData", + dlg.begin(MethodInfo { id: "analytics.management.uploads.uploadData", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -14154,13 +14182,13 @@ impl<'a, C, A> ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14252,7 +14280,7 @@ impl<'a, C, A> ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14262,10 +14290,10 @@ impl<'a, C, A> ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut ManagementUploadUploadDataCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -14379,7 +14407,7 @@ impl<'a, C, A> ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut ManagementUploadUploadDataCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -14389,7 +14417,7 @@ impl<'a, C, A> ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut ManagementUploadUploadDataCall<'a, C, A> { self._custom_data_source_id = new_value.to_string(); @@ -14407,12 +14435,12 @@ impl<'a, C, A> ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut ManagementUploadUploadDataCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementUploadUploadDataCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementUploadUploadDataCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14508,7 +14536,7 @@ impl<'a, C, A> ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.accountUserLinks.insert", + dlg.begin(MethodInfo { id: "analytics.management.accountUserLinks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -14550,14 +14578,14 @@ impl<'a, C, A> ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14601,7 +14629,7 @@ impl<'a, C, A> ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14611,10 +14639,10 @@ impl<'a, C, A> ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14646,7 +14674,7 @@ impl<'a, C, A> ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EntityUserLink) -> ManagementAccountUserLinkInsertCall<'a, C, A> { self._request = new_value; @@ -14656,7 +14684,7 @@ impl<'a, C, A> ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementAccountUserLinkInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -14674,12 +14702,12 @@ impl<'a, C, A> ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14696,17 +14724,17 @@ impl<'a, C, A> ManagementAccountUserLinkInsertCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementAccountUserLinkInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementAccountUserLinkInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14776,7 +14804,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webpropertyUserLinks.insert", + dlg.begin(MethodInfo { id: "analytics.management.webpropertyUserLinks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -14819,14 +14847,14 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14870,7 +14898,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14880,10 +14908,10 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14915,7 +14943,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EntityUserLink) -> ManagementWebpropertyUserLinkInsertCall<'a, C, A> { self._request = new_value; @@ -14925,7 +14953,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementWebpropertyUserLinkInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -14935,7 +14963,7 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementWebpropertyUserLinkInsertCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -14953,12 +14981,12 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14975,17 +15003,17 @@ impl<'a, C, A> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where C: Borrow } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementWebpropertyUserLinkInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebpropertyUserLinkInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15050,7 +15078,7 @@ impl<'a, C, A> ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.experiments.delete", + dlg.begin(MethodInfo { id: "analytics.management.experiments.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -15094,7 +15122,7 @@ impl<'a, C, A> ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15130,7 +15158,7 @@ impl<'a, C, A> ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15140,10 +15168,10 @@ impl<'a, C, A> ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut ManagementExperimentDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -15176,7 +15204,7 @@ impl<'a, C, A> ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut ManagementExperimentDeleteCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -15186,7 +15214,7 @@ impl<'a, C, A> ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut ManagementExperimentDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -15196,7 +15224,7 @@ impl<'a, C, A> ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut ManagementExperimentDeleteCall<'a, C, A> { self._experiment_id = new_value.to_string(); @@ -15214,12 +15242,12 @@ impl<'a, C, A> ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut ManagementExperimentDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementExperimentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementExperimentDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an unsampled report. +/// +/// A builder for the *unsampledReports.delete* method supported by a *management* resource. +/// It is not used directly, but through a `ManagementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_analytics3 as analytics3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use analytics3::Analytics; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Analytics::new(hyper::Client::new(), 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 ! +/// let result = hub.management().unsampled_reports_delete("accountId", "webPropertyId", "profileId", "unsampledReportId") +/// .doit(); +/// # } +/// ``` +pub struct ManagementUnsampledReportDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Analytics, + _account_id: String, + _web_property_id: String, + _profile_id: String, + _unsampled_report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ManagementUnsampledReportDeleteCall<'a, C, A> {} + +impl<'a, C, A> ManagementUnsampledReportDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "analytics.management.unsampledReports.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("accountId", self._account_id.to_string())); + params.push(("webPropertyId", self._web_property_id.to_string())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("unsampledReportId", self._unsampled_report_id.to_string())); + for &field in ["accountId", "webPropertyId", "profileId", "unsampledReportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/unsampledReports/{unsampledReportId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Edit.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{accountId}", "accountId"), ("{webPropertyId}", "webPropertyId"), ("{profileId}", "profileId"), ("{unsampledReportId}", "unsampledReportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(4); + for param_name in ["unsampledReportId", "profileId", "webPropertyId", "accountId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Account ID to delete the unsampled report for. + /// + /// Sets the *account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn account_id(mut self, new_value: &str) -> ManagementUnsampledReportDeleteCall<'a, C, A> { + self._account_id = new_value.to_string(); + self + } + /// Web property ID to delete the unsampled reports for. + /// + /// Sets the *web property id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn web_property_id(mut self, new_value: &str) -> ManagementUnsampledReportDeleteCall<'a, C, A> { + self._web_property_id = new_value.to_string(); + self + } + /// View (Profile) ID to delete the unsampled report for. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ManagementUnsampledReportDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// ID of the unsampled report to be deleted. + /// + /// Sets the *unsampled report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn unsampled_report_id(mut self, new_value: &str) -> ManagementUnsampledReportDeleteCall<'a, C, A> { + self._unsampled_report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ManagementUnsampledReportDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ManagementUnsampledReportDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Edit`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ManagementUnsampledReportDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15317,7 +15606,7 @@ impl<'a, C, A> ManagementProfilePatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profiles.patch", + dlg.begin(MethodInfo { id: "analytics.management.profiles.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -15361,14 +15650,14 @@ impl<'a, C, A> ManagementProfilePatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15412,7 +15701,7 @@ impl<'a, C, A> ManagementProfilePatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15422,10 +15711,10 @@ impl<'a, C, A> ManagementProfilePatchCall<'a, C, A> where C: BorrowMut ManagementProfilePatchCall<'a, C, A> where C: BorrowMut ManagementProfilePatchCall<'a, C, A> { self._request = new_value; @@ -15467,7 +15756,7 @@ impl<'a, C, A> ManagementProfilePatchCall<'a, C, A> where C: BorrowMut ManagementProfilePatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -15477,7 +15766,7 @@ impl<'a, C, A> ManagementProfilePatchCall<'a, C, A> where C: BorrowMut ManagementProfilePatchCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -15487,7 +15776,7 @@ impl<'a, C, A> ManagementProfilePatchCall<'a, C, A> where C: BorrowMut ManagementProfilePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -15505,12 +15794,12 @@ impl<'a, C, A> ManagementProfilePatchCall<'a, C, A> where C: BorrowMut ManagementProfilePatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementProfilePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfilePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15600,7 +15889,7 @@ impl<'a, C, A> ManagementFilterGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.filters.get", + dlg.begin(MethodInfo { id: "analytics.management.filters.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -15643,7 +15932,7 @@ impl<'a, C, A> ManagementFilterGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15679,7 +15968,7 @@ impl<'a, C, A> ManagementFilterGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15689,10 +15978,10 @@ impl<'a, C, A> ManagementFilterGetCall<'a, C, A> where C: BorrowMut ManagementFilterGetCall<'a, C, A> where C: BorrowMut ManagementFilterGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -15735,7 +16024,7 @@ impl<'a, C, A> ManagementFilterGetCall<'a, C, A> where C: BorrowMut ManagementFilterGetCall<'a, C, A> { self._filter_id = new_value.to_string(); @@ -15753,12 +16042,12 @@ impl<'a, C, A> ManagementFilterGetCall<'a, C, A> where C: BorrowMut ManagementFilterGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementFilterGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementFilterGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15820,8 +16109,8 @@ impl<'a, C, A> ManagementFilterGetCall<'a, C, A> where C: BorrowMut ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.list", + dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -15901,7 +16190,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15937,7 +16226,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15947,10 +16236,10 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15983,7 +16272,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -15993,7 +16282,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -16025,12 +16314,12 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16047,17 +16336,17 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16092,8 +16381,8 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkListCall<'a, C, A> where C: Borro /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.management().account_summaries_list() -/// .start_index(-93) -/// .max_results(-31) +/// .start_index(-74) +/// .max_results(-48) /// .doit(); /// # } /// ``` @@ -16122,7 +16411,7 @@ impl<'a, C, A> ManagementAccountSummaryListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.accountSummaries.list", + dlg.begin(MethodInfo { id: "analytics.management.accountSummaries.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._start_index { @@ -16148,7 +16437,7 @@ impl<'a, C, A> ManagementAccountSummaryListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16184,7 +16473,7 @@ impl<'a, C, A> ManagementAccountSummaryListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16194,10 +16483,10 @@ impl<'a, C, A> ManagementAccountSummaryListCall<'a, C, A> where C: BorrowMut ManagementAccountSummaryListCall<'a, C, A> where C: BorrowMut ManagementAccountSummaryListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementAccountSummaryListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementAccountSummaryListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16319,8 +16608,8 @@ impl<'a, C, A> ManagementAccountSummaryListCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customDimensions.list", + dlg.begin(MethodInfo { id: "analytics.management.customDimensions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -16400,7 +16689,7 @@ impl<'a, C, A> ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16436,7 +16725,7 @@ impl<'a, C, A> ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16446,10 +16735,10 @@ impl<'a, C, A> ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -16492,7 +16781,7 @@ impl<'a, C, A> ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -16524,12 +16813,12 @@ impl<'a, C, A> ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementCustomDimensionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomDimensionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16591,8 +16880,8 @@ impl<'a, C, A> ManagementCustomDimensionListCall<'a, C, A> where C: BorrowMut ManagementUploadListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.uploads.list", + dlg.begin(MethodInfo { id: "analytics.management.uploads.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -16674,7 +16963,7 @@ impl<'a, C, A> ManagementUploadListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16710,7 +16999,7 @@ impl<'a, C, A> ManagementUploadListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16720,10 +17009,10 @@ impl<'a, C, A> ManagementUploadListCall<'a, C, A> where C: BorrowMut ManagementUploadListCall<'a, C, A> where C: BorrowMut ManagementUploadListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -16766,7 +17055,7 @@ impl<'a, C, A> ManagementUploadListCall<'a, C, A> where C: BorrowMut ManagementUploadListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -16776,7 +17065,7 @@ impl<'a, C, A> ManagementUploadListCall<'a, C, A> where C: BorrowMut ManagementUploadListCall<'a, C, A> { self._custom_data_source_id = new_value.to_string(); @@ -16808,12 +17097,12 @@ impl<'a, C, A> ManagementUploadListCall<'a, C, A> where C: BorrowMut ManagementUploadListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementUploadListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementUploadListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16875,8 +17164,8 @@ impl<'a, C, A> ManagementUploadListCall<'a, C, A> where C: BorrowMut ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profileUserLinks.list", + dlg.begin(MethodInfo { id: "analytics.management.profileUserLinks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -16958,7 +17247,7 @@ impl<'a, C, A> ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16994,7 +17283,7 @@ impl<'a, C, A> ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17004,10 +17293,10 @@ impl<'a, C, A> ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut ManagementProfileUserLinkListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -17050,7 +17339,7 @@ impl<'a, C, A> ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut ManagementProfileUserLinkListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -17060,7 +17349,7 @@ impl<'a, C, A> ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut ManagementProfileUserLinkListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -17092,12 +17381,12 @@ impl<'a, C, A> ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementProfileUserLinkListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileUserLinkListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17159,8 +17448,8 @@ impl<'a, C, A> ManagementProfileUserLinkListCall<'a, C, A> where C: BorrowMut ManagementAccountUserLinkListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.accountUserLinks.list", + dlg.begin(MethodInfo { id: "analytics.management.accountUserLinks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -17238,7 +17527,7 @@ impl<'a, C, A> ManagementAccountUserLinkListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17274,7 +17563,7 @@ impl<'a, C, A> ManagementAccountUserLinkListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17284,10 +17573,10 @@ impl<'a, C, A> ManagementAccountUserLinkListCall<'a, C, A> where C: BorrowMut ManagementAccountUserLinkListCall<'a, C, A> where C: BorrowMut ManagementAccountUserLinkListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -17352,12 +17641,12 @@ impl<'a, C, A> ManagementAccountUserLinkListCall<'a, C, A> where C: BorrowMut ManagementAccountUserLinkListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementAccountUserLinkListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementAccountUserLinkListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17457,7 +17746,7 @@ impl<'a, C, A> ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customMetrics.update", + dlg.begin(MethodInfo { id: "analytics.management.customMetrics.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -17504,14 +17793,14 @@ impl<'a, C, A> ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17555,7 +17844,7 @@ impl<'a, C, A> ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17565,10 +17854,10 @@ impl<'a, C, A> ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut ManagementCustomMetricUpdateCall<'a, C, A> { self._request = new_value; @@ -17610,7 +17899,7 @@ impl<'a, C, A> ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut ManagementCustomMetricUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -17620,7 +17909,7 @@ impl<'a, C, A> ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut ManagementCustomMetricUpdateCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -17630,7 +17919,7 @@ impl<'a, C, A> ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut ManagementCustomMetricUpdateCall<'a, C, A> { self._custom_metric_id = new_value.to_string(); @@ -17655,12 +17944,12 @@ impl<'a, C, A> ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut ManagementCustomMetricUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementCustomMetricUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomMetricUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17758,7 +18047,7 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.uploads.deleteUploadData", + dlg.begin(MethodInfo { id: "analytics.management.uploads.deleteUploadData", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -17801,14 +18090,14 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17852,7 +18141,7 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17862,10 +18151,10 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17887,7 +18176,7 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AnalyticsDataimportDeleteUploadDataRequest) -> ManagementUploadDeleteUploadDataCall<'a, C, A> { self._request = new_value; @@ -17897,7 +18186,7 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementUploadDeleteUploadDataCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -17907,7 +18196,7 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementUploadDeleteUploadDataCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -17917,7 +18206,7 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut /// /// Sets the *custom data source id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn custom_data_source_id(mut self, new_value: &str) -> ManagementUploadDeleteUploadDataCall<'a, C, A> { self._custom_data_source_id = new_value.to_string(); @@ -17935,12 +18224,12 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17957,17 +18246,17 @@ impl<'a, C, A> ManagementUploadDeleteUploadDataCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementUploadDeleteUploadDataCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementUploadDeleteUploadDataCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18039,7 +18328,7 @@ impl<'a, C, A> ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.experiments.update", + dlg.begin(MethodInfo { id: "analytics.management.experiments.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -18084,14 +18373,14 @@ impl<'a, C, A> ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -18135,7 +18424,7 @@ impl<'a, C, A> ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18145,10 +18434,10 @@ impl<'a, C, A> ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut ManagementExperimentUpdateCall<'a, C, A> { self._request = new_value; @@ -18190,7 +18479,7 @@ impl<'a, C, A> ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut ManagementExperimentUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -18200,7 +18489,7 @@ impl<'a, C, A> ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut ManagementExperimentUpdateCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -18210,7 +18499,7 @@ impl<'a, C, A> ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut ManagementExperimentUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -18220,7 +18509,7 @@ impl<'a, C, A> ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut ManagementExperimentUpdateCall<'a, C, A> { self._experiment_id = new_value.to_string(); @@ -18238,12 +18527,12 @@ impl<'a, C, A> ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut ManagementExperimentUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementExperimentUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementExperimentUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18342,7 +18631,7 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.goals.update", + dlg.begin(MethodInfo { id: "analytics.management.goals.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -18387,14 +18676,14 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -18438,7 +18727,7 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18448,10 +18737,10 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut ManagementGoalUpdateCall<'a, C, A> { self._request = new_value; @@ -18493,7 +18782,7 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut ManagementGoalUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -18503,7 +18792,7 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut ManagementGoalUpdateCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -18513,7 +18802,7 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut ManagementGoalUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -18523,7 +18812,7 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut ManagementGoalUpdateCall<'a, C, A> { self._goal_id = new_value.to_string(); @@ -18541,12 +18830,12 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementGoalUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementGoalUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18608,8 +18897,8 @@ impl<'a, C, A> ManagementGoalUpdateCall<'a, C, A> where C: BorrowMut ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customDataSources.list", + dlg.begin(MethodInfo { id: "analytics.management.customDataSources.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -18689,7 +18978,7 @@ impl<'a, C, A> ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18725,7 +19014,7 @@ impl<'a, C, A> ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18735,10 +19024,10 @@ impl<'a, C, A> ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut ManagementCustomDataSourceListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -18781,7 +19070,7 @@ impl<'a, C, A> ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut ManagementCustomDataSourceListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -18813,12 +19102,12 @@ impl<'a, C, A> ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementCustomDataSourceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomDataSourceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18880,8 +19169,8 @@ impl<'a, C, A> ManagementCustomDataSourceListCall<'a, C, A> where C: BorrowMut ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customMetrics.list", + dlg.begin(MethodInfo { id: "analytics.management.customMetrics.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -18961,7 +19250,7 @@ impl<'a, C, A> ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18997,7 +19286,7 @@ impl<'a, C, A> ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19007,10 +19296,10 @@ impl<'a, C, A> ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut ManagementCustomMetricListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -19053,7 +19342,7 @@ impl<'a, C, A> ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut ManagementCustomMetricListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -19085,12 +19374,12 @@ impl<'a, C, A> ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementCustomMetricListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomMetricListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19152,8 +19441,8 @@ impl<'a, C, A> ManagementCustomMetricListCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.unsampledReports.list", + dlg.begin(MethodInfo { id: "analytics.management.unsampledReports.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -19235,7 +19524,7 @@ impl<'a, C, A> ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19271,7 +19560,7 @@ impl<'a, C, A> ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19281,10 +19570,10 @@ impl<'a, C, A> ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -19327,7 +19616,7 @@ impl<'a, C, A> ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -19337,7 +19626,7 @@ impl<'a, C, A> ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -19369,12 +19658,12 @@ impl<'a, C, A> ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut ManagementUnsampledReportListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementUnsampledReportListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementUnsampledReportListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19464,7 +19753,7 @@ impl<'a, C, A> ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webproperties.get", + dlg.begin(MethodInfo { id: "analytics.management.webproperties.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -19507,7 +19796,7 @@ impl<'a, C, A> ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19543,7 +19832,7 @@ impl<'a, C, A> ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19553,10 +19842,10 @@ impl<'a, C, A> ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut ManagementWebpropertyGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -19599,7 +19888,7 @@ impl<'a, C, A> ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut ManagementWebpropertyGetCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -19617,12 +19906,12 @@ impl<'a, C, A> ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut ManagementWebpropertyGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementWebpropertyGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebpropertyGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19720,7 +20009,7 @@ impl<'a, C, A> ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.experiments.insert", + dlg.begin(MethodInfo { id: "analytics.management.experiments.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -19764,14 +20053,14 @@ impl<'a, C, A> ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19815,7 +20104,7 @@ impl<'a, C, A> ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19825,10 +20114,10 @@ impl<'a, C, A> ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut ManagementExperimentInsertCall<'a, C, A> { self._request = new_value; @@ -19870,7 +20159,7 @@ impl<'a, C, A> ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut ManagementExperimentInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -19880,7 +20169,7 @@ impl<'a, C, A> ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut ManagementExperimentInsertCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -19890,7 +20179,7 @@ impl<'a, C, A> ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut ManagementExperimentInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -19908,12 +20197,12 @@ impl<'a, C, A> ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut ManagementExperimentInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementExperimentInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementExperimentInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20004,7 +20293,7 @@ impl<'a, C, A> ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customDimensions.get", + dlg.begin(MethodInfo { id: "analytics.management.customDimensions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -20048,7 +20337,7 @@ impl<'a, C, A> ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -20084,7 +20373,7 @@ impl<'a, C, A> ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20094,10 +20383,10 @@ impl<'a, C, A> ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -20140,7 +20429,7 @@ impl<'a, C, A> ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionGetCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -20150,7 +20439,7 @@ impl<'a, C, A> ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionGetCall<'a, C, A> { self._custom_dimension_id = new_value.to_string(); @@ -20168,12 +20457,12 @@ impl<'a, C, A> ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementCustomDimensionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomDimensionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20235,8 +20524,8 @@ impl<'a, C, A> ManagementCustomDimensionGetCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.list", + dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -20318,7 +20607,7 @@ impl<'a, C, A> ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -20354,7 +20643,7 @@ impl<'a, C, A> ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20364,10 +20653,10 @@ impl<'a, C, A> ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20400,7 +20689,7 @@ impl<'a, C, A> ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementProfileFilterLinkListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -20410,7 +20699,7 @@ impl<'a, C, A> ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementProfileFilterLinkListCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -20420,7 +20709,7 @@ impl<'a, C, A> ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ManagementProfileFilterLinkListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -20452,12 +20741,12 @@ impl<'a, C, A> ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20474,17 +20763,17 @@ impl<'a, C, A> ManagementProfileFilterLinkListCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementProfileFilterLinkListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileFilterLinkListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20554,7 +20843,7 @@ impl<'a, C, A> ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webproperties.patch", + dlg.begin(MethodInfo { id: "analytics.management.webproperties.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -20597,14 +20886,14 @@ impl<'a, C, A> ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -20648,7 +20937,7 @@ impl<'a, C, A> ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20658,10 +20947,10 @@ impl<'a, C, A> ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut ManagementWebpropertyPatchCall<'a, C, A> { self._request = new_value; @@ -20703,7 +20992,7 @@ impl<'a, C, A> ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut ManagementWebpropertyPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -20713,7 +21002,7 @@ impl<'a, C, A> ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut ManagementWebpropertyPatchCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -20731,12 +21020,12 @@ impl<'a, C, A> ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut ManagementWebpropertyPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementWebpropertyPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebpropertyPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20833,7 +21122,7 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customDimensions.insert", + dlg.begin(MethodInfo { id: "analytics.management.customDimensions.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -20876,14 +21165,14 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -20927,7 +21216,7 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20937,10 +21226,10 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20972,7 +21261,7 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CustomDimension) -> ManagementCustomDimensionInsertCall<'a, C, A> { self._request = new_value; @@ -20982,7 +21271,7 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementCustomDimensionInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -20992,7 +21281,7 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementCustomDimensionInsertCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -21010,12 +21299,12 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -21032,17 +21321,17 @@ impl<'a, C, A> ManagementCustomDimensionInsertCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Edit`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementCustomDimensionInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomDimensionInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21112,7 +21401,7 @@ impl<'a, C, A> ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.customMetrics.insert", + dlg.begin(MethodInfo { id: "analytics.management.customMetrics.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -21155,14 +21444,14 @@ impl<'a, C, A> ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -21206,7 +21495,7 @@ impl<'a, C, A> ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21216,10 +21505,10 @@ impl<'a, C, A> ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut ManagementCustomMetricInsertCall<'a, C, A> { self._request = new_value; @@ -21261,7 +21550,7 @@ impl<'a, C, A> ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut ManagementCustomMetricInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -21271,7 +21560,7 @@ impl<'a, C, A> ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut ManagementCustomMetricInsertCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -21289,12 +21578,12 @@ impl<'a, C, A> ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut ManagementCustomMetricInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementCustomMetricInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementCustomMetricInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21392,7 +21681,7 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profileUserLinks.insert", + dlg.begin(MethodInfo { id: "analytics.management.profileUserLinks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -21436,14 +21725,14 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -21487,7 +21776,7 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21497,10 +21786,10 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21532,7 +21821,7 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EntityUserLink) -> ManagementProfileUserLinkInsertCall<'a, C, A> { self._request = new_value; @@ -21542,7 +21831,7 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementProfileUserLinkInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -21552,7 +21841,7 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementProfileUserLinkInsertCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -21562,7 +21851,7 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ManagementProfileUserLinkInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -21580,12 +21869,12 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -21602,17 +21891,17 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementProfileUserLinkInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileUserLinkInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21647,8 +21936,8 @@ impl<'a, C, A> ManagementProfileUserLinkInsertCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.management().webproperties_list("accountId") -/// .start_index(-54) -/// .max_results(-82) +/// .start_index(-35) +/// .max_results(-65) /// .doit(); /// # } /// ``` @@ -21678,7 +21967,7 @@ impl<'a, C, A> ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webproperties.list", + dlg.begin(MethodInfo { id: "analytics.management.webproperties.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -21726,7 +22015,7 @@ impl<'a, C, A> ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -21762,7 +22051,7 @@ impl<'a, C, A> ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21772,10 +22061,10 @@ impl<'a, C, A> ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut ManagementWebpropertyListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -21840,12 +22129,12 @@ impl<'a, C, A> ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut ManagementWebpropertyListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementWebpropertyListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebpropertyListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21942,7 +22231,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.insert", + dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -21985,14 +22274,14 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -22036,7 +22325,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22046,10 +22335,10 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22081,7 +22370,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EntityAdWordsLink) -> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> { self._request = new_value; @@ -22091,7 +22380,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -22101,7 +22390,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -22119,12 +22408,12 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22141,17 +22430,17 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where C: Bor } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Edit`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22222,7 +22511,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.patch", + dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -22266,14 +22555,14 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -22317,7 +22606,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22327,10 +22616,10 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22362,7 +22651,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EntityAdWordsLink) -> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> { self._request = new_value; @@ -22372,7 +22661,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -22382,7 +22671,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -22392,7 +22681,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr /// /// Sets the *web property ad words link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_ad_words_link_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> { self._web_property_ad_words_link_id = new_value.to_string(); @@ -22410,12 +22699,12 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22432,17 +22721,17 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where C: Borr } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Edit`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22507,7 +22796,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.goals.get", + dlg.begin(MethodInfo { id: "analytics.management.goals.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -22552,7 +22841,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22588,7 +22877,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22598,10 +22887,10 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22634,7 +22923,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementGoalGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -22644,7 +22933,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementGoalGetCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -22654,7 +22943,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ManagementGoalGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -22664,7 +22953,7 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *goal id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn goal_id(mut self, new_value: &str) -> ManagementGoalGetCall<'a, C, A> { self._goal_id = new_value.to_string(); @@ -22682,12 +22971,12 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22704,17 +22993,17 @@ impl<'a, C, A> ManagementGoalGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementGoalGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementGoalGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22778,7 +23067,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.delete", + dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -22821,7 +23110,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22857,7 +23146,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22867,10 +23156,10 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22893,7 +23182,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -22903,7 +23192,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -22913,7 +23202,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor /// /// Sets the *web property ad words link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_ad_words_link_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> { self._web_property_ad_words_link_id = new_value.to_string(); @@ -22931,12 +23220,12 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22953,17 +23242,17 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where C: Bor } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Edit`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23034,7 +23323,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.update", + dlg.begin(MethodInfo { id: "analytics.management.webPropertyAdWordsLinks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -23078,14 +23367,14 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -23129,7 +23418,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23139,10 +23428,10 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23174,7 +23463,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EntityAdWordsLink) -> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> { self._request = new_value; @@ -23184,7 +23473,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -23194,7 +23483,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor /// /// Sets the *web property id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -23204,7 +23493,7 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor /// /// Sets the *web property ad words link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn web_property_ad_words_link_id(mut self, new_value: &str) -> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> { self._web_property_ad_words_link_id = new_value.to_string(); @@ -23222,12 +23511,12 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -23244,17 +23533,17 @@ impl<'a, C, A> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where C: Bor } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Edit`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementWebPropertyAdWordsLinkUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23324,7 +23613,7 @@ impl<'a, C, A> ManagementFilterPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.filters.patch", + dlg.begin(MethodInfo { id: "analytics.management.filters.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -23367,14 +23656,14 @@ impl<'a, C, A> ManagementFilterPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -23418,7 +23707,7 @@ impl<'a, C, A> ManagementFilterPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23428,10 +23717,10 @@ impl<'a, C, A> ManagementFilterPatchCall<'a, C, A> where C: BorrowMut ManagementFilterPatchCall<'a, C, A> where C: BorrowMut ManagementFilterPatchCall<'a, C, A> { self._request = new_value; @@ -23473,7 +23762,7 @@ impl<'a, C, A> ManagementFilterPatchCall<'a, C, A> where C: BorrowMut ManagementFilterPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -23483,7 +23772,7 @@ impl<'a, C, A> ManagementFilterPatchCall<'a, C, A> where C: BorrowMut ManagementFilterPatchCall<'a, C, A> { self._filter_id = new_value.to_string(); @@ -23501,12 +23790,12 @@ impl<'a, C, A> ManagementFilterPatchCall<'a, C, A> where C: BorrowMut ManagementFilterPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementFilterPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementFilterPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23568,8 +23857,8 @@ impl<'a, C, A> ManagementFilterPatchCall<'a, C, A> where C: BorrowMut ManagementFilterListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.filters.list", + dlg.begin(MethodInfo { id: "analytics.management.filters.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -23647,7 +23936,7 @@ impl<'a, C, A> ManagementFilterListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23683,7 +23972,7 @@ impl<'a, C, A> ManagementFilterListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23693,10 +23982,10 @@ impl<'a, C, A> ManagementFilterListCall<'a, C, A> where C: BorrowMut ManagementFilterListCall<'a, C, A> where C: BorrowMut ManagementFilterListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -23761,12 +24050,12 @@ impl<'a, C, A> ManagementFilterListCall<'a, C, A> where C: BorrowMut ManagementFilterListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementFilterListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementFilterListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23856,7 +24145,7 @@ impl<'a, C, A> ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.filters.delete", + dlg.begin(MethodInfo { id: "analytics.management.filters.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -23899,7 +24188,7 @@ impl<'a, C, A> ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23935,7 +24224,7 @@ impl<'a, C, A> ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23945,10 +24234,10 @@ impl<'a, C, A> ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut ManagementFilterDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -23991,7 +24280,7 @@ impl<'a, C, A> ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut ManagementFilterDeleteCall<'a, C, A> { self._filter_id = new_value.to_string(); @@ -24009,12 +24298,12 @@ impl<'a, C, A> ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut ManagementFilterDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementFilterDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementFilterDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24111,7 +24400,7 @@ impl<'a, C, A> ManagementProfileInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profiles.insert", + dlg.begin(MethodInfo { id: "analytics.management.profiles.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -24154,14 +24443,14 @@ impl<'a, C, A> ManagementProfileInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -24205,7 +24494,7 @@ impl<'a, C, A> ManagementProfileInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24215,10 +24504,10 @@ impl<'a, C, A> ManagementProfileInsertCall<'a, C, A> where C: BorrowMut ManagementProfileInsertCall<'a, C, A> where C: BorrowMut ManagementProfileInsertCall<'a, C, A> { self._request = new_value; @@ -24260,7 +24549,7 @@ impl<'a, C, A> ManagementProfileInsertCall<'a, C, A> where C: BorrowMut ManagementProfileInsertCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -24270,7 +24559,7 @@ impl<'a, C, A> ManagementProfileInsertCall<'a, C, A> where C: BorrowMut ManagementProfileInsertCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -24288,12 +24577,12 @@ impl<'a, C, A> ManagementProfileInsertCall<'a, C, A> where C: BorrowMut ManagementProfileInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementProfileInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24383,7 +24672,7 @@ impl<'a, C, A> ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.accountUserLinks.delete", + dlg.begin(MethodInfo { id: "analytics.management.accountUserLinks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -24425,7 +24714,7 @@ impl<'a, C, A> ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -24461,7 +24750,7 @@ impl<'a, C, A> ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24471,10 +24760,10 @@ impl<'a, C, A> ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24497,7 +24786,7 @@ impl<'a, C, A> ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> ManagementAccountUserLinkDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -24507,7 +24796,7 @@ impl<'a, C, A> ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< /// /// Sets the *link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn link_id(mut self, new_value: &str) -> ManagementAccountUserLinkDeleteCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -24525,12 +24814,12 @@ impl<'a, C, A> ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -24547,17 +24836,17 @@ impl<'a, C, A> ManagementAccountUserLinkDeleteCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageUser`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagementAccountUserLinkDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementAccountUserLinkDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24628,7 +24917,7 @@ impl<'a, C, A> ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profiles.update", + dlg.begin(MethodInfo { id: "analytics.management.profiles.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -24672,14 +24961,14 @@ impl<'a, C, A> ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -24723,7 +25012,7 @@ impl<'a, C, A> ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24733,10 +25022,10 @@ impl<'a, C, A> ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut ManagementProfileUpdateCall<'a, C, A> { self._request = new_value; @@ -24778,7 +25067,7 @@ impl<'a, C, A> ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut ManagementProfileUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -24788,7 +25077,7 @@ impl<'a, C, A> ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut ManagementProfileUpdateCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -24798,7 +25087,7 @@ impl<'a, C, A> ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut ManagementProfileUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -24816,12 +25105,12 @@ impl<'a, C, A> ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut ManagementProfileUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementProfileUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24913,7 +25202,7 @@ impl<'a, C, A> ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.get", + dlg.begin(MethodInfo { id: "analytics.management.profileFilterLinks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -24958,7 +25247,7 @@ impl<'a, C, A> ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -24994,7 +25283,7 @@ impl<'a, C, A> ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25004,10 +25293,10 @@ impl<'a, C, A> ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -25050,7 +25339,7 @@ impl<'a, C, A> ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkGetCall<'a, C, A> { self._web_property_id = new_value.to_string(); @@ -25060,7 +25349,7 @@ impl<'a, C, A> ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -25070,7 +25359,7 @@ impl<'a, C, A> ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkGetCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -25088,12 +25377,12 @@ impl<'a, C, A> ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ManagementProfileFilterLinkGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagementProfileFilterLinkGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25155,12 +25444,12 @@ impl<'a, C, A> ManagementProfileFilterLinkGetCall<'a, C, A> where C: BorrowMut DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.data.mcf.get", + dlg.begin(MethodInfo { id: "analytics.data.mcf.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("ids", self._ids.to_string())); @@ -25239,7 +25528,7 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25275,7 +25564,7 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25285,10 +25574,10 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25321,7 +25610,7 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *ids* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ids(mut self, new_value: &str) -> DataMcfGetCall<'a, C, A> { self._ids = new_value.to_string(); @@ -25331,7 +25620,7 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *start-date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn start_date(mut self, new_value: &str) -> DataMcfGetCall<'a, C, A> { self._start_date = new_value.to_string(); @@ -25341,7 +25630,7 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *end-date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn end_date(mut self, new_value: &str) -> DataMcfGetCall<'a, C, A> { self._end_date = new_value.to_string(); @@ -25351,7 +25640,7 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *metrics* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn metrics(mut self, new_value: &str) -> DataMcfGetCall<'a, C, A> { self._metrics = new_value.to_string(); @@ -25411,12 +25700,12 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25433,17 +25722,17 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DataMcfGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DataMcfGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25478,14 +25767,15 @@ impl<'a, C, A> DataMcfGetCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.data().ga_get("ids", "start-date", "end-date", "metrics") -/// .start_index(-99) -/// .sort("Lorem") -/// .segment("dolor") -/// .sampling_level("vero") -/// .output("nonumy") -/// .max_results(-8) +/// .start_index(-91) +/// .sort("takimata") +/// .segment("dolores") +/// .sampling_level("consetetur") +/// .output("erat") +/// .max_results(-52) +/// .include_empty_rows(true) /// .filters("dolores") -/// .dimensions("consetetur") +/// .dimensions("et") /// .doit(); /// # } /// ``` @@ -25503,6 +25793,7 @@ pub struct DataGaGetCall<'a, C, A> _sampling_level: Option, _output: Option, _max_results: Option, + _include_empty_rows: Option, _filters: Option, _dimensions: Option, _delegate: Option<&'a mut Delegate>, @@ -25524,9 +25815,9 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.data.ga.get", + dlg.begin(MethodInfo { id: "analytics.data.ga.get", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((14 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); params.push(("ids", self._ids.to_string())); params.push(("start-date", self._start_date.to_string())); params.push(("end-date", self._end_date.to_string())); @@ -25549,13 +25840,16 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau if let Some(value) = self._max_results { params.push(("max-results", value.to_string())); } + if let Some(value) = self._include_empty_rows { + params.push(("include-empty-rows", value.to_string())); + } if let Some(value) = self._filters { params.push(("filters", value.to_string())); } if let Some(value) = self._dimensions { params.push(("dimensions", value.to_string())); } - for &field in ["alt", "ids", "start-date", "end-date", "metrics", "start-index", "sort", "segment", "samplingLevel", "output", "max-results", "filters", "dimensions"].iter() { + for &field in ["alt", "ids", "start-date", "end-date", "metrics", "start-index", "sort", "segment", "samplingLevel", "output", "max-results", "include-empty-rows", "filters", "dimensions"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -25572,7 +25866,7 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25608,7 +25902,7 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25618,10 +25912,10 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25654,7 +25948,7 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *ids* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ids(mut self, new_value: &str) -> DataGaGetCall<'a, C, A> { self._ids = new_value.to_string(); @@ -25664,7 +25958,7 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *start-date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn start_date(mut self, new_value: &str) -> DataGaGetCall<'a, C, A> { self._start_date = new_value.to_string(); @@ -25674,7 +25968,7 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *end-date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn end_date(mut self, new_value: &str) -> DataGaGetCall<'a, C, A> { self._end_date = new_value.to_string(); @@ -25684,7 +25978,7 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *metrics* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn metrics(mut self, new_value: &str) -> DataGaGetCall<'a, C, A> { self._metrics = new_value.to_string(); @@ -25732,6 +26026,13 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau self._max_results = Some(new_value); self } + /// The response will include empty rows if this parameter is set to true, the default is true + /// + /// Sets the *include-empty-rows* query property to the given value. + pub fn include_empty_rows(mut self, new_value: bool) -> DataGaGetCall<'a, C, A> { + self._include_empty_rows = Some(new_value); + self + } /// A comma-separated list of dimension or metric filters to be applied to Analytics data. /// /// Sets the *filters* query property to the given value. @@ -25758,12 +26059,12 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25780,17 +26081,17 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DataGaGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DataGaGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25825,10 +26126,10 @@ impl<'a, C, A> DataGaGetCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.data().realtime_get("ids", "metrics") -/// .sort("dolores") -/// .max_results(-69) -/// .filters("et") -/// .dimensions("sed") +/// .sort("aliquyam") +/// .max_results(-91) +/// .filters("sit") +/// .dimensions("aliquyam") /// .doit(); /// # } /// ``` @@ -25861,7 +26162,7 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.data.realtime.get", + dlg.begin(MethodInfo { id: "analytics.data.realtime.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("ids", self._ids.to_string())); @@ -25895,7 +26196,7 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25931,7 +26232,7 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25941,10 +26242,10 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25977,7 +26278,7 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *ids* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ids(mut self, new_value: &str) -> DataRealtimeGetCall<'a, C, A> { self._ids = new_value.to_string(); @@ -25987,7 +26288,7 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *metrics* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn metrics(mut self, new_value: &str) -> DataRealtimeGetCall<'a, C, A> { self._metrics = new_value.to_string(); @@ -26033,12 +26334,12 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26055,17 +26356,17 @@ impl<'a, C, A> DataRealtimeGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DataRealtimeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DataRealtimeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26133,7 +26434,7 @@ impl<'a, C, A> ProvisioningCreateAccountTicketCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.provisioning.createAccountTicket", + dlg.begin(MethodInfo { id: "analytics.provisioning.createAccountTicket", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -26153,14 +26454,14 @@ impl<'a, C, A> ProvisioningCreateAccountTicketCall<'a, C, A> where C: BorrowMut< self._scopes.insert(Scope::Provision.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -26204,7 +26505,7 @@ impl<'a, C, A> ProvisioningCreateAccountTicketCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26214,10 +26515,10 @@ impl<'a, C, A> ProvisioningCreateAccountTicketCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26249,7 +26550,7 @@ impl<'a, C, A> ProvisioningCreateAccountTicketCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AccountTicket) -> ProvisioningCreateAccountTicketCall<'a, C, A> { self._request = new_value; @@ -26267,12 +26568,12 @@ impl<'a, C, A> ProvisioningCreateAccountTicketCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26289,17 +26590,17 @@ impl<'a, C, A> ProvisioningCreateAccountTicketCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Provision`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProvisioningCreateAccountTicketCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProvisioningCreateAccountTicketCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26361,7 +26662,7 @@ impl<'a, C, A> MetadataColumnListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "analytics.metadata.columns.list", + dlg.begin(MethodInfo { id: "analytics.metadata.columns.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("reportType", self._report_type.to_string())); @@ -26403,7 +26704,7 @@ impl<'a, C, A> MetadataColumnListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -26439,7 +26740,7 @@ impl<'a, C, A> MetadataColumnListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26449,10 +26750,10 @@ impl<'a, C, A> MetadataColumnListCall<'a, C, A> where C: BorrowMut MetadataColumnListCall<'a, C, A> where C: BorrowMut MetadataColumnListCall<'a, C, A> { self._report_type = new_value.to_string(); @@ -26503,12 +26804,12 @@ impl<'a, C, A> MetadataColumnListCall<'a, C, A> where C: BorrowMut MetadataColumnListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MetadataColumnListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MetadataColumnListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/androidenterprise1-cli/Cargo.toml b/gen/androidenterprise1-cli/Cargo.toml index c088a898e9..3c6f49704d 100644 --- a/gen/androidenterprise1-cli/Cargo.toml +++ b/gen/androidenterprise1-cli/Cargo.toml @@ -4,11 +4,11 @@ [package] name = "google-androidenterprise1-cli" -version = "0.3.2+20150922" +version = "0.3.3+20160106" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Enterprise (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidenterprise1-cli" -homepage = "https://developers.google.com/play/enterprise" +homepage = "https://developers.google.com/android/work/play/emm-api" documentation = "http://byron.github.io/google-apis-rs/google_androidenterprise1_cli" license = "MIT" keywords = ["androidenterprise", "google", "cli"] @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/androidenterprise1-cli/LICENSE.md b/gen/androidenterprise1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/androidenterprise1-cli/LICENSE.md +++ b/gen/androidenterprise1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/androidenterprise1-cli/README.md b/gen/androidenterprise1-cli/README.md index 784f8f34d2..628942dc3a 100644 --- a/gen/androidenterprise1-cli/README.md +++ b/gen/androidenterprise1-cli/README.md @@ -11,20 +11,20 @@ capabilities. Errors will be printed to standard error, and cause the program's If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. Everything else about the *Android Enterprise* API can be found at the -[official documentation site](https://developers.google.com/play/enterprise). +[official documentation site](https://developers.google.com/android/work/play/emm-api). # Downloads You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/androidenterprise1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/androidenterprise1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/androidenterprise1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/androidenterprise1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/androidenterprise1-cli). # Usage -This documentation was generated from the *Android Enterprise* API at revision *20150922*. The CLI is at version *0.3.2*. +This documentation was generated from the *Android Enterprise* API at revision *20160106*. The CLI is at version *0.3.3*. ```bash androidenterprise1 [options] @@ -50,10 +50,12 @@ androidenterprise1 [options] delete [-p ]... enroll (-r )... [-p ]... [-o ] get [-p ]... [-o ] + get-store-layout [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] send-test-push-notification [-p ]... [-o ] set-account (-r )... [-p ]... [-o ] + set-store-layout (-r )... [-p ]... [-o ] unenroll [-p ]... entitlements delete [-p ]... @@ -81,6 +83,20 @@ androidenterprise1 [options] get-app-restrictions-schema [-p ]... [-o ] get-permissions [-p ]... [-o ] update-permissions (-r )... [-p ]... [-o ] + storelayoutclusters + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + storelayoutpages + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] users generate-token [-p ]... [-o ] get [-p ]... [-o ] @@ -92,18 +108,18 @@ androidenterprise1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/androidenterprise1-cli/mkdocs.yml b/gen/androidenterprise1-cli/mkdocs.yml index 09018b6ea2..0f9e783573 100644 --- a/gen/androidenterprise1-cli/mkdocs.yml +++ b/gen/androidenterprise1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Enterprise v0.3.2+20150922 +site_name: Android Enterprise v0.3.3+20160106 site_url: http://byron.github.io/google-apis-rs/google-androidenterprise1-cli site_description: Write integrating applications with bcore @@ -27,10 +27,12 @@ pages: - ['enterprises_delete.md', 'Enterprises', 'Delete'] - ['enterprises_enroll.md', 'Enterprises', 'Enroll'] - ['enterprises_get.md', 'Enterprises', 'Get'] +- ['enterprises_get-store-layout.md', 'Enterprises', 'Get Store Layout'] - ['enterprises_insert.md', 'Enterprises', 'Insert'] - ['enterprises_list.md', 'Enterprises', 'List'] - ['enterprises_send-test-push-notification.md', 'Enterprises', 'Send Test Push Notification'] - ['enterprises_set-account.md', 'Enterprises', 'Set Account'] +- ['enterprises_set-store-layout.md', 'Enterprises', 'Set Store Layout'] - ['enterprises_unenroll.md', 'Enterprises', 'Unenroll'] - ['entitlements_delete.md', 'Entitlements', 'Delete'] - ['entitlements_get.md', 'Entitlements', 'Get'] @@ -52,6 +54,18 @@ pages: - ['products_get-app-restrictions-schema.md', 'Products', 'Get App Restrictions Schema'] - ['products_get-permissions.md', 'Products', 'Get Permissions'] - ['products_update-permissions.md', 'Products', 'Update Permissions'] +- ['storelayoutclusters_delete.md', 'Storelayoutclusters', 'Delete'] +- ['storelayoutclusters_get.md', 'Storelayoutclusters', 'Get'] +- ['storelayoutclusters_insert.md', 'Storelayoutclusters', 'Insert'] +- ['storelayoutclusters_list.md', 'Storelayoutclusters', 'List'] +- ['storelayoutclusters_patch.md', 'Storelayoutclusters', 'Patch'] +- ['storelayoutclusters_update.md', 'Storelayoutclusters', 'Update'] +- ['storelayoutpages_delete.md', 'Storelayoutpages', 'Delete'] +- ['storelayoutpages_get.md', 'Storelayoutpages', 'Get'] +- ['storelayoutpages_insert.md', 'Storelayoutpages', 'Insert'] +- ['storelayoutpages_list.md', 'Storelayoutpages', 'List'] +- ['storelayoutpages_patch.md', 'Storelayoutpages', 'Patch'] +- ['storelayoutpages_update.md', 'Storelayoutpages', 'Update'] - ['users_generate-token.md', 'Users', 'Generate Token'] - ['users_get.md', 'Users', 'Get'] - ['users_get-available-product-set.md', 'Users', 'Get Available Product Set'] @@ -61,5 +75,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/androidenterprise1-cli/src/main.rs b/gen/androidenterprise1-cli/src/main.rs index 5bfb44be9f..c0d4db8266 100644 --- a/gen/androidenterprise1-cli/src/main.rs +++ b/gen/androidenterprise1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::AndroidEnterprise>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _collections_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _collections_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.collections().delete(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("collection-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -89,10 +89,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _collections_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _collections_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.collections().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("collection-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -105,7 +105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -141,13 +141,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _collections_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _collections_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -161,8 +161,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -181,7 +181,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Collection = json::value::from_value(object).unwrap(); let mut call = self.hub.collections().insert(request, opt.value_of("enterprise-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -194,7 +194,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -207,7 +207,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -230,10 +230,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _collections_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _collections_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.collections().list(opt.value_of("enterprise-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -246,7 +246,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -259,7 +259,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -282,13 +282,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _collections_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _collections_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -302,8 +302,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -322,7 +322,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Collection = json::value::from_value(object).unwrap(); let mut call = self.hub.collections().patch(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("collection-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -335,7 +335,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -348,7 +348,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -371,13 +371,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _collections_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _collections_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -391,8 +391,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -411,7 +411,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Collection = json::value::from_value(object).unwrap(); let mut call = self.hub.collections().update(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("collection-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -424,7 +424,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -437,7 +437,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -460,10 +460,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _collectionviewers_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _collectionviewers_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.collectionviewers().delete(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("collection-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -476,7 +476,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -489,7 +489,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -504,10 +504,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _collectionviewers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _collectionviewers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.collectionviewers().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("collection-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -520,7 +520,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -533,7 +533,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -556,10 +556,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _collectionviewers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _collectionviewers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.collectionviewers().list(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("collection-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -572,7 +572,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -585,7 +585,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -608,13 +608,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _collectionviewers_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _collectionviewers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -628,8 +628,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-email" => Some(("primaryEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -646,7 +646,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::User = json::value::from_value(object).unwrap(); let mut call = self.hub.collectionviewers().patch(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("collection-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -659,7 +659,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -672,7 +672,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -695,13 +695,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _collectionviewers_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _collectionviewers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -715,8 +715,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-email" => Some(("primaryEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -733,7 +733,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::User = json::value::from_value(object).unwrap(); let mut call = self.hub.collectionviewers().update(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("collection-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -746,7 +746,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -759,7 +759,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -782,10 +782,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _devices_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _devices_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.devices().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("device-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -798,7 +798,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -811,7 +811,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -834,10 +834,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _devices_get_state(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _devices_get_state(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.devices().get_state(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("device-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -850,7 +850,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -863,7 +863,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -886,10 +886,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _devices_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _devices_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.devices().list(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -902,7 +902,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -915,7 +915,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -938,13 +938,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _devices_set_state(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _devices_set_state(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -958,8 +958,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-state" => Some(("accountState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -975,7 +975,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DeviceState = json::value::from_value(object).unwrap(); let mut call = self.hub.devices().set_state(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("device-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -988,7 +988,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1001,7 +1001,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1024,10 +1024,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _enterprises_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _enterprises_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.enterprises().delete(opt.value_of("enterprise-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1040,7 +1040,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1053,7 +1053,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1068,13 +1068,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _enterprises_enroll(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _enterprises_enroll(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1088,8 +1088,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-domain" => Some(("primaryDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1107,7 +1107,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Enterprise = json::value::from_value(object).unwrap(); let mut call = self.hub.enterprises().enroll(request, opt.value_of("token").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1120,7 +1120,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1133,7 +1133,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1156,10 +1156,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _enterprises_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _enterprises_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.enterprises().get(opt.value_of("enterprise-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1172,7 +1172,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1185,7 +1185,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1208,13 +1208,65 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _enterprises_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _enterprises_get_store_layout(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.enterprises().get_store_layout(opt.value_of("enterprise-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _enterprises_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1228,8 +1280,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-domain" => Some(("primaryDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1247,7 +1299,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Enterprise = json::value::from_value(object).unwrap(); let mut call = self.hub.enterprises().insert(request, opt.value_of("token").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1260,7 +1312,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1273,7 +1325,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1296,10 +1348,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _enterprises_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _enterprises_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.enterprises().list(opt.value_of("domain").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1312,7 +1364,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1325,7 +1377,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1348,10 +1400,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _enterprises_send_test_push_notification(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _enterprises_send_test_push_notification(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.enterprises().send_test_push_notification(opt.value_of("enterprise-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1364,7 +1416,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1377,7 +1429,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1400,13 +1452,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _enterprises_set_account(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _enterprises_set_account(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1420,8 +1472,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-email" => Some(("accountEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1437,7 +1489,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EnterpriseAccount = json::value::from_value(object).unwrap(); let mut call = self.hub.enterprises().set_account(request, opt.value_of("enterprise-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1450,7 +1502,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1463,7 +1515,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1486,205 +1538,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _enterprises_unenroll(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.enterprises().unenroll(opt.value_of("enterprise-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _entitlements_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.entitlements().delete(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("entitlement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _entitlements_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.entitlements().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("entitlement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _entitlements_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.entitlements().list(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _entitlements_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _enterprises_set_store_layout(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1698,8 +1558,286 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "homepage-id" => Some(("homepageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["homepage-id", "kind"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StoreLayout = json::value::from_value(object).unwrap(); + let mut call = self.hub.enterprises().set_store_layout(request, opt.value_of("enterprise-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _enterprises_unenroll(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.enterprises().unenroll(opt.value_of("enterprise-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _entitlements_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.entitlements().delete(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("entitlement-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _entitlements_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.entitlements().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("entitlement-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _entitlements_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.entitlements().list(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _entitlements_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reason" => Some(("reason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1716,7 +1854,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Entitlement = json::value::from_value(object).unwrap(); let mut call = self.hub.entitlements().patch(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("entitlement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "install" => { @@ -1732,7 +1870,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["install"].iter().map(|v|*v)); @@ -1746,7 +1884,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1769,13 +1907,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _entitlements_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _entitlements_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1789,8 +1927,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reason" => Some(("reason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1807,7 +1945,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Entitlement = json::value::from_value(object).unwrap(); let mut call = self.hub.entitlements().update(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("entitlement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "install" => { @@ -1823,7 +1961,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["install"].iter().map(|v|*v)); @@ -1837,7 +1975,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1860,10 +1998,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _grouplicenses_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _grouplicenses_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.grouplicenses().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("group-license-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1876,7 +2014,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1889,7 +2027,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1912,10 +2050,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _grouplicenses_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _grouplicenses_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.grouplicenses().list(opt.value_of("enterprise-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1928,7 +2066,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1941,7 +2079,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1964,10 +2102,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _grouplicenseusers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _grouplicenseusers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.grouplicenseusers().list(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("group-license-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1980,7 +2118,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1993,7 +2131,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2016,10 +2154,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _installs_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _installs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.installs().delete(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("device-id").unwrap_or(""), opt.value_of("install-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2032,7 +2170,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2045,7 +2183,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2060,10 +2198,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _installs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _installs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.installs().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("device-id").unwrap_or(""), opt.value_of("install-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2076,7 +2214,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2089,7 +2227,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2112,10 +2250,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _installs_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _installs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.installs().list(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("device-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2128,7 +2266,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2141,7 +2279,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2164,13 +2302,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _installs_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _installs_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2184,8 +2322,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "install-state" => Some(("installState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version-code" => Some(("versionCode", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2203,7 +2341,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Install = json::value::from_value(object).unwrap(); let mut call = self.hub.installs().patch(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("device-id").unwrap_or(""), opt.value_of("install-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2216,7 +2354,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2229,7 +2367,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2252,13 +2390,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _installs_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _installs_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2272,8 +2410,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "install-state" => Some(("installState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "version-code" => Some(("versionCode", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2291,7 +2429,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Install = json::value::from_value(object).unwrap(); let mut call = self.hub.installs().update(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or(""), opt.value_of("device-id").unwrap_or(""), opt.value_of("install-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2304,7 +2442,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2317,7 +2455,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2340,10 +2478,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _permissions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.permissions().get(opt.value_of("permission-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2359,7 +2497,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -2373,7 +2511,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2396,13 +2534,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_approve(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_approve(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2416,8 +2554,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "approval-url-info.kind" => Some(("approvalUrlInfo.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "approval-url-info.approval-url" => Some(("approvalUrlInfo.approvalUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2433,7 +2571,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ProductsApproveRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.products().approve(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("product-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2446,7 +2584,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2459,7 +2597,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2474,10 +2612,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_generate_approval_url(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_generate_approval_url(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.products().generate_approval_url(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("product-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language-code" => { @@ -2493,7 +2631,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language-code"].iter().map(|v|*v)); @@ -2507,7 +2645,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2530,10 +2668,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.products().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("product-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2549,7 +2687,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -2563,7 +2701,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2586,10 +2724,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_get_app_restrictions_schema(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_get_app_restrictions_schema(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.products().get_app_restrictions_schema(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("product-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2605,7 +2743,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -2619,7 +2757,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2642,10 +2780,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_get_permissions(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_get_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.products().get_permissions(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("product-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2658,7 +2796,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2671,7 +2809,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2694,13 +2832,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_update_permissions(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_update_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2714,8 +2852,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2731,7 +2869,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ProductPermissions = json::value::from_value(object).unwrap(); let mut call = self.hub.products().update_permissions(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("product-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2744,7 +2882,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2757,7 +2895,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2780,10 +2918,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_generate_token(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _storelayoutclusters_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.users().generate_token(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.storelayoutclusters().delete(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("page-id").unwrap_or(""), opt.value_of("cluster-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2796,7 +2934,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2809,215 +2947,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _users_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.users().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _users_get_available_product_set(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.users().get_available_product_set(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _users_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.users().list(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("email").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _users_revoke_token(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.users().revoke_token(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3032,13 +2962,65 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_set_available_product_set(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _storelayoutclusters_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.storelayoutclusters().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("page-id").unwrap_or(""), opt.value_of("cluster-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _storelayoutclusters_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3052,8 +3034,985 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "order-in-page" => Some(("orderInPage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "order-in-page", "product-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StoreCluster = json::value::from_value(object).unwrap(); + let mut call = self.hub.storelayoutclusters().insert(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _storelayoutclusters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.storelayoutclusters().list(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _storelayoutclusters_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "order-in-page" => Some(("orderInPage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "order-in-page", "product-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StoreCluster = json::value::from_value(object).unwrap(); + let mut call = self.hub.storelayoutclusters().patch(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("page-id").unwrap_or(""), opt.value_of("cluster-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _storelayoutclusters_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "order-in-page" => Some(("orderInPage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "order-in-page", "product-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StoreCluster = json::value::from_value(object).unwrap(); + let mut call = self.hub.storelayoutclusters().update(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("page-id").unwrap_or(""), opt.value_of("cluster-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _storelayoutpages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.storelayoutpages().delete(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _storelayoutpages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.storelayoutpages().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _storelayoutpages_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "link" => Some(("link", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "link"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StorePage = json::value::from_value(object).unwrap(); + let mut call = self.hub.storelayoutpages().insert(request, opt.value_of("enterprise-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _storelayoutpages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.storelayoutpages().list(opt.value_of("enterprise-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _storelayoutpages_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "link" => Some(("link", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "link"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StorePage = json::value::from_value(object).unwrap(); + let mut call = self.hub.storelayoutpages().patch(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _storelayoutpages_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "link" => Some(("link", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "link"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StorePage = json::value::from_value(object).unwrap(); + let mut call = self.hub.storelayoutpages().update(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _users_generate_token(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.users().generate_token(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _users_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.users().get(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _users_get_available_product_set(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.users().get_available_product_set(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _users_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.users().list(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("email").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _users_revoke_token(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.users().revoke_token(opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _users_set_available_product_set(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "product-id" => Some(("productId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -3069,7 +4028,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ProductSet = json::value::from_value(object).unwrap(); let mut call = self.hub.users().set_available_product_set(request, opt.value_of("enterprise-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3082,7 +4041,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3095,7 +4054,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3203,6 +4162,9 @@ impl<'n, 'a> Engine<'n, 'a> { ("get", Some(opt)) => { call_result = self._enterprises_get(opt, dry_run, &mut err); }, + ("get-store-layout", Some(opt)) => { + call_result = self._enterprises_get_store_layout(opt, dry_run, &mut err); + }, ("insert", Some(opt)) => { call_result = self._enterprises_insert(opt, dry_run, &mut err); }, @@ -3215,6 +4177,9 @@ impl<'n, 'a> Engine<'n, 'a> { ("set-account", Some(opt)) => { call_result = self._enterprises_set_account(opt, dry_run, &mut err); }, + ("set-store-layout", Some(opt)) => { + call_result = self._enterprises_set_store_layout(opt, dry_run, &mut err); + }, ("unenroll", Some(opt)) => { call_result = self._enterprises_unenroll(opt, dry_run, &mut err); }, @@ -3332,6 +4297,58 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, + ("storelayoutclusters", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._storelayoutclusters_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._storelayoutclusters_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._storelayoutclusters_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._storelayoutclusters_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._storelayoutclusters_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._storelayoutclusters_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("storelayoutclusters".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("storelayoutpages", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._storelayoutpages_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._storelayoutpages_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._storelayoutpages_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._storelayoutpages_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._storelayoutpages_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._storelayoutpages_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("storelayoutpages".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("users", Some(opt)) => { match opt.subcommand() { ("generate-token", Some(opt)) => { @@ -3375,14 +4392,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "androidenterprise1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "androidenterprise1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -3402,7 +4419,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -3441,7 +4458,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("collections", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a collection."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collections_delete", vec![ @@ -3463,7 +4480,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves the details of a collection."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collections_get", vec![ @@ -3491,7 +4508,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new collection."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collections_insert", vec![ @@ -3519,7 +4536,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the IDs of all the collections for an enterprise."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collections_list", vec![ @@ -3541,7 +4558,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a collection. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collections_patch", vec![ @@ -3575,7 +4592,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a collection."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collections_update", vec![ @@ -3612,7 +4629,7 @@ fn main() { ]), ("collectionviewers", "methods: 'delete', 'get', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Removes the user from the list of those specifically allowed to see the collection. If the collection's visibility is set to viewersOnly then only such users will see the collection."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collectionviewers_delete", vec![ @@ -3640,7 +4657,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves the ID of the user if they have been specifically allowed to see the collection. If the collection's visibility is set to viewersOnly then only these users will see the collection."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collectionviewers_get", vec![ @@ -3674,7 +4691,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the IDs of the users who have been specifically allowed to see the collection. If the collection's visibility is set to viewersOnly then only these users will see the collection."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collectionviewers_list", vec![ @@ -3702,7 +4719,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Adds the user to the list of those specifically allowed to see the collection. If the collection's visibility is set to viewersOnly then only such users will see the collection. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collectionviewers_patch", vec![ @@ -3742,7 +4759,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Adds the user to the list of those specifically allowed to see the collection. If the collection's visibility is set to viewersOnly then only such users will see the collection."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/collectionviewers_update", vec![ @@ -3785,7 +4802,7 @@ fn main() { ]), ("devices", "methods: 'get', 'get-state', 'list' and 'set-state'", vec![ - ("get", + ("get", Some(r##"Retrieves the details of a device."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/devices_get", vec![ @@ -3819,7 +4836,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-state", + ("get-state", Some(r##"Retrieves whether a device is enabled or disabled for access by the user to Google services. The device state takes effect only if enforcing EMM policies on Android devices is enabled in the Google Admin Console. Otherwise, the device state is ignored and all devices are allowed access to Google services."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/devices_get-state", vec![ @@ -3853,7 +4870,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the IDs of all of a user's devices."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/devices_list", vec![ @@ -3881,7 +4898,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-state", + ("set-state", Some(r##"Sets whether a device is enabled or disabled for access by the user to Google services. The device state takes effect only if enforcing EMM policies on Android devices is enabled in the Google Admin Console. Otherwise, the device state is ignored and all devices are allowed access to Google services."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/devices_set-state", vec![ @@ -3923,8 +4940,8 @@ fn main() { ]), ]), - ("enterprises", "methods: 'delete', 'enroll', 'get', 'insert', 'list', 'send-test-push-notification', 'set-account' and 'unenroll'", vec![ - ("delete", + ("enterprises", "methods: 'delete', 'enroll', 'get', 'get-store-layout', 'insert', 'list', 'send-test-push-notification', 'set-account', 'set-store-layout' and 'unenroll'", vec![ + ("delete", Some(r##"Deletes the binding between the MDM and enterprise. This is now deprecated; use this to unenroll customers that were previously enrolled with the 'insert' call, then enroll them again with the 'enroll' call."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_delete", vec![ @@ -3940,7 +4957,7 @@ fn main() { Some(false), Some(true)), ]), - ("enroll", + ("enroll", Some(r##"Enrolls an enterprise with the calling MDM."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_enroll", vec![ @@ -3968,7 +4985,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves the name and domain of an enterprise."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_get", vec![ @@ -3990,7 +5007,29 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("get-store-layout", + Some(r##"Returns the store layout resource."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_get-store-layout", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", Some(r##"Establishes the binding between the MDM and an enterprise. This is now deprecated; use enroll instead."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_insert", vec![ @@ -4018,7 +5057,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Looks up an enterprise by domain name."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_list", vec![ @@ -4040,7 +5079,7 @@ fn main() { Some(false), Some(false)), ]), - ("send-test-push-notification", + ("send-test-push-notification", Some(r##"Sends a test push notification to validate the MDM integration with the Google Cloud Pub/Sub service for this enterprise."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_send-test-push-notification", vec![ @@ -4062,7 +5101,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-account", + ("set-account", Some(r##"Set the account that will be used to authenticate to the API as the enterprise."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_set-account", vec![ @@ -4090,7 +5129,35 @@ fn main() { Some(false), Some(false)), ]), - ("unenroll", + ("set-store-layout", + Some(r##"Sets the store layout resource."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_set-store-layout", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("unenroll", Some(r##"Unenrolls an enterprise from the calling MDM."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/enterprises_unenroll", vec![ @@ -4109,7 +5176,7 @@ fn main() { ]), ("entitlements", "methods: 'delete', 'get', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Removes an entitlement to an app for a user and uninstalls it."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/entitlements_delete", vec![ @@ -4137,7 +5204,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves details of an entitlement."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/entitlements_get", vec![ @@ -4171,7 +5238,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List of all entitlements for the specified user. Only the ID is set."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/entitlements_list", vec![ @@ -4199,7 +5266,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Adds or updates an entitlement to an app for a user. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/entitlements_patch", vec![ @@ -4239,7 +5306,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Adds or updates an entitlement to an app for a user."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/entitlements_update", vec![ @@ -4282,7 +5349,7 @@ fn main() { ]), ("grouplicenses", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves details of an enterprise's group license for a product."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/grouplicenses_get", vec![ @@ -4310,7 +5377,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves IDs of all products for which the enterprise has a group license."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/grouplicenses_list", vec![ @@ -4335,7 +5402,7 @@ fn main() { ]), ("grouplicenseusers", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves the IDs of the users who have been granted entitlements under the license."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/grouplicenseusers_list", vec![ @@ -4366,7 +5433,7 @@ fn main() { ]), ("installs", "methods: 'delete', 'get', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Requests to remove an app from a device. A call to get or list will still show the app as installed on the device until it is actually removed."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/installs_delete", vec![ @@ -4400,7 +5467,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves details of an installation of an app on a device."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/installs_get", vec![ @@ -4440,7 +5507,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the details of all apps installed on the specified device."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/installs_list", vec![ @@ -4474,7 +5541,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Requests to install the latest version of an app to a device. If the app is already installed then it is updated to the latest version if necessary. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/installs_patch", vec![ @@ -4520,7 +5587,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Requests to install the latest version of an app to a device. If the app is already installed then it is updated to the latest version if necessary."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/installs_update", vec![ @@ -4569,7 +5636,7 @@ fn main() { ]), ("permissions", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Retrieves details of an Android app permission for display to an enterprise admin."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/permissions_get", vec![ @@ -4594,7 +5661,7 @@ fn main() { ]), ("products", "methods: 'approve', 'generate-approval-url', 'get', 'get-app-restrictions-schema', 'get-permissions' and 'update-permissions'", vec![ - ("approve", + ("approve", Some(r##"Approves the specified product (and the relevant app permissions, if any)."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/products_approve", vec![ @@ -4622,7 +5689,7 @@ fn main() { Some(false), Some(true)), ]), - ("generate-approval-url", + ("generate-approval-url", Some(r##"Generates a URL that can be rendered in an iframe to display the permissions (if any) of a product. An enterprise admin must view these permissions and accept them on behalf of their organization in order to approve that product. Admins should accept the displayed permissions by interacting with a separate UI element in the EMM console, which in turn should trigger the use of this URL as the approvalUrlInfo.approvalUrl property in a Products.approve call to approve the product. This URL can only be used to display permissions for up to 1 day."##), @@ -4652,7 +5719,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves details of a product for display to an enterprise admin."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/products_get", vec![ @@ -4680,7 +5747,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-app-restrictions-schema", + ("get-app-restrictions-schema", Some(r##"Retrieves the schema defining app restrictions configurable for this product. All products have a schema, but this may be empty if no app restrictions are defined."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/products_get-app-restrictions-schema", vec![ @@ -4708,7 +5775,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-permissions", + ("get-permissions", Some(r##"Retrieves the Android app permissions required by this app."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/products_get-permissions", vec![ @@ -4736,7 +5803,7 @@ fn main() { Some(false), Some(false)), ]), - ("update-permissions", + ("update-permissions", Some(r##"Updates the set of Android app permissions for this app that have been accepted by the enterprise."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/products_update-permissions", vec![ @@ -4772,8 +5839,386 @@ fn main() { ]), ]), + ("storelayoutclusters", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes a cluster."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutclusters_delete", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"page-id"##), + None, + Some(r##"The ID of the page."##), + Some(true), + Some(false)), + + (Some(r##"cluster-id"##), + None, + Some(r##"The ID of the cluster."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Retrieves details of a cluster."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutclusters_get", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"page-id"##), + None, + Some(r##"The ID of the page."##), + Some(true), + Some(false)), + + (Some(r##"cluster-id"##), + None, + Some(r##"The ID of the cluster."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new cluster in a page."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutclusters_insert", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"page-id"##), + None, + Some(r##"The ID of the page."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the details of all clusters on the specified page."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutclusters_list", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"page-id"##), + None, + Some(r##"The ID of the page."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates a cluster. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutclusters_patch", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"page-id"##), + None, + Some(r##"The ID of the page."##), + Some(true), + Some(false)), + + (Some(r##"cluster-id"##), + None, + Some(r##"The ID of the cluster."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates a cluster."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutclusters_update", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"page-id"##), + None, + Some(r##"The ID of the page."##), + Some(true), + Some(false)), + + (Some(r##"cluster-id"##), + None, + Some(r##"The ID of the cluster."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("storelayoutpages", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes a store page."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutpages_delete", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"page-id"##), + None, + Some(r##"The ID of the page."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Retrieves details of a store page."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutpages_get", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"page-id"##), + None, + Some(r##"The ID of the page."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new store page."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutpages_insert", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the details of all pages in the store."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutpages_list", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates the content of a store page. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutpages_patch", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"page-id"##), + None, + Some(r##"The ID of the page."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates the content of a store page."##), + "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/storelayoutpages_update", + vec![ + (Some(r##"enterprise-id"##), + None, + Some(r##"The ID of the enterprise."##), + Some(true), + Some(false)), + + (Some(r##"page-id"##), + None, + Some(r##"The ID of the page."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("users", "methods: 'generate-token', 'get', 'get-available-product-set', 'list', 'revoke-token' and 'set-available-product-set'", vec![ - ("generate-token", + ("generate-token", Some(r##"Generates a token (activation code) to allow this user to configure their work account in the Android Setup Wizard. Revokes any previously generated token."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/users_generate-token", vec![ @@ -4801,7 +6246,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves a user's details."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/users_get", vec![ @@ -4829,7 +6274,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-available-product-set", + ("get-available-product-set", Some(r##"Retrieves the set of products a user is entitled to access."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/users_get-available-product-set", vec![ @@ -4857,8 +6302,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Looks up a user by email address."##), + ("list", + Some(r##"Looks up a user by email address. This only works for Google managed users."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/users_list", vec![ (Some(r##"enterprise-id"##), @@ -4885,7 +6330,7 @@ fn main() { Some(false), Some(false)), ]), - ("revoke-token", + ("revoke-token", Some(r##"Revokes a previously generated token (activation code) for the user."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/users_revoke-token", vec![ @@ -4907,7 +6352,7 @@ fn main() { Some(false), Some(true)), ]), - ("set-available-product-set", + ("set-available-product-set", Some(r##"Modifies the set of products a user is entitled to access."##), "Details at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli/users_set-available-product-set", vec![ @@ -4947,7 +6392,7 @@ fn main() { let mut app = App::new("androidenterprise1") .author("Sebastian Thiel ") - .version("0.3.2+20150922") + .version("0.3.3+20160106") .about("Allows MDMs/EMMs and enterprises to manage the deployment of apps to Android for Work users.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_androidenterprise1_cli") .arg(Arg::with_name("url") @@ -4971,7 +6416,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -4982,7 +6427,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/androidenterprise1/Cargo.toml b/gen/androidenterprise1/Cargo.toml index 606bf87b96..bbc604a88b 100644 --- a/gen/androidenterprise1/Cargo.toml +++ b/gen/androidenterprise1/Cargo.toml @@ -4,11 +4,11 @@ [package] name = "google-androidenterprise1" -version = "0.1.10+20150922" +version = "0.1.11+20160106" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Enterprise (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidenterprise1" -homepage = "https://developers.google.com/play/enterprise" +homepage = "https://developers.google.com/android/work/play/emm-api" documentation = "http://byron.github.io/google-apis-rs/google_androidenterprise1" license = "MIT" keywords = ["androidenterprise", "google", "protocol", "web", "api"] diff --git a/gen/androidenterprise1/LICENSE.md b/gen/androidenterprise1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/androidenterprise1/LICENSE.md +++ b/gen/androidenterprise1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/androidenterprise1/README.md b/gen/androidenterprise1/README.md index 2acc63815e..814309f266 100644 --- a/gen/androidenterprise1/README.md +++ b/gen/androidenterprise1/README.md @@ -5,10 +5,10 @@ DO NOT EDIT ! --> The `google-androidenterprise1` library allows access to all features of the *Google Android Enterprise* service. -This documentation was generated from *Android Enterprise* crate version *0.1.10+20150922*, where *20150922* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Android Enterprise* crate version *0.1.11+20160106*, where *20160106* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Android Enterprise* *v1* API can be found at the -[official documentation site](https://developers.google.com/play/enterprise). +[official documentation site](https://developers.google.com/android/work/play/emm-api). # Features Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.AndroidEnterprise.html) ... @@ -20,7 +20,7 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [devices](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.Device.html) * [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.DeviceGetCall.html), [*get state*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.DeviceGetStateCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.DeviceListCall.html) and [*set state*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.DeviceSetStateCall.html) * [enterprises](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.Enterprise.html) - * [*delete*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseDeleteCall.html), [*enroll*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseEnrollCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseListCall.html), [*send test push notification*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSetAccountCall.html) and [*unenroll*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseUnenrollCall.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseDeleteCall.html), [*enroll*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseEnrollCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGetCall.html), [*get store layout*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseGetStoreLayoutCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseListCall.html), [*send test push notification*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSetAccountCall.html), [*set store layout*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EnterpriseUnenrollCall.html) * [entitlements](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.Entitlement.html) * [*delete*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EntitlementDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EntitlementGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EntitlementListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EntitlementPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.EntitlementUpdateCall.html) * grouplicenses @@ -33,6 +33,10 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.PermissionGetCall.html) * [products](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.Product.html) * [*approve*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.ProductApproveCall.html), [*generate approval url*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.ProductGenerateApprovalUrlCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.ProductGetCall.html), [*get app restrictions schema*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.ProductGetAppRestrictionsSchemaCall.html), [*get permissions*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.ProductGetPermissionCall.html) and [*update permissions*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.ProductUpdatePermissionCall.html) +* storelayoutclusters + * [*delete*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutclusterDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutclusterGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutclusterInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutclusterListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutclusterPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutclusterUpdateCall.html) +* storelayoutpages + * [*delete*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutpageDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutpageGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutpageInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutpageListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutpagePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.StorelayoutpageUpdateCall.html) * [users](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.User.html) * [*generate token*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.UserGenerateTokenCall.html), [*get*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.UserGetCall.html), [*get available product set*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.UserGetAvailableProductSetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.UserListCall.html), [*revoke token*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.UserRevokeTokenCall.html) and [*set available product set*](http://byron.github.io/google-apis-rs/google_androidenterprise1/struct.UserSetAvailableProductSetCall.html) @@ -67,15 +71,16 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.users().revoke_token(...).doit() -let r = hub.collectionviewers().update(...).doit() -let r = hub.collectionviewers().patch(...).doit() -let r = hub.users().list(...).doit() -let r = hub.collectionviewers().get(...).doit() -let r = hub.users().set_available_product_set(...).doit() -let r = hub.users().generate_token(...).doit() -let r = hub.users().get_available_product_set(...).doit() -let r = hub.users().get(...).doit() +let r = hub.enterprises().send_test_push_notification(...).doit() +let r = hub.enterprises().set_store_layout(...).doit() +let r = hub.enterprises().get_store_layout(...).doit() +let r = hub.enterprises().list(...).doit() +let r = hub.enterprises().unenroll(...).doit() +let r = hub.enterprises().set_account(...).doit() +let r = hub.enterprises().delete(...).doit() +let r = hub.enterprises().enroll(...).doit() +let r = hub.enterprises().insert(...).doit() +let r = hub.enterprises().get(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -100,7 +105,7 @@ google-androidenterprise1 = "*" extern crate hyper; extern crate yup_oauth2 as oauth2; extern crate google_androidenterprise1 as androidenterprise1; -use androidenterprise1::User; +use androidenterprise1::StoreLayout; use androidenterprise1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -121,12 +126,12 @@ let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! -let mut req = User::default(); +let mut req = StoreLayout::default(); // 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 ! -let result = hub.collectionviewers().update(req, "enterpriseId", "collectionId", "userId") +let result = hub.enterprises().set_store_layout(req, "enterpriseId") .doit(); match result { diff --git a/gen/androidenterprise1/src/cmn.rs b/gen/androidenterprise1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/androidenterprise1/src/cmn.rs +++ b/gen/androidenterprise1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/androidenterprise1/src/lib.rs b/gen/androidenterprise1/src/lib.rs index 18d009b89c..0abbd8a23d 100644 --- a/gen/androidenterprise1/src/lib.rs +++ b/gen/androidenterprise1/src/lib.rs @@ -2,10 +2,10 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Android Enterprise* crate version *0.1.10+20150922*, where *20150922* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Android Enterprise* crate version *0.1.11+20160106*, where *20160106* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Android Enterprise* *v1* API can be found at the -//! [official documentation site](https://developers.google.com/play/enterprise). +//! [official documentation site](https://developers.google.com/android/work/play/emm-api). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/androidenterprise1). //! # Features //! @@ -18,7 +18,7 @@ //! * [devices](struct.Device.html) //! * [*get*](struct.DeviceGetCall.html), [*get state*](struct.DeviceGetStateCall.html), [*list*](struct.DeviceListCall.html) and [*set state*](struct.DeviceSetStateCall.html) //! * [enterprises](struct.Enterprise.html) -//! * [*delete*](struct.EnterpriseDeleteCall.html), [*enroll*](struct.EnterpriseEnrollCall.html), [*get*](struct.EnterpriseGetCall.html), [*insert*](struct.EnterpriseInsertCall.html), [*list*](struct.EnterpriseListCall.html), [*send test push notification*](struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](struct.EnterpriseSetAccountCall.html) and [*unenroll*](struct.EnterpriseUnenrollCall.html) +//! * [*delete*](struct.EnterpriseDeleteCall.html), [*enroll*](struct.EnterpriseEnrollCall.html), [*get*](struct.EnterpriseGetCall.html), [*get store layout*](struct.EnterpriseGetStoreLayoutCall.html), [*insert*](struct.EnterpriseInsertCall.html), [*list*](struct.EnterpriseListCall.html), [*send test push notification*](struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](struct.EnterpriseSetAccountCall.html), [*set store layout*](struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](struct.EnterpriseUnenrollCall.html) //! * [entitlements](struct.Entitlement.html) //! * [*delete*](struct.EntitlementDeleteCall.html), [*get*](struct.EntitlementGetCall.html), [*list*](struct.EntitlementListCall.html), [*patch*](struct.EntitlementPatchCall.html) and [*update*](struct.EntitlementUpdateCall.html) //! * grouplicenses @@ -31,6 +31,10 @@ //! * [*get*](struct.PermissionGetCall.html) //! * [products](struct.Product.html) //! * [*approve*](struct.ProductApproveCall.html), [*generate approval url*](struct.ProductGenerateApprovalUrlCall.html), [*get*](struct.ProductGetCall.html), [*get app restrictions schema*](struct.ProductGetAppRestrictionsSchemaCall.html), [*get permissions*](struct.ProductGetPermissionCall.html) and [*update permissions*](struct.ProductUpdatePermissionCall.html) +//! * storelayoutclusters +//! * [*delete*](struct.StorelayoutclusterDeleteCall.html), [*get*](struct.StorelayoutclusterGetCall.html), [*insert*](struct.StorelayoutclusterInsertCall.html), [*list*](struct.StorelayoutclusterListCall.html), [*patch*](struct.StorelayoutclusterPatchCall.html) and [*update*](struct.StorelayoutclusterUpdateCall.html) +//! * storelayoutpages +//! * [*delete*](struct.StorelayoutpageDeleteCall.html), [*get*](struct.StorelayoutpageGetCall.html), [*insert*](struct.StorelayoutpageInsertCall.html), [*list*](struct.StorelayoutpageListCall.html), [*patch*](struct.StorelayoutpagePatchCall.html) and [*update*](struct.StorelayoutpageUpdateCall.html) //! * [users](struct.User.html) //! * [*generate token*](struct.UserGenerateTokenCall.html), [*get*](struct.UserGetCall.html), [*get available product set*](struct.UserGetAvailableProductSetCall.html), [*list*](struct.UserListCall.html), [*revoke token*](struct.UserRevokeTokenCall.html) and [*set available product set*](struct.UserSetAvailableProductSetCall.html) //! @@ -67,15 +71,16 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.users().revoke_token(...).doit() -//! let r = hub.collectionviewers().update(...).doit() -//! let r = hub.collectionviewers().patch(...).doit() -//! let r = hub.users().list(...).doit() -//! let r = hub.collectionviewers().get(...).doit() -//! let r = hub.users().set_available_product_set(...).doit() -//! let r = hub.users().generate_token(...).doit() -//! let r = hub.users().get_available_product_set(...).doit() -//! let r = hub.users().get(...).doit() +//! let r = hub.enterprises().send_test_push_notification(...).doit() +//! let r = hub.enterprises().set_store_layout(...).doit() +//! let r = hub.enterprises().get_store_layout(...).doit() +//! let r = hub.enterprises().list(...).doit() +//! let r = hub.enterprises().unenroll(...).doit() +//! let r = hub.enterprises().set_account(...).doit() +//! let r = hub.enterprises().delete(...).doit() +//! let r = hub.enterprises().enroll(...).doit() +//! let r = hub.enterprises().insert(...).doit() +//! let r = hub.enterprises().get(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -100,7 +105,7 @@ //! extern crate hyper; //! extern crate yup_oauth2 as oauth2; //! extern crate google_androidenterprise1 as androidenterprise1; -//! use androidenterprise1::User; +//! use androidenterprise1::StoreLayout; //! use androidenterprise1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; @@ -122,12 +127,12 @@ //! // 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 ! -//! let mut req = User::default(); +//! let mut req = StoreLayout::default(); //! //! // 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 ! -//! let result = hub.collectionviewers().update(req, "enterpriseId", "collectionId", "userId") +//! let result = hub.enterprises().set_store_layout(req, "enterpriseId") //! .doit(); //! //! match result { diff --git a/gen/androidenterprise1/src/lib.rs.in b/gen/androidenterprise1/src/lib.rs.in index 10d29a4cd1..f64c5e010e 100644 --- a/gen/androidenterprise1/src/lib.rs.in +++ b/gen/androidenterprise1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -69,7 +70,7 @@ impl Default for Scope { /// extern crate hyper; /// extern crate yup_oauth2 as oauth2; /// extern crate google_androidenterprise1 as androidenterprise1; -/// use androidenterprise1::User; +/// use androidenterprise1::StoreLayout; /// use androidenterprise1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; @@ -91,12 +92,12 @@ impl Default for Scope { /// // 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 ! -/// let mut req = User::default(); +/// let mut req = StoreLayout::default(); /// /// // 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 ! -/// let result = hub.collectionviewers().update(req, "enterpriseId", "collectionId", "userId") +/// let result = hub.enterprises().set_store_layout(req, "enterpriseId") /// .doit(); /// /// match result { @@ -132,7 +133,7 @@ impl<'a, C, A> AndroidEnterprise AndroidEnterprise { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -166,12 +167,18 @@ impl<'a, C, A> AndroidEnterprise pub fn products(&'a self) -> ProductMethods<'a, C, A> { ProductMethods { hub: &self } } + pub fn storelayoutclusters(&'a self) -> StorelayoutclusterMethods<'a, C, A> { + StorelayoutclusterMethods { hub: &self } + } + pub fn storelayoutpages(&'a self) -> StorelayoutpageMethods<'a, C, A> { + StorelayoutpageMethods { hub: &self } + } pub fn users(&'a self) -> UserMethods<'a, C, A> { UserMethods { hub: &self } } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -406,6 +413,9 @@ pub struct Product { /// App versions currently available for this product. The returned list contains only public versions. Alpha and beta versions are not included. #[serde(rename="appVersion")] pub app_version: Option>, + /// Whether this product is free, free with in-app purchases, or paid. + #[serde(rename="productPricing")] + pub product_pricing: Option, /// A link to an image that can be used as an icon for the product. #[serde(rename="iconUrl")] pub icon_url: Option, @@ -668,6 +678,46 @@ pub struct AppRestrictionsSchemaRestriction { impl Part for AppRestrictionsSchemaRestriction {} +/// The store page resources for the enterprise. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list storelayoutclusters](struct.StorelayoutclusterListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StoreLayoutClustersListResponse { + /// A store cluster of an enterprise. + pub cluster: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#storeLayoutClustersListResponse". + pub kind: Option, +} + +impl ResponseResult for StoreLayoutClustersListResponse {} + + +/// The store page resources for the enterprise. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list storelayoutpages](struct.StorelayoutpageListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StoreLayoutPagesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#storeLayoutPagesListResponse". + pub kind: Option, + /// A store page of an enterprise. + pub page: Option>, +} + +impl ResponseResult for StoreLayoutPagesListResponse {} + + /// A service account that can be used to authenticate as the enterprise to API calls that require such authentication. /// /// # Activities @@ -707,6 +757,21 @@ pub struct AppVersion { impl Part for AppVersion {} +/// A localized string with its locale. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LocalizedText { + /// The BCP47 tag for a locale. (e.g. "en-US", "de"). + pub locale: Option, + /// The text localized in the associated locale. + pub text: Option, +} + +impl Part for LocalizedText {} + + /// The grouplicense resources for the enterprise. /// /// # Activities @@ -728,6 +793,33 @@ pub struct GroupLicensesListResponse { impl ResponseResult for GroupLicensesListResponse {} +/// General setting for the Google Play for Work store layout, currently only specifying the page to display the first time the store is opened. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set store layout enterprises](struct.EnterpriseSetStoreLayoutCall.html) (request|response) +/// * [get store layout enterprises](struct.EnterpriseGetStoreLayoutCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StoreLayout { + /// The ID of the store page to be used as the homepage. The homepage will be used as the first page shown in the Google Play for Work store. + /// + /// If there is no homepage set, an empty store is shown. The homepage can be unset (by not specifying it) to empty the store. + /// + /// If there exists at least one page, this field must be set to the ID of a valid page. + #[serde(rename="homepageId")] + pub homepage_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#storeLayout". + pub kind: Option, +} + +impl RequestValue for StoreLayout {} +impl ResponseResult for StoreLayout {} + + /// The device resources for the user. /// /// # Activities @@ -784,6 +876,8 @@ impl ResponseResult for EnterprisesListResponse {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [send test push notification enterprises](struct.EnterpriseSendTestPushNotificationCall.html) (none) +/// * [set store layout enterprises](struct.EnterpriseSetStoreLayoutCall.html) (none) +/// * [get store layout enterprises](struct.EnterpriseGetStoreLayoutCall.html) (none) /// * [list enterprises](struct.EnterpriseListCall.html) (none) /// * [unenroll enterprises](struct.EnterpriseUnenrollCall.html) (none) /// * [set account enterprises](struct.EnterpriseSetAccountCall.html) (none) @@ -853,24 +947,38 @@ pub struct CollectionViewersListResponse { impl ResponseResult for CollectionViewersListResponse {} -/// The collection resources for the enterprise. +/// Definition of a Google Play for Work store cluster, a list of products displayed as part of a store page. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list collections](struct.CollectionListCall.html) (response) +/// * [get storelayoutclusters](struct.StorelayoutclusterGetCall.html) (response) +/// * [update storelayoutclusters](struct.StorelayoutclusterUpdateCall.html) (request|response) +/// * [patch storelayoutclusters](struct.StorelayoutclusterPatchCall.html) (request|response) +/// * [insert storelayoutclusters](struct.StorelayoutclusterInsertCall.html) (request|response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CollectionsListResponse { - /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#collectionsListResponse". +pub struct StoreCluster { + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#storeCluster". pub kind: Option, - /// An ordered collection of products which can be made visible on the Google Play Store to a selected group of users. - pub collection: Option>, + /// List of products in the order they are displayed in the cluster. There should not be duplicates within a cluster. + #[serde(rename="productId")] + pub product_id: Option>, + /// Unique ID of this cluster. Assigned by the server. Immutable once assigned. + pub id: Option, + /// Ordered list of localized strings giving the name of this page. The text displayed is the one that best matches the user locale, or the first entry if there is no good match. There needs to be at least one entry. + pub name: Option>, + /// String (US-ASCII only) used to determine order of this cluster within the parent page's elements. Page elements are sorted in lexicographic order of this field. Duplicated values are allowed, but ordering between elements with duplicate order is undefined. + /// + /// The value of this field is never visible to a user, it is used solely for the purpose of defining an ordering. Maximum length is 20 characters. + #[serde(rename="orderInPage")] + pub order_in_page: Option, } -impl ResponseResult for CollectionsListResponse {} +impl RequestValue for StoreCluster {} +impl ResponseResult for StoreCluster {} /// The matching user resources. @@ -893,6 +1001,36 @@ pub struct UsersListResponse { impl ResponseResult for UsersListResponse {} +/// Definition of a Google Play for Work store page, made of a localized name and links to other pages. A page also contains clusters defined as a subcollection. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get storelayoutpages](struct.StorelayoutpageGetCall.html) (response) +/// * [update storelayoutpages](struct.StorelayoutpageUpdateCall.html) (request|response) +/// * [patch storelayoutpages](struct.StorelayoutpagePatchCall.html) (request|response) +/// * [insert storelayoutpages](struct.StorelayoutpageInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StorePage { + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#storePage". + pub kind: Option, + /// Ordered list of pages a user should be able to reach from this page. The pages must exist, must not be this page, and once a link is created the page linked to cannot be deleted until all links to it are removed. It is recommended that the basic pages are created first, before adding the links between pages. + /// + /// No attempt is made to verify that all pages are reachable from the homepage. + pub link: Option>, + /// Unique ID of this page. Assigned by the server. Immutable once assigned. + pub id: Option, + /// Ordered list of localized strings giving the name of this page. The text displayed is the one that best matches the user locale, or the first entry if there is no good match. There needs to be at least one entry. + pub name: Option>, +} + +impl RequestValue for StorePage {} +impl ResponseResult for StorePage {} + + /// There is no detailed description. /// /// # Activities @@ -962,7 +1100,7 @@ impl ResponseResult for ProductPermissions {} pub struct User { /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#user". pub kind: Option, - /// The user's primary email, e.g. "jsmith@example.com". + /// The user's primary email, e.g. "jsmith@example.com". Will always be set for Google managed users and not set for EMM managed users. #[serde(rename="primaryEmail")] pub primary_email: Option, /// The unique ID for the user. @@ -974,6 +1112,26 @@ impl Resource for User {} impl ResponseResult for User {} +/// The collection resources for the enterprise. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list collections](struct.CollectionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CollectionsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "androidenterprise#collectionsListResponse". + pub kind: Option, + /// An ordered collection of products which can be made visible on the Google Play Store to a selected group of users. + pub collection: Option>, +} + +impl ResponseResult for CollectionsListResponse {} + + /// A group license object indicates a product that an enterprise admin has approved for use in the enterprise. The product may be free or paid. For free products, a group license object is created in these cases: if the enterprise admin approves a product in Google Play, if the product is added to a collection, or if an entitlement for the product is created for a user via the API. For paid products, a group license object is only created as part of the first bulk purchase of that product in Google Play by the enterprise admin. /// /// The API can be used to query group licenses; the available information includes the total number of licenses purchased (for paid products) and the total number of licenses that have been provisioned, that is, the total number of user entitlements in existence for the product. @@ -1016,6 +1174,163 @@ impl ResponseResult for GroupLicense {} // MethodBuilders ### // ################# +/// A builder providing access to all methods supported on *storelayoutpage* resources. +/// It is not used directly, but through the `AndroidEnterprise` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_androidenterprise1 as androidenterprise1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use androidenterprise1::AndroidEnterprise; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = AndroidEnterprise::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.storelayoutpages(); +/// # } +/// ``` +pub struct StorelayoutpageMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, +} + +impl<'a, C, A> MethodsBuilder for StorelayoutpageMethods<'a, C, A> {} + +impl<'a, C, A> StorelayoutpageMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the details of all pages in the store. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + pub fn list(&self, enterprise_id: &str) -> StorelayoutpageListCall<'a, C, A> { + StorelayoutpageListCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves details of a store page. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + pub fn get(&self, enterprise_id: &str, page_id: &str) -> StorelayoutpageGetCall<'a, C, A> { + StorelayoutpageGetCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new store page. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + pub fn insert(&self, request: StorePage, enterprise_id: &str) -> StorelayoutpageInsertCall<'a, C, A> { + StorelayoutpageInsertCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the content of a store page. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + pub fn update(&self, request: StorePage, enterprise_id: &str, page_id: &str) -> StorelayoutpageUpdateCall<'a, C, A> { + StorelayoutpageUpdateCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates the content of a store page. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + pub fn patch(&self, request: StorePage, enterprise_id: &str, page_id: &str) -> StorelayoutpagePatchCall<'a, C, A> { + StorelayoutpagePatchCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a store page. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + pub fn delete(&self, enterprise_id: &str, page_id: &str) -> StorelayoutpageDeleteCall<'a, C, A> { + StorelayoutpageDeleteCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *collectionviewer* resources. /// It is not used directly, but through the `AndroidEnterprise` hub. /// @@ -1242,7 +1557,7 @@ impl<'a, C, A> UserMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Looks up a user by email address. + /// Looks up a user by email address. This only works for Google managed users. /// /// # Arguments /// @@ -1627,7 +1942,7 @@ impl<'a, C, A> DeviceMethods<'a, C, A> { /// ::default(), None); /// let mut hub = AndroidEnterprise::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `enroll(...)`, `get(...)`, `insert(...)`, `list(...)`, `send_test_push_notification(...)`, `set_account(...)` and `unenroll(...)` +/// // like `delete(...)`, `enroll(...)`, `get(...)`, `get_store_layout(...)`, `insert(...)`, `list(...)`, `send_test_push_notification(...)`, `set_account(...)`, `set_store_layout(...)` and `unenroll(...)` /// // to build up your call. /// let rb = hub.enterprises(); /// # } @@ -1729,6 +2044,42 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Returns the store layout resource. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + pub fn get_store_layout(&self, enterprise_id: &str) -> EnterpriseGetStoreLayoutCall<'a, C, A> { + EnterpriseGetStoreLayoutCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the store layout resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + pub fn set_store_layout(&self, request: StoreLayout, enterprise_id: &str) -> EnterpriseSetStoreLayoutCall<'a, C, A> { + EnterpriseSetStoreLayoutCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Enrolls an enterprise with the calling MDM. @@ -1787,6 +2138,175 @@ impl<'a, C, A> EnterpriseMethods<'a, C, A> { +/// A builder providing access to all methods supported on *storelayoutcluster* resources. +/// It is not used directly, but through the `AndroidEnterprise` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_androidenterprise1 as androidenterprise1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use androidenterprise1::AndroidEnterprise; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = AndroidEnterprise::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.storelayoutclusters(); +/// # } +/// ``` +pub struct StorelayoutclusterMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, +} + +impl<'a, C, A> MethodsBuilder for StorelayoutclusterMethods<'a, C, A> {} + +impl<'a, C, A> StorelayoutclusterMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes a cluster. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + /// * `clusterId` - The ID of the cluster. + pub fn delete(&self, enterprise_id: &str, page_id: &str, cluster_id: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { + StorelayoutclusterDeleteCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _cluster_id: cluster_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a cluster. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + /// * `clusterId` - The ID of the cluster. + pub fn patch(&self, request: StoreCluster, enterprise_id: &str, page_id: &str, cluster_id: &str) -> StorelayoutclusterPatchCall<'a, C, A> { + StorelayoutclusterPatchCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _cluster_id: cluster_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a cluster. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + /// * `clusterId` - The ID of the cluster. + pub fn update(&self, request: StoreCluster, enterprise_id: &str, page_id: &str, cluster_id: &str) -> StorelayoutclusterUpdateCall<'a, C, A> { + StorelayoutclusterUpdateCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _cluster_id: cluster_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the details of all clusters on the specified page. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + pub fn list(&self, enterprise_id: &str, page_id: &str) -> StorelayoutclusterListCall<'a, C, A> { + StorelayoutclusterListCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves details of a cluster. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + /// * `clusterId` - The ID of the cluster. + pub fn get(&self, enterprise_id: &str, page_id: &str, cluster_id: &str) -> StorelayoutclusterGetCall<'a, C, A> { + StorelayoutclusterGetCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _cluster_id: cluster_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new cluster in a page. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `enterpriseId` - The ID of the enterprise. + /// * `pageId` - The ID of the page. + pub fn insert(&self, request: StoreCluster, enterprise_id: &str, page_id: &str) -> StorelayoutclusterInsertCall<'a, C, A> { + StorelayoutclusterInsertCall { + hub: self.hub, + _request: request, + _enterprise_id: enterprise_id.to_string(), + _page_id: page_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *collection* resources. /// It is not used directly, but through the `AndroidEnterprise` hub. /// @@ -2211,26 +2731,6 @@ impl<'a, C, A> ProductMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Retrieves details of a product for display to an enterprise admin. - /// - /// # Arguments - /// - /// * `enterpriseId` - The ID of the enterprise. - /// * `productId` - The ID of the product, e.g. "app:com.google.android.gm". - pub fn get(&self, enterprise_id: &str, product_id: &str) -> ProductGetCall<'a, C, A> { - ProductGetCall { - hub: self.hub, - _enterprise_id: enterprise_id.to_string(), - _product_id: product_id.to_string(), - _language: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Approves the specified product (and the relevant app permissions, if any). @@ -2272,6 +2772,26 @@ impl<'a, C, A> ProductMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Retrieves details of a product for display to an enterprise admin. + /// + /// # Arguments + /// + /// * `enterpriseId` - The ID of the enterprise. + /// * `productId` - The ID of the product, e.g. "app:com.google.android.gm". + pub fn get(&self, enterprise_id: &str, product_id: &str) -> ProductGetCall<'a, C, A> { + ProductGetCall { + hub: self.hub, + _enterprise_id: enterprise_id.to_string(), + _product_id: product_id.to_string(), + _language: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Updates the set of Android app permissions for this app that have been accepted by the enterprise. @@ -2460,6 +2980,1552 @@ impl<'a, C, A> PermissionMethods<'a, C, A> { // CallBuilders ### // ################# +/// Retrieves the details of all pages in the store. +/// +/// A builder for the *list* method supported by a *storelayoutpage* resource. +/// It is not used directly, but through a `StorelayoutpageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let result = hub.storelayoutpages().list("enterpriseId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutpageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutpageListCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutpageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StoreLayoutPagesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutpages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + for &field in ["alt", "enterpriseId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpageListCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutpageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutpageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutpageListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves details of a store page. +/// +/// A builder for the *get* method supported by a *storelayoutpage* resource. +/// It is not used directly, but through a `StorelayoutpageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let result = hub.storelayoutpages().get("enterpriseId", "pageId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutpageGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _page_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutpageGetCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutpageGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StorePage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutpages.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + for &field in ["alt", "enterpriseId", "pageId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpageGetCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutpageGetCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutpageGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutpageGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutpageGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new store page. +/// +/// A builder for the *insert* method supported by a *storelayoutpage* resource. +/// It is not used directly, but through a `StorelayoutpageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::StorePage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let mut req = StorePage::default(); +/// +/// // 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 ! +/// let result = hub.storelayoutpages().insert(req, "enterpriseId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutpageInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: StorePage, + _enterprise_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutpageInsertCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutpageInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StorePage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutpages.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + for &field in ["alt", "enterpriseId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: StorePage) -> StorelayoutpageInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpageInsertCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutpageInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutpageInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutpageInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates the content of a store page. +/// +/// A builder for the *update* method supported by a *storelayoutpage* resource. +/// It is not used directly, but through a `StorelayoutpageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::StorePage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let mut req = StorePage::default(); +/// +/// // 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 ! +/// let result = hub.storelayoutpages().update(req, "enterpriseId", "pageId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutpageUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: StorePage, + _enterprise_id: String, + _page_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutpageUpdateCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutpageUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StorePage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutpages.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + for &field in ["alt", "enterpriseId", "pageId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: StorePage) -> StorelayoutpageUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpageUpdateCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutpageUpdateCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutpageUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutpageUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutpageUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates the content of a store page. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *storelayoutpage* resource. +/// It is not used directly, but through a `StorelayoutpageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::StorePage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let mut req = StorePage::default(); +/// +/// // 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 ! +/// let result = hub.storelayoutpages().patch(req, "enterpriseId", "pageId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutpagePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: StorePage, + _enterprise_id: String, + _page_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutpagePatchCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutpagePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StorePage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutpages.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + for &field in ["alt", "enterpriseId", "pageId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: StorePage) -> StorelayoutpagePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpagePatchCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutpagePatchCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutpagePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutpagePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutpagePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a store page. +/// +/// A builder for the *delete* method supported by a *storelayoutpage* resource. +/// It is not used directly, but through a `StorelayoutpageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let result = hub.storelayoutpages().delete("enterpriseId", "pageId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutpageDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _page_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutpageDeleteCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutpageDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutpages.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + for &field in ["enterpriseId", "pageId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutpageDeleteCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutpageDeleteCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutpageDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutpageDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutpageDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + /// Removes the user from the list of those specifically allowed to see the collection. If the collection's visibility is set to viewersOnly then only such users will see the collection. /// /// A builder for the *delete* method supported by a *collectionviewer* resource. @@ -2516,7 +4582,7 @@ impl<'a, C, A> CollectionviewerDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collectionviewers.delete", + dlg.begin(MethodInfo { id: "androidenterprise.collectionviewers.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -2559,7 +4625,7 @@ impl<'a, C, A> CollectionviewerDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2595,7 +4661,7 @@ impl<'a, C, A> CollectionviewerDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2605,10 +4671,10 @@ impl<'a, C, A> CollectionviewerDeleteCall<'a, C, A> where C: BorrowMut CollectionviewerDeleteCall<'a, C, A> where C: BorrowMut CollectionviewerDeleteCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -2641,7 +4707,7 @@ impl<'a, C, A> CollectionviewerDeleteCall<'a, C, A> where C: BorrowMut CollectionviewerDeleteCall<'a, C, A> { self._collection_id = new_value.to_string(); @@ -2651,7 +4717,7 @@ impl<'a, C, A> CollectionviewerDeleteCall<'a, C, A> where C: BorrowMut CollectionviewerDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2669,12 +4735,12 @@ impl<'a, C, A> CollectionviewerDeleteCall<'a, C, A> where C: BorrowMut CollectionviewerDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CollectionviewerDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionviewerDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2772,7 +4838,7 @@ impl<'a, C, A> CollectionviewerPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collectionviewers.patch", + dlg.begin(MethodInfo { id: "androidenterprise.collectionviewers.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -2816,14 +4882,14 @@ impl<'a, C, A> CollectionviewerPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2867,7 +4933,7 @@ impl<'a, C, A> CollectionviewerPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2877,10 +4943,10 @@ impl<'a, C, A> CollectionviewerPatchCall<'a, C, A> where C: BorrowMut CollectionviewerPatchCall<'a, C, A> where C: BorrowMut CollectionviewerPatchCall<'a, C, A> { self._request = new_value; @@ -2922,7 +4988,7 @@ impl<'a, C, A> CollectionviewerPatchCall<'a, C, A> where C: BorrowMut CollectionviewerPatchCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -2932,7 +4998,7 @@ impl<'a, C, A> CollectionviewerPatchCall<'a, C, A> where C: BorrowMut CollectionviewerPatchCall<'a, C, A> { self._collection_id = new_value.to_string(); @@ -2942,7 +5008,7 @@ impl<'a, C, A> CollectionviewerPatchCall<'a, C, A> where C: BorrowMut CollectionviewerPatchCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2960,12 +5026,12 @@ impl<'a, C, A> CollectionviewerPatchCall<'a, C, A> where C: BorrowMut CollectionviewerPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CollectionviewerPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionviewerPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3056,7 +5122,7 @@ impl<'a, C, A> CollectionviewerGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collectionviewers.get", + dlg.begin(MethodInfo { id: "androidenterprise.collectionviewers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -3100,7 +5166,7 @@ impl<'a, C, A> CollectionviewerGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3136,7 +5202,7 @@ impl<'a, C, A> CollectionviewerGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3146,10 +5212,10 @@ impl<'a, C, A> CollectionviewerGetCall<'a, C, A> where C: BorrowMut CollectionviewerGetCall<'a, C, A> where C: BorrowMut CollectionviewerGetCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -3192,7 +5258,7 @@ impl<'a, C, A> CollectionviewerGetCall<'a, C, A> where C: BorrowMut CollectionviewerGetCall<'a, C, A> { self._collection_id = new_value.to_string(); @@ -3202,7 +5268,7 @@ impl<'a, C, A> CollectionviewerGetCall<'a, C, A> where C: BorrowMut CollectionviewerGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3220,12 +5286,12 @@ impl<'a, C, A> CollectionviewerGetCall<'a, C, A> where C: BorrowMut CollectionviewerGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CollectionviewerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionviewerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3315,7 +5381,7 @@ impl<'a, C, A> CollectionviewerListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collectionviewers.list", + dlg.begin(MethodInfo { id: "androidenterprise.collectionviewers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -3358,7 +5424,7 @@ impl<'a, C, A> CollectionviewerListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3394,7 +5460,7 @@ impl<'a, C, A> CollectionviewerListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3404,10 +5470,10 @@ impl<'a, C, A> CollectionviewerListCall<'a, C, A> where C: BorrowMut CollectionviewerListCall<'a, C, A> where C: BorrowMut CollectionviewerListCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -3450,7 +5516,7 @@ impl<'a, C, A> CollectionviewerListCall<'a, C, A> where C: BorrowMut CollectionviewerListCall<'a, C, A> { self._collection_id = new_value.to_string(); @@ -3468,12 +5534,12 @@ impl<'a, C, A> CollectionviewerListCall<'a, C, A> where C: BorrowMut CollectionviewerListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CollectionviewerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionviewerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3571,7 +5637,7 @@ impl<'a, C, A> CollectionviewerUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collectionviewers.update", + dlg.begin(MethodInfo { id: "androidenterprise.collectionviewers.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -3615,14 +5681,14 @@ impl<'a, C, A> CollectionviewerUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3666,7 +5732,7 @@ impl<'a, C, A> CollectionviewerUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3676,10 +5742,10 @@ impl<'a, C, A> CollectionviewerUpdateCall<'a, C, A> where C: BorrowMut CollectionviewerUpdateCall<'a, C, A> where C: BorrowMut CollectionviewerUpdateCall<'a, C, A> { self._request = new_value; @@ -3721,7 +5787,7 @@ impl<'a, C, A> CollectionviewerUpdateCall<'a, C, A> where C: BorrowMut CollectionviewerUpdateCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -3731,7 +5797,7 @@ impl<'a, C, A> CollectionviewerUpdateCall<'a, C, A> where C: BorrowMut CollectionviewerUpdateCall<'a, C, A> { self._collection_id = new_value.to_string(); @@ -3741,7 +5807,7 @@ impl<'a, C, A> CollectionviewerUpdateCall<'a, C, A> where C: BorrowMut CollectionviewerUpdateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3759,12 +5825,12 @@ impl<'a, C, A> CollectionviewerUpdateCall<'a, C, A> where C: BorrowMut CollectionviewerUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CollectionviewerUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionviewerUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3854,7 +5920,7 @@ impl<'a, C, A> UserRevokeTokenCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.users.revokeToken", + dlg.begin(MethodInfo { id: "androidenterprise.users.revokeToken", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -3896,7 +5962,7 @@ impl<'a, C, A> UserRevokeTokenCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3932,7 +5998,7 @@ impl<'a, C, A> UserRevokeTokenCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3942,10 +6008,10 @@ impl<'a, C, A> UserRevokeTokenCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3968,7 +6034,7 @@ impl<'a, C, A> UserRevokeTokenCall<'a, C, A> where C: BorrowMut, /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> UserRevokeTokenCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -3978,7 +6044,7 @@ impl<'a, C, A> UserRevokeTokenCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserRevokeTokenCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3996,12 +6062,12 @@ impl<'a, C, A> UserRevokeTokenCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4018,17 +6084,17 @@ impl<'a, C, A> UserRevokeTokenCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRevokeTokenCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRevokeTokenCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4091,7 +6157,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.users.get", + dlg.begin(MethodInfo { id: "androidenterprise.users.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -4134,7 +6200,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4170,7 +6236,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4180,10 +6246,10 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4216,7 +6282,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> UserGetCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -4226,7 +6292,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4244,12 +6310,12 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4266,17 +6332,17 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4284,7 +6350,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } -/// Looks up a user by email address. +/// Looks up a user by email address. This only works for Google managed users. /// /// A builder for the *list* method supported by a *user* resource. /// It is not used directly, but through a `UserMethods` instance. @@ -4339,7 +6405,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.users.list", + dlg.begin(MethodInfo { id: "androidenterprise.users.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -4382,7 +6448,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4418,7 +6484,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4428,10 +6494,10 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4464,7 +6530,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> UserListCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -4474,7 +6540,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *email* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn email(mut self, new_value: &str) -> UserListCall<'a, C, A> { self._email = new_value.to_string(); @@ -4492,12 +6558,12 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4514,17 +6580,17 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4587,7 +6653,7 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.users.generateToken", + dlg.begin(MethodInfo { id: "androidenterprise.users.generateToken", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -4630,7 +6696,7 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4666,7 +6732,7 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4676,10 +6742,10 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4712,7 +6778,7 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> UserGenerateTokenCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -4722,7 +6788,7 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserGenerateTokenCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4740,12 +6806,12 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4762,17 +6828,17 @@ impl<'a, C, A> UserGenerateTokenCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserGenerateTokenCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserGenerateTokenCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4842,7 +6908,7 @@ impl<'a, C, A> UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.users.setAvailableProductSet", + dlg.begin(MethodInfo { id: "androidenterprise.users.setAvailableProductSet", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -4885,14 +6951,14 @@ impl<'a, C, A> UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4936,7 +7002,7 @@ impl<'a, C, A> UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4946,10 +7012,10 @@ impl<'a, C, A> UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserSetAvailableProductSetCall<'a, C, A> { self._request = new_value; @@ -4991,7 +7057,7 @@ impl<'a, C, A> UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserSetAvailableProductSetCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -5001,7 +7067,7 @@ impl<'a, C, A> UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserSetAvailableProductSetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5019,12 +7085,12 @@ impl<'a, C, A> UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserSetAvailableProductSetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserSetAvailableProductSetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserSetAvailableProductSetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5114,7 +7180,7 @@ impl<'a, C, A> UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.users.getAvailableProductSet", + dlg.begin(MethodInfo { id: "androidenterprise.users.getAvailableProductSet", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -5157,7 +7223,7 @@ impl<'a, C, A> UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5193,7 +7259,7 @@ impl<'a, C, A> UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5203,10 +7269,10 @@ impl<'a, C, A> UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserGetAvailableProductSetCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -5249,7 +7315,7 @@ impl<'a, C, A> UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserGetAvailableProductSetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5267,12 +7333,12 @@ impl<'a, C, A> UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut UserGetAvailableProductSetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserGetAvailableProductSetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserGetAvailableProductSetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5371,7 +7437,7 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.installs.patch", + dlg.begin(MethodInfo { id: "androidenterprise.installs.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -5416,14 +7482,14 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5467,7 +7533,7 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5477,10 +7543,10 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5512,7 +7578,7 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Install) -> InstallPatchCall<'a, C, A> { self._request = new_value; @@ -5522,7 +7588,7 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> InstallPatchCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -5532,7 +7598,7 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> InstallPatchCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5542,7 +7608,7 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *device id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn device_id(mut self, new_value: &str) -> InstallPatchCall<'a, C, A> { self._device_id = new_value.to_string(); @@ -5552,7 +7618,7 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *install id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn install_id(mut self, new_value: &str) -> InstallPatchCall<'a, C, A> { self._install_id = new_value.to_string(); @@ -5570,12 +7636,12 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5592,17 +7658,17 @@ impl<'a, C, A> InstallPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstallPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstallPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5667,7 +7733,7 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.installs.get", + dlg.begin(MethodInfo { id: "androidenterprise.installs.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -5712,7 +7778,7 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5748,7 +7814,7 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5758,10 +7824,10 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5794,7 +7860,7 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> InstallGetCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -5804,7 +7870,7 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> InstallGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5814,7 +7880,7 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *device id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn device_id(mut self, new_value: &str) -> InstallGetCall<'a, C, A> { self._device_id = new_value.to_string(); @@ -5824,7 +7890,7 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *install id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn install_id(mut self, new_value: &str) -> InstallGetCall<'a, C, A> { self._install_id = new_value.to_string(); @@ -5842,12 +7908,12 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5864,17 +7930,17 @@ impl<'a, C, A> InstallGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstallGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstallGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5938,7 +8004,7 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.installs.list", + dlg.begin(MethodInfo { id: "androidenterprise.installs.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -5982,7 +8048,7 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6018,7 +8084,7 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6028,10 +8094,10 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6064,7 +8130,7 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> InstallListCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -6074,7 +8140,7 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> InstallListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -6084,7 +8150,7 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *device id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn device_id(mut self, new_value: &str) -> InstallListCall<'a, C, A> { self._device_id = new_value.to_string(); @@ -6102,12 +8168,12 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6124,17 +8190,17 @@ impl<'a, C, A> InstallListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstallListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstallListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6199,7 +8265,7 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.installs.delete", + dlg.begin(MethodInfo { id: "androidenterprise.installs.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -6243,7 +8309,7 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6279,7 +8345,7 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6289,10 +8355,10 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6315,7 +8381,7 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> InstallDeleteCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -6325,7 +8391,7 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> InstallDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -6335,7 +8401,7 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *device id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn device_id(mut self, new_value: &str) -> InstallDeleteCall<'a, C, A> { self._device_id = new_value.to_string(); @@ -6345,7 +8411,7 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *install id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn install_id(mut self, new_value: &str) -> InstallDeleteCall<'a, C, A> { self._install_id = new_value.to_string(); @@ -6363,12 +8429,12 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6385,17 +8451,17 @@ impl<'a, C, A> InstallDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstallDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstallDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6467,7 +8533,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.installs.update", + dlg.begin(MethodInfo { id: "androidenterprise.installs.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -6512,14 +8578,14 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6563,7 +8629,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6573,10 +8639,10 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6608,7 +8674,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Install) -> InstallUpdateCall<'a, C, A> { self._request = new_value; @@ -6618,7 +8684,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> InstallUpdateCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -6628,7 +8694,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> InstallUpdateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -6638,7 +8704,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *device id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn device_id(mut self, new_value: &str) -> InstallUpdateCall<'a, C, A> { self._device_id = new_value.to_string(); @@ -6648,7 +8714,7 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *install id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn install_id(mut self, new_value: &str) -> InstallUpdateCall<'a, C, A> { self._install_id = new_value.to_string(); @@ -6666,12 +8732,12 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6688,17 +8754,17 @@ impl<'a, C, A> InstallUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstallUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstallUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6769,7 +8835,7 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.devices.setState", + dlg.begin(MethodInfo { id: "androidenterprise.devices.setState", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -6813,14 +8879,14 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6864,7 +8930,7 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6874,10 +8940,10 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6909,7 +8975,7 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: DeviceState) -> DeviceSetStateCall<'a, C, A> { self._request = new_value; @@ -6919,7 +8985,7 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> DeviceSetStateCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -6929,7 +8995,7 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> DeviceSetStateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -6939,7 +9005,7 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *device id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn device_id(mut self, new_value: &str) -> DeviceSetStateCall<'a, C, A> { self._device_id = new_value.to_string(); @@ -6957,12 +9023,12 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6979,17 +9045,17 @@ impl<'a, C, A> DeviceSetStateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeviceSetStateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeviceSetStateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7053,7 +9119,7 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.devices.getState", + dlg.begin(MethodInfo { id: "androidenterprise.devices.getState", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -7097,7 +9163,7 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7133,7 +9199,7 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7143,10 +9209,10 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7179,7 +9245,7 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> DeviceGetStateCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -7189,7 +9255,7 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> DeviceGetStateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -7199,7 +9265,7 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *device id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn device_id(mut self, new_value: &str) -> DeviceGetStateCall<'a, C, A> { self._device_id = new_value.to_string(); @@ -7217,12 +9283,12 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7239,17 +9305,17 @@ impl<'a, C, A> DeviceGetStateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeviceGetStateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeviceGetStateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7312,7 +9378,7 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.devices.list", + dlg.begin(MethodInfo { id: "androidenterprise.devices.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -7355,7 +9421,7 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7391,7 +9457,7 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7401,10 +9467,10 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7437,7 +9503,7 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> DeviceListCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -7447,7 +9513,7 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> DeviceListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -7465,12 +9531,12 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7487,17 +9553,17 @@ impl<'a, C, A> DeviceListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeviceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeviceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7561,7 +9627,7 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.devices.get", + dlg.begin(MethodInfo { id: "androidenterprise.devices.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -7605,7 +9671,7 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7641,7 +9707,7 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7651,10 +9717,10 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7687,7 +9753,7 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> DeviceGetCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -7697,7 +9763,7 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> DeviceGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -7707,7 +9773,7 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *device id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn device_id(mut self, new_value: &str) -> DeviceGetCall<'a, C, A> { self._device_id = new_value.to_string(); @@ -7725,12 +9791,12 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7747,17 +9813,17 @@ impl<'a, C, A> DeviceGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeviceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeviceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7819,7 +9885,7 @@ impl<'a, C, A> EnterpriseUnenrollCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.enterprises.unenroll", + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.unenroll", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -7860,7 +9926,7 @@ impl<'a, C, A> EnterpriseUnenrollCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7896,7 +9962,7 @@ impl<'a, C, A> EnterpriseUnenrollCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7906,10 +9972,10 @@ impl<'a, C, A> EnterpriseUnenrollCall<'a, C, A> where C: BorrowMut EnterpriseUnenrollCall<'a, C, A> where C: BorrowMut EnterpriseUnenrollCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -7950,12 +10016,12 @@ impl<'a, C, A> EnterpriseUnenrollCall<'a, C, A> where C: BorrowMut EnterpriseUnenrollCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EnterpriseUnenrollCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseUnenrollCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8051,7 +10117,7 @@ impl<'a, C, A> EnterpriseInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.enterprises.insert", + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("token", self._token.to_string())); @@ -8072,14 +10138,14 @@ impl<'a, C, A> EnterpriseInsertCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8123,7 +10189,7 @@ impl<'a, C, A> EnterpriseInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8133,10 +10199,10 @@ impl<'a, C, A> EnterpriseInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8168,7 +10234,7 @@ impl<'a, C, A> EnterpriseInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Enterprise) -> EnterpriseInsertCall<'a, C, A> { self._request = new_value; @@ -8178,7 +10244,7 @@ impl<'a, C, A> EnterpriseInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *token* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn token(mut self, new_value: &str) -> EnterpriseInsertCall<'a, C, A> { self._token = new_value.to_string(); @@ -8196,12 +10262,12 @@ impl<'a, C, A> EnterpriseInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8218,17 +10284,17 @@ impl<'a, C, A> EnterpriseInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EnterpriseInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8290,7 +10356,7 @@ impl<'a, C, A> EnterpriseSendTestPushNotificationCall<'a, C, A> where C: BorrowM Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.enterprises.sendTestPushNotification", + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.sendTestPushNotification", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -8332,7 +10398,7 @@ impl<'a, C, A> EnterpriseSendTestPushNotificationCall<'a, C, A> where C: BorrowM params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8368,7 +10434,7 @@ impl<'a, C, A> EnterpriseSendTestPushNotificationCall<'a, C, A> where C: BorrowM match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8378,10 +10444,10 @@ impl<'a, C, A> EnterpriseSendTestPushNotificationCall<'a, C, A> where C: BorrowM if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8414,7 +10480,7 @@ impl<'a, C, A> EnterpriseSendTestPushNotificationCall<'a, C, A> where C: BorrowM /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseSendTestPushNotificationCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -8432,12 +10498,12 @@ impl<'a, C, A> EnterpriseSendTestPushNotificationCall<'a, C, A> where C: BorrowM } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8454,17 +10520,17 @@ impl<'a, C, A> EnterpriseSendTestPushNotificationCall<'a, C, A> where C: BorrowM } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EnterpriseSendTestPushNotificationCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseSendTestPushNotificationCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8526,7 +10592,7 @@ impl<'a, C, A> EnterpriseListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.enterprises.list", + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("domain", self._domain.to_string())); @@ -8547,7 +10613,7 @@ impl<'a, C, A> EnterpriseListCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8583,7 +10649,7 @@ impl<'a, C, A> EnterpriseListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8593,10 +10659,10 @@ impl<'a, C, A> EnterpriseListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8629,7 +10695,7 @@ impl<'a, C, A> EnterpriseListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *domain* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn domain(mut self, new_value: &str) -> EnterpriseListCall<'a, C, A> { self._domain = new_value.to_string(); @@ -8647,12 +10713,12 @@ impl<'a, C, A> EnterpriseListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8669,17 +10735,17 @@ impl<'a, C, A> EnterpriseListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EnterpriseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8741,7 +10807,7 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.enterprises.get", + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -8783,7 +10849,7 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8819,7 +10885,7 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8829,10 +10895,10 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8865,7 +10931,7 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseGetCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -8883,12 +10949,12 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8905,17 +10971,520 @@ impl<'a, C, A> EnterpriseGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EnterpriseGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns the store layout resource. +/// +/// A builder for the *getStoreLayout* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let result = hub.enterprises().get_store_layout("enterpriseId") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseGetStoreLayoutCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseGetStoreLayoutCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseGetStoreLayoutCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StoreLayout)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.getStoreLayout", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + for &field in ["alt", "enterpriseId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseGetStoreLayoutCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EnterpriseGetStoreLayoutCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EnterpriseGetStoreLayoutCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EnterpriseGetStoreLayoutCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Sets the store layout resource. +/// +/// A builder for the *setStoreLayout* method supported by a *enterprise* resource. +/// It is not used directly, but through a `EnterpriseMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::StoreLayout; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let mut req = StoreLayout::default(); +/// +/// // 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 ! +/// let result = hub.enterprises().set_store_layout(req, "enterpriseId") +/// .doit(); +/// # } +/// ``` +pub struct EnterpriseSetStoreLayoutCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: StoreLayout, + _enterprise_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EnterpriseSetStoreLayoutCall<'a, C, A> {} + +impl<'a, C, A> EnterpriseSetStoreLayoutCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StoreLayout)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.setStoreLayout", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + for &field in ["alt", "enterpriseId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: StoreLayout) -> EnterpriseSetStoreLayoutCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseSetStoreLayoutCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EnterpriseSetStoreLayoutCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EnterpriseSetStoreLayoutCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EnterpriseSetStoreLayoutCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8984,7 +11553,7 @@ impl<'a, C, A> EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.enterprises.enroll", + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.enroll", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("token", self._token.to_string())); @@ -9005,14 +11574,14 @@ impl<'a, C, A> EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9056,7 +11625,7 @@ impl<'a, C, A> EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9066,10 +11635,10 @@ impl<'a, C, A> EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9101,7 +11670,7 @@ impl<'a, C, A> EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Enterprise) -> EnterpriseEnrollCall<'a, C, A> { self._request = new_value; @@ -9111,7 +11680,7 @@ impl<'a, C, A> EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, /// /// Sets the *token* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn token(mut self, new_value: &str) -> EnterpriseEnrollCall<'a, C, A> { self._token = new_value.to_string(); @@ -9129,12 +11698,12 @@ impl<'a, C, A> EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9151,17 +11720,17 @@ impl<'a, C, A> EnterpriseEnrollCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EnterpriseEnrollCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseEnrollCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9230,7 +11799,7 @@ impl<'a, C, A> EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.enterprises.setAccount", + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.setAccount", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -9272,14 +11841,14 @@ impl<'a, C, A> EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9323,7 +11892,7 @@ impl<'a, C, A> EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9333,10 +11902,10 @@ impl<'a, C, A> EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut EnterpriseSetAccountCall<'a, C, A> { self._request = new_value; @@ -9378,7 +11947,7 @@ impl<'a, C, A> EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut EnterpriseSetAccountCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -9396,12 +11965,12 @@ impl<'a, C, A> EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut EnterpriseSetAccountCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EnterpriseSetAccountCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseSetAccountCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9490,7 +12059,7 @@ impl<'a, C, A> EnterpriseDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.enterprises.delete", + dlg.begin(MethodInfo { id: "androidenterprise.enterprises.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -9531,7 +12100,7 @@ impl<'a, C, A> EnterpriseDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9567,7 +12136,7 @@ impl<'a, C, A> EnterpriseDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9577,10 +12146,10 @@ impl<'a, C, A> EnterpriseDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9603,7 +12172,7 @@ impl<'a, C, A> EnterpriseDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> EnterpriseDeleteCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -9621,12 +12190,12 @@ impl<'a, C, A> EnterpriseDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9643,17 +12212,1635 @@ impl<'a, C, A> EnterpriseDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EnterpriseDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EnterpriseDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a cluster. +/// +/// A builder for the *delete* method supported by a *storelayoutcluster* resource. +/// It is not used directly, but through a `StorelayoutclusterMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let result = hub.storelayoutclusters().delete("enterpriseId", "pageId", "clusterId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutclusterDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _page_id: String, + _cluster_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutclusterDeleteCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutclusterDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutclusters.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + params.push(("clusterId", self._cluster_id.to_string())); + for &field in ["enterpriseId", "pageId", "clusterId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId"), ("{clusterId}", "clusterId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["clusterId", "pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The ID of the cluster. + /// + /// Sets the *cluster id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterDeleteCall<'a, C, A> { + self._cluster_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutclusterDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutclusterDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutclusterDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a cluster. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *storelayoutcluster* resource. +/// It is not used directly, but through a `StorelayoutclusterMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::StoreCluster; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let mut req = StoreCluster::default(); +/// +/// // 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 ! +/// let result = hub.storelayoutclusters().patch(req, "enterpriseId", "pageId", "clusterId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutclusterPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: StoreCluster, + _enterprise_id: String, + _page_id: String, + _cluster_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutclusterPatchCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutclusterPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StoreCluster)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutclusters.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + params.push(("clusterId", self._cluster_id.to_string())); + for &field in ["alt", "enterpriseId", "pageId", "clusterId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId"), ("{clusterId}", "clusterId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["clusterId", "pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: StoreCluster) -> StorelayoutclusterPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterPatchCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterPatchCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The ID of the cluster. + /// + /// Sets the *cluster id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterPatchCall<'a, C, A> { + self._cluster_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutclusterPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutclusterPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutclusterPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a cluster. +/// +/// A builder for the *update* method supported by a *storelayoutcluster* resource. +/// It is not used directly, but through a `StorelayoutclusterMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::StoreCluster; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let mut req = StoreCluster::default(); +/// +/// // 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 ! +/// let result = hub.storelayoutclusters().update(req, "enterpriseId", "pageId", "clusterId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutclusterUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: StoreCluster, + _enterprise_id: String, + _page_id: String, + _cluster_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutclusterUpdateCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutclusterUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StoreCluster)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutclusters.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + params.push(("clusterId", self._cluster_id.to_string())); + for &field in ["alt", "enterpriseId", "pageId", "clusterId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId"), ("{clusterId}", "clusterId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["clusterId", "pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: StoreCluster) -> StorelayoutclusterUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterUpdateCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterUpdateCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The ID of the cluster. + /// + /// Sets the *cluster id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterUpdateCall<'a, C, A> { + self._cluster_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutclusterUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutclusterUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutclusterUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the details of all clusters on the specified page. +/// +/// A builder for the *list* method supported by a *storelayoutcluster* resource. +/// It is not used directly, but through a `StorelayoutclusterMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let result = hub.storelayoutclusters().list("enterpriseId", "pageId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutclusterListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _page_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutclusterListCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutclusterListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StoreLayoutClustersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutclusters.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + for &field in ["alt", "enterpriseId", "pageId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterListCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterListCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutclusterListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutclusterListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutclusterListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves details of a cluster. +/// +/// A builder for the *get* method supported by a *storelayoutcluster* resource. +/// It is not used directly, but through a `StorelayoutclusterMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let result = hub.storelayoutclusters().get("enterpriseId", "pageId", "clusterId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutclusterGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _page_id: String, + _cluster_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutclusterGetCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutclusterGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StoreCluster)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutclusters.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + params.push(("clusterId", self._cluster_id.to_string())); + for &field in ["alt", "enterpriseId", "pageId", "clusterId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters/{clusterId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId"), ("{clusterId}", "clusterId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["clusterId", "pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The ID of the cluster. + /// + /// Sets the *cluster id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn cluster_id(mut self, new_value: &str) -> StorelayoutclusterGetCall<'a, C, A> { + self._cluster_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutclusterGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutclusterGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutclusterGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new cluster in a page. +/// +/// A builder for the *insert* method supported by a *storelayoutcluster* resource. +/// It is not used directly, but through a `StorelayoutclusterMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// use androidenterprise1::StoreCluster; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let mut req = StoreCluster::default(); +/// +/// // 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 ! +/// let result = hub.storelayoutclusters().insert(req, "enterpriseId", "pageId") +/// .doit(); +/// # } +/// ``` +pub struct StorelayoutclusterInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _request: StoreCluster, + _enterprise_id: String, + _page_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for StorelayoutclusterInsertCall<'a, C, A> {} + +impl<'a, C, A> StorelayoutclusterInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StoreCluster)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.storelayoutclusters.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("pageId", self._page_id.to_string())); + for &field in ["alt", "enterpriseId", "pageId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/storeLayout/pages/{pageId}/clusters".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{pageId}", "pageId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["pageId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: StoreCluster) -> StorelayoutclusterInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> StorelayoutclusterInsertCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the page. + /// + /// Sets the *page id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_id(mut self, new_value: &str) -> StorelayoutclusterInsertCall<'a, C, A> { + self._page_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> StorelayoutclusterInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> StorelayoutclusterInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> StorelayoutclusterInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9722,7 +13909,7 @@ impl<'a, C, A> CollectionInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collections.insert", + dlg.begin(MethodInfo { id: "androidenterprise.collections.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -9764,14 +13951,14 @@ impl<'a, C, A> CollectionInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9815,7 +14002,7 @@ impl<'a, C, A> CollectionInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9825,10 +14012,10 @@ impl<'a, C, A> CollectionInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9860,7 +14047,7 @@ impl<'a, C, A> CollectionInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Collection) -> CollectionInsertCall<'a, C, A> { self._request = new_value; @@ -9870,7 +14057,7 @@ impl<'a, C, A> CollectionInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> CollectionInsertCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -9888,12 +14075,12 @@ impl<'a, C, A> CollectionInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9910,17 +14097,17 @@ impl<'a, C, A> CollectionInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CollectionInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9990,7 +14177,7 @@ impl<'a, C, A> CollectionPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collections.patch", + dlg.begin(MethodInfo { id: "androidenterprise.collections.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -10033,14 +14220,14 @@ impl<'a, C, A> CollectionPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10084,7 +14271,7 @@ impl<'a, C, A> CollectionPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10094,10 +14281,10 @@ impl<'a, C, A> CollectionPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10129,7 +14316,7 @@ impl<'a, C, A> CollectionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Collection) -> CollectionPatchCall<'a, C, A> { self._request = new_value; @@ -10139,7 +14326,7 @@ impl<'a, C, A> CollectionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> CollectionPatchCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -10149,7 +14336,7 @@ impl<'a, C, A> CollectionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *collection id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection_id(mut self, new_value: &str) -> CollectionPatchCall<'a, C, A> { self._collection_id = new_value.to_string(); @@ -10167,12 +14354,12 @@ impl<'a, C, A> CollectionPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10189,17 +14376,17 @@ impl<'a, C, A> CollectionPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CollectionPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10269,7 +14456,7 @@ impl<'a, C, A> CollectionUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collections.update", + dlg.begin(MethodInfo { id: "androidenterprise.collections.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -10312,14 +14499,14 @@ impl<'a, C, A> CollectionUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10363,7 +14550,7 @@ impl<'a, C, A> CollectionUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10373,10 +14560,10 @@ impl<'a, C, A> CollectionUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10408,7 +14595,7 @@ impl<'a, C, A> CollectionUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Collection) -> CollectionUpdateCall<'a, C, A> { self._request = new_value; @@ -10418,7 +14605,7 @@ impl<'a, C, A> CollectionUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> CollectionUpdateCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -10428,7 +14615,7 @@ impl<'a, C, A> CollectionUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *collection id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection_id(mut self, new_value: &str) -> CollectionUpdateCall<'a, C, A> { self._collection_id = new_value.to_string(); @@ -10446,12 +14633,12 @@ impl<'a, C, A> CollectionUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10468,17 +14655,17 @@ impl<'a, C, A> CollectionUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CollectionUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10540,7 +14727,7 @@ impl<'a, C, A> CollectionListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collections.list", + dlg.begin(MethodInfo { id: "androidenterprise.collections.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -10582,7 +14769,7 @@ impl<'a, C, A> CollectionListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10618,7 +14805,7 @@ impl<'a, C, A> CollectionListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10628,10 +14815,10 @@ impl<'a, C, A> CollectionListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10664,7 +14851,7 @@ impl<'a, C, A> CollectionListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> CollectionListCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -10682,12 +14869,12 @@ impl<'a, C, A> CollectionListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10704,17 +14891,17 @@ impl<'a, C, A> CollectionListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CollectionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10777,7 +14964,7 @@ impl<'a, C, A> CollectionDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collections.delete", + dlg.begin(MethodInfo { id: "androidenterprise.collections.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -10819,7 +15006,7 @@ impl<'a, C, A> CollectionDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10855,7 +15042,7 @@ impl<'a, C, A> CollectionDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10865,10 +15052,10 @@ impl<'a, C, A> CollectionDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10891,7 +15078,7 @@ impl<'a, C, A> CollectionDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> CollectionDeleteCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -10901,7 +15088,7 @@ impl<'a, C, A> CollectionDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *collection id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection_id(mut self, new_value: &str) -> CollectionDeleteCall<'a, C, A> { self._collection_id = new_value.to_string(); @@ -10919,12 +15106,12 @@ impl<'a, C, A> CollectionDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10941,17 +15128,17 @@ impl<'a, C, A> CollectionDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CollectionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11014,7 +15201,7 @@ impl<'a, C, A> CollectionGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.collections.get", + dlg.begin(MethodInfo { id: "androidenterprise.collections.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -11057,7 +15244,7 @@ impl<'a, C, A> CollectionGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11093,7 +15280,7 @@ impl<'a, C, A> CollectionGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11103,10 +15290,10 @@ impl<'a, C, A> CollectionGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11139,7 +15326,7 @@ impl<'a, C, A> CollectionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> CollectionGetCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -11149,7 +15336,7 @@ impl<'a, C, A> CollectionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *collection id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection_id(mut self, new_value: &str) -> CollectionGetCall<'a, C, A> { self._collection_id = new_value.to_string(); @@ -11167,12 +15354,12 @@ impl<'a, C, A> CollectionGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11189,17 +15376,17 @@ impl<'a, C, A> CollectionGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CollectionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CollectionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11262,7 +15449,7 @@ impl<'a, C, A> GrouplicenseuserListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.grouplicenseusers.list", + dlg.begin(MethodInfo { id: "androidenterprise.grouplicenseusers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -11305,7 +15492,7 @@ impl<'a, C, A> GrouplicenseuserListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11341,7 +15528,7 @@ impl<'a, C, A> GrouplicenseuserListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11351,10 +15538,10 @@ impl<'a, C, A> GrouplicenseuserListCall<'a, C, A> where C: BorrowMut GrouplicenseuserListCall<'a, C, A> where C: BorrowMut GrouplicenseuserListCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -11397,7 +15584,7 @@ impl<'a, C, A> GrouplicenseuserListCall<'a, C, A> where C: BorrowMut GrouplicenseuserListCall<'a, C, A> { self._group_license_id = new_value.to_string(); @@ -11415,12 +15602,12 @@ impl<'a, C, A> GrouplicenseuserListCall<'a, C, A> where C: BorrowMut GrouplicenseuserListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GrouplicenseuserListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GrouplicenseuserListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11488,7 +15675,7 @@ impl<'a, C, A> GrouplicenseuserListCall<'a, C, A> where C: BorrowMut EntitlementUpdateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.entitlements.update", + dlg.begin(MethodInfo { id: "androidenterprise.entitlements.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -11567,14 +15754,14 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11618,7 +15805,7 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11628,10 +15815,10 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11663,7 +15850,7 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Entitlement) -> EntitlementUpdateCall<'a, C, A> { self._request = new_value; @@ -11673,7 +15860,7 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> EntitlementUpdateCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -11683,7 +15870,7 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> EntitlementUpdateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -11693,7 +15880,7 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *entitlement id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn entitlement_id(mut self, new_value: &str) -> EntitlementUpdateCall<'a, C, A> { self._entitlement_id = new_value.to_string(); @@ -11718,12 +15905,12 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11740,17 +15927,17 @@ impl<'a, C, A> EntitlementUpdateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EntitlementUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EntitlementUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11813,7 +16000,7 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.entitlements.list", + dlg.begin(MethodInfo { id: "androidenterprise.entitlements.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -11856,7 +16043,7 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11892,7 +16079,7 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11902,10 +16089,10 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11938,7 +16125,7 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> EntitlementListCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -11948,7 +16135,7 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> EntitlementListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -11966,12 +16153,12 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11988,17 +16175,17 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EntitlementListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EntitlementListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12062,7 +16249,7 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.entitlements.get", + dlg.begin(MethodInfo { id: "androidenterprise.entitlements.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -12106,7 +16293,7 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12142,7 +16329,7 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12152,10 +16339,10 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12188,7 +16375,7 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> EntitlementGetCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -12198,7 +16385,7 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> EntitlementGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -12208,7 +16395,7 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *entitlement id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn entitlement_id(mut self, new_value: &str) -> EntitlementGetCall<'a, C, A> { self._entitlement_id = new_value.to_string(); @@ -12226,12 +16413,12 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12248,17 +16435,17 @@ impl<'a, C, A> EntitlementGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EntitlementGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EntitlementGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12331,7 +16518,7 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.entitlements.patch", + dlg.begin(MethodInfo { id: "androidenterprise.entitlements.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -12378,14 +16565,14 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12429,7 +16616,7 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12439,10 +16626,10 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12474,7 +16661,7 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Entitlement) -> EntitlementPatchCall<'a, C, A> { self._request = new_value; @@ -12484,7 +16671,7 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> EntitlementPatchCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -12494,7 +16681,7 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> EntitlementPatchCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -12504,7 +16691,7 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *entitlement id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn entitlement_id(mut self, new_value: &str) -> EntitlementPatchCall<'a, C, A> { self._entitlement_id = new_value.to_string(); @@ -12529,12 +16716,12 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12551,17 +16738,17 @@ impl<'a, C, A> EntitlementPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EntitlementPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EntitlementPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12625,7 +16812,7 @@ impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.entitlements.delete", + dlg.begin(MethodInfo { id: "androidenterprise.entitlements.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -12668,7 +16855,7 @@ impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12704,7 +16891,7 @@ impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12714,10 +16901,10 @@ impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12740,7 +16927,7 @@ impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -12750,7 +16937,7 @@ impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -12760,7 +16947,7 @@ impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *entitlement id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn entitlement_id(mut self, new_value: &str) -> EntitlementDeleteCall<'a, C, A> { self._entitlement_id = new_value.to_string(); @@ -12778,12 +16965,12 @@ impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12800,17 +16987,17 @@ impl<'a, C, A> EntitlementDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EntitlementDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EntitlementDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12873,7 +17060,7 @@ impl<'a, C, A> ProductGetPermissionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.products.getPermissions", + dlg.begin(MethodInfo { id: "androidenterprise.products.getPermissions", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -12916,7 +17103,7 @@ impl<'a, C, A> ProductGetPermissionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12952,7 +17139,7 @@ impl<'a, C, A> ProductGetPermissionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12962,10 +17149,10 @@ impl<'a, C, A> ProductGetPermissionCall<'a, C, A> where C: BorrowMut ProductGetPermissionCall<'a, C, A> where C: BorrowMut ProductGetPermissionCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -13008,7 +17195,7 @@ impl<'a, C, A> ProductGetPermissionCall<'a, C, A> where C: BorrowMut ProductGetPermissionCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -13026,12 +17213,12 @@ impl<'a, C, A> ProductGetPermissionCall<'a, C, A> where C: BorrowMut ProductGetPermissionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProductGetPermissionCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Retrieves details of a product for display to an enterprise admin. -/// -/// A builder for the *get* method supported by a *product* resource. -/// It is not used directly, but through a `ProductMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_androidenterprise1 as androidenterprise1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use androidenterprise1::AndroidEnterprise; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! -/// let result = hub.products().get("enterpriseId", "productId") -/// .language("aliquyam") -/// .doit(); -/// # } -/// ``` -pub struct ProductGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a AndroidEnterprise, - _enterprise_id: String, - _product_id: String, - _language: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ProductGetCall<'a, C, A> {} - -impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Product)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "androidenterprise.products.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("enterpriseId", self._enterprise_id.to_string())); - params.push(("productId", self._product_id.to_string())); - if let Some(value) = self._language { - params.push(("language", value.to_string())); - } - for &field in ["alt", "enterpriseId", "productId", "language"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{productId}", "productId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["productId", "enterpriseId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the enterprise. - /// - /// Sets the *enterprise id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn enterprise_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { - self._enterprise_id = new_value.to_string(); - self - } - /// The ID of the product, e.g. "app:com.google.android.gm". - /// - /// Sets the *product id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn product_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { - self._product_id = new_value.to_string(); - self - } - /// The BCP47 tag for the user's preferred language (e.g. "en-US", "de"). - /// - /// Sets the *language* query property to the given value. - pub fn language(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { - self._language = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ProductGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ProductGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ProductGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductGetPermissionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13388,7 +17315,7 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.products.approve", + dlg.begin(MethodInfo { id: "androidenterprise.products.approve", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -13430,14 +17357,14 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13481,7 +17408,7 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13491,10 +17418,10 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13516,7 +17443,7 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ProductsApproveRequest) -> ProductApproveCall<'a, C, A> { self._request = new_value; @@ -13526,7 +17453,7 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> ProductApproveCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -13536,7 +17463,7 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *product id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn product_id(mut self, new_value: &str) -> ProductApproveCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -13554,12 +17481,12 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13576,17 +17503,17 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProductApproveCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductApproveCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13621,7 +17548,7 @@ impl<'a, C, A> ProductApproveCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.products().get_app_restrictions_schema("enterpriseId", "productId") -/// .language("sed") +/// .language("est") /// .doit(); /// # } /// ``` @@ -13651,7 +17578,7 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.products.getAppRestrictionsSchema", + dlg.begin(MethodInfo { id: "androidenterprise.products.getAppRestrictionsSchema", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -13697,7 +17624,7 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13733,7 +17660,7 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13743,10 +17670,10 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13779,7 +17706,7 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> ProductGetAppRestrictionsSchemaCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -13789,7 +17716,7 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< /// /// Sets the *product id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn product_id(mut self, new_value: &str) -> ProductGetAppRestrictionsSchemaCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -13814,12 +17741,12 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13836,17 +17763,277 @@ impl<'a, C, A> ProductGetAppRestrictionsSchemaCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProductGetAppRestrictionsSchemaCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductGetAppRestrictionsSchemaCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves details of a product for display to an enterprise admin. +/// +/// A builder for the *get* method supported by a *product* resource. +/// It is not used directly, but through a `ProductMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_androidenterprise1 as androidenterprise1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use androidenterprise1::AndroidEnterprise; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = AndroidEnterprise::new(hyper::Client::new(), 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 ! +/// let result = hub.products().get("enterpriseId", "productId") +/// .language("ut") +/// .doit(); +/// # } +/// ``` +pub struct ProductGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a AndroidEnterprise, + _enterprise_id: String, + _product_id: String, + _language: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProductGetCall<'a, C, A> {} + +impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Product)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "androidenterprise.products.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("enterpriseId", self._enterprise_id.to_string())); + params.push(("productId", self._product_id.to_string())); + if let Some(value) = self._language { + params.push(("language", value.to_string())); + } + for &field in ["alt", "enterpriseId", "productId", "language"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/androidenterprise/v1/enterprises/{enterpriseId}/products/{productId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{enterpriseId}", "enterpriseId"), ("{productId}", "productId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["productId", "enterpriseId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the enterprise. + /// + /// Sets the *enterprise id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn enterprise_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { + self._enterprise_id = new_value.to_string(); + self + } + /// The ID of the product, e.g. "app:com.google.android.gm". + /// + /// Sets the *product id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn product_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { + self._product_id = new_value.to_string(); + self + } + /// The BCP47 tag for the user's preferred language (e.g. "en-US", "de"). + /// + /// Sets the *language* query property to the given value. + pub fn language(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { + self._language = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProductGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProductGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProductGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13916,7 +18103,7 @@ impl<'a, C, A> ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.products.updatePermissions", + dlg.begin(MethodInfo { id: "androidenterprise.products.updatePermissions", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -13959,14 +18146,14 @@ impl<'a, C, A> ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14010,7 +18197,7 @@ impl<'a, C, A> ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14020,10 +18207,10 @@ impl<'a, C, A> ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut ProductUpdatePermissionCall<'a, C, A> { self._request = new_value; @@ -14065,7 +18252,7 @@ impl<'a, C, A> ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut ProductUpdatePermissionCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -14075,7 +18262,7 @@ impl<'a, C, A> ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut ProductUpdatePermissionCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -14093,12 +18280,12 @@ impl<'a, C, A> ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProductUpdatePermissionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductUpdatePermissionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14162,7 +18349,7 @@ impl<'a, C, A> ProductUpdatePermissionCall<'a, C, A> where C: BorrowMut ProductGenerateApprovalUrlCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.products.generateApprovalUrl", + dlg.begin(MethodInfo { id: "androidenterprise.products.generateApprovalUrl", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -14238,7 +18425,7 @@ impl<'a, C, A> ProductGenerateApprovalUrlCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14274,7 +18461,7 @@ impl<'a, C, A> ProductGenerateApprovalUrlCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14284,10 +18471,10 @@ impl<'a, C, A> ProductGenerateApprovalUrlCall<'a, C, A> where C: BorrowMut ProductGenerateApprovalUrlCall<'a, C, A> where C: BorrowMut ProductGenerateApprovalUrlCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -14330,7 +18517,7 @@ impl<'a, C, A> ProductGenerateApprovalUrlCall<'a, C, A> where C: BorrowMut ProductGenerateApprovalUrlCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -14355,12 +18542,12 @@ impl<'a, C, A> ProductGenerateApprovalUrlCall<'a, C, A> where C: BorrowMut ProductGenerateApprovalUrlCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProductGenerateApprovalUrlCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductGenerateApprovalUrlCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14450,7 +18637,7 @@ impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.grouplicenses.get", + dlg.begin(MethodInfo { id: "androidenterprise.grouplicenses.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -14493,7 +18680,7 @@ impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14529,7 +18716,7 @@ impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14539,10 +18726,10 @@ impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14575,7 +18762,7 @@ impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> GrouplicenseGetCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -14585,7 +18772,7 @@ impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *group license id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_license_id(mut self, new_value: &str) -> GrouplicenseGetCall<'a, C, A> { self._group_license_id = new_value.to_string(); @@ -14603,12 +18790,12 @@ impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14625,17 +18812,17 @@ impl<'a, C, A> GrouplicenseGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GrouplicenseGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GrouplicenseGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14697,7 +18884,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.grouplicenses.list", + dlg.begin(MethodInfo { id: "androidenterprise.grouplicenses.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("enterpriseId", self._enterprise_id.to_string())); @@ -14739,7 +18926,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14775,7 +18962,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14785,10 +18972,10 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14821,7 +19008,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *enterprise id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn enterprise_id(mut self, new_value: &str) -> GrouplicenseListCall<'a, C, A> { self._enterprise_id = new_value.to_string(); @@ -14839,12 +19026,12 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14861,17 +19048,17 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GrouplicenseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GrouplicenseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14906,7 +19093,7 @@ impl<'a, C, A> GrouplicenseListCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.permissions().get("permissionId") -/// .language("dolores") +/// .language("dolor") /// .doit(); /// # } /// ``` @@ -14935,7 +19122,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidenterprise.permissions.get", + dlg.begin(MethodInfo { id: "androidenterprise.permissions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("permissionId", self._permission_id.to_string())); @@ -14980,7 +19167,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15016,7 +19203,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15026,10 +19213,10 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15062,7 +19249,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *permission id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn permission_id(mut self, new_value: &str) -> PermissionGetCall<'a, C, A> { self._permission_id = new_value.to_string(); @@ -15087,12 +19274,12 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15109,17 +19296,17 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PermissionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PermissionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/androidpublisher2-cli/Cargo.toml b/gen/androidpublisher2-cli/Cargo.toml index d397b3f578..ae00d569f2 100644 --- a/gen/androidpublisher2-cli/Cargo.toml +++ b/gen/androidpublisher2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androidpublisher2-cli" -version = "0.3.2+20150910" +version = "0.3.3+20160111" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Publisher (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidpublisher2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/androidpublisher2-cli/LICENSE.md b/gen/androidpublisher2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/androidpublisher2-cli/LICENSE.md +++ b/gen/androidpublisher2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/androidpublisher2-cli/README.md b/gen/androidpublisher2-cli/README.md index 47eeb48e21..861f6b4d33 100644 --- a/gen/androidpublisher2-cli/README.md +++ b/gen/androidpublisher2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Android Publisher* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/androidpublisher2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/androidpublisher2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/androidpublisher2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/androidpublisher2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/androidpublisher2-cli). # Usage -This documentation was generated from the *Android Publisher* API at revision *20150910*. The CLI is at version *0.3.2*. +This documentation was generated from the *Android Publisher* API at revision *20160111*. The CLI is at version *0.3.3*. ```bash androidpublisher2 [options] @@ -88,18 +88,18 @@ androidpublisher2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/androidpublisher2-cli/mkdocs.yml b/gen/androidpublisher2-cli/mkdocs.yml index 6e9074d150..0085112181 100644 --- a/gen/androidpublisher2-cli/mkdocs.yml +++ b/gen/androidpublisher2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Publisher v0.3.2+20150910 +site_name: Android Publisher v0.3.3+20160111 site_url: http://byron.github.io/google-apis-rs/google-androidpublisher2-cli site_description: Write integrating applications with bcore @@ -64,5 +64,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/androidpublisher2-cli/src/main.rs b/gen/androidpublisher2-cli/src/main.rs index 1107ad0885..d49301478f 100644 --- a/gen/androidpublisher2-cli/src/main.rs +++ b/gen/androidpublisher2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,20 +36,20 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::AndroidPublisher>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _edits_apklistings_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _edits_apklistings_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); let mut call = self.hub.edits().apklistings_delete(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code, opt.value_of("language").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -62,7 +62,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -75,7 +75,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -90,11 +90,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_apklistings_deleteall(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_apklistings_deleteall(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); let mut call = self.hub.edits().apklistings_deleteall(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -107,7 +107,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -120,7 +120,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -135,11 +135,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_apklistings_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_apklistings_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); let mut call = self.hub.edits().apklistings_get(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code, opt.value_of("language").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -152,7 +152,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -165,7 +165,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -188,11 +188,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_apklistings_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_apklistings_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); let mut call = self.hub.edits().apklistings_list(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -205,7 +205,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -218,7 +218,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -241,13 +241,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_apklistings_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_apklistings_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -261,8 +261,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "recent-changes" => Some(("recentChanges", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "language" => Some(("language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -279,7 +279,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::ApkListing = json::value::from_value(object).unwrap(); let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); let mut call = self.hub.edits().apklistings_patch(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code, opt.value_of("language").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -292,7 +292,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -305,7 +305,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -328,13 +328,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_apklistings_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_apklistings_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -348,8 +348,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "recent-changes" => Some(("recentChanges", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "language" => Some(("language", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -366,7 +366,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::ApkListing = json::value::from_value(object).unwrap(); let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); let mut call = self.hub.edits().apklistings_update(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code, opt.value_of("language").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -379,7 +379,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -392,7 +392,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -415,13 +415,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_apks_addexternallyhosted(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_apks_addexternallyhosted(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -435,8 +435,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "externally-hosted-apk.icon-base64" => Some(("externallyHostedApk.iconBase64", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "externally-hosted-apk.certificate-base64s" => Some(("externallyHostedApk.certificateBase64s", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -464,7 +464,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ApksAddExternallyHostedRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.edits().apks_addexternallyhosted(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -477,7 +477,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -490,7 +490,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -513,10 +513,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_apks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_apks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().apks_list(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -529,7 +529,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -542,7 +542,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -565,10 +565,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_apks_upload(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_apks_upload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().apks_upload(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -581,7 +581,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -589,7 +589,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -597,7 +597,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -621,10 +621,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_commit(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_commit(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().commit(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -637,7 +637,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -650,7 +650,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -673,10 +673,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().delete(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -689,7 +689,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -702,7 +702,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -717,10 +717,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_details_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_details_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().details_get(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -733,7 +733,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -746,7 +746,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -769,13 +769,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_details_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_details_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -789,8 +789,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "contact-email" => Some(("contactEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "contact-phone" => Some(("contactPhone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -808,7 +808,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AppDetails = json::value::from_value(object).unwrap(); let mut call = self.hub.edits().details_patch(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -821,7 +821,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -834,7 +834,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -857,13 +857,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_details_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_details_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -877,8 +877,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "contact-email" => Some(("contactEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "contact-phone" => Some(("contactPhone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -896,7 +896,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AppDetails = json::value::from_value(object).unwrap(); let mut call = self.hub.edits().details_update(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -909,7 +909,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -922,7 +922,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -945,11 +945,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_expansionfiles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_expansionfiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); let mut call = self.hub.edits().expansionfiles_get(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code, opt.value_of("expansion-file-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -962,7 +962,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -975,7 +975,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -998,13 +998,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_expansionfiles_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_expansionfiles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1018,8 +1018,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "references-version" => Some(("referencesVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "file-size" => Some(("fileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1036,7 +1036,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::ExpansionFile = json::value::from_value(object).unwrap(); let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); let mut call = self.hub.edits().expansionfiles_patch(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code, opt.value_of("expansion-file-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1049,7 +1049,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1062,7 +1062,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1085,13 +1085,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_expansionfiles_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_expansionfiles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1105,8 +1105,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "references-version" => Some(("referencesVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "file-size" => Some(("fileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1123,7 +1123,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::ExpansionFile = json::value::from_value(object).unwrap(); let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); let mut call = self.hub.edits().expansionfiles_update(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code, opt.value_of("expansion-file-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1136,7 +1136,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1149,7 +1149,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1172,11 +1172,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_expansionfiles_upload(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_expansionfiles_upload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let apk_version_code: i32 = arg_from_str(&opt.value_of("apk-version-code").unwrap_or(""), err, "", "integer"); let mut call = self.hub.edits().expansionfiles_upload(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), apk_version_code, opt.value_of("expansion-file-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1189,7 +1189,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1197,7 +1197,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1205,7 +1205,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1229,10 +1229,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().get(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1245,7 +1245,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1258,7 +1258,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1281,10 +1281,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_images_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_images_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().images_delete(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("language").unwrap_or(""), opt.value_of("image-type").unwrap_or(""), opt.value_of("image-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1297,7 +1297,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1310,7 +1310,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1325,10 +1325,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_images_deleteall(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_images_deleteall(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().images_deleteall(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("language").unwrap_or(""), opt.value_of("image-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1341,7 +1341,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1354,7 +1354,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1377,10 +1377,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_images_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_images_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().images_list(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("language").unwrap_or(""), opt.value_of("image-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1393,7 +1393,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1406,7 +1406,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1429,10 +1429,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_images_upload(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_images_upload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().images_upload(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("language").unwrap_or(""), opt.value_of("image-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1445,7 +1445,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1453,7 +1453,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1461,7 +1461,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1485,13 +1485,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1505,8 +1505,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "expiry-time-seconds" => Some(("expiryTimeSeconds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1522,7 +1522,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AppEdit = json::value::from_value(object).unwrap(); let mut call = self.hub.edits().insert(request, opt.value_of("package-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1535,7 +1535,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1548,7 +1548,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1571,10 +1571,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_listings_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_listings_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().listings_delete(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("language").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1587,7 +1587,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1600,7 +1600,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1615,10 +1615,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_listings_deleteall(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_listings_deleteall(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().listings_deleteall(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1631,7 +1631,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1644,7 +1644,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1659,10 +1659,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_listings_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_listings_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().listings_get(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("language").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1675,7 +1675,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1688,7 +1688,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1711,10 +1711,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_listings_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_listings_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().listings_list(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1727,7 +1727,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1740,7 +1740,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1763,13 +1763,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_listings_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_listings_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1783,8 +1783,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "short-description" => Some(("shortDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "video" => Some(("video", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1803,7 +1803,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Listing = json::value::from_value(object).unwrap(); let mut call = self.hub.edits().listings_patch(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("language").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1816,7 +1816,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1829,7 +1829,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1852,13 +1852,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_listings_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_listings_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1872,8 +1872,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "short-description" => Some(("shortDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "video" => Some(("video", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1892,7 +1892,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Listing = json::value::from_value(object).unwrap(); let mut call = self.hub.edits().listings_update(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("language").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1905,7 +1905,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1918,7 +1918,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1941,10 +1941,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_testers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_testers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().testers_get(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("track").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1957,7 +1957,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1970,7 +1970,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1993,13 +1993,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_testers_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_testers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2013,8 +2013,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "google-groups" => Some(("googleGroups", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "google-plus-communities" => Some(("googlePlusCommunities", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2030,7 +2030,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Testers = json::value::from_value(object).unwrap(); let mut call = self.hub.edits().testers_patch(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("track").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2043,7 +2043,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2056,7 +2056,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2079,13 +2079,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_testers_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_testers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2099,8 +2099,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "google-groups" => Some(("googleGroups", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "google-plus-communities" => Some(("googlePlusCommunities", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2116,7 +2116,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Testers = json::value::from_value(object).unwrap(); let mut call = self.hub.edits().testers_update(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("track").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2129,7 +2129,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2142,7 +2142,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2165,10 +2165,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_tracks_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_tracks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().tracks_get(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("track").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2181,7 +2181,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2194,7 +2194,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2217,10 +2217,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_tracks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_tracks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().tracks_list(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2233,7 +2233,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2246,7 +2246,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2269,13 +2269,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_tracks_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_tracks_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2289,8 +2289,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "track" => Some(("track", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-fraction" => Some(("userFraction", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -2307,7 +2307,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Track = json::value::from_value(object).unwrap(); let mut call = self.hub.edits().tracks_patch(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("track").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2320,7 +2320,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2333,7 +2333,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2356,13 +2356,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_tracks_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_tracks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2376,8 +2376,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "track" => Some(("track", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "user-fraction" => Some(("userFraction", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -2394,7 +2394,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Track = json::value::from_value(object).unwrap(); let mut call = self.hub.edits().tracks_update(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or(""), opt.value_of("track").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2407,7 +2407,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2420,7 +2420,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2443,10 +2443,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _edits_validate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _edits_validate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.edits().validate(opt.value_of("package-name").unwrap_or(""), opt.value_of("edit-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2459,7 +2459,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2472,7 +2472,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2495,10 +2495,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _entitlements_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _entitlements_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.entitlements().list(opt.value_of("package-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "token" => { @@ -2523,7 +2523,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["token", "start-index", "max-results", "product-id"].iter().map(|v|*v)); @@ -2557,13 +2557,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inappproducts_batch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inappproducts_batch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2577,8 +2577,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -2592,7 +2592,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InappproductsBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.inappproducts().batch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2605,7 +2605,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2618,7 +2618,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2641,10 +2641,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inappproducts_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inappproducts_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.inappproducts().delete(opt.value_of("package-name").unwrap_or(""), opt.value_of("sku").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2657,7 +2657,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2670,7 +2670,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2685,10 +2685,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inappproducts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inappproducts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.inappproducts().get(opt.value_of("package-name").unwrap_or(""), opt.value_of("sku").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2701,7 +2701,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2714,7 +2714,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2737,13 +2737,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inappproducts_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inappproducts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2757,8 +2757,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "sku" => Some(("sku", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2785,7 +2785,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InAppProduct = json::value::from_value(object).unwrap(); let mut call = self.hub.inappproducts().insert(request, opt.value_of("package-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "auto-convert-missing-prices" => { @@ -2801,7 +2801,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["auto-convert-missing-prices"].iter().map(|v|*v)); @@ -2815,7 +2815,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2838,10 +2838,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inappproducts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inappproducts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.inappproducts().list(opt.value_of("package-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "token" => { @@ -2863,7 +2863,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["token", "start-index", "max-results"].iter().map(|v|*v)); @@ -2877,7 +2877,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2900,13 +2900,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inappproducts_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inappproducts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2920,8 +2920,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "sku" => Some(("sku", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2948,7 +2948,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InAppProduct = json::value::from_value(object).unwrap(); let mut call = self.hub.inappproducts().patch(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("sku").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "auto-convert-missing-prices" => { @@ -2964,7 +2964,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["auto-convert-missing-prices"].iter().map(|v|*v)); @@ -2978,7 +2978,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3001,13 +3001,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inappproducts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inappproducts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3021,8 +3021,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "sku" => Some(("sku", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3049,7 +3049,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InAppProduct = json::value::from_value(object).unwrap(); let mut call = self.hub.inappproducts().update(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("sku").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "auto-convert-missing-prices" => { @@ -3065,7 +3065,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["auto-convert-missing-prices"].iter().map(|v|*v)); @@ -3079,7 +3079,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3102,10 +3102,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _purchases_products_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _purchases_products_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.purchases().products_get(opt.value_of("package-name").unwrap_or(""), opt.value_of("product-id").unwrap_or(""), opt.value_of("token").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3118,7 +3118,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3131,7 +3131,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3154,10 +3154,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _purchases_subscriptions_cancel(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _purchases_subscriptions_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.purchases().subscriptions_cancel(opt.value_of("package-name").unwrap_or(""), opt.value_of("subscription-id").unwrap_or(""), opt.value_of("token").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3170,7 +3170,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3183,7 +3183,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3198,13 +3198,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _purchases_subscriptions_defer(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _purchases_subscriptions_defer(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3218,8 +3218,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "deferral-info.expected-expiry-time-millis" => Some(("deferralInfo.expectedExpiryTimeMillis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "deferral-info.desired-expiry-time-millis" => Some(("deferralInfo.desiredExpiryTimeMillis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3235,7 +3235,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SubscriptionPurchasesDeferRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.purchases().subscriptions_defer(request, opt.value_of("package-name").unwrap_or(""), opt.value_of("subscription-id").unwrap_or(""), opt.value_of("token").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3248,7 +3248,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3261,7 +3261,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3284,10 +3284,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _purchases_subscriptions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _purchases_subscriptions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.purchases().subscriptions_get(opt.value_of("package-name").unwrap_or(""), opt.value_of("subscription-id").unwrap_or(""), opt.value_of("token").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3300,7 +3300,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3313,7 +3313,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3336,10 +3336,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _purchases_subscriptions_refund(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _purchases_subscriptions_refund(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.purchases().subscriptions_refund(opt.value_of("package-name").unwrap_or(""), opt.value_of("subscription-id").unwrap_or(""), opt.value_of("token").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3352,7 +3352,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3365,7 +3365,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3380,10 +3380,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _purchases_subscriptions_revoke(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _purchases_subscriptions_revoke(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.purchases().subscriptions_revoke(opt.value_of("package-name").unwrap_or(""), opt.value_of("subscription-id").unwrap_or(""), opt.value_of("token").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3396,7 +3396,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3409,7 +3409,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3634,14 +3634,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "androidpublisher2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "androidpublisher2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -3661,7 +3661,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -3701,7 +3701,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("edits", "methods: 'apklistings-delete', 'apklistings-deleteall', 'apklistings-get', 'apklistings-list', 'apklistings-patch', 'apklistings-update', 'apks-addexternallyhosted', 'apks-list', 'apks-upload', 'commit', 'delete', 'details-get', 'details-patch', 'details-update', 'expansionfiles-get', 'expansionfiles-patch', 'expansionfiles-update', 'expansionfiles-upload', 'get', 'images-delete', 'images-deleteall', 'images-list', 'images-upload', 'insert', 'listings-delete', 'listings-deleteall', 'listings-get', 'listings-list', 'listings-patch', 'listings-update', 'testers-get', 'testers-patch', 'testers-update', 'tracks-get', 'tracks-list', 'tracks-patch', 'tracks-update' and 'validate'", vec![ - ("apklistings-delete", + ("apklistings-delete", Some(r##"Deletes the APK-specific localized listing for a specified APK and language code."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_apklistings-delete", vec![ @@ -3735,7 +3735,7 @@ fn main() { Some(false), Some(true)), ]), - ("apklistings-deleteall", + ("apklistings-deleteall", Some(r##"Deletes all the APK-specific localized listings for a specified APK."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_apklistings-deleteall", vec![ @@ -3763,7 +3763,7 @@ fn main() { Some(false), Some(true)), ]), - ("apklistings-get", + ("apklistings-get", Some(r##"Fetches the APK-specific localized listing for a specified APK and language code."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_apklistings-get", vec![ @@ -3803,7 +3803,7 @@ fn main() { Some(false), Some(false)), ]), - ("apklistings-list", + ("apklistings-list", Some(r##"Lists all the APK-specific localized listings for a specified APK."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_apklistings-list", vec![ @@ -3837,7 +3837,7 @@ fn main() { Some(false), Some(false)), ]), - ("apklistings-patch", + ("apklistings-patch", Some(r##"Updates or creates the APK-specific localized listing for a specified APK and language code. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_apklistings-patch", vec![ @@ -3883,7 +3883,7 @@ fn main() { Some(false), Some(false)), ]), - ("apklistings-update", + ("apklistings-update", Some(r##"Updates or creates the APK-specific localized listing for a specified APK and language code."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_apklistings-update", vec![ @@ -3929,7 +3929,7 @@ fn main() { Some(false), Some(false)), ]), - ("apks-addexternallyhosted", + ("apks-addexternallyhosted", Some(r##"Creates a new APK without uploading the APK itself to Google Play, instead hosting the APK at a specified URL. This function is only available to enterprises using Google Play for Work whose application is configured to restrict distribution to the enterprise domain."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_apks-addexternallyhosted", vec![ @@ -3963,7 +3963,7 @@ fn main() { Some(false), Some(false)), ]), - ("apks-list", + ("apks-list", None, "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_apks-list", vec![ @@ -3991,7 +3991,7 @@ fn main() { Some(false), Some(false)), ]), - ("apks-upload", + ("apks-upload", None, "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_apks-upload", vec![ @@ -4025,7 +4025,7 @@ fn main() { Some(false), Some(false)), ]), - ("commit", + ("commit", Some(r##"Commits/applies the changes made in this edit back to the app."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_commit", vec![ @@ -4053,7 +4053,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes an edit for an app. Creating a new edit will automatically delete any of your previous edits so this method need only be called if you want to preemptively abandon an edit."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_delete", vec![ @@ -4075,7 +4075,7 @@ fn main() { Some(false), Some(true)), ]), - ("details-get", + ("details-get", Some(r##"Fetches app details for this edit. This includes the default language and developer support contact information."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_details-get", vec![ @@ -4103,7 +4103,7 @@ fn main() { Some(false), Some(false)), ]), - ("details-patch", + ("details-patch", Some(r##"Updates app details for this edit. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_details-patch", vec![ @@ -4137,7 +4137,7 @@ fn main() { Some(false), Some(false)), ]), - ("details-update", + ("details-update", Some(r##"Updates app details for this edit."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_details-update", vec![ @@ -4171,7 +4171,7 @@ fn main() { Some(false), Some(false)), ]), - ("expansionfiles-get", + ("expansionfiles-get", Some(r##"Fetches the Expansion File configuration for the APK specified."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_expansionfiles-get", vec![ @@ -4211,7 +4211,7 @@ fn main() { Some(false), Some(false)), ]), - ("expansionfiles-patch", + ("expansionfiles-patch", Some(r##"Updates the APK's Expansion File configuration to reference another APK's Expansion Files. To add a new Expansion File use the Upload method. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_expansionfiles-patch", vec![ @@ -4257,7 +4257,7 @@ fn main() { Some(false), Some(false)), ]), - ("expansionfiles-update", + ("expansionfiles-update", Some(r##"Updates the APK's Expansion File configuration to reference another APK's Expansion Files. To add a new Expansion File use the Upload method."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_expansionfiles-update", vec![ @@ -4303,7 +4303,7 @@ fn main() { Some(false), Some(false)), ]), - ("expansionfiles-upload", + ("expansionfiles-upload", Some(r##"Uploads and attaches a new Expansion File to the APK specified."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_expansionfiles-upload", vec![ @@ -4349,7 +4349,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns information about the edit specified. Calls will fail if the edit is no long active (e.g. has been deleted, superseded or expired)."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_get", vec![ @@ -4377,7 +4377,7 @@ fn main() { Some(false), Some(false)), ]), - ("images-delete", + ("images-delete", Some(r##"Deletes the image (specified by id) from the edit."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_images-delete", vec![ @@ -4417,7 +4417,7 @@ fn main() { Some(false), Some(true)), ]), - ("images-deleteall", + ("images-deleteall", Some(r##"Deletes all images for the specified language and image type."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_images-deleteall", vec![ @@ -4457,7 +4457,7 @@ fn main() { Some(false), Some(false)), ]), - ("images-list", + ("images-list", Some(r##"Lists all images for the specified language and image type."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_images-list", vec![ @@ -4497,7 +4497,7 @@ fn main() { Some(false), Some(false)), ]), - ("images-upload", + ("images-upload", Some(r##"Uploads a new image and adds it to the list of images for the specified language and image type."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_images-upload", vec![ @@ -4543,7 +4543,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new edit for an app, populated with the app's current state."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_insert", vec![ @@ -4571,7 +4571,7 @@ fn main() { Some(false), Some(false)), ]), - ("listings-delete", + ("listings-delete", Some(r##"Deletes the specified localized store listing from an edit."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_listings-delete", vec![ @@ -4599,7 +4599,7 @@ fn main() { Some(false), Some(true)), ]), - ("listings-deleteall", + ("listings-deleteall", Some(r##"Deletes all localized listings from an edit."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_listings-deleteall", vec![ @@ -4621,7 +4621,7 @@ fn main() { Some(false), Some(true)), ]), - ("listings-get", + ("listings-get", Some(r##"Fetches information about a localized store listing."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_listings-get", vec![ @@ -4655,7 +4655,7 @@ fn main() { Some(false), Some(false)), ]), - ("listings-list", + ("listings-list", Some(r##"Returns all of the localized store listings attached to this edit."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_listings-list", vec![ @@ -4683,7 +4683,7 @@ fn main() { Some(false), Some(false)), ]), - ("listings-patch", + ("listings-patch", Some(r##"Creates or updates a localized store listing. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_listings-patch", vec![ @@ -4723,7 +4723,7 @@ fn main() { Some(false), Some(false)), ]), - ("listings-update", + ("listings-update", Some(r##"Creates or updates a localized store listing."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_listings-update", vec![ @@ -4763,7 +4763,7 @@ fn main() { Some(false), Some(false)), ]), - ("testers-get", + ("testers-get", None, "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_testers-get", vec![ @@ -4797,7 +4797,7 @@ fn main() { Some(false), Some(false)), ]), - ("testers-patch", + ("testers-patch", None, "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_testers-patch", vec![ @@ -4837,7 +4837,7 @@ fn main() { Some(false), Some(false)), ]), - ("testers-update", + ("testers-update", None, "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_testers-update", vec![ @@ -4877,7 +4877,7 @@ fn main() { Some(false), Some(false)), ]), - ("tracks-get", + ("tracks-get", Some(r##"Fetches the track configuration for the specified track type. Includes the APK version codes that are in this track."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_tracks-get", vec![ @@ -4911,7 +4911,7 @@ fn main() { Some(false), Some(false)), ]), - ("tracks-list", + ("tracks-list", Some(r##"Lists all the track configurations for this edit."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_tracks-list", vec![ @@ -4939,7 +4939,7 @@ fn main() { Some(false), Some(false)), ]), - ("tracks-patch", + ("tracks-patch", Some(r##"Updates the track configuration for the specified track type. When halted, the rollout track cannot be updated without adding new APKs, and adding new APKs will cause it to resume. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_tracks-patch", vec![ @@ -4979,7 +4979,7 @@ fn main() { Some(false), Some(false)), ]), - ("tracks-update", + ("tracks-update", Some(r##"Updates the track configuration for the specified track type. When halted, the rollout track cannot be updated without adding new APKs, and adding new APKs will cause it to resume."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_tracks-update", vec![ @@ -5019,7 +5019,7 @@ fn main() { Some(false), Some(false)), ]), - ("validate", + ("validate", Some(r##"Checks that the edit can be successfully committed. The edit's changes are not applied to the live app."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/edits_validate", vec![ @@ -5050,7 +5050,7 @@ fn main() { ]), ("entitlements", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Lists the user's current inapp item or subscription entitlements"##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/entitlements_list", vec![ @@ -5075,7 +5075,7 @@ fn main() { ]), ("inappproducts", "methods: 'batch', 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("batch", + ("batch", None, "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/inappproducts_batch", vec![ @@ -5097,7 +5097,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete an in-app product for an app."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/inappproducts_delete", vec![ @@ -5119,7 +5119,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns information about the in-app product specified."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/inappproducts_get", vec![ @@ -5147,7 +5147,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new in-app product for an app."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/inappproducts_insert", vec![ @@ -5175,7 +5175,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all the in-app products for an Android app, both subscriptions and managed in-app products.."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/inappproducts_list", vec![ @@ -5197,7 +5197,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates the details of an in-app product. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/inappproducts_patch", vec![ @@ -5231,7 +5231,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates the details of an in-app product."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/inappproducts_update", vec![ @@ -5268,7 +5268,7 @@ fn main() { ]), ("purchases", "methods: 'products-get', 'subscriptions-cancel', 'subscriptions-defer', 'subscriptions-get', 'subscriptions-refund' and 'subscriptions-revoke'", vec![ - ("products-get", + ("products-get", Some(r##"Checks the purchase and consumption status of an inapp item."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/purchases_products-get", vec![ @@ -5302,7 +5302,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-cancel", + ("subscriptions-cancel", Some(r##"Cancels a user's subscription purchase. The subscription remains valid until its expiration time."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/purchases_subscriptions-cancel", vec![ @@ -5330,7 +5330,7 @@ fn main() { Some(false), Some(true)), ]), - ("subscriptions-defer", + ("subscriptions-defer", Some(r##"Defers a user's subscription purchase until a specified future expiration time."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/purchases_subscriptions-defer", vec![ @@ -5370,7 +5370,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-get", + ("subscriptions-get", Some(r##"Checks whether a user's subscription purchase is valid and returns its expiry time."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/purchases_subscriptions-get", vec![ @@ -5404,7 +5404,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-refund", + ("subscriptions-refund", Some(r##"Refunds a user's subscription purchase, but the subscription remains valid until its expiration time and it will continue to recur."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/purchases_subscriptions-refund", vec![ @@ -5432,7 +5432,7 @@ fn main() { Some(false), Some(true)), ]), - ("subscriptions-revoke", + ("subscriptions-revoke", Some(r##"Refunds and immediately revokes a user's subscription purchase. Access to the subscription will be terminated immediately and it will stop recurring."##), "Details at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli/purchases_subscriptions-revoke", vec![ @@ -5466,7 +5466,7 @@ fn main() { let mut app = App::new("androidpublisher2") .author("Sebastian Thiel ") - .version("0.3.2+20150910") + .version("0.3.3+20160111") .about("Lets Android application developers access their Google Play accounts.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_androidpublisher2_cli") .arg(Arg::with_name("url") @@ -5490,7 +5490,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -5501,7 +5501,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/androidpublisher2/Cargo.toml b/gen/androidpublisher2/Cargo.toml index 1b6a4ff47c..9200a5fd92 100644 --- a/gen/androidpublisher2/Cargo.toml +++ b/gen/androidpublisher2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androidpublisher2" -version = "0.1.10+20150910" +version = "0.1.11+20160111" authors = ["Sebastian Thiel "] description = "A complete library to interact with Android Publisher (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/androidpublisher2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/androidpublisher2/LICENSE.md b/gen/androidpublisher2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/androidpublisher2/LICENSE.md +++ b/gen/androidpublisher2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/androidpublisher2/README.md b/gen/androidpublisher2/README.md index 8d6ae2199d..c8dab59fce 100644 --- a/gen/androidpublisher2/README.md +++ b/gen/androidpublisher2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-androidpublisher2` library allows access to all features of the *Google Android Publisher* service. -This documentation was generated from *Android Publisher* crate version *0.1.10+20150910*, where *20150910* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Android Publisher* crate version *0.1.11+20160111*, where *20160111* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Android Publisher* *v2* API can be found at the [official documentation site](https://developers.google.com/android-publisher). diff --git a/gen/androidpublisher2/src/cmn.rs b/gen/androidpublisher2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/androidpublisher2/src/cmn.rs +++ b/gen/androidpublisher2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/androidpublisher2/src/lib.rs b/gen/androidpublisher2/src/lib.rs index 3be0223ecf..ff17acbad6 100644 --- a/gen/androidpublisher2/src/lib.rs +++ b/gen/androidpublisher2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Android Publisher* crate version *0.1.10+20150910*, where *20150910* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Android Publisher* crate version *0.1.11+20160111*, where *20160111* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Android Publisher* *v2* API can be found at the //! [official documentation site](https://developers.google.com/android-publisher). diff --git a/gen/androidpublisher2/src/lib.rs.in b/gen/androidpublisher2/src/lib.rs.in index 427e3dfcc8..b4abdd62cb 100644 --- a/gen/androidpublisher2/src/lib.rs.in +++ b/gen/androidpublisher2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -133,7 +134,7 @@ impl<'a, C, A> AndroidPublisher AndroidPublisher { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -151,7 +152,7 @@ impl<'a, C, A> AndroidPublisher } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -193,6 +194,26 @@ pub struct Entitlement { impl Resource for Entitlement {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [apks list edits](struct.EditApkListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ApksListResponse { + /// no description provided + pub apks: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "androidpublisher#apksListResponse". + pub kind: Option, +} + +impl ResponseResult for ApksListResponse {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -224,7 +245,7 @@ pub struct InAppProduct { pub sku: Option, /// no description provided pub status: Option, - /// Subscription period, specified in ISO 8601 format. Acceptable values are "P1W" (one week), "P1M" (one month) and "P1Y" (one year). + /// Subscription period, specified in ISO 8601 format. Acceptable values are "P1W" (one week), "P1M" (one month), "P3M" (three months), "P6M" (six months), and "P1Y" (one year). #[serde(rename="subscriptionPeriod")] pub subscription_period: Option, /// Definition of a season for a seasonal subscription. Can be defined only for yearly subscriptions. @@ -944,22 +965,18 @@ impl Part for Image {} /// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [apks list edits](struct.EditApkListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ApksListResponse { - /// no description provided - pub apks: Option>, - /// Identifies what kind of resource this is. Value: the fixed string "androidpublisher#apksListResponse". - pub kind: Option, +pub struct Prorate { + /// Defines the first day on which the price takes effect. + pub start: Option, + /// Default price cannot be zero and must be less than the full subscription price. Default price is always in the developer's Checkout merchant currency. Targeted countries have their prices set automatically based on the default_price. + #[serde(rename="defaultPrice")] + pub default_price: Option, } -impl ResponseResult for ApksListResponse {} +impl Part for Prorate {} /// There is no detailed description. @@ -1060,10 +1077,12 @@ impl ResponseResult for InappproductsBatchResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Season { - /// Inclusive start date of the recurrence period. - pub start: Option, + /// Optionally present list of prorations for the season. Each proration is a one-off discounted entry into a subscription. Each proration contains the first date on which the discount is available and the new pricing information. + pub prorations: Option>, /// Inclusive end date of the recurrence period. pub end: Option, + /// Inclusive start date of the recurrence period. + pub start: Option, } impl Part for Season {} @@ -2464,7 +2483,7 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.entitlements.list", + dlg.begin(MethodInfo { id: "androidpublisher.entitlements.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -2527,7 +2546,7 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2548,7 +2567,7 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2558,10 +2577,10 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2594,7 +2613,7 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EntitlementListCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -2637,12 +2656,12 @@ impl<'a, C, A> EntitlementListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2717,7 +2736,7 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.purchases.subscriptions.revoke", + dlg.begin(MethodInfo { id: "androidpublisher.purchases.subscriptions.revoke", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -2760,7 +2779,7 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2796,7 +2815,7 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2806,10 +2825,10 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRevokeCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -2842,7 +2861,7 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRevokeCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -2852,7 +2871,7 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRevokeCall<'a, C, A> { self._token = new_value.to_string(); @@ -2870,12 +2889,12 @@ impl<'a, C, A> PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRevokeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PurchaseSubscriptionRevokeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PurchaseSubscriptionRevokeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2966,7 +2985,7 @@ impl<'a, C, A> PurchaseProductGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.purchases.products.get", + dlg.begin(MethodInfo { id: "androidpublisher.purchases.products.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -3010,7 +3029,7 @@ impl<'a, C, A> PurchaseProductGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3046,7 +3065,7 @@ impl<'a, C, A> PurchaseProductGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3056,10 +3075,10 @@ impl<'a, C, A> PurchaseProductGetCall<'a, C, A> where C: BorrowMut PurchaseProductGetCall<'a, C, A> where C: BorrowMut PurchaseProductGetCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -3102,7 +3121,7 @@ impl<'a, C, A> PurchaseProductGetCall<'a, C, A> where C: BorrowMut PurchaseProductGetCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -3112,7 +3131,7 @@ impl<'a, C, A> PurchaseProductGetCall<'a, C, A> where C: BorrowMut PurchaseProductGetCall<'a, C, A> { self._token = new_value.to_string(); @@ -3130,12 +3149,12 @@ impl<'a, C, A> PurchaseProductGetCall<'a, C, A> where C: BorrowMut PurchaseProductGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PurchaseProductGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PurchaseProductGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3226,7 +3245,7 @@ impl<'a, C, A> PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.purchases.subscriptions.get", + dlg.begin(MethodInfo { id: "androidpublisher.purchases.subscriptions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -3270,7 +3289,7 @@ impl<'a, C, A> PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3306,7 +3325,7 @@ impl<'a, C, A> PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3316,10 +3335,10 @@ impl<'a, C, A> PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionGetCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -3362,7 +3381,7 @@ impl<'a, C, A> PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionGetCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -3372,7 +3391,7 @@ impl<'a, C, A> PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionGetCall<'a, C, A> { self._token = new_value.to_string(); @@ -3390,12 +3409,12 @@ impl<'a, C, A> PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PurchaseSubscriptionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PurchaseSubscriptionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3486,7 +3505,7 @@ impl<'a, C, A> PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.purchases.subscriptions.cancel", + dlg.begin(MethodInfo { id: "androidpublisher.purchases.subscriptions.cancel", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -3529,7 +3548,7 @@ impl<'a, C, A> PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3565,7 +3584,7 @@ impl<'a, C, A> PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3575,10 +3594,10 @@ impl<'a, C, A> PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionCancelCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -3611,7 +3630,7 @@ impl<'a, C, A> PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionCancelCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -3621,7 +3640,7 @@ impl<'a, C, A> PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionCancelCall<'a, C, A> { self._token = new_value.to_string(); @@ -3639,12 +3658,12 @@ impl<'a, C, A> PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionCancelCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PurchaseSubscriptionCancelCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PurchaseSubscriptionCancelCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3735,7 +3754,7 @@ impl<'a, C, A> PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.purchases.subscriptions.refund", + dlg.begin(MethodInfo { id: "androidpublisher.purchases.subscriptions.refund", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -3778,7 +3797,7 @@ impl<'a, C, A> PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3814,7 +3833,7 @@ impl<'a, C, A> PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3824,10 +3843,10 @@ impl<'a, C, A> PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRefundCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -3860,7 +3879,7 @@ impl<'a, C, A> PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRefundCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -3870,7 +3889,7 @@ impl<'a, C, A> PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRefundCall<'a, C, A> { self._token = new_value.to_string(); @@ -3888,12 +3907,12 @@ impl<'a, C, A> PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionRefundCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PurchaseSubscriptionRefundCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PurchaseSubscriptionRefundCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3991,7 +4010,7 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.purchases.subscriptions.defer", + dlg.begin(MethodInfo { id: "androidpublisher.purchases.subscriptions.defer", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -4035,14 +4054,14 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4086,7 +4105,7 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4096,10 +4115,10 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionDeferCall<'a, C, A> { self._request = new_value; @@ -4141,7 +4160,7 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionDeferCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -4151,7 +4170,7 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionDeferCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -4161,7 +4180,7 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionDeferCall<'a, C, A> { self._token = new_value.to_string(); @@ -4179,12 +4198,12 @@ impl<'a, C, A> PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut PurchaseSubscriptionDeferCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PurchaseSubscriptionDeferCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PurchaseSubscriptionDeferCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4278,7 +4297,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.images.upload", + dlg.begin(MethodInfo { id: "androidpublisher.edits.images.upload", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -4297,13 +4316,13 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/androidpublisher/v2/applications/{packageName}/edits/{editId}/listings/{language}/{imageType}".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/androidpublisher/v2/applications/{packageName}/edits/{editId}/listings/{language}/{imageType}".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -4331,7 +4350,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4395,7 +4414,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4405,10 +4424,10 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4512,7 +4531,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditImageUploadCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -4522,7 +4541,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditImageUploadCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -4532,7 +4551,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, /// /// Sets the *language* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn language(mut self, new_value: &str) -> EditImageUploadCall<'a, C, A> { self._language = new_value.to_string(); @@ -4541,7 +4560,7 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, /// /// Sets the *image type* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn image_type(mut self, new_value: &str) -> EditImageUploadCall<'a, C, A> { self._image_type = new_value.to_string(); @@ -4559,12 +4578,12 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4581,17 +4600,17 @@ impl<'a, C, A> EditImageUploadCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditImageUploadCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditImageUploadCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4663,7 +4682,7 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.expansionfiles.update", + dlg.begin(MethodInfo { id: "androidpublisher.edits.expansionfiles.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -4708,14 +4727,14 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4759,7 +4778,7 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4769,10 +4788,10 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditExpansionfileUpdateCall<'a, C, A> { self._request = new_value; @@ -4814,7 +4833,7 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditExpansionfileUpdateCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -4824,7 +4843,7 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditExpansionfileUpdateCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -4834,7 +4853,7 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditExpansionfileUpdateCall<'a, C, A> { self._apk_version_code = new_value; @@ -4843,7 +4862,7 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditExpansionfileUpdateCall<'a, C, A> { self._expansion_file_type = new_value.to_string(); @@ -4861,12 +4880,12 @@ impl<'a, C, A> EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut EditExpansionfileUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditExpansionfileUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditExpansionfileUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4956,7 +4975,7 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.details.get", + dlg.begin(MethodInfo { id: "androidpublisher.edits.details.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -4999,7 +5018,7 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5035,7 +5054,7 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5045,10 +5064,10 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5081,7 +5100,7 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditDetailGetCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -5091,7 +5110,7 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditDetailGetCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -5109,12 +5128,12 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5131,17 +5150,17 @@ impl<'a, C, A> EditDetailGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditDetailGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditDetailGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5204,7 +5223,7 @@ impl<'a, C, A> EditListingDeleteallCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.deleteall", + dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.deleteall", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -5246,7 +5265,7 @@ impl<'a, C, A> EditListingDeleteallCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5282,7 +5301,7 @@ impl<'a, C, A> EditListingDeleteallCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5292,10 +5311,10 @@ impl<'a, C, A> EditListingDeleteallCall<'a, C, A> where C: BorrowMut EditListingDeleteallCall<'a, C, A> where C: BorrowMut EditListingDeleteallCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -5328,7 +5347,7 @@ impl<'a, C, A> EditListingDeleteallCall<'a, C, A> where C: BorrowMut EditListingDeleteallCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -5346,12 +5365,12 @@ impl<'a, C, A> EditListingDeleteallCall<'a, C, A> where C: BorrowMut EditListingDeleteallCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditListingDeleteallCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditListingDeleteallCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5448,7 +5467,7 @@ impl<'a, C, A> EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.apks.addexternallyhosted", + dlg.begin(MethodInfo { id: "androidpublisher.edits.apks.addexternallyhosted", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -5491,14 +5510,14 @@ impl<'a, C, A> EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5542,7 +5561,7 @@ impl<'a, C, A> EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5552,10 +5571,10 @@ impl<'a, C, A> EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut EditApkAddexternallyhostedCall<'a, C, A> { self._request = new_value; @@ -5597,7 +5616,7 @@ impl<'a, C, A> EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut EditApkAddexternallyhostedCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -5607,7 +5626,7 @@ impl<'a, C, A> EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut EditApkAddexternallyhostedCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -5625,12 +5644,12 @@ impl<'a, C, A> EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut EditApkAddexternallyhostedCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditApkAddexternallyhostedCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditApkAddexternallyhostedCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5721,7 +5740,7 @@ impl<'a, C, A> EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.deleteall", + dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.deleteall", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -5764,7 +5783,7 @@ impl<'a, C, A> EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5800,7 +5819,7 @@ impl<'a, C, A> EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5810,10 +5829,10 @@ impl<'a, C, A> EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut EditApklistingDeleteallCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -5846,7 +5865,7 @@ impl<'a, C, A> EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut EditApklistingDeleteallCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -5856,7 +5875,7 @@ impl<'a, C, A> EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut EditApklistingDeleteallCall<'a, C, A> { self._apk_version_code = new_value; @@ -5874,12 +5893,12 @@ impl<'a, C, A> EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut EditApklistingDeleteallCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditApklistingDeleteallCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditApklistingDeleteallCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5976,7 +5995,7 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.details.update", + dlg.begin(MethodInfo { id: "androidpublisher.edits.details.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -6019,14 +6038,14 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6070,7 +6089,7 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6080,10 +6099,10 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6115,7 +6134,7 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AppDetails) -> EditDetailUpdateCall<'a, C, A> { self._request = new_value; @@ -6125,7 +6144,7 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditDetailUpdateCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -6135,7 +6154,7 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditDetailUpdateCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -6153,12 +6172,12 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6175,17 +6194,17 @@ impl<'a, C, A> EditDetailUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditDetailUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditDetailUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6249,7 +6268,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.tracks.get", + dlg.begin(MethodInfo { id: "androidpublisher.edits.tracks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -6293,7 +6312,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6329,7 +6348,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6339,10 +6358,10 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6375,7 +6394,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditTrackGetCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -6385,7 +6404,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditTrackGetCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -6395,7 +6414,7 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *track* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn track(mut self, new_value: &str) -> EditTrackGetCall<'a, C, A> { self._track = new_value.to_string(); @@ -6413,12 +6432,12 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6435,17 +6454,17 @@ impl<'a, C, A> EditTrackGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditTrackGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditTrackGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6517,7 +6536,7 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.expansionfiles.patch", + dlg.begin(MethodInfo { id: "androidpublisher.edits.expansionfiles.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -6562,14 +6581,14 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6613,7 +6632,7 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6623,10 +6642,10 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditExpansionfilePatchCall<'a, C, A> { self._request = new_value; @@ -6668,7 +6687,7 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditExpansionfilePatchCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -6678,7 +6697,7 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditExpansionfilePatchCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -6688,7 +6707,7 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditExpansionfilePatchCall<'a, C, A> { self._apk_version_code = new_value; @@ -6697,7 +6716,7 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditExpansionfilePatchCall<'a, C, A> { self._expansion_file_type = new_value.to_string(); @@ -6715,12 +6734,12 @@ impl<'a, C, A> EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut EditExpansionfilePatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditExpansionfilePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditExpansionfilePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6812,7 +6831,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.images.list", + dlg.begin(MethodInfo { id: "androidpublisher.edits.images.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -6857,7 +6876,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6893,7 +6912,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6903,10 +6922,10 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6939,7 +6958,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditImageListCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -6949,7 +6968,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditImageListCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -6959,7 +6978,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *language* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn language(mut self, new_value: &str) -> EditImageListCall<'a, C, A> { self._language = new_value.to_string(); @@ -6968,7 +6987,7 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *image type* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn image_type(mut self, new_value: &str) -> EditImageListCall<'a, C, A> { self._image_type = new_value.to_string(); @@ -6986,12 +7005,12 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7008,17 +7027,17 @@ impl<'a, C, A> EditImageListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditImageListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditImageListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7089,7 +7108,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.tracks.update", + dlg.begin(MethodInfo { id: "androidpublisher.edits.tracks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -7133,14 +7152,14 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7184,7 +7203,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7194,10 +7213,10 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7229,7 +7248,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Track) -> EditTrackUpdateCall<'a, C, A> { self._request = new_value; @@ -7239,7 +7258,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditTrackUpdateCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -7249,7 +7268,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditTrackUpdateCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -7259,7 +7278,7 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *track* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn track(mut self, new_value: &str) -> EditTrackUpdateCall<'a, C, A> { self._track = new_value.to_string(); @@ -7277,12 +7296,12 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7299,17 +7318,17 @@ impl<'a, C, A> EditTrackUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditTrackUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditTrackUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7380,7 +7399,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.patch", + dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -7424,14 +7443,14 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7475,7 +7494,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7485,10 +7504,10 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7520,7 +7539,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Listing) -> EditListingPatchCall<'a, C, A> { self._request = new_value; @@ -7530,7 +7549,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditListingPatchCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -7540,7 +7559,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditListingPatchCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -7550,7 +7569,7 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *language* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn language(mut self, new_value: &str) -> EditListingPatchCall<'a, C, A> { self._language = new_value.to_string(); @@ -7568,12 +7587,12 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7590,17 +7609,17 @@ impl<'a, C, A> EditListingPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditListingPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditListingPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7663,7 +7682,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.get", + dlg.begin(MethodInfo { id: "androidpublisher.edits.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -7706,7 +7725,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7742,7 +7761,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7752,10 +7771,10 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7788,7 +7807,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditGetCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -7798,7 +7817,7 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditGetCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -7816,12 +7835,12 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7838,17 +7857,17 @@ impl<'a, C, A> EditGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7914,7 +7933,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.images.delete", + dlg.begin(MethodInfo { id: "androidpublisher.edits.images.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -7959,7 +7978,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7995,7 +8014,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8005,10 +8024,10 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8031,7 +8050,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditImageDeleteCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -8041,7 +8060,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditImageDeleteCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -8051,7 +8070,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *language* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn language(mut self, new_value: &str) -> EditImageDeleteCall<'a, C, A> { self._language = new_value.to_string(); @@ -8060,7 +8079,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *image type* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn image_type(mut self, new_value: &str) -> EditImageDeleteCall<'a, C, A> { self._image_type = new_value.to_string(); @@ -8070,7 +8089,7 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *image id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn image_id(mut self, new_value: &str) -> EditImageDeleteCall<'a, C, A> { self._image_id = new_value.to_string(); @@ -8088,12 +8107,12 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8110,17 +8129,17 @@ impl<'a, C, A> EditImageDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditImageDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditImageDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8183,7 +8202,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.apks.upload", + dlg.begin(MethodInfo { id: "androidpublisher.edits.apks.upload", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -8200,13 +8219,13 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/androidpublisher/v2/applications/{packageName}/edits/{editId}/apks".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/androidpublisher/v2/applications/{packageName}/edits/{editId}/apks".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -8234,7 +8253,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8298,7 +8317,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8308,10 +8327,10 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8415,7 +8434,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditApkUploadCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -8425,7 +8444,7 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditApkUploadCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -8443,12 +8462,12 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8465,17 +8484,17 @@ impl<'a, C, A> EditApkUploadCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditApkUploadCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditApkUploadCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8547,7 +8566,7 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.update", + dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -8592,14 +8611,14 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8643,7 +8662,7 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8653,10 +8672,10 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut EditApklistingUpdateCall<'a, C, A> where C: BorrowMut EditApklistingUpdateCall<'a, C, A> { self._request = new_value; @@ -8698,7 +8717,7 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut EditApklistingUpdateCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -8708,7 +8727,7 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut EditApklistingUpdateCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -8718,7 +8737,7 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut EditApklistingUpdateCall<'a, C, A> { self._apk_version_code = new_value; @@ -8728,7 +8747,7 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut EditApklistingUpdateCall<'a, C, A> { self._language = new_value.to_string(); @@ -8746,12 +8765,12 @@ impl<'a, C, A> EditApklistingUpdateCall<'a, C, A> where C: BorrowMut EditApklistingUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditApklistingUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditApklistingUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8839,7 +8858,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.apks.list", + dlg.begin(MethodInfo { id: "androidpublisher.edits.apks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -8882,7 +8901,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8918,7 +8937,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8928,10 +8947,10 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8964,7 +8983,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditApkListCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -8974,7 +8993,7 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditApkListCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -8992,12 +9011,12 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9014,17 +9033,17 @@ impl<'a, C, A> EditApkListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditApkListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditApkListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9096,7 +9115,7 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.patch", + dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -9141,14 +9160,14 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9192,7 +9211,7 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9202,10 +9221,10 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut EditApklistingPatchCall<'a, C, A> where C: BorrowMut EditApklistingPatchCall<'a, C, A> { self._request = new_value; @@ -9247,7 +9266,7 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut EditApklistingPatchCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -9257,7 +9276,7 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut EditApklistingPatchCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -9267,7 +9286,7 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut EditApklistingPatchCall<'a, C, A> { self._apk_version_code = new_value; @@ -9277,7 +9296,7 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut EditApklistingPatchCall<'a, C, A> { self._language = new_value.to_string(); @@ -9295,12 +9314,12 @@ impl<'a, C, A> EditApklistingPatchCall<'a, C, A> where C: BorrowMut EditApklistingPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditApklistingPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditApklistingPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9391,7 +9410,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.get", + dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -9435,7 +9454,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9471,7 +9490,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9481,10 +9500,10 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9517,7 +9536,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditListingGetCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -9527,7 +9546,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditListingGetCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -9537,7 +9556,7 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *language* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn language(mut self, new_value: &str) -> EditListingGetCall<'a, C, A> { self._language = new_value.to_string(); @@ -9555,12 +9574,12 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9577,17 +9596,17 @@ impl<'a, C, A> EditListingGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditListingGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditListingGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9652,7 +9671,7 @@ impl<'a, C, A> EditApklistingDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.delete", + dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -9696,7 +9715,7 @@ impl<'a, C, A> EditApklistingDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9732,7 +9751,7 @@ impl<'a, C, A> EditApklistingDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9742,10 +9761,10 @@ impl<'a, C, A> EditApklistingDeleteCall<'a, C, A> where C: BorrowMut EditApklistingDeleteCall<'a, C, A> where C: BorrowMut EditApklistingDeleteCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -9778,7 +9797,7 @@ impl<'a, C, A> EditApklistingDeleteCall<'a, C, A> where C: BorrowMut EditApklistingDeleteCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -9788,7 +9807,7 @@ impl<'a, C, A> EditApklistingDeleteCall<'a, C, A> where C: BorrowMut EditApklistingDeleteCall<'a, C, A> { self._apk_version_code = new_value; @@ -9798,7 +9817,7 @@ impl<'a, C, A> EditApklistingDeleteCall<'a, C, A> where C: BorrowMut EditApklistingDeleteCall<'a, C, A> { self._language = new_value.to_string(); @@ -9816,12 +9835,12 @@ impl<'a, C, A> EditApklistingDeleteCall<'a, C, A> where C: BorrowMut EditApklistingDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditApklistingDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditApklistingDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9910,7 +9929,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.testers.get", + dlg.begin(MethodInfo { id: "androidpublisher.edits.testers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -9954,7 +9973,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9990,7 +10009,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10000,10 +10019,10 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10036,7 +10055,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditTesterGetCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -10046,7 +10065,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditTesterGetCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -10055,7 +10074,7 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *track* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn track(mut self, new_value: &str) -> EditTesterGetCall<'a, C, A> { self._track = new_value.to_string(); @@ -10073,12 +10092,12 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10095,17 +10114,17 @@ impl<'a, C, A> EditTesterGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditTesterGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditTesterGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10168,7 +10187,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.delete", + dlg.begin(MethodInfo { id: "androidpublisher.edits.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -10210,7 +10229,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10246,7 +10265,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10256,10 +10275,10 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10282,7 +10301,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditDeleteCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -10292,7 +10311,7 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditDeleteCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -10310,12 +10329,12 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10332,17 +10351,17 @@ impl<'a, C, A> EditDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10409,7 +10428,7 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.expansionfiles.upload", + dlg.begin(MethodInfo { id: "androidpublisher.edits.expansionfiles.upload", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -10428,13 +10447,13 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10526,7 +10545,7 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10536,10 +10555,10 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditExpansionfileUploadCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -10653,7 +10672,7 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditExpansionfileUploadCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -10663,7 +10682,7 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditExpansionfileUploadCall<'a, C, A> { self._apk_version_code = new_value; @@ -10672,7 +10691,7 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditExpansionfileUploadCall<'a, C, A> { self._expansion_file_type = new_value.to_string(); @@ -10690,12 +10709,12 @@ impl<'a, C, A> EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut EditExpansionfileUploadCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditExpansionfileUploadCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditExpansionfileUploadCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10791,7 +10810,7 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.insert", + dlg.begin(MethodInfo { id: "androidpublisher.edits.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -10833,14 +10852,14 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10884,7 +10903,7 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10894,10 +10913,10 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10929,7 +10948,7 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AppEdit) -> EditInsertCall<'a, C, A> { self._request = new_value; @@ -10939,7 +10958,7 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditInsertCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -10957,12 +10976,12 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10979,17 +10998,17 @@ impl<'a, C, A> EditInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11052,7 +11071,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.list", + dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -11095,7 +11114,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11131,7 +11150,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11141,10 +11160,10 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11177,7 +11196,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditListingListCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -11187,7 +11206,7 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditListingListCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -11205,12 +11224,12 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11227,17 +11246,17 @@ impl<'a, C, A> EditListingListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditListingListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditListingListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11306,7 +11325,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.testers.patch", + dlg.begin(MethodInfo { id: "androidpublisher.edits.testers.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -11350,14 +11369,14 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11401,7 +11420,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11411,10 +11430,10 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11446,7 +11465,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Testers) -> EditTesterPatchCall<'a, C, A> { self._request = new_value; @@ -11456,7 +11475,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditTesterPatchCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -11466,7 +11485,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditTesterPatchCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -11475,7 +11494,7 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *track* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn track(mut self, new_value: &str) -> EditTesterPatchCall<'a, C, A> { self._track = new_value.to_string(); @@ -11493,12 +11512,12 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11515,17 +11534,17 @@ impl<'a, C, A> EditTesterPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditTesterPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditTesterPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11588,7 +11607,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.commit", + dlg.begin(MethodInfo { id: "androidpublisher.edits.commit", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -11631,7 +11650,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11667,7 +11686,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11677,10 +11696,10 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11713,7 +11732,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditCommitCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -11723,7 +11742,7 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditCommitCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -11741,12 +11760,12 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11763,17 +11782,17 @@ impl<'a, C, A> EditCommitCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditCommitCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditCommitCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11836,7 +11855,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.tracks.list", + dlg.begin(MethodInfo { id: "androidpublisher.edits.tracks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -11879,7 +11898,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11915,7 +11934,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11925,10 +11944,10 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11961,7 +11980,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditTrackListCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -11971,7 +11990,7 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditTrackListCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -11989,12 +12008,12 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12011,17 +12030,17 @@ impl<'a, C, A> EditTrackListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditTrackListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditTrackListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12084,7 +12103,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.validate", + dlg.begin(MethodInfo { id: "androidpublisher.edits.validate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -12127,7 +12146,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12163,7 +12182,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12173,10 +12192,10 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12209,7 +12228,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditValidateCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -12219,7 +12238,7 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditValidateCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -12237,12 +12256,12 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12259,17 +12278,17 @@ impl<'a, C, A> EditValidateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditValidateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditValidateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12340,7 +12359,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.update", + dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -12384,14 +12403,14 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12435,7 +12454,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12445,10 +12464,10 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12480,7 +12499,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Listing) -> EditListingUpdateCall<'a, C, A> { self._request = new_value; @@ -12490,7 +12509,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditListingUpdateCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -12500,7 +12519,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditListingUpdateCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -12510,7 +12529,7 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *language* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn language(mut self, new_value: &str) -> EditListingUpdateCall<'a, C, A> { self._language = new_value.to_string(); @@ -12528,12 +12547,12 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12550,17 +12569,17 @@ impl<'a, C, A> EditListingUpdateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditListingUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditListingUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12625,7 +12644,7 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.expansionfiles.get", + dlg.begin(MethodInfo { id: "androidpublisher.edits.expansionfiles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -12670,7 +12689,7 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12706,7 +12725,7 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12716,10 +12735,10 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut EditExpansionfileGetCall<'a, C, A> where C: BorrowMut EditExpansionfileGetCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -12762,7 +12781,7 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut EditExpansionfileGetCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -12772,7 +12791,7 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut EditExpansionfileGetCall<'a, C, A> { self._apk_version_code = new_value; @@ -12781,7 +12800,7 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut EditExpansionfileGetCall<'a, C, A> { self._expansion_file_type = new_value.to_string(); @@ -12799,12 +12818,12 @@ impl<'a, C, A> EditExpansionfileGetCall<'a, C, A> where C: BorrowMut EditExpansionfileGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditExpansionfileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditExpansionfileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12896,7 +12915,7 @@ impl<'a, C, A> EditImageDeleteallCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.images.deleteall", + dlg.begin(MethodInfo { id: "androidpublisher.edits.images.deleteall", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -12941,7 +12960,7 @@ impl<'a, C, A> EditImageDeleteallCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12977,7 +12996,7 @@ impl<'a, C, A> EditImageDeleteallCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12987,10 +13006,10 @@ impl<'a, C, A> EditImageDeleteallCall<'a, C, A> where C: BorrowMut EditImageDeleteallCall<'a, C, A> where C: BorrowMut EditImageDeleteallCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -13033,7 +13052,7 @@ impl<'a, C, A> EditImageDeleteallCall<'a, C, A> where C: BorrowMut EditImageDeleteallCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -13043,7 +13062,7 @@ impl<'a, C, A> EditImageDeleteallCall<'a, C, A> where C: BorrowMut EditImageDeleteallCall<'a, C, A> { self._language = new_value.to_string(); @@ -13052,7 +13071,7 @@ impl<'a, C, A> EditImageDeleteallCall<'a, C, A> where C: BorrowMut EditImageDeleteallCall<'a, C, A> { self._image_type = new_value.to_string(); @@ -13070,12 +13089,12 @@ impl<'a, C, A> EditImageDeleteallCall<'a, C, A> where C: BorrowMut EditImageDeleteallCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditImageDeleteallCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditImageDeleteallCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13172,7 +13191,7 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.details.patch", + dlg.begin(MethodInfo { id: "androidpublisher.edits.details.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -13215,14 +13234,14 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13266,7 +13285,7 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13276,10 +13295,10 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13311,7 +13330,7 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AppDetails) -> EditDetailPatchCall<'a, C, A> { self._request = new_value; @@ -13321,7 +13340,7 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditDetailPatchCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -13331,7 +13350,7 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditDetailPatchCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -13349,12 +13368,12 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13371,17 +13390,17 @@ impl<'a, C, A> EditDetailPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditDetailPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditDetailPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13452,7 +13471,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.tracks.patch", + dlg.begin(MethodInfo { id: "androidpublisher.edits.tracks.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -13496,14 +13515,14 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13547,7 +13566,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13557,10 +13576,10 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13592,7 +13611,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Track) -> EditTrackPatchCall<'a, C, A> { self._request = new_value; @@ -13602,7 +13621,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditTrackPatchCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -13612,7 +13631,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditTrackPatchCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -13622,7 +13641,7 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *track* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn track(mut self, new_value: &str) -> EditTrackPatchCall<'a, C, A> { self._track = new_value.to_string(); @@ -13640,12 +13659,12 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13662,17 +13681,17 @@ impl<'a, C, A> EditTrackPatchCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditTrackPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditTrackPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13736,7 +13755,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.delete", + dlg.begin(MethodInfo { id: "androidpublisher.edits.listings.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -13779,7 +13798,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13815,7 +13834,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13825,10 +13844,10 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13851,7 +13870,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditListingDeleteCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -13861,7 +13880,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditListingDeleteCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -13871,7 +13890,7 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *language* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn language(mut self, new_value: &str) -> EditListingDeleteCall<'a, C, A> { self._language = new_value.to_string(); @@ -13889,12 +13908,12 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13911,17 +13930,17 @@ impl<'a, C, A> EditListingDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditListingDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditListingDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13986,7 +14005,7 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.get", + dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -14031,7 +14050,7 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14067,7 +14086,7 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14077,10 +14096,10 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14113,7 +14132,7 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditApklistingGetCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -14123,7 +14142,7 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditApklistingGetCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -14133,7 +14152,7 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *apk version code* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apk_version_code(mut self, new_value: i32) -> EditApklistingGetCall<'a, C, A> { self._apk_version_code = new_value; @@ -14143,7 +14162,7 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *language* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn language(mut self, new_value: &str) -> EditApklistingGetCall<'a, C, A> { self._language = new_value.to_string(); @@ -14161,12 +14180,12 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14183,17 +14202,17 @@ impl<'a, C, A> EditApklistingGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditApklistingGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditApklistingGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14262,7 +14281,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.testers.update", + dlg.begin(MethodInfo { id: "androidpublisher.edits.testers.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -14306,14 +14325,14 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14357,7 +14376,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14367,10 +14386,10 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14402,7 +14421,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Testers) -> EditTesterUpdateCall<'a, C, A> { self._request = new_value; @@ -14412,7 +14431,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> EditTesterUpdateCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -14422,7 +14441,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *edit id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn edit_id(mut self, new_value: &str) -> EditTesterUpdateCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -14431,7 +14450,7 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *track* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn track(mut self, new_value: &str) -> EditTesterUpdateCall<'a, C, A> { self._track = new_value.to_string(); @@ -14449,12 +14468,12 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14471,17 +14490,17 @@ impl<'a, C, A> EditTesterUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EditTesterUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditTesterUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14545,7 +14564,7 @@ impl<'a, C, A> EditApklistingListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.list", + dlg.begin(MethodInfo { id: "androidpublisher.edits.apklistings.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -14589,7 +14608,7 @@ impl<'a, C, A> EditApklistingListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14625,7 +14644,7 @@ impl<'a, C, A> EditApklistingListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14635,10 +14654,10 @@ impl<'a, C, A> EditApklistingListCall<'a, C, A> where C: BorrowMut EditApklistingListCall<'a, C, A> where C: BorrowMut EditApklistingListCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -14681,7 +14700,7 @@ impl<'a, C, A> EditApklistingListCall<'a, C, A> where C: BorrowMut EditApklistingListCall<'a, C, A> { self._edit_id = new_value.to_string(); @@ -14691,7 +14710,7 @@ impl<'a, C, A> EditApklistingListCall<'a, C, A> where C: BorrowMut EditApklistingListCall<'a, C, A> { self._apk_version_code = new_value; @@ -14709,12 +14728,12 @@ impl<'a, C, A> EditApklistingListCall<'a, C, A> where C: BorrowMut EditApklistingListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EditApklistingListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EditApklistingListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14807,7 +14826,7 @@ impl<'a, C, A> InappproductBatchCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.batch", + dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.batch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -14827,14 +14846,14 @@ impl<'a, C, A> InappproductBatchCall<'a, C, A> where C: BorrowMut self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14878,7 +14897,7 @@ impl<'a, C, A> InappproductBatchCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14888,10 +14907,10 @@ impl<'a, C, A> InappproductBatchCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14923,7 +14942,7 @@ impl<'a, C, A> InappproductBatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InappproductsBatchRequest) -> InappproductBatchCall<'a, C, A> { self._request = new_value; @@ -14941,12 +14960,12 @@ impl<'a, C, A> InappproductBatchCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14963,17 +14982,17 @@ impl<'a, C, A> InappproductBatchCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InappproductBatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InappproductBatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15041,7 +15060,7 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.list", + dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -15092,7 +15111,7 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15128,7 +15147,7 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15138,10 +15157,10 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15174,7 +15193,7 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> InappproductListCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -15210,12 +15229,12 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15232,17 +15251,17 @@ impl<'a, C, A> InappproductListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InappproductListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InappproductListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15313,7 +15332,7 @@ impl<'a, C, A> InappproductInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.insert", + dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -15358,14 +15377,14 @@ impl<'a, C, A> InappproductInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15409,7 +15428,7 @@ impl<'a, C, A> InappproductInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15419,10 +15438,10 @@ impl<'a, C, A> InappproductInsertCall<'a, C, A> where C: BorrowMut InappproductInsertCall<'a, C, A> where C: BorrowMut InappproductInsertCall<'a, C, A> { self._request = new_value; @@ -15464,7 +15483,7 @@ impl<'a, C, A> InappproductInsertCall<'a, C, A> where C: BorrowMut InappproductInsertCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -15489,12 +15508,12 @@ impl<'a, C, A> InappproductInsertCall<'a, C, A> where C: BorrowMut InappproductInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InappproductInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InappproductInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15584,7 +15603,7 @@ impl<'a, C, A> InappproductDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.delete", + dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -15626,7 +15645,7 @@ impl<'a, C, A> InappproductDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15662,7 +15681,7 @@ impl<'a, C, A> InappproductDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15672,10 +15691,10 @@ impl<'a, C, A> InappproductDeleteCall<'a, C, A> where C: BorrowMut InappproductDeleteCall<'a, C, A> where C: BorrowMut InappproductDeleteCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -15708,7 +15727,7 @@ impl<'a, C, A> InappproductDeleteCall<'a, C, A> where C: BorrowMut InappproductDeleteCall<'a, C, A> { self._sku = new_value.to_string(); @@ -15726,12 +15745,12 @@ impl<'a, C, A> InappproductDeleteCall<'a, C, A> where C: BorrowMut InappproductDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InappproductDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InappproductDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15821,7 +15840,7 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.get", + dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -15864,7 +15883,7 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15900,7 +15919,7 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15910,10 +15929,10 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15945,7 +15964,7 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> InappproductGetCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -15955,7 +15974,7 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *sku* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sku(mut self, new_value: &str) -> InappproductGetCall<'a, C, A> { self._sku = new_value.to_string(); @@ -15973,12 +15992,12 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15995,17 +16014,17 @@ impl<'a, C, A> InappproductGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InappproductGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InappproductGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16077,7 +16096,7 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.update", + dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -16123,14 +16142,14 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -16174,7 +16193,7 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16184,10 +16203,10 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut InappproductUpdateCall<'a, C, A> where C: BorrowMut InappproductUpdateCall<'a, C, A> { self._request = new_value; @@ -16229,7 +16248,7 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut InappproductUpdateCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -16239,7 +16258,7 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut InappproductUpdateCall<'a, C, A> { self._sku = new_value.to_string(); @@ -16264,12 +16283,12 @@ impl<'a, C, A> InappproductUpdateCall<'a, C, A> where C: BorrowMut InappproductUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InappproductUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InappproductUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16368,7 +16387,7 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.patch", + dlg.begin(MethodInfo { id: "androidpublisher.inappproducts.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("packageName", self._package_name.to_string())); @@ -16414,14 +16433,14 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -16465,7 +16484,7 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16475,10 +16494,10 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16510,7 +16529,7 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InAppProduct) -> InappproductPatchCall<'a, C, A> { self._request = new_value; @@ -16520,7 +16539,7 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *package name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn package_name(mut self, new_value: &str) -> InappproductPatchCall<'a, C, A> { self._package_name = new_value.to_string(); @@ -16530,7 +16549,7 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *sku* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sku(mut self, new_value: &str) -> InappproductPatchCall<'a, C, A> { self._sku = new_value.to_string(); @@ -16555,12 +16574,12 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16577,17 +16596,17 @@ impl<'a, C, A> InappproductPatchCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InappproductPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InappproductPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/appengine1_beta4-cli/Cargo.toml b/gen/appengine1_beta4-cli/Cargo.toml index 320441b646..3081613278 100644 --- a/gen/appengine1_beta4-cli/Cargo.toml +++ b/gen/appengine1_beta4-cli/Cargo.toml @@ -4,11 +4,11 @@ [package] name = "google-appengine1_beta4-cli" -version = "0.3.2+20150831" +version = "0.3.3+20160121" authors = ["Sebastian Thiel "] description = "A complete library to interact with appengine (protocol v1beta4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta4-cli" -homepage = "https://developers.google.com/appengine/" +homepage = "https://cloud.google.com/appengine/docs/admin-api/" documentation = "http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli" license = "MIT" keywords = ["appengine", "google", "cli"] @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/appengine1_beta4-cli/LICENSE.md b/gen/appengine1_beta4-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/appengine1_beta4-cli/LICENSE.md +++ b/gen/appengine1_beta4-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/appengine1_beta4-cli/README.md b/gen/appengine1_beta4-cli/README.md index bacb0b9032..26c513bf0c 100644 --- a/gen/appengine1_beta4-cli/README.md +++ b/gen/appengine1_beta4-cli/README.md @@ -11,20 +11,20 @@ capabilities. Errors will be printed to standard error, and cause the program's If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. Everything else about the *appengine* API can be found at the -[official documentation site](https://developers.google.com/appengine/). +[official documentation site](https://cloud.google.com/appengine/docs/admin-api/). # Downloads You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/appengine1-beta4.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/appengine1-beta4.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/appengine1-beta4.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/appengine1-beta4.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta4-cli). # Usage -This documentation was generated from the *appengine* API at revision *20150831*. The CLI is at version *0.3.2*. +This documentation was generated from the *appengine* API at revision *20160121*. The CLI is at version *0.3.3*. ```bash appengine1-beta4 [options] @@ -44,18 +44,18 @@ appengine1-beta4 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/appengine1_beta4-cli/mkdocs.yml b/gen/appengine1_beta4-cli/mkdocs.yml index b341bfb11e..6c72852c3a 100644 --- a/gen/appengine1_beta4-cli/mkdocs.yml +++ b/gen/appengine1_beta4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appengine v0.3.2+20150831 +site_name: appengine v0.3.3+20160121 site_url: http://byron.github.io/google-apis-rs/google-appengine1_beta4-cli site_description: Write integrating applications with bcore @@ -23,5 +23,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/appengine1_beta4-cli/src/main.rs b/gen/appengine1_beta4-cli/src/main.rs index a55e4f6c64..5588cc69f2 100644 --- a/gen/appengine1_beta4-cli/src/main.rs +++ b/gen/appengine1_beta4-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Appengine>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _apps_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _apps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().get(opt.value_of("apps-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "ensure-resources-exist" => { @@ -64,7 +64,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ensure-resources-exist"].iter().map(|v|*v)); @@ -78,7 +78,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -101,10 +101,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_modules_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_modules_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().modules_delete(opt.value_of("apps-id").unwrap_or(""), opt.value_of("modules-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -117,7 +117,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -130,7 +130,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -153,10 +153,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_modules_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_modules_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().modules_get(opt.value_of("apps-id").unwrap_or(""), opt.value_of("modules-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -169,7 +169,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -182,7 +182,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -205,10 +205,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_modules_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_modules_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().modules_list(opt.value_of("apps-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -227,7 +227,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -241,7 +241,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -264,13 +264,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_modules_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_modules_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -284,8 +284,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "split.shard-by" => Some(("split.shardBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "split.allocations" => Some(("split.allocations", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Map })), @@ -303,7 +303,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Module = json::value::from_value(object).unwrap(); let mut call = self.hub.apps().modules_patch(request, opt.value_of("apps-id").unwrap_or(""), opt.value_of("modules-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "migrate-traffic" => { @@ -322,7 +322,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["mask", "migrate-traffic"].iter().map(|v|*v)); @@ -336,7 +336,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -359,13 +359,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_modules_versions_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_modules_versions_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -379,8 +379,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -405,9 +405,19 @@ impl<'n, 'a> Engine<'n, 'a> { "deployer" => Some(("deployer", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "env" => Some(("env", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.min-pending-latency" => Some(("automaticScaling.minPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-received-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-sent-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetSentBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-received-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-sent-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetSentPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.disk-utilization.target-write-ops-per-sec" => Some(("automaticScaling.diskUtilization.targetWriteOpsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.disk-utilization.target-read-bytes-per-sec" => Some(("automaticScaling.diskUtilization.targetReadBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.disk-utilization.target-read-ops-per-sec" => Some(("automaticScaling.diskUtilization.targetReadOpsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.disk-utilization.target-write-bytes-per-sec" => Some(("automaticScaling.diskUtilization.targetWriteBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.max-pending-latency" => Some(("automaticScaling.maxPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.max-idle-instances" => Some(("automaticScaling.maxIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.min-idle-instances" => Some(("automaticScaling.minIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.request-utilization.target-concurrent-requests" => Some(("automaticScaling.requestUtilization.targetConcurrentRequests", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.request-utilization.target-request-count-per-sec" => Some(("automaticScaling.requestUtilization.targetRequestCountPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.cool-down-period" => Some(("automaticScaling.coolDownPeriod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "automatic-scaling.max-total-instances" => Some(("automaticScaling.maxTotalInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "automatic-scaling.max-concurrent-requests" => Some(("automaticScaling.maxConcurrentRequests", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -430,7 +440,7 @@ impl<'n, 'a> Engine<'n, 'a> { "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "runtime" => Some(("runtime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "container", "cool-down-period", "cpu", "cpu-utilization", "creation-time", "default-expiration", "deployer", "deployment", "disable-health-check", "disk-gb", "env", "env-variables", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "nobuild-files-regex", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "target-utilization", "threadsafe", "timeout", "unhealthy-threshold", "url", "vm"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "container", "cool-down-period", "cpu", "cpu-utilization", "creation-time", "default-expiration", "deployer", "deployment", "disable-health-check", "disk-gb", "disk-utilization", "env", "env-variables", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "request-utilization", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "target-concurrent-requests", "target-read-bytes-per-sec", "target-read-ops-per-sec", "target-received-bytes-per-sec", "target-received-packets-per-sec", "target-request-count-per-sec", "target-sent-bytes-per-sec", "target-sent-packets-per-sec", "target-utilization", "target-write-bytes-per-sec", "target-write-ops-per-sec", "threadsafe", "timeout", "unhealthy-threshold", "url", "vm"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -441,7 +451,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Version = json::value::from_value(object).unwrap(); let mut call = self.hub.apps().modules_versions_create(request, opt.value_of("apps-id").unwrap_or(""), opt.value_of("modules-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -454,7 +464,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -467,7 +477,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -490,10 +500,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_modules_versions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_modules_versions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().modules_versions_delete(opt.value_of("apps-id").unwrap_or(""), opt.value_of("modules-id").unwrap_or(""), opt.value_of("versions-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -506,7 +516,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -519,7 +529,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -542,10 +552,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_modules_versions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_modules_versions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().modules_versions_get(opt.value_of("apps-id").unwrap_or(""), opt.value_of("modules-id").unwrap_or(""), opt.value_of("versions-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -561,7 +571,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["view"].iter().map(|v|*v)); @@ -575,7 +585,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -598,10 +608,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_modules_versions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_modules_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().modules_versions_list(opt.value_of("apps-id").unwrap_or(""), opt.value_of("modules-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -623,7 +633,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size", "view"].iter().map(|v|*v)); @@ -637,7 +647,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -660,10 +670,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().operations_get(opt.value_of("apps-id").unwrap_or(""), opt.value_of("operations-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -676,7 +686,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -689,7 +699,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -712,10 +722,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().operations_list(opt.value_of("apps-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -737,7 +747,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); @@ -751,7 +761,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -837,14 +847,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "appengine1-beta4-secret.json", + match cmn::application_secret_from_directory(&config_dir, "appengine1-beta4-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -864,7 +874,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -907,7 +917,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("apps", "methods: 'get', 'modules-delete', 'modules-get', 'modules-list', 'modules-patch', 'modules-versions-create', 'modules-versions-delete', 'modules-versions-get', 'modules-versions-list', 'operations-get' and 'operations-list'", vec![ - ("get", + ("get", Some(r##"Gets information about an application."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_get", vec![ @@ -929,7 +939,7 @@ fn main() { Some(false), Some(false)), ]), - ("modules-delete", + ("modules-delete", Some(r##"Deletes a module and all enclosed versions."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-delete", vec![ @@ -957,7 +967,7 @@ fn main() { Some(false), Some(false)), ]), - ("modules-get", + ("modules-get", Some(r##"Gets the current configuration of the module."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-get", vec![ @@ -985,7 +995,7 @@ fn main() { Some(false), Some(false)), ]), - ("modules-list", + ("modules-list", Some(r##"Lists all the modules in the application."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-list", vec![ @@ -1007,7 +1017,7 @@ fn main() { Some(false), Some(false)), ]), - ("modules-patch", + ("modules-patch", Some(r##"Updates the configuration of the specified module."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-patch", vec![ @@ -1041,7 +1051,7 @@ fn main() { Some(false), Some(false)), ]), - ("modules-versions-create", + ("modules-versions-create", Some(r##"Deploys new code and resource files to a version."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-versions-create", vec![ @@ -1075,7 +1085,7 @@ fn main() { Some(false), Some(false)), ]), - ("modules-versions-delete", + ("modules-versions-delete", Some(r##"Deletes an existing version."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-versions-delete", vec![ @@ -1109,7 +1119,7 @@ fn main() { Some(false), Some(false)), ]), - ("modules-versions-get", + ("modules-versions-get", Some(r##"Gets application deployment information."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-versions-get", vec![ @@ -1143,7 +1153,7 @@ fn main() { Some(false), Some(false)), ]), - ("modules-versions-list", + ("modules-versions-list", Some(r##"Lists the versions of a module."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_modules-versions-list", vec![ @@ -1171,7 +1181,7 @@ fn main() { Some(false), Some(false)), ]), - ("operations-get", + ("operations-get", Some(r##"Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_operations-get", vec![ @@ -1199,7 +1209,7 @@ fn main() { Some(false), Some(false)), ]), - ("operations-list", + ("operations-list", Some(r##"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 below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`."##), "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli/apps_operations-list", vec![ @@ -1227,7 +1237,7 @@ fn main() { let mut app = App::new("appengine1-beta4") .author("Sebastian Thiel ") - .version("0.3.2+20150831") + .version("0.3.3+20160121") .about("The Google App Engine Admin API enables developers to provision and manage their App Engine applications.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appengine1_beta4_cli") .arg(Arg::with_name("url") @@ -1251,7 +1261,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1262,7 +1272,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/appengine1_beta4/Cargo.toml b/gen/appengine1_beta4/Cargo.toml index 9348353a8e..0255944005 100644 --- a/gen/appengine1_beta4/Cargo.toml +++ b/gen/appengine1_beta4/Cargo.toml @@ -4,11 +4,11 @@ [package] name = "google-appengine1_beta4" -version = "0.1.10+20150831" +version = "0.1.11+20160121" authors = ["Sebastian Thiel "] description = "A complete library to interact with appengine (protocol v1beta4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta4" -homepage = "https://developers.google.com/appengine/" +homepage = "https://cloud.google.com/appengine/docs/admin-api/" documentation = "http://byron.github.io/google-apis-rs/google_appengine1_beta4" license = "MIT" keywords = ["appengine", "google", "protocol", "web", "api"] @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/appengine1_beta4/LICENSE.md b/gen/appengine1_beta4/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/appengine1_beta4/LICENSE.md +++ b/gen/appengine1_beta4/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/appengine1_beta4/README.md b/gen/appengine1_beta4/README.md index e69dfdf540..f33b1df444 100644 --- a/gen/appengine1_beta4/README.md +++ b/gen/appengine1_beta4/README.md @@ -5,10 +5,10 @@ DO NOT EDIT ! --> The `google-appengine1_beta4` library allows access to all features of the *Google appengine* service. -This documentation was generated from *appengine* crate version *0.1.10+20150831*, where *20150831* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *appengine* crate version *0.1.11+20160121*, where *20160121* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *appengine* *v1_beta4* API can be found at the -[official documentation site](https://developers.google.com/appengine/). +[official documentation site](https://cloud.google.com/appengine/docs/admin-api/). # Features Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_appengine1_beta4/struct.Appengine.html) ... diff --git a/gen/appengine1_beta4/src/cmn.rs b/gen/appengine1_beta4/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/appengine1_beta4/src/cmn.rs +++ b/gen/appengine1_beta4/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/appengine1_beta4/src/lib.rs b/gen/appengine1_beta4/src/lib.rs index 32fe5ab6d8..aa39b1a9b4 100644 --- a/gen/appengine1_beta4/src/lib.rs +++ b/gen/appengine1_beta4/src/lib.rs @@ -2,10 +2,10 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *appengine* crate version *0.1.10+20150831*, where *20150831* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *appengine* crate version *0.1.11+20160121*, where *20160121* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *appengine* *v1_beta4* API can be found at the -//! [official documentation site](https://developers.google.com/appengine/). +//! [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta4). //! # Features //! diff --git a/gen/appengine1_beta4/src/lib.rs.in b/gen/appengine1_beta4/src/lib.rs.in index 3cbd945eb8..a7ded09499 100644 --- a/gen/appengine1_beta4/src/lib.rs.in +++ b/gen/appengine1_beta4/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -134,7 +135,7 @@ impl<'a, C, A> Appengine Appengine { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -143,7 +144,7 @@ impl<'a, C, A> Appengine } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -157,6 +158,191 @@ impl<'a, C, A> Appengine // ############ // SCHEMAS ### // ########## +/// Used to specify extra network settings (for VM runtimes only). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Network { + /// A tag to apply to the VM instance during creation. + #[serde(rename="instanceTag")] + pub instance_tag: Option, + /// A list of ports (or port pairs) to forward from the VM into the app container. + #[serde(rename="forwardedPorts")] + pub forwarded_ports: Option>, + /// The Google Compute Engine network where the VMs will be created. If not specified, or empty, the network named "default" will be used. (The short name should be specified, not the resource path.) + pub name: Option, +} + +impl Part for Network {} + + +/// An Application contains the top-level configuration of an App Engine application. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get apps](struct.AppGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Application { + /// The full path to the application in the API. Example: "apps/myapp". @OutputOnly + pub name: Option, + /// A Google Cloud Storage bucket which can be used for storing files associated with an application. This bucket is associated with the application and can be used by the gcloud deployment commands. @OutputOnly + #[serde(rename="codeBucket")] + pub code_bucket: Option, + /// A Google Cloud Storage bucket which can be used by the application to store content. @OutputOnly + #[serde(rename="defaultBucket")] + pub default_bucket: Option, + /// HTTP path dispatch rules for requests to the app that do not explicitly target a module or version. The rules are order-dependent. + #[serde(rename="dispatchRules")] + pub dispatch_rules: Option>, + /// The relative name/path of the application. Example: "myapp". @OutputOnly + pub id: Option, + /// The location from which the application will be run. Choices are "us-central" for United States and "europe-west" for European Union. Application instances will run out of data centers in the chosen location and all of the application's End User Content will be stored at rest in the chosen location. The default is "us-central". + pub location: Option, +} + +impl ResponseResult for Application {} + + +/// A Version is a specific set of source code and configuration files deployed to a module. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [modules versions create apps](struct.AppModuleVersionCreateCall.html) (request) +/// * [modules versions get apps](struct.AppModuleVersionGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Version { + /// A module with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. + #[serde(rename="basicScaling")] + pub basic_scaling: Option, + /// Beta settings supplied to the application via metadata. + #[serde(rename="betaSettings")] + pub beta_settings: Option>, + /// A module with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. + #[serde(rename="manualScaling")] + pub manual_scaling: Option, + /// Creation time of this version. This will be between the start and end times of the operation that creates this version. @OutputOnly + #[serde(rename="creationTime")] + pub creation_time: Option, + /// Whether to deploy this app in a VM container. + pub vm: Option, + /// Before an application can receive email or XMPP messages, the application must be configured to enable the service. + #[serde(rename="inboundServices")] + pub inbound_services: Option>, + /// The frontend instance class to use to run this app. Valid values are `[F1, F2, F4, F4_1G]`. Default: "F1" + #[serde(rename="instanceClass")] + pub instance_class: Option, + /// Code and application artifacts that make up this version. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + pub deployment: Option, + /// Custom static error pages instead of these generic error pages, (limit 10 KB/page) Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + #[serde(rename="errorHandlers")] + pub error_handlers: Option>, + /// The current serving status of this version. Only `SERVING` versions will have instances created or billed for. If this field is unset when a version is created, `SERVING` status will be assumed. It is an error to explicitly set this field to `SERVING_STATUS_UNSPECIFIED`. + #[serde(rename="servingStatus")] + pub serving_status: Option, + /// The relative name/path of the Version within the module. Example: "v1". Version specifiers can contain lowercase letters, digits, and hyphens. It cannot begin with the prefix `ah-` and the names `default` and `latest` are reserved and cannot be used. + pub id: Option, + /// If true, multiple requests can be dispatched to the app at once. + pub threadsafe: Option, + /// Serving configuration for Google Cloud Endpoints. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + #[serde(rename="apiConfig")] + pub api_config: Option, + /// Go only. Files that match this pattern will not be built into the app. May only be set on create requests. + #[serde(rename="nobuildFilesRegex")] + pub nobuild_files_regex: Option, + /// Used to specify extra network settings (for VM runtimes only). + pub network: Option, + /// An ordered list of URL Matching patterns that should be applied to incoming requests. The first matching URL consumes the request, and subsequent handlers are not attempted. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + pub handlers: Option>, + /// Configure health checking for the VM instances. Unhealthy VM instances will be stopped and replaced with new instances. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + #[serde(rename="healthCheck")] + pub health_check: Option, + /// The length of time a static file served by a static file handler ought to be cached by web proxies and browsers, if the handler does not specify its own expiration. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + #[serde(rename="defaultExpiration")] + pub default_expiration: Option, + /// The full path to the Version resource in the API. Example: "apps/myapp/modules/default/versions/v1". @OutputOnly + pub name: Option, + /// Configuration for Python runtime third-party libraries required by the application. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + pub libraries: Option>, + /// The email address of the user who created this version. @OutputOnly + pub deployer: Option, + /// The App Engine execution environment to use for this version. Default: "1" + pub env: Option, + /// Automatic scaling is the scaling policy that App Engine has used since its inception. It is based on request rate, response latencies, and other application metrics. + #[serde(rename="automaticScaling")] + pub automatic_scaling: Option, + /// The desired runtime. Values can include python27, java7, go, etc. + pub runtime: Option, + /// Environment variables made available to the application. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + #[serde(rename="envVariables")] + pub env_variables: Option>, + /// Used to specify how many machine resources an app version needs (for VM runtimes only). + pub resources: Option, +} + +impl RequestValue for Version {} +impl ResponseResult for Version {} + + +/// A Python runtime third-party library required by the application. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Library { + /// The version of the library to select, or "latest". + pub version: Option, + /// The name of the library, e.g. "PIL" or "django". + pub name: Option, +} + +impl Part for Library {} + + +/// Target scaling by CPU usage. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CpuUtilization { + /// Target (0-1) CPU utilization ratio to maintain when scaling. + #[serde(rename="targetUtilization")] + pub target_utilization: Option, + /// The period of time over which CPU utilization is calculated. + #[serde(rename="aggregationWindowLength")] + pub aggregation_window_length: Option, +} + +impl Part for CpuUtilization {} + + +/// Used to specify how many machine resources an app version needs. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Resources { + /// How much disk size, in GB, an app version needs. + #[serde(rename="diskGb")] + pub disk_gb: Option, + /// How many CPU cores an app version needs. + pub cpu: Option, + /// How much memory, in GB, an app version needs. + #[serde(rename="memoryGb")] + pub memory_gb: Option, +} + +impl Part for Resources {} + + /// Response message for `Modules.ListModules`. /// /// # Activities @@ -178,6 +364,177 @@ pub struct ListModulesResponse { impl ResponseResult for ListModulesResponse {} +/// 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). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// 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. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There will be a common set of message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// A module with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BasicScaling { + /// The instance will be shut down this amount of time after receiving its last request. + #[serde(rename="idleTimeout")] + pub idle_timeout: Option, + /// The maximum number of instances for App Engine to create for this version. + #[serde(rename="maxInstances")] + pub max_instances: Option, +} + +impl Part for BasicScaling {} + + +/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StaticFilesHandler { + /// If specified, all files served by this handler will be served using the specified MIME type. If not specified, the MIME type for a file will be derived from the file's filename extension. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// The length of time a static file served by this handler ought to be cached by web proxies and browsers. + pub expiration: Option, + /// The path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern. + pub path: Option, + /// A regular expression that matches the file paths for all files that will be referenced by this handler. + #[serde(rename="uploadPathRegex")] + pub upload_path_regex: Option, + /// If true, this UrlMap entry does not match the request unless the file referenced by the handler also exists. If no such file exists, processing will continue with the next UrlMap that matches the requested URL. + #[serde(rename="requireMatchingFile")] + pub require_matching_file: Option, + /// HTTP headers to use for all responses from these URLs. + #[serde(rename="httpHeaders")] + pub http_headers: Option>, + /// By default, files declared in static file handlers are uploaded as static data and are only served to end users, they cannot be read by an application. If this field is set to true, the files are also uploaded as code data so your application can read them. Both uploads are charged against your code and static data storage resource quotas. + #[serde(rename="applicationReadable")] + pub application_readable: Option, +} + +impl Part for StaticFilesHandler {} + + +/// Target scaling by network usage (for VM runtimes only). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkUtilization { + /// Target bytes per second received. + #[serde(rename="targetReceivedBytesPerSec")] + pub target_received_bytes_per_sec: Option, + /// Target bytes per second sent. + #[serde(rename="targetSentBytesPerSec")] + pub target_sent_bytes_per_sec: Option, + /// Target packets per second sent. + #[serde(rename="targetSentPacketsPerSec")] + pub target_sent_packets_per_sec: Option, + /// Target packets per second received. + #[serde(rename="targetReceivedPacketsPerSec")] + pub target_received_packets_per_sec: Option, +} + +impl Part for NetworkUtilization {} + + +/// Response message for `Versions.ListVersions`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [modules versions list apps](struct.AppModuleVersionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListVersionsResponse { + /// Continuation token for fetching the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The versions belonging to the requested application module. + pub versions: Option>, +} + +impl ResponseResult for ListVersionsResponse {} + + +/// Code and application artifacts used to deploy a version to App Engine. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Deployment { + /// A manifest of files stored in Google Cloud Storage which should be included as part of this application. All files must be readable using the credentials supplied with this call. + pub files: Option>, + /// The origin of the source code for this deployment. There can be more than one source reference per Version if source code is distributed among multiple repositories. + #[serde(rename="sourceReferences")] + pub source_references: Option>, + /// If supplied, a docker (container) image which should be used to start the application. Only applicable to the 'vm' runtime. + pub container: Option, +} + +impl Part for Deployment {} + + +/// Executes a script to handle the request that matches the URL pattern. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ScriptHandler { + /// Specifies the path to the script from the application root directory. + #[serde(rename="scriptPath")] + pub script_path: Option, +} + +impl Part for ScriptHandler {} + + +/// Rules to match an HTTP request and dispatch that request to a module. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UrlDispatchRule { + /// The pathname within the host. This must start with a '/'. A single '*' (glob) can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters. + pub path: Option, + /// The domain name to match on. Supports '*' (glob) wildcarding on the left-hand side of a '.'. If empty, all domains will be matched (the same as '*'). + pub domain: Option, + /// The resource id of a Module in this application that should service the matched request. The Module must already exist. Example: "default". + pub module: Option, +} + +impl Part for UrlDispatchRule {} + + +/// Use Google Cloud Endpoints to handle requests. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ApiEndpointHandler { + /// Specifies the path to the script from the application root directory. + #[serde(rename="scriptPath")] + pub script_path: Option, +} + +impl Part for ApiEndpointHandler {} + + /// Configure health checking for the VM instances. Unhealthy VM instances will be killed and replaced with new instances. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -255,139 +612,6 @@ pub struct StaticDirectoryHandler { impl Part for StaticDirectoryHandler {} -/// An Application contains the top-level configuration of an App Engine application. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get apps](struct.AppGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Application { - /// HTTP path dispatch rules for requests to the app that do not explicitly target a module or version. The rules are order-dependent. - #[serde(rename="dispatchRules")] - pub dispatch_rules: Option>, - /// The location from which the application will be run. Choices are "us-central" for United States and "europe-west" for European Union. Application instances will run out of data centers in the chosen location and all of the application's End User Content will be stored at rest in the chosen location. The default is "us-central". - pub location: Option, - /// The relative name/path of the application. Example: "myapp". @OutputOnly - pub id: Option, - /// The full path to the application in the API. Example: "apps/myapp". @OutputOnly - pub name: Option, - /// A Google Cloud Storage bucket which can be used for storing files associated with an application. This bucket is associated with the application and can be used by the gcloud deployment commands. @OutputOnly - #[serde(rename="codeBucket")] - pub code_bucket: Option, -} - -impl ResponseResult for Application {} - - -/// A Version is a specific set of source code and configuration files deployed to a module. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [modules versions create apps](struct.AppModuleVersionCreateCall.html) (request) -/// * [modules versions get apps](struct.AppModuleVersionGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Version { - /// A module with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. - #[serde(rename="basicScaling")] - pub basic_scaling: Option, - /// Beta settings supplied to the application via metadata. - #[serde(rename="betaSettings")] - pub beta_settings: Option>, - /// A module with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. - #[serde(rename="manualScaling")] - pub manual_scaling: Option, - /// Creation time of this version. This will be between the start and end times of the operation that creates this version. @OutputOnly - #[serde(rename="creationTime")] - pub creation_time: Option, - /// Whether to deploy this app in a VM container (deprecated, use "env":"2"). - pub vm: Option, - /// Before an application can receive email or XMPP messages, the application must be configured to enable the service. - #[serde(rename="inboundServices")] - pub inbound_services: Option>, - /// The frontend instance class to use to run this app. Valid values are `[F1, F2, F4, F4_1G]`. Default: "F1" - #[serde(rename="instanceClass")] - pub instance_class: Option, - /// Code and application artifacts that make up this version. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. - pub deployment: Option, - /// Custom static error pages instead of these generic error pages, (limit 10 KB/page) Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. - #[serde(rename="errorHandlers")] - pub error_handlers: Option>, - /// The current serving status of this version. Only `SERVING` versions will have instances created or billed for. If this field is unset when a version is created, `SERVING` status will be assumed. It is an error to explicitly set this field to `SERVING_STATUS_UNSPECIFIED`. - #[serde(rename="servingStatus")] - pub serving_status: Option, - /// The relative name/path of the Version within the module. Example: "v1". Version specifiers can contain lowercase letters, digits, and hyphens. It cannot begin with the prefix `ah-` and the names `default` and `latest` are reserved and cannot be used. - pub id: Option, - /// If true, multiple requests can be dispatched to the app at once. - pub threadsafe: Option, - /// Serving configuration for Google Cloud Endpoints. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. - #[serde(rename="apiConfig")] - pub api_config: Option, - /// Go only. Files that match this pattern will not be built into the app. May only be set on create requests. - #[serde(rename="nobuildFilesRegex")] - pub nobuild_files_regex: Option, - /// Used to specify extra network settings (for VM runtimes only). - pub network: Option, - /// An ordered list of URL Matching patterns that should be applied to incoming requests. The first matching URL consumes the request, and subsequent handlers are not attempted. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. - pub handlers: Option>, - /// Configure health checking for the VM instances. Unhealthy VM instances will be stopped and replaced with new instances. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. - #[serde(rename="healthCheck")] - pub health_check: Option, - /// The length of time a static file served by a static file handler ought to be cached by web proxies and browsers, if the handler does not specify its own expiration. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. - #[serde(rename="defaultExpiration")] - pub default_expiration: Option, - /// The full path to the Version resource in the API. Example: "apps/myapp/modules/default/versions/v1". @OutputOnly - pub name: Option, - /// Configuration for Python runtime third-party libraries required by the application. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. - pub libraries: Option>, - /// The email address of the user who created this version. @OutputOnly - pub deployer: Option, - /// The App Engine execution environment to use for this version. Default: "1" - pub env: Option, - /// Automatic scaling is the scaling policy that App Engine has used since its inception. It is based on request rate, response latencies, and other application metrics. - #[serde(rename="automaticScaling")] - pub automatic_scaling: Option, - /// The desired runtime. Values can include python27, java7, go, etc. - pub runtime: Option, - /// Environment variables made available to the application. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. - #[serde(rename="envVariables")] - pub env_variables: Option>, - /// Used to specify how many machine resources an app version needs (for VM runtimes only). - pub resources: Option, -} - -impl RequestValue for Version {} -impl ResponseResult for Version {} - - -/// Response message for `Versions.ListVersions`. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [modules versions list apps](struct.AppModuleVersionListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListVersionsResponse { - /// Continuation token for fetching the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The versions belonging to the requested application module. - pub versions: Option>, -} - -impl ResponseResult for ListVersionsResponse {} - - /// Automatic scaling is the scaling policy that App Engine has used since its inception. It is based on request rate, response latencies, and other application metrics. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -397,15 +621,24 @@ pub struct AutomaticScaling { /// Target scaling by CPU usage. #[serde(rename="cpuUtilization")] pub cpu_utilization: Option, + /// Target scaling by network usage. + #[serde(rename="networkUtilization")] + pub network_utilization: Option, + /// The minimum number of idle instances that App Engine should maintain for this version. Only applies to the default version of a module, since other versions are not expected to receive significant traffic. + #[serde(rename="minIdleInstances")] + pub min_idle_instances: Option, /// The maximum amount of time that App Engine should allow a request to wait in the pending queue before starting a new instance to handle it. #[serde(rename="maxPendingLatency")] pub max_pending_latency: Option, /// The maximum number of idle instances that App Engine should maintain for this version. #[serde(rename="maxIdleInstances")] pub max_idle_instances: Option, - /// The minimum number of idle instances that App Engine should maintain for this version. Only applies to the default version of a module, since other versions are not expected to receive significant traffic. - #[serde(rename="minIdleInstances")] - pub min_idle_instances: Option, + /// Target scaling by disk usage. + #[serde(rename="diskUtilization")] + pub disk_utilization: Option, + /// Target scaling by request utilization. + #[serde(rename="requestUtilization")] + pub request_utilization: Option, /// The amount of time that the [Autoscaler](https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Applies only to the VM runtime. #[serde(rename="coolDownPeriod")] pub cool_down_period: Option, @@ -471,7 +704,7 @@ pub struct FileInfo { /// The MIME type of the file; if unspecified, the value from Google Cloud Storage will be used. #[serde(rename="mimeType")] pub mime_type: Option, - /// The URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage. + /// The URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/\/\'. #[serde(rename="sourceUrl")] pub source_url: Option, /// The SHA1 (160 bits) hash of the file in hex. @@ -482,142 +715,7 @@ pub struct FileInfo { impl Part for FileInfo {} -/// Configuration for traffic splitting for versions within a single module. Traffic splitting allows traffic directed to the module to be assigned to one of several versions in a fractional way, enabling experiments and canarying new builds, for example. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TrafficSplit { - /// Which mechanism should be used as a selector when choosing a version to send a request to. The traffic selection algorithm will be stable for either type until allocations are changed. - #[serde(rename="shardBy")] - pub shard_by: Option, - /// Mapping from module version IDs within the module to fractional (0.000, 1] allocations of traffic for that version. Each version may only be specified once, but some versions in the module may not have any traffic allocation. Modules that have traffic allocated in this field may not be deleted until the module is deleted, or their traffic allocation is removed. Allocations must sum to 1. Supports precision up to two decimal places for IP-based splits and up to three decimal places for cookie-based splits. - pub allocations: Option>, -} - -impl Part for TrafficSplit {} - - -/// Target scaling by CPU usage. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CpuUtilization { - /// Target (0-1) CPU utilization ratio to maintain when scaling. - #[serde(rename="targetUtilization")] - pub target_utilization: Option, - /// The period of time over which CPU utilization is calculated. - #[serde(rename="aggregationWindowLength")] - pub aggregation_window_length: Option, -} - -impl Part for CpuUtilization {} - - -/// This resource represents a long-running operation that is the result of a network API call. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [modules versions delete apps](struct.AppModuleVersionDeleteCall.html) (response) -/// * [modules versions create apps](struct.AppModuleVersionCreateCall.html) (response) -/// * [operations get apps](struct.AppOperationGetCall.html) (response) -/// * [modules delete apps](struct.AppModuleDeleteCall.html) (response) -/// * [modules patch apps](struct.AppModulePatchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// 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. - pub metadata: Option>, - /// 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. - pub done: Option, - /// The normal response of the operation in case of success. 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`. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping above, the `name` should have the format of `operations/some/unique/name`. - pub name: Option, - /// The error result of the operation in case of failure. - pub error: Option, -} - -impl ResponseResult for Operation {} - - -/// Used to specify how many machine resources an app version needs. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Resources { - /// How much disk size, in GB, an app version needs. - #[serde(rename="diskGb")] - pub disk_gb: Option, - /// How many CPU cores an app version needs. - pub cpu: Option, - /// How much memory, in GB, an app version needs. - #[serde(rename="memoryGb")] - pub memory_gb: Option, -} - -impl Part for Resources {} - - -/// Used to specify extra network settings (for VM runtimes only). -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Network { - /// A tag to apply to the VM instance during creation. - #[serde(rename="instanceTag")] - pub instance_tag: Option, - /// A list of ports (or port pairs) to forward from the VM into the app container. - #[serde(rename="forwardedPorts")] - pub forwarded_ports: Option>, - /// The Google Compute Engine network where the VMs will be created. If not specified, or empty, the network named "default" will be used. (The short name should be specified, not the resource path.) - pub name: Option, -} - -impl Part for Network {} - - -/// 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). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Status { - /// 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][google.rpc.Status.details] field, or localized by the client. - pub message: Option, - /// The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. - pub code: Option, - /// A list of messages that carry the error details. There will be a common set of message types for APIs to use. - pub details: Option>>, -} - -impl Part for Status {} - - -/// A module with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BasicScaling { - /// The instance will be shut down this amount of time after receiving its last request. - #[serde(rename="idleTimeout")] - pub idle_timeout: Option, - /// The maximum number of instances for App Engine to create for this version. - #[serde(rename="maxInstances")] - pub max_instances: Option, -} - -impl Part for BasicScaling {} - - -/// The response message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. +/// The response message for Operations.ListOperations. /// /// # Activities /// @@ -638,36 +736,6 @@ pub struct ListOperationsResponse { impl ResponseResult for ListOperationsResponse {} -/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StaticFilesHandler { - /// If specified, all files served by this handler will be served using the specified MIME type. If not specified, the MIME type for a file will be derived from the file's filename extension. - #[serde(rename="mimeType")] - pub mime_type: Option, - /// The length of time a static file served by this handler ought to be cached by web proxies and browsers. - pub expiration: Option, - /// The path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern. - pub path: Option, - /// A regular expression that matches the file paths for all files that will be referenced by this handler. - #[serde(rename="uploadPathRegex")] - pub upload_path_regex: Option, - /// If true, this [UrlMap][google.appengine.v1beta4.UrlMap] entry does not match the request unless the file referenced by the handler also exists. If no such file exists, processing will continue with the next [UrlMap][google.appengine.v1beta4.UrlMap] that matches the requested URL. - #[serde(rename="requireMatchingFile")] - pub require_matching_file: Option, - /// HTTP headers to use for all responses from these URLs. - #[serde(rename="httpHeaders")] - pub http_headers: Option>, - /// By default, files declared in static file handlers are uploaded as static data and are only served to end users, they cannot be read by an application. If this field is set to true, the files are also uploaded as code data so your application can read them. Both uploads are charged against your code and static data storage resource quotas. - #[serde(rename="applicationReadable")] - pub application_readable: Option, -} - -impl Part for StaticFilesHandler {} - - /// A module with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -717,55 +785,6 @@ pub struct ApiConfigHandler { impl Part for ApiConfigHandler {} -/// A Python runtime third-party library required by the application. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Library { - /// The version of the library to select, or "latest". - pub version: Option, - /// The name of the library, e.g. "PIL" or "django". - pub name: Option, -} - -impl Part for Library {} - - -/// A reference to a particular snapshot of the source tree used to build and deploy the application. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SourceReference { - /// The canonical (and persistent) identifier of the deployed revision, i.e. any kind of aliases including tags or branch names are not allowed. Example (git): "2198322f89e0bb2e25021667c2ed489d1fd34e6b" - #[serde(rename="revisionId")] - pub revision_id: Option, - /// Optional. A URI string identifying the repository. Example: "https://source.developers.google.com/p/app-123/r/default" - pub repository: Option, -} - -impl Part for SourceReference {} - - -/// Code and application artifacts used to deploy a version to App Engine. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Deployment { - /// A manifest of files stored in Google Cloud Storage which should be included as part of this application. All files must be readable using the credentials supplied with this call. - pub files: Option>, - /// The origin of the source code for this deployment. There can be more than one source reference per Version if source code is distributed among multiple repositories. - #[serde(rename="sourceReferences")] - pub source_references: Option>, - /// If supplied, a docker (container) image which should be used to start the application. Only applicable to the 'vm' runtime. - pub container: Option, -} - -impl Part for Deployment {} - - /// A module is a component of an application that provides a single service or configuration. A module has a collection of versions that define a specific set of code used to implement the functionality of that module. /// /// # Activities @@ -790,49 +809,106 @@ impl RequestValue for Module {} impl ResponseResult for Module {} -/// Executes a script to handle the request that matches the URL pattern. +/// A reference to a particular snapshot of the source tree used to build and deploy the application. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ScriptHandler { - /// Specifies the path to the script from the application root directory. - #[serde(rename="scriptPath")] - pub script_path: Option, +pub struct SourceReference { + /// The canonical (and persistent) identifier of the deployed revision, i.e. any kind of aliases including tags or branch names are not allowed. Example (git): "2198322f89e0bb2e25021667c2ed489d1fd34e6b" + #[serde(rename="revisionId")] + pub revision_id: Option, + /// Optional. A URI string identifying the repository. Example: "https://source.developers.google.com/p/app-123/r/default" + pub repository: Option, } -impl Part for ScriptHandler {} +impl Part for SourceReference {} -/// Rules to match an HTTP request and dispatch that request to a module. +/// Target scaling by disk usage (for VM runtimes only). /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UrlDispatchRule { - /// The pathname within the host. This must start with a '/'. A single '*' (glob) can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters. - pub path: Option, - /// The domain name to match on. Supports '*' (glob) wildcarding on the left-hand side of a '.'. If empty, all domains will be matched (the same as '*'). - pub domain: Option, - /// The resource id of a Module in this application that should service the matched request. The Module must already exist. Example: "default". - pub module: Option, +pub struct DiskUtilization { + /// Target ops per second written. + #[serde(rename="targetWriteOpsPerSec")] + pub target_write_ops_per_sec: Option, + /// Target bytes per second read. + #[serde(rename="targetReadBytesPerSec")] + pub target_read_bytes_per_sec: Option, + /// Target ops per second read. + #[serde(rename="targetReadOpsPerSec")] + pub target_read_ops_per_sec: Option, + /// Target bytes per second written. + #[serde(rename="targetWriteBytesPerSec")] + pub target_write_bytes_per_sec: Option, } -impl Part for UrlDispatchRule {} +impl Part for DiskUtilization {} -/// Use Google Cloud Endpoints to handle requests. +/// Target scaling by request utilization (for VM runtimes only). /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ApiEndpointHandler { - /// Specifies the path to the script from the application root directory. - #[serde(rename="scriptPath")] - pub script_path: Option, +pub struct RequestUtilization { + /// Target number of concurrent requests. + #[serde(rename="targetConcurrentRequests")] + pub target_concurrent_requests: Option, + /// Target requests per second. + #[serde(rename="targetRequestCountPerSec")] + pub target_request_count_per_sec: Option, } -impl Part for ApiEndpointHandler {} +impl Part for RequestUtilization {} + + +/// Configuration for traffic splitting for versions within a single module. Traffic splitting allows traffic directed to the module to be assigned to one of several versions in a fractional way, enabling experiments and canarying new builds, for example. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TrafficSplit { + /// Which mechanism should be used as a selector when choosing a version to send a request to. The traffic selection algorithm will be stable for either type until allocations are changed. + #[serde(rename="shardBy")] + pub shard_by: Option, + /// Mapping from module version IDs within the module to fractional (0.000, 1] allocations of traffic for that version. Each version may only be specified once, but some versions in the module may not have any traffic allocation. Modules that have traffic allocated in this field may not be deleted until the module is deleted, or their traffic allocation is removed. Allocations must sum to 1. Supports precision up to two decimal places for IP-based splits and up to three decimal places for cookie-based splits. + pub allocations: Option>, +} + +impl Part for TrafficSplit {} + + +/// This resource represents a long-running operation that is the result of a network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [modules versions delete apps](struct.AppModuleVersionDeleteCall.html) (response) +/// * [modules versions create apps](struct.AppModuleVersionCreateCall.html) (response) +/// * [operations get apps](struct.AppOperationGetCall.html) (response) +/// * [modules delete apps](struct.AppModuleDeleteCall.html) (response) +/// * [modules patch apps](struct.AppModulePatchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// 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. + pub metadata: Option>, + /// 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. + pub done: Option, + /// The normal response of the operation in case of success. 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`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping above, the `name` should have the format of `operations/some/unique/name`. + pub name: Option, + /// The error result of the operation in case of failure. + pub error: Option, +} + +impl ResponseResult for Operation {} @@ -1176,7 +1252,7 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.modules.patch", + dlg.begin(MethodInfo { id: "appengine.apps.modules.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -1225,14 +1301,14 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1276,7 +1352,7 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1286,10 +1362,10 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1321,7 +1397,7 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Module) -> AppModulePatchCall<'a, C, A> { self._request = new_value; @@ -1331,7 +1407,7 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppModulePatchCall<'a, C, A> { self._apps_id = new_value.to_string(); @@ -1341,7 +1417,7 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *modules id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn modules_id(mut self, new_value: &str) -> AppModulePatchCall<'a, C, A> { self._modules_id = new_value.to_string(); @@ -1373,12 +1449,12 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1401,17 +1477,17 @@ impl<'a, C, A> AppModulePatchCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AppModulePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppModulePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1477,7 +1553,7 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.modules.list", + dlg.begin(MethodInfo { id: "appengine.apps.modules.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -1525,7 +1601,7 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1561,7 +1637,7 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1571,10 +1647,10 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1607,7 +1683,7 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppModuleListCall<'a, C, A> { self._apps_id = new_value.to_string(); @@ -1639,12 +1715,12 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1667,17 +1743,17 @@ impl<'a, C, A> AppModuleListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AppModuleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppModuleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1740,7 +1816,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.modules.get", + dlg.begin(MethodInfo { id: "appengine.apps.modules.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -1783,7 +1859,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1819,7 +1895,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1829,10 +1905,10 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1865,7 +1941,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppModuleGetCall<'a, C, A> { self._apps_id = new_value.to_string(); @@ -1875,7 +1951,7 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *modules id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn modules_id(mut self, new_value: &str) -> AppModuleGetCall<'a, C, A> { self._modules_id = new_value.to_string(); @@ -1893,12 +1969,12 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1921,17 +1997,17 @@ impl<'a, C, A> AppModuleGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AppModuleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppModuleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1995,7 +2071,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.get", + dlg.begin(MethodInfo { id: "appengine.apps.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -2040,7 +2116,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2076,7 +2152,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2086,10 +2162,10 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2122,13 +2198,13 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppGetCall<'a, C, A> { self._apps_id = new_value.to_string(); self } - /// Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the `GET` operation. If specified and any resources cloud not be created, the request will fail with an error code. + /// Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the `GET` operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete. /// /// Sets the *ensure resources exist* query property to the given value. pub fn ensure_resources_exist(mut self, new_value: bool) -> AppGetCall<'a, C, A> { @@ -2147,12 +2223,12 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2175,17 +2251,17 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AppGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2248,7 +2324,7 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.modules.delete", + dlg.begin(MethodInfo { id: "appengine.apps.modules.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -2291,7 +2367,7 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2327,7 +2403,7 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2337,10 +2413,10 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2373,7 +2449,7 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppModuleDeleteCall<'a, C, A> { self._apps_id = new_value.to_string(); @@ -2383,7 +2459,7 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *modules id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn modules_id(mut self, new_value: &str) -> AppModuleDeleteCall<'a, C, A> { self._modules_id = new_value.to_string(); @@ -2401,12 +2477,12 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2429,17 +2505,17 @@ impl<'a, C, A> AppModuleDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AppModuleDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppModuleDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2502,7 +2578,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.operations.get", + dlg.begin(MethodInfo { id: "appengine.apps.operations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -2545,7 +2621,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2581,7 +2657,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2591,10 +2667,10 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2627,7 +2703,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppOperationGetCall<'a, C, A> { self._apps_id = new_value.to_string(); @@ -2637,7 +2713,7 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *operations id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operations_id(mut self, new_value: &str) -> AppOperationGetCall<'a, C, A> { self._operations_id = new_value.to_string(); @@ -2655,12 +2731,12 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2683,17 +2759,17 @@ impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AppOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2761,7 +2837,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.operations.list", + dlg.begin(MethodInfo { id: "appengine.apps.operations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -2812,7 +2888,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2848,7 +2924,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2858,10 +2934,10 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2894,7 +2970,7 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn apps_id(mut self, new_value: &str) -> AppOperationListCall<'a, C, A> { self._apps_id = new_value.to_string(); @@ -2933,12 +3009,12 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2961,17 +3037,17 @@ impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AppOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3035,7 +3111,7 @@ impl<'a, C, A> AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.modules.versions.delete", + dlg.begin(MethodInfo { id: "appengine.apps.modules.versions.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -3079,7 +3155,7 @@ impl<'a, C, A> AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3115,7 +3191,7 @@ impl<'a, C, A> AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3125,10 +3201,10 @@ impl<'a, C, A> AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionDeleteCall<'a, C, A> { self._apps_id = new_value.to_string(); @@ -3171,7 +3247,7 @@ impl<'a, C, A> AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionDeleteCall<'a, C, A> { self._modules_id = new_value.to_string(); @@ -3181,7 +3257,7 @@ impl<'a, C, A> AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionDeleteCall<'a, C, A> { self._versions_id = new_value.to_string(); @@ -3199,12 +3275,12 @@ impl<'a, C, A> AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut AppModuleVersionDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AppModuleVersionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppModuleVersionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3307,7 +3383,7 @@ impl<'a, C, A> AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.modules.versions.create", + dlg.begin(MethodInfo { id: "appengine.apps.modules.versions.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -3350,14 +3426,14 @@ impl<'a, C, A> AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3401,7 +3477,7 @@ impl<'a, C, A> AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3411,10 +3487,10 @@ impl<'a, C, A> AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut AppModuleVersionCreateCall<'a, C, A> { self._request = new_value; @@ -3456,7 +3532,7 @@ impl<'a, C, A> AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut AppModuleVersionCreateCall<'a, C, A> { self._apps_id = new_value.to_string(); @@ -3466,7 +3542,7 @@ impl<'a, C, A> AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut AppModuleVersionCreateCall<'a, C, A> { self._modules_id = new_value.to_string(); @@ -3484,12 +3560,12 @@ impl<'a, C, A> AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut AppModuleVersionCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AppModuleVersionCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppModuleVersionCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3588,7 +3664,7 @@ impl<'a, C, A> AppModuleVersionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.modules.versions.get", + dlg.begin(MethodInfo { id: "appengine.apps.modules.versions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -3635,7 +3711,7 @@ impl<'a, C, A> AppModuleVersionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3671,7 +3747,7 @@ impl<'a, C, A> AppModuleVersionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3681,10 +3757,10 @@ impl<'a, C, A> AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> { self._apps_id = new_value.to_string(); @@ -3727,7 +3803,7 @@ impl<'a, C, A> AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> { self._modules_id = new_value.to_string(); @@ -3737,7 +3813,7 @@ impl<'a, C, A> AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> { self._versions_id = new_value.to_string(); @@ -3762,12 +3838,12 @@ impl<'a, C, A> AppModuleVersionGetCall<'a, C, A> where C: BorrowMut AppModuleVersionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AppModuleVersionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppModuleVersionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3869,7 +3945,7 @@ impl<'a, C, A> AppModuleVersionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appengine.apps.modules.versions.list", + dlg.begin(MethodInfo { id: "appengine.apps.modules.versions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("appsId", self._apps_id.to_string())); @@ -3921,7 +3997,7 @@ impl<'a, C, A> AppModuleVersionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3957,7 +4033,7 @@ impl<'a, C, A> AppModuleVersionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3967,10 +4043,10 @@ impl<'a, C, A> AppModuleVersionListCall<'a, C, A> where C: BorrowMut AppModuleVersionListCall<'a, C, A> where C: BorrowMut AppModuleVersionListCall<'a, C, A> { self._apps_id = new_value.to_string(); @@ -4013,7 +4089,7 @@ impl<'a, C, A> AppModuleVersionListCall<'a, C, A> where C: BorrowMut AppModuleVersionListCall<'a, C, A> { self._modules_id = new_value.to_string(); @@ -4052,12 +4128,12 @@ impl<'a, C, A> AppModuleVersionListCall<'a, C, A> where C: BorrowMut AppModuleVersionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AppModuleVersionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppModuleVersionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/appengine1_beta5-cli/Cargo.toml b/gen/appengine1_beta5-cli/Cargo.toml new file mode 100644 index 0000000000..ac0a6cfae5 --- /dev/null +++ b/gen/appengine1_beta5-cli/Cargo.toml @@ -0,0 +1,35 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-appengine1_beta5-cli" +version = "0.3.3+20160121" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with appengine (protocol v1beta5)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta5-cli" +homepage = "https://cloud.google.com/appengine/docs/admin-api/" +documentation = "http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli" +license = "MIT" +keywords = ["appengine", "google", "cli"] + +[[bin]] +name = "appengine1-beta5" + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +strsim = "0.4" +yup-hyper-mock = "1.0" +clap = "2.0" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + + +[dependencies.google-appengine1_beta5] +path = "../appengine1_beta5" diff --git a/gen/deploymentmanager2_beta1-cli/LICENSE.md b/gen/appengine1_beta5-cli/LICENSE.md similarity index 96% rename from gen/deploymentmanager2_beta1-cli/LICENSE.md rename to gen/appengine1_beta5-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/deploymentmanager2_beta1-cli/LICENSE.md +++ b/gen/appengine1_beta5-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/appengine1_beta5-cli/README.md b/gen/appengine1_beta5-cli/README.md new file mode 100644 index 0000000000..466a1116ee --- /dev/null +++ b/gen/appengine1_beta5-cli/README.md @@ -0,0 +1,123 @@ + +The `appengine1-beta5` command-line interface *(CLI)* allows to use most features of the *Google appengine* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *appengine* API can be found at the +[official documentation site](https://cloud.google.com/appengine/docs/admin-api/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/appengine1-beta5.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/appengine1-beta5.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta5-cli). + +# Usage + +This documentation was generated from the *appengine* API at revision *20160121*. The CLI is at version *0.3.3*. + +```bash +appengine1-beta5 [options] + apps + get [-p ]... [-o ] + operations-get [-p ]... [-o ] + operations-list [-p ]... [-o ] + services-delete [-p ]... [-o ] + services-get [-p ]... [-o ] + services-list [-p ]... [-o ] + services-patch (-r )... [-p ]... [-o ] + services-versions-create (-r )... [-p ]... [-o ] + services-versions-delete [-p ]... [-o ] + services-versions-get [-p ]... [-o ] + services-versions-list [-p ]... [-o ] + appengine1-beta5 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `appengine1-beta5-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/appengine1-beta5-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/appengine1-beta5-secret.json`, assuming that the required *appengine* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `appengine1-beta5 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/appengine1_beta5-cli/mkdocs.yml b/gen/appengine1_beta5-cli/mkdocs.yml new file mode 100644 index 0000000000..3a8f3b68c9 --- /dev/null +++ b/gen/appengine1_beta5-cli/mkdocs.yml @@ -0,0 +1,27 @@ +site_name: appengine v0.3.3+20160121 +site_url: http://byron.github.io/google-apis-rs/google-appengine1_beta5-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta5-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['apps_get.md', 'Apps', 'Get'] +- ['apps_operations-get.md', 'Apps', 'Operations Get'] +- ['apps_operations-list.md', 'Apps', 'Operations List'] +- ['apps_services-delete.md', 'Apps', 'Services Delete'] +- ['apps_services-get.md', 'Apps', 'Services Get'] +- ['apps_services-list.md', 'Apps', 'Services List'] +- ['apps_services-patch.md', 'Apps', 'Services Patch'] +- ['apps_services-versions-create.md', 'Apps', 'Services Versions Create'] +- ['apps_services-versions-delete.md', 'Apps', 'Services Versions Delete'] +- ['apps_services-versions-get.md', 'Apps', 'Services Versions Get'] +- ['apps_services-versions-list.md', 'Apps', 'Services Versions List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/genomics1_beta2-cli/src/cmn.rs b/gen/appengine1_beta5-cli/src/cmn.rs similarity index 93% rename from gen/genomics1_beta2-cli/src/cmn.rs rename to gen/appengine1_beta5-cli/src/cmn.rs index 56051cab08..ae86fdef65 100644 --- a/gen/genomics1_beta2-cli/src/cmn.rs +++ b/gen/appengine1_beta5-cli/src/cmn.rs @@ -1,8 +1,8 @@ // COPY OF 'src/rust/cli/cmn.rs' // DO NOT EDIT use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; -use serde::json; -use serde::json::value::Value; +use serde_json as json; +use serde_json::value::Value; use mime::Mime; use clap::{App, SubCommand}; use strsim; @@ -120,7 +120,7 @@ pub struct FieldCursor(Vec); impl ToString for FieldCursor { fn to_string(&self) -> String { - self.0.connect(".") + self.0.join(".") } } @@ -237,15 +237,15 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, + pub fn set_json_value(&self, mut object: &mut Value, value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, + err: &mut InvalidOptionsError, orig_cursor: &FieldCursor) { assert!(self.0.len() > 0); for field in &self.0[..self.0.len()-1] { let tmp = object; - object = + object = match *tmp { Value::Object(ref mut mapping) => { mapping.entry(field.to_owned()).or_insert( @@ -259,19 +259,19 @@ impl FieldCursor { match *object { Value::Object(ref mut mapping) => { let field = &self.0[self.0.len()-1]; - let to_jval = - |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| -> Value { match jtype { - JsonType::Boolean => + JsonType::Boolean => Value::Bool(arg_from_str(value, err, &field, "boolean")), - JsonType::Int => + JsonType::Int => Value::I64(arg_from_str(value, err, &field, "int")), - JsonType::Uint => + JsonType::Uint => Value::U64(arg_from_str(value, err, &field, "uint")), - JsonType::Float => + JsonType::Float => Value::F64(arg_from_str(value, err, &field, "float")), - JsonType::String => + JsonType::String => Value::String(value.to_owned()), } }; @@ -338,7 +338,7 @@ pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut Inv match UploadProtocol::from_str(name) { Ok(up) => up, Err(msg) => { - err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); UploadProtocol::Simple } }) @@ -376,8 +376,8 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { } -pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, - arg_name: &'a str, +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, arg_type: &'a str) -> T where T: FromStr + Default, ::Err: fmt::Display { @@ -411,7 +411,7 @@ impl TokenStorage for JsonTokenStorage { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => + Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), _ => Err(json::Error::IoError(err)) @@ -424,7 +424,7 @@ impl TokenStorage for JsonTokenStorage { Ok(mut f) => { match json::to_writer_pretty(&mut f, &token) { Ok(_) => Ok(()), - Err(io_err) => Err(json::Error::IoError(io_err)), + Err(serde_err) => Err(serde_err), } }, Err(io_err) => Err(json::Error::IoError(io_err)) @@ -435,7 +435,7 @@ impl TokenStorage for JsonTokenStorage { fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { match fs::File::open(&self.path(scope_hash)) { - Ok(mut f) => { + Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), Err(err) => Err(err), @@ -455,17 +455,17 @@ impl TokenStorage for JsonTokenStorage { #[derive(Debug)] pub enum ApplicationSecretError { DecoderError((String, json::Error)), - FormatError(String), + FormatError(String), } impl fmt::Display for ApplicationSecretError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { ApplicationSecretError::DecoderError((ref path, ref err)) - => writeln!(f, "Could not decode file at '{}' with error: {}.", + => writeln!(f, "Could not decode file at '{}' with error: {}.", path, err), ApplicationSecretError::FormatError(ref path) - => writeln!(f, "'installed' field is unset in secret file at '{}'.", + => writeln!(f, "'installed' field is unset in secret file at '{}'.", path), } } @@ -485,7 +485,7 @@ impl fmt::Display for ConfigurationError { match *self { ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), - ConfigurationError::DirectoryUnset + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), ConfigurationError::HomeExpansionFailed(ref dir) => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), @@ -532,10 +532,10 @@ impl fmt::Display for FieldError { FieldError::TrailingFieldSep(ref field) => writeln!(f, "'{}': Single field separator may not be last character.", field), FieldError::Unknown(ref field, ref suggestion, ref value) => { - let suffix = + let suffix = match *suggestion { Some(ref s) => { - let kv = + let kv = match *value { Some(ref v) => format!("{}={}", s, v), None => s.clone(), @@ -546,7 +546,7 @@ impl fmt::Display for FieldError { }; writeln!(f, "Field '{}' does not exist.{}", field, suffix) }, - FieldError::Duplicate(ref cursor) + FieldError::Duplicate(ref cursor) => writeln!(f, "Value at '{}' was already set", cursor), FieldError::Empty => writeln!(f, "Field names must not be empty."), @@ -574,13 +574,13 @@ impl fmt::Display for CLIError { CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), CLIError::Input(ref err) => write!(f, "Input -> {}", err), CLIError::Field(ref err) => write!(f, "Field -> {}", err), - CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) - => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.connect(", ")), - CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", arg_name, value, type_name, err_desc), CLIError::UnknownParameter(ref param_name, ref possible_values) => { - let mut suffix = + let suffix = match did_you_mean(param_name, &possible_values) { Some(v) => format!(" Did you mean '{}' ?", v), None => String::new(), @@ -634,7 +634,7 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) } - let expanded_config_dir = + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { match env::var("HOME").ok().or(env::var("UserProfile").ok()) { None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), @@ -657,8 +657,8 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { Ok(expanded_config_dir) } -pub fn application_secret_from_directory(dir: &str, - secret_basename: &str, +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, json_console_secret: &str) -> Result { let secret_path = Path::new(dir).join(secret_basename); @@ -679,10 +679,13 @@ pub fn application_secret_from_directory(dir: &str, Err(cfe) => cfe, Ok(mut f) => { // Assure we convert 'ugly' json string into pretty one - let console_secret: ConsoleApplicationSecret + let console_secret: ConsoleApplicationSecret = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(io_err) => io_err, + Err(serde_err) => match serde_err { + json::Error::IoError(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, Ok(_) => continue, } } @@ -691,17 +694,17 @@ pub fn application_secret_from_directory(dir: &str, } return secret_io_error(err) }, - Ok(mut f) => { + Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::IoError(err)) => return secret_io_error(err), - Err(json_err) => + Err(json_err) => return Err(CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => + Ok(console_secret) => match console_secret.installed { Some(secret) => return Ok(secret), None => return Err( @@ -715,4 +718,4 @@ pub fn application_secret_from_directory(dir: &str, } } unreachable!(); -} \ No newline at end of file +} diff --git a/gen/appengine1_beta5-cli/src/main.rs b/gen/appengine1_beta5-cli/src/main.rs new file mode 100644 index 0000000000..87ce279dc0 --- /dev/null +++ b/gen/appengine1_beta5-cli/src/main.rs @@ -0,0 +1,1334 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_appengine1_beta5 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Appengine>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _apps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.apps().get(opt.value_of("apps-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "ensure-resources-exist" => { + call = call.ensure_resources_exist(arg_from_str(value.unwrap_or("false"), err, "ensure-resources-exist", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["ensure-resources-exist"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _apps_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.apps().operations_get(opt.value_of("apps-id").unwrap_or(""), opt.value_of("operations-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _apps_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.apps().operations_list(opt.value_of("apps-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _apps_services_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.apps().services_delete(opt.value_of("apps-id").unwrap_or(""), opt.value_of("services-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _apps_services_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.apps().services_get(opt.value_of("apps-id").unwrap_or(""), opt.value_of("services-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _apps_services_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.apps().services_list(opt.value_of("apps-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _apps_services_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "split.shard-by" => Some(("split.shardBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "split.allocations" => Some(("split.allocations", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Map })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["allocations", "id", "name", "shard-by", "split"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Service = json::value::from_value(object).unwrap(); + let mut call = self.hub.apps().services_patch(request, opt.value_of("apps-id").unwrap_or(""), opt.value_of("services-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "migrate-traffic" => { + call = call.migrate_traffic(arg_from_str(value.unwrap_or("false"), err, "migrate-traffic", "boolean")); + }, + "mask" => { + call = call.mask(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["mask", "migrate-traffic"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _apps_services_versions_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "basic-scaling.idle-timeout" => Some(("basicScaling.idleTimeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "basic-scaling.max-instances" => Some(("basicScaling.maxInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "beta-settings" => Some(("betaSettings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "vm" => Some(("vm", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "instance-class" => Some(("instanceClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "api-config.url" => Some(("apiConfig.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "api-config.security-level" => Some(("apiConfig.securityLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "api-config.auth-fail-action" => Some(("apiConfig.authFailAction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "api-config.login" => Some(("apiConfig.login", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "api-config.script" => Some(("apiConfig.script", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "threadsafe" => Some(("threadsafe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "health-check.restart-threshold" => Some(("healthCheck.restartThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "health-check.check-interval" => Some(("healthCheck.checkInterval", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "health-check.unhealthy-threshold" => Some(("healthCheck.unhealthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "health-check.healthy-threshold" => Some(("healthCheck.healthyThreshold", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "health-check.host" => Some(("healthCheck.host", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "health-check.timeout" => Some(("healthCheck.timeout", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "health-check.disable-health-check" => Some(("healthCheck.disableHealthCheck", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-expiration" => Some(("defaultExpiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deployer" => Some(("deployer", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "env" => Some(("env", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "disk-usage-bytes" => Some(("diskUsageBytes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "automatic-scaling.min-pending-latency" => Some(("automaticScaling.minPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-received-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-sent-bytes-per-sec" => Some(("automaticScaling.networkUtilization.targetSentBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-received-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetReceivedPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.network-utilization.target-sent-packets-per-sec" => Some(("automaticScaling.networkUtilization.targetSentPacketsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.disk-utilization.target-write-ops-per-sec" => Some(("automaticScaling.diskUtilization.targetWriteOpsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.disk-utilization.target-read-bytes-per-sec" => Some(("automaticScaling.diskUtilization.targetReadBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.disk-utilization.target-read-ops-per-sec" => Some(("automaticScaling.diskUtilization.targetReadOpsPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.disk-utilization.target-write-bytes-per-sec" => Some(("automaticScaling.diskUtilization.targetWriteBytesPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.max-pending-latency" => Some(("automaticScaling.maxPendingLatency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "automatic-scaling.max-idle-instances" => Some(("automaticScaling.maxIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.min-idle-instances" => Some(("automaticScaling.minIdleInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.request-utilization.target-concurrent-requests" => Some(("automaticScaling.requestUtilization.targetConcurrentRequests", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.request-utilization.target-request-count-per-sec" => Some(("automaticScaling.requestUtilization.targetRequestCountPerSec", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.cool-down-period" => Some(("automaticScaling.coolDownPeriod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "automatic-scaling.max-total-instances" => Some(("automaticScaling.maxTotalInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.max-concurrent-requests" => Some(("automaticScaling.maxConcurrentRequests", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.min-total-instances" => Some(("automaticScaling.minTotalInstances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "automatic-scaling.cpu-utilization.target-utilization" => Some(("automaticScaling.cpuUtilization.targetUtilization", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "automatic-scaling.cpu-utilization.aggregation-window-length" => Some(("automaticScaling.cpuUtilization.aggregationWindowLength", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "env-variables" => Some(("envVariables", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "resources.disk-gb" => Some(("resources.diskGb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "resources.cpu" => Some(("resources.cpu", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "resources.memory-gb" => Some(("resources.memoryGb", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "manual-scaling.instances" => Some(("manualScaling.instances", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "inbound-services" => Some(("inboundServices", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "deployment.container.image" => Some(("deployment.container.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.instance-tag" => Some(("network.instanceTag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network.forwarded-ports" => Some(("network.forwardedPorts", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "network.name" => Some(("network.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nobuild-files-regex" => Some(("nobuildFilesRegex", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "serving-status" => Some(("servingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "runtime" => Some(("runtime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["aggregation-window-length", "api-config", "auth-fail-action", "automatic-scaling", "basic-scaling", "beta-settings", "check-interval", "container", "cool-down-period", "cpu", "cpu-utilization", "creation-time", "default-expiration", "deployer", "deployment", "disable-health-check", "disk-gb", "disk-usage-bytes", "disk-utilization", "env", "env-variables", "forwarded-ports", "health-check", "healthy-threshold", "host", "id", "idle-timeout", "image", "inbound-services", "instance-class", "instance-tag", "instances", "login", "manual-scaling", "max-concurrent-requests", "max-idle-instances", "max-instances", "max-pending-latency", "max-total-instances", "memory-gb", "min-idle-instances", "min-pending-latency", "min-total-instances", "name", "network", "network-utilization", "nobuild-files-regex", "request-utilization", "resources", "restart-threshold", "runtime", "script", "security-level", "serving-status", "target-concurrent-requests", "target-read-bytes-per-sec", "target-read-ops-per-sec", "target-received-bytes-per-sec", "target-received-packets-per-sec", "target-request-count-per-sec", "target-sent-bytes-per-sec", "target-sent-packets-per-sec", "target-utilization", "target-write-bytes-per-sec", "target-write-ops-per-sec", "threadsafe", "timeout", "unhealthy-threshold", "url", "vm"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Version = json::value::from_value(object).unwrap(); + let mut call = self.hub.apps().services_versions_create(request, opt.value_of("apps-id").unwrap_or(""), opt.value_of("services-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _apps_services_versions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.apps().services_versions_delete(opt.value_of("apps-id").unwrap_or(""), opt.value_of("services-id").unwrap_or(""), opt.value_of("versions-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _apps_services_versions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.apps().services_versions_get(opt.value_of("apps-id").unwrap_or(""), opt.value_of("services-id").unwrap_or(""), opt.value_of("versions-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "view" => { + call = call.view(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["view"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _apps_services_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.apps().services_versions_list(opt.value_of("apps-id").unwrap_or(""), opt.value_of("services-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "view" => { + call = call.view(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size", "view"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("apps", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._apps_get(opt, dry_run, &mut err); + }, + ("operations-get", Some(opt)) => { + call_result = self._apps_operations_get(opt, dry_run, &mut err); + }, + ("operations-list", Some(opt)) => { + call_result = self._apps_operations_list(opt, dry_run, &mut err); + }, + ("services-delete", Some(opt)) => { + call_result = self._apps_services_delete(opt, dry_run, &mut err); + }, + ("services-get", Some(opt)) => { + call_result = self._apps_services_get(opt, dry_run, &mut err); + }, + ("services-list", Some(opt)) => { + call_result = self._apps_services_list(opt, dry_run, &mut err); + }, + ("services-patch", Some(opt)) => { + call_result = self._apps_services_patch(opt, dry_run, &mut err); + }, + ("services-versions-create", Some(opt)) => { + call_result = self._apps_services_versions_create(opt, dry_run, &mut err); + }, + ("services-versions-delete", Some(opt)) => { + call_result = self._apps_services_versions_delete(opt, dry_run, &mut err); + }, + ("services-versions-get", Some(opt)) => { + call_result = self._apps_services_versions_get(opt, dry_run, &mut err); + }, + ("services-versions-list", Some(opt)) => { + call_result = self._apps_services_versions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("apps".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "appengine1-beta5-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "appengine1-beta5", + db_dir: config_dir.clone(), + }, None); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::Appengine::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "bearer-token", "callback", "fields", "key", "oauth-token", "pp", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("bearer-token", "bearer_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("apps", "methods: 'get', 'operations-get', 'operations-list', 'services-delete', 'services-get', 'services-list', 'services-patch', 'services-versions-create', 'services-versions-delete', 'services-versions-get' and 'services-versions-list'", vec![ + ("get", + Some(r##"Gets information about an application."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_get", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the application to get. For example: "apps/myapp"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-get", + Some(r##"Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_operations-get", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. The name of the operation resource."##), + Some(true), + Some(false)), + + (Some(r##"operations-id"##), + None, + Some(r##"Part of `name`. See documentation of `appsId`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("operations-list", + Some(r##"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 below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_operations-list", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. The name of the operation collection."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("services-delete", + Some(r##"Deletes a service and all enclosed versions."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-delete", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default"."##), + Some(true), + Some(false)), + + (Some(r##"services-id"##), + None, + Some(r##"Part of `name`. See documentation of `appsId`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("services-get", + Some(r##"Gets the current configuration of the service."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-get", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default"."##), + Some(true), + Some(false)), + + (Some(r##"services-id"##), + None, + Some(r##"Part of `name`. See documentation of `appsId`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("services-list", + Some(r##"Lists all the services in the application."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-list", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the resource requested. For example: "apps/myapp"."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("services-patch", + Some(r##"Updates the configuration of the specified service."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-patch", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the resource to update. For example: "apps/myapp/services/default"."##), + Some(true), + Some(false)), + + (Some(r##"services-id"##), + None, + Some(r##"Part of `name`. See documentation of `appsId`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("services-versions-create", + Some(r##"Deploys new code and resource files to a version."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-versions-create", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the resource to update. For example: "apps/myapp/services/default"."##), + Some(true), + Some(false)), + + (Some(r##"services-id"##), + None, + Some(r##"Part of `name`. See documentation of `appsId`."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("services-versions-delete", + Some(r##"Deletes an existing version."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-versions-delete", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default/versions/v1"."##), + Some(true), + Some(false)), + + (Some(r##"services-id"##), + None, + Some(r##"Part of `name`. See documentation of `appsId`."##), + Some(true), + Some(false)), + + (Some(r##"versions-id"##), + None, + Some(r##"Part of `name`. See documentation of `appsId`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("services-versions-get", + Some(r##"Gets application deployment information."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-versions-get", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default/versions/v1"."##), + Some(true), + Some(false)), + + (Some(r##"services-id"##), + None, + Some(r##"Part of `name`. See documentation of `appsId`."##), + Some(true), + Some(false)), + + (Some(r##"versions-id"##), + None, + Some(r##"Part of `name`. See documentation of `appsId`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("services-versions-list", + Some(r##"Lists the versions of a service."##), + "Details at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli/apps_services-versions-list", + vec![ + (Some(r##"apps-id"##), + None, + Some(r##"Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default"."##), + Some(true), + Some(false)), + + (Some(r##"services-id"##), + None, + Some(r##"Part of `name`. See documentation of `appsId`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("appengine1-beta5") + .author("Sebastian Thiel ") + .version("0.3.3+20160121") + .about("The Google App Engine Admin API enables developers to provision and manage their App Engine applications.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appengine1_beta5_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/appengine1_beta5/Cargo.toml b/gen/appengine1_beta5/Cargo.toml new file mode 100644 index 0000000000..097d1f1a47 --- /dev/null +++ b/gen/appengine1_beta5/Cargo.toml @@ -0,0 +1,29 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-appengine1_beta5" +version = "0.1.11+20160121" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with appengine (protocol v1beta5)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta5" +homepage = "https://cloud.google.com/appengine/docs/admin-api/" +documentation = "http://byron.github.io/google-apis-rs/google_appengine1_beta5" +license = "MIT" +keywords = ["appengine", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +url = ">= 0.5" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + diff --git a/gen/cloudsearch1-cli/LICENSE.md b/gen/appengine1_beta5/LICENSE.md similarity index 96% rename from gen/cloudsearch1-cli/LICENSE.md rename to gen/appengine1_beta5/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudsearch1-cli/LICENSE.md +++ b/gen/appengine1_beta5/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/appengine1_beta5/README.md b/gen/appengine1_beta5/README.md new file mode 100644 index 0000000000..55a3b882c6 --- /dev/null +++ b/gen/appengine1_beta5/README.md @@ -0,0 +1,185 @@ + +The `google-appengine1_beta5` library allows access to all features of the *Google appengine* service. + +This documentation was generated from *appengine* crate version *0.1.11+20160121*, where *20160121* is the exact revision of the *appengine:v1beta5* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. + +Everything else about the *appengine* *v1_beta5* API can be found at the +[official documentation site](https://cloud.google.com/appengine/docs/admin-api/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.Appengine.html) ... + +* apps + * [*get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppGetCall.html), [*operations get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppOperationGetCall.html), [*operations list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppOperationListCall.html), [*services delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceDeleteCall.html), [*services get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceGetCall.html), [*services list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceListCall.html), [*services patch*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServicePatchCall.html), [*services versions create*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionCreateCall.html), [*services versions delete*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionDeleteCall.html), [*services versions get*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionGetCall.html) and [*services versions list*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.AppServiceVersionListCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_appengine1_beta5/struct.Appengine.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.apps().services_versions_delete(...).doit() +let r = hub.apps().operations_get(...).doit() +let r = hub.apps().services_delete(...).doit() +let r = hub.apps().services_versions_create(...).doit() +let r = hub.apps().services_patch(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-appengine1_beta5 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_appengine1_beta5 as appengine1_beta5; +use appengine1_beta5::Service; +use appengine1_beta5::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use appengine1_beta5::Appengine; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = Appengine::new(hyper::Client::new(), 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 ! +let mut req = Service::default(); + +// 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 ! +let result = hub.apps().services_patch(req, "appsId", "servicesId") + .migrate_traffic(false) + .mask("sed") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_appengine1_beta5/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_appengine1_beta5/../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](http://byron.github.io/google-apis-rs/google_appengine1_beta5/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.ResponseResult.html), 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")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.CallBuilder.html) 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](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.Delegate.html) 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 [enocodable](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.Part.html) 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](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.CallBuilder.html), 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](http://byron.github.io/google-apis-rs/google_appengine1_beta5/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **appengine1_beta5** 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-rs/LICENSE.md diff --git a/gen/deploymentmanager2_beta1/src/build.rs b/gen/appengine1_beta5/src/build.rs similarity index 81% rename from gen/deploymentmanager2_beta1/src/build.rs rename to gen/appengine1_beta5/src/build.rs index 77b46f424c..b318830100 100644 --- a/gen/deploymentmanager2_beta1/src/build.rs +++ b/gen/appengine1_beta5/src/build.rs @@ -12,5 +12,5 @@ pub fn main() { let mut registry = syntex::Registry::new(); serde_codegen::register(&mut registry); - registry.expand("google-deploymentmanager2_beta1", &src, &dst).unwrap(); + registry.expand("google-appengine1_beta5", &src, &dst).unwrap(); } diff --git a/gen/genomics1_beta2/src/cmn.rs b/gen/appengine1_beta5/src/cmn.rs similarity index 93% rename from gen/genomics1_beta2/src/cmn.rs rename to gen/appengine1_beta5/src/cmn.rs index 6294f5a77b..87b91a8986 100644 --- a/gen/genomics1_beta2/src/cmn.rs +++ b/gen/appengine1_beta5/src/cmn.rs @@ -5,18 +5,19 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; use hyper; use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, HeaderFormat}; -use hyper::http::LINE_ENDING; +use hyper::http::h1::LINE_ENDING; use hyper::method::Method; use hyper::status::StatusCode; -use serde; +use serde_json as json; /// Identifies the Hub. There is only one per library, this trait is supposed /// to make intended use more explicit. @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -114,13 +115,21 @@ impl hyper::net::NetworkStream for DummyNetworkStream { fn peer_addr(&mut self) -> io::Result { Ok("127.0.0.1:1337".parse().unwrap()) } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } } /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -128,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -142,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -171,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -183,18 +192,18 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. /// * `json_decode_error` - The decoder error - fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) { + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { let _ = json_encoded_value; let _ = json_decode_error; } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -205,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -224,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -275,7 +284,7 @@ pub enum Error { /// Shows that we failed to decode the server response. /// This can happen if the protocol changes in conjunction with strict json decoding. - JsonDecodeError(String, serde::json::Error), + JsonDecodeError(String, json::Error), /// Indicates an HTTP repsonse with a non-success status code Failure(hyper::client::Response), @@ -296,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -309,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -410,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -424,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -438,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -490,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -504,7 +513,7 @@ impl ::std::ops::DerefMut for XUploadContentType { } impl Header for XUploadContentType { fn header_name() -> &'static str { "X-Upload-Content-Type" } - fn parse_header(raw: &[Vec]) -> Option { + fn parse_header(raw: &[Vec]) -> hyper::error::Result { hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) } } @@ -569,8 +578,8 @@ impl Header for ContentRange { } /// We are not parsable, as parsing is done by the `Range` header - fn parse_header(_: &[Vec]) -> Option { - None + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) } } @@ -595,19 +604,19 @@ impl Header for RangeResponseHeader { "Range" } - fn parse_header(raw: &[Vec]) -> Option { + fn parse_header(raw: &[Vec]) -> hyper::error::Result { if raw.len() > 0 { let v = &raw[0]; if let Ok(s) = std::str::from_utf8(v) { const PREFIX: &'static str = "bytes "; if s.starts_with(PREFIX) { if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { - return Some(RangeResponseHeader(c)) + return Ok(RangeResponseHeader(c)) } } } } - None + Err(hyper::error::Error::Method) } } @@ -649,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -659,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -717,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, - serde::json::from_str(&json_err).ok(), - serde::json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); continue; } } @@ -728,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) @@ -740,9 +749,9 @@ impl<'a, A> ResumableUploadHelper<'a, A> // Copy of src/rust/cli/cmn.rs // TODO(ST): Allow sharing common code between program types -pub fn remove_json_null_values(value: &mut serde::json::value::Value) { +pub fn remove_json_null_values(value: &mut json::value::Value) { match *value { - serde::json::value::Value::Object(ref mut map) => { + json::value::Value::Object(ref mut map) => { let mut for_removal = Vec::new(); for (key, mut value) in map.iter_mut() { diff --git a/gen/genomics1_beta2/src/lib.rs b/gen/appengine1_beta5/src/lib.rs similarity index 63% rename from gen/genomics1_beta2/src/lib.rs rename to gen/appengine1_beta5/src/lib.rs index 98273e408a..aec013454e 100644 --- a/gen/genomics1_beta2/src/lib.rs +++ b/gen/appengine1_beta5/src/lib.rs @@ -2,41 +2,17 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *genomics* crate version *0.1.8+20150326*, where *20150326* is the exact revision of the *genomics:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.8*. +//! This documentation was generated from *appengine* crate version *0.1.11+20160121*, where *20160121* is the exact revision of the *appengine:v1beta5* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! -//! Everything else about the *genomics* *v1_beta2* API can be found at the -//! [official documentation site](https://developers.google.com/genomics/v1beta2/reference). -//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1_beta2). +//! Everything else about the *appengine* *v1_beta5* API can be found at the +//! [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1_beta5). //! # Features //! -//! Handle the following *Resources* with ease from the central [hub](struct.Genomics.html) ... +//! Handle the following *Resources* with ease from the central [hub](struct.Appengine.html) ... //! -//! * [annotation sets](struct.AnnotationSet.html) -//! * [*create*](struct.AnnotationSetCreateCall.html), [*delete*](struct.AnnotationSetDeleteCall.html), [*get*](struct.AnnotationSetGetCall.html), [*patch*](struct.AnnotationSetPatchCall.html), [*search*](struct.AnnotationSetSearchCall.html) and [*update*](struct.AnnotationSetUpdateCall.html) -//! * [annotations](struct.Annotation.html) -//! * [*batch create*](struct.AnnotationBatchCreateCall.html), [*create*](struct.AnnotationCreateCall.html), [*delete*](struct.AnnotationDeleteCall.html), [*get*](struct.AnnotationGetCall.html), [*patch*](struct.AnnotationPatchCall.html), [*search*](struct.AnnotationSearchCall.html) and [*update*](struct.AnnotationUpdateCall.html) -//! * callsets -//! * [*create*](struct.CallsetCreateCall.html), [*delete*](struct.CallsetDeleteCall.html), [*get*](struct.CallsetGetCall.html), [*patch*](struct.CallsetPatchCall.html), [*search*](struct.CallsetSearchCall.html) and [*update*](struct.CallsetUpdateCall.html) -//! * [datasets](struct.Dataset.html) -//! * [*create*](struct.DatasetCreateCall.html), [*delete*](struct.DatasetDeleteCall.html), [*get*](struct.DatasetGetCall.html), [*list*](struct.DatasetListCall.html), [*patch*](struct.DatasetPatchCall.html), [*undelete*](struct.DatasetUndeleteCall.html) and [*update*](struct.DatasetUpdateCall.html) -//! * experimental -//! * [*jobs create*](struct.ExperimentalJobCreateCall.html) -//! * [jobs](struct.Job.html) -//! * [*cancel*](struct.JobCancelCall.html), [*get*](struct.JobGetCall.html) and [*search*](struct.JobSearchCall.html) -//! * readgroupsets -//! * [*align*](struct.ReadgroupsetAlignCall.html), [*call*](struct.ReadgroupsetCallCall.html), [*coveragebuckets list*](struct.ReadgroupsetCoveragebucketListCall.html), [*delete*](struct.ReadgroupsetDeleteCall.html), [*export*](struct.ReadgroupsetExportCall.html), [*get*](struct.ReadgroupsetGetCall.html), [*import*](struct.ReadgroupsetImportCall.html), [*patch*](struct.ReadgroupsetPatchCall.html), [*search*](struct.ReadgroupsetSearchCall.html) and [*update*](struct.ReadgroupsetUpdateCall.html) -//! * [reads](struct.Read.html) -//! * [*search*](struct.ReadSearchCall.html) -//! * [references](struct.Reference.html) -//! * [*bases list*](struct.ReferenceBaseListCall.html), [*get*](struct.ReferenceGetCall.html) and [*search*](struct.ReferenceSearchCall.html) -//! * referencesets -//! * [*get*](struct.ReferencesetGetCall.html) and [*search*](struct.ReferencesetSearchCall.html) -//! * streaming readstore -//! * [*streamreads*](struct.StreamingReadstoreStreamreadCall.html) -//! * [variants](struct.Variant.html) -//! * [*create*](struct.VariantCreateCall.html), [*delete*](struct.VariantDeleteCall.html), [*get*](struct.VariantGetCall.html), [*search*](struct.VariantSearchCall.html) and [*update*](struct.VariantUpdateCall.html) -//! * variantsets -//! * [*delete*](struct.VariantsetDeleteCall.html), [*export*](struct.VariantsetExportCall.html), [*get*](struct.VariantsetGetCall.html), [*import variants*](struct.VariantsetImportVariantCall.html), [*merge variants*](struct.VariantsetMergeVariantCall.html), [*patch*](struct.VariantsetPatchCall.html), [*search*](struct.VariantsetSearchCall.html) and [*update*](struct.VariantsetUpdateCall.html) +//! * apps +//! * [*get*](struct.AppGetCall.html), [*operations get*](struct.AppOperationGetCall.html), [*operations list*](struct.AppOperationListCall.html), [*services delete*](struct.AppServiceDeleteCall.html), [*services get*](struct.AppServiceGetCall.html), [*services list*](struct.AppServiceListCall.html), [*services patch*](struct.AppServicePatchCall.html), [*services versions create*](struct.AppServiceVersionCreateCall.html), [*services versions delete*](struct.AppServiceVersionDeleteCall.html), [*services versions get*](struct.AppServiceVersionGetCall.html) and [*services versions list*](struct.AppServiceVersionListCall.html) //! //! //! @@ -47,7 +23,7 @@ //! //! The API is structured into the following primary items: //! -//! * **[Hub](struct.Genomics.html)** +//! * **[Hub](struct.Appengine.html)** //! * a central object to maintain state and allow accessing all *Activities* //! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn //! allow access to individual [*Call Builders*](trait.CallBuilder.html) @@ -71,13 +47,11 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.annotations().search(...).doit() -//! let r = hub.annotations().patch(...).doit() -//! let r = hub.annotations().create(...).doit() -//! let r = hub.annotations().delete(...).doit() -//! let r = hub.annotations().update(...).doit() -//! let r = hub.annotations().get(...).doit() -//! let r = hub.annotations().batch_create(...).doit() +//! let r = hub.apps().services_versions_delete(...).doit() +//! let r = hub.apps().operations_get(...).doit() +//! let r = hub.apps().services_delete(...).doit() +//! let r = hub.apps().services_versions_create(...).doit() +//! let r = hub.apps().services_patch(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -93,7 +67,7 @@ //! //! ```toml //! [dependencies] -//! google-genomics1_beta2 = "*" +//! google-appengine1_beta5 = "*" //! ``` //! //! ## A complete example @@ -101,13 +75,13 @@ //! ```test_harness,no_run //! extern crate hyper; //! extern crate yup_oauth2 as oauth2; -//! extern crate google_genomics1_beta2 as genomics1_beta2; -//! use genomics1_beta2::Annotation; -//! use genomics1_beta2::{Result, Error}; +//! extern crate google_appengine1_beta5 as appengine1_beta5; +//! use appengine1_beta5::Service; +//! use appengine1_beta5::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; //! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -//! use genomics1_beta2::Genomics; +//! use appengine1_beta5::Appengine; //! //! // Get an ApplicationSecret instance by some means. It contains the `client_id` and //! // `client_secret`, among other things. @@ -120,16 +94,18 @@ //! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, //! hyper::Client::new(), //! ::default(), None); -//! let mut hub = Genomics::new(hyper::Client::new(), auth); +//! let mut hub = Appengine::new(hyper::Client::new(), 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 ! -//! let mut req = Annotation::default(); +//! let mut req = Service::default(); //! //! // 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 ! -//! let result = hub.annotations().patch(req, "annotationId") +//! let result = hub.apps().services_patch(req, "appsId", "servicesId") +//! .migrate_traffic(true) +//! .mask("invidunt") //! .doit(); //! //! match result { diff --git a/gen/deploymentmanager2_beta1/src/lib.rs.in b/gen/appengine1_beta5/src/lib.rs.in similarity index 56% rename from gen/deploymentmanager2_beta1/src/lib.rs.in rename to gen/appengine1_beta5/src/lib.rs.in index 5ee5f1c8e9..2d87f63b6a 100644 --- a/gen/deploymentmanager2_beta1/src/lib.rs.in +++ b/gen/appengine1_beta5/src/lib.rs.in @@ -4,6 +4,7 @@ extern crate hyper; extern crate serde; +extern crate serde_json; extern crate yup_oauth2 as oauth2; extern crate mime; extern crate url; @@ -15,13 +16,14 @@ use std::cell::RefCell; use std::borrow::BorrowMut; use std::default::Default; use std::collections::BTreeMap; -use serde::json; +use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -34,29 +36,21 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// View your Google Cloud Platform management resources and deployment status information - NdevCloudmanReadonly, - /// View and manage your data across Google Cloud Platform services CloudPlatform, - - /// View and manage your Google Cloud Platform management resources and deployment status information - NdevCloudman, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { - Scope::NdevCloudmanReadonly => "https://www.googleapis.com/auth/ndev.cloudman.readonly", Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", - Scope::NdevCloudman => "https://www.googleapis.com/auth/ndev.cloudman", } } } impl Default for Scope { fn default() -> Scope { - Scope::NdevCloudmanReadonly + Scope::CloudPlatform } } @@ -66,7 +60,7 @@ impl Default for Scope { // HUB ### // ###### -/// Central instance to access all Deploymentmanager related resource activities +/// Central instance to access all Appengine related resource activities /// /// # Examples /// @@ -75,12 +69,13 @@ impl Default for Scope { /// ```test_harness,no_run /// extern crate hyper; /// extern crate yup_oauth2 as oauth2; -/// extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -/// use deploymentmanager2_beta1::{Result, Error}; +/// extern crate google_appengine1_beta5 as appengine1_beta5; +/// use appengine1_beta5::Service; +/// use appengine1_beta5::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; /// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use deploymentmanager2_beta1::Deploymentmanager; +/// use appengine1_beta5::Appengine; /// /// // Get an ApplicationSecret instance by some means. It contains the `client_id` and /// // `client_secret`, among other things. @@ -93,13 +88,18 @@ impl Default for Scope { /// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// hyper::Client::new(), /// ::default(), None); -/// let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +/// let mut hub = Appengine::new(hyper::Client::new(), 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 ! +/// let mut req = Service::default(); +/// /// // 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 ! -/// let result = hub.operations().list("project") -/// .page_token("et") -/// .max_results(-18) +/// let result = hub.apps().services_patch(req, "appsId", "servicesId") +/// .migrate_traffic(false) +/// .mask("accusam") /// .doit(); /// /// match result { @@ -120,43 +120,31 @@ impl Default for Scope { /// } /// # } /// ``` -pub struct Deploymentmanager { +pub struct Appengine { client: RefCell, auth: RefCell, _user_agent: String, } -impl<'a, C, A> Hub for Deploymentmanager {} +impl<'a, C, A> Hub for Appengine {} -impl<'a, C, A> Deploymentmanager +impl<'a, C, A> Appengine where C: BorrowMut, A: oauth2::GetToken { - pub fn new(client: C, authenticator: A) -> Deploymentmanager { - Deploymentmanager { + pub fn new(client: C, authenticator: A) -> Appengine { + Appengine { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.8".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } - pub fn deployments(&'a self) -> DeploymentMethods<'a, C, A> { - DeploymentMethods { hub: &self } - } - pub fn manifests(&'a self) -> ManifestMethods<'a, C, A> { - ManifestMethods { hub: &self } - } - pub fn operations(&'a self) -> OperationMethods<'a, C, A> { - OperationMethods { hub: &self } - } - pub fn resources(&'a self) -> ResourceMethods<'a, C, A> { - ResourceMethods { hub: &self } - } - pub fn types(&'a self) -> TypeMethods<'a, C, A> { - TypeMethods { hub: &self } + pub fn apps(&'a self) -> AppMethods<'a, C, A> { + AppMethods { hub: &self } } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.8`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -170,363 +158,739 @@ impl<'a, C, A> Deploymentmanager // ############ // SCHEMAS ### // ########## -/// Next available tag: 12 +/// Used to specify extra network settings (for VM runtimes only). /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get resources](struct.ResourceGetCall.html) (response) -/// * [list resources](struct.ResourceListCall.html) (none) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResourceType { - /// ! [Output Only] A list of any errors that occurred during deployment. - pub errors: Option>, - /// ! [Output Only] The name of the resource as it appears in the YAML config. +pub struct Network { + /// A tag to apply to the VM instance during creation. + #[serde(rename="instanceTag")] + pub instance_tag: Option, + /// A list of ports (or port pairs) to forward from the VM into the app container. + #[serde(rename="forwardedPorts")] + pub forwarded_ports: Option>, + /// The Google Compute Engine network where the VMs will be created. If not specified, or empty, the network named "default" will be used. (The short name should be specified, not the resource path.) pub name: Option, - /// ! [Output Only] The URL of the actual resource. - pub url: Option, - /// ! [Output Only] URL of the manifest representing the current configuration ! of this resource. - pub manifest: Option, - /// ! [Output Only] The state of the resource. - pub state: Option, - /// ! [Output Only] The intended state of the resource. - pub intent: Option, - /// ! [Output Only] The type of the resource, for example ! ?compute.v1.instance?, or ?replicaPools.v1beta2.instanceGroupManager? - #[serde(rename="type")] - pub type_: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, } -impl Resource for ResourceType {} -impl ResponseResult for ResourceType {} +impl Part for Network {} -/// ! Metadata for this warning in 'key: value' format. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationWarningsData { - /// ! A key for the warning data. - pub key: Option, - /// ! A warning data value corresponding to the key. - pub value: Option, -} - -impl NestedType for OperationWarningsData {} -impl Part for OperationWarningsData {} - - -/// ! [Output Only] If warning messages generated during processing of this ! operation, this field will be populated. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationWarnings { - /// ! Optional human-readable details for this warning. - pub message: Option, - /// ! The warning type identifier for this warning. - pub code: Option, - /// ! Metadata for this warning in 'key: value' format. - pub data: Option>, -} - -impl NestedType for OperationWarnings {} -impl Part for OperationWarnings {} - - -/// ! A response containing a partial list of resources and a page token used ! to build the next request if the request has been truncated. Next available tag: 4 +/// A service is a logical component of an application that can share state and communicate in a secure fashion with other services. For example, an application that handles customer requests might include separate services to handle other tasks such as API requests from mobile devices or backend data analysis. Each service has a collection of versions that define a specific set of code used to implement the functionality of that service. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list resources](struct.ResourceListCall.html) (response) +/// * [services get apps](struct.AppServiceGetCall.html) (response) +/// * [services patch apps](struct.AppServicePatchCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResourcesListResponse { - /// ! A token used to continue a truncated list request. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// ! Resources contained in this list response. - pub resources: Option>, +pub struct Service { + /// A mapping that defines fractional HTTP traffic diversion to different versions within the service. + pub split: Option, + /// The relative name/path of the service within the application. Example: "default" @OutputOnly + pub id: Option, + /// The full path to the Service resource in the API. Example: "apps/myapp/services/default" @OutputOnly + pub name: Option, } -impl ResponseResult for ResourcesListResponse {} +impl RequestValue for Service {} +impl ResponseResult for Service {} -/// ! The array of errors encountered while processing this operation. +/// An Application contains the top-level configuration of an App Engine application. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get apps](struct.AppGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationErrorErrors { - /// ! An optional, human-readable error message. - pub message: Option, - /// ! The error type identifier for this error. - pub code: Option, - /// ! Indicates the field in the request which caused the error. ! This property is optional. +pub struct Application { + /// The full path to the application in the API. Example: "apps/myapp". @OutputOnly + pub name: Option, + /// A Google Cloud Storage bucket which can be used for storing files associated with an application. This bucket is associated with the application and can be used by the gcloud deployment commands. @OutputOnly + #[serde(rename="codeBucket")] + pub code_bucket: Option, + /// A Google Cloud Storage bucket which can be used by the application to store content. @OutputOnly + #[serde(rename="defaultBucket")] + pub default_bucket: Option, + /// HTTP path dispatch rules for requests to the app that do not explicitly target a service or version. The rules are order-dependent. + #[serde(rename="dispatchRules")] + pub dispatch_rules: Option>, + /// The relative name/path of the application. Example: "myapp". @OutputOnly + pub id: Option, + /// The location from which the application will be run. Choices are "us" for United States and "eu" for European Union. Application instances will run out of data centers in the chosen location and all of the application's End User Content will be stored at rest in the chosen location. The default is "us". pub location: Option, } -impl NestedType for OperationErrorErrors {} -impl Part for OperationErrorErrors {} +impl ResponseResult for Application {} -/// Next available tag: 10 +/// A Version is a specific set of source code and configuration files deployed to a service. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list manifests](struct.ManifestListCall.html) (none) -/// * [get manifests](struct.ManifestGetCall.html) (response) +/// * [services versions create apps](struct.AppServiceVersionCreateCall.html) (request) +/// * [services versions get apps](struct.AppServiceVersionGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Manifest { - /// ! [Output Only] The fully-expanded configuration file, including any ! templates and references. - #[serde(rename="evaluatedConfig")] - pub evaluated_config: Option, - /// v2beta1: YAML with config - described above v2beta2: YAML + templates. ! The YAML configuration for this manifest. - pub config: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. +pub struct Version { + /// A service with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. + #[serde(rename="basicScaling")] + pub basic_scaling: Option, + /// Beta settings supplied to the application via metadata. + #[serde(rename="betaSettings")] + pub beta_settings: Option>, + /// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. + #[serde(rename="manualScaling")] + pub manual_scaling: Option, + /// Creation time of this version. This will be between the start and end times of the operation that creates this version. @OutputOnly + #[serde(rename="creationTime")] + pub creation_time: Option, + /// Whether to deploy this app in a VM container. + pub vm: Option, + /// Before an application can receive email or XMPP messages, the application must be configured to enable the service. + #[serde(rename="inboundServices")] + pub inbound_services: Option>, + /// The instance class to use to run this app. Valid values for AutomaticScaling are `[F1, F2, F4, F4_1G]`. Valid values for ManualScaling and BasicScaling are `[B1, B2, B4, B8, B4_1G]`. Default: "F1" for AutomaticScaling, "B1" for ManualScaling and BasicScaling + #[serde(rename="instanceClass")] + pub instance_class: Option, + /// Code and application artifacts that make up this version. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + pub deployment: Option, + /// Custom static error pages instead of these generic error pages, (limit 10 KB/page) Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + #[serde(rename="errorHandlers")] + pub error_handlers: Option>, + /// The current serving status of this version. Only `SERVING` versions will have instances created or billed for. If this field is unset when a version is created, `SERVING` status will be assumed. It is an error to explicitly set this field to `SERVING_STATUS_UNSPECIFIED`. + #[serde(rename="servingStatus")] + pub serving_status: Option, + /// The relative name/path of the Version within the service. Example: "v1". Version specifiers can contain lowercase letters, digits, and hyphens. It cannot begin with the prefix `ah-` and the names `default` and `latest` are reserved and cannot be used. pub id: Option, - /// [Output Only] Self link for the manifest. - #[serde(rename="selfLink")] - pub self_link: Option, - /// ! [Output Only] The name of the manifest. + /// If true, multiple requests can be dispatched to the app at once. + pub threadsafe: Option, + /// Serving configuration for Google Cloud Endpoints. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + #[serde(rename="apiConfig")] + pub api_config: Option, + /// Go only. Files that match this pattern will not be built into the app. May only be set on create requests. + #[serde(rename="nobuildFilesRegex")] + pub nobuild_files_regex: Option, + /// Used to specify extra network settings (for VM runtimes only). + pub network: Option, + /// An ordered list of URL Matching patterns that should be applied to incoming requests. The first matching URL consumes the request, and subsequent handlers are not attempted. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + pub handlers: Option>, + /// Configure health checking for the VM instances. Unhealthy VM instances will be stopped and replaced with new instances. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + #[serde(rename="healthCheck")] + pub health_check: Option, + /// The length of time a static file served by a static file handler ought to be cached by web proxies and browsers, if the handler does not specify its own expiration. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + #[serde(rename="defaultExpiration")] + pub default_expiration: Option, + /// The full path to the Version resource in the API. Example: "apps/myapp/services/default/versions/v1". @OutputOnly pub name: Option, + /// Configuration for Python runtime third-party libraries required by the application. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + pub libraries: Option>, + /// The email address of the user who created this version. @OutputOnly + pub deployer: Option, + /// The App Engine execution environment to use for this version. Default: "1" + pub env: Option, + /// Total size of version files hosted on App Engine disk in bytes. @OutputOnly + #[serde(rename="diskUsageBytes")] + pub disk_usage_bytes: Option, + /// Automatic scaling is the scaling policy that App Engine has used since its inception. It is based on request rate, response latencies, and other application metrics. + #[serde(rename="automaticScaling")] + pub automatic_scaling: Option, + /// The desired runtime. Values can include python27, java7, go, etc. + pub runtime: Option, + /// Environment variables made available to the application. Only returned in `GET` requests if `view=FULL` is set. May only be set on create requests; once created, is immutable. + #[serde(rename="envVariables")] + pub env_variables: Option>, + /// Used to specify how many machine resources an app version needs (for VM runtimes only). + pub resources: Option, } -impl Resource for Manifest {} -impl ResponseResult for Manifest {} +impl RequestValue for Version {} +impl ResponseResult for Version {} -/// ! [Output Only] If errors occurred during processing of this operation, ! this field will be populated. +/// Target scaling by CPU usage. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationError { - /// ! The array of errors encountered while processing this operation. - pub errors: Option>, +pub struct CpuUtilization { + /// Target (0-1) CPU utilization ratio to maintain when scaling. + #[serde(rename="targetUtilization")] + pub target_utilization: Option, + /// The period of time over which CPU utilization is calculated. + #[serde(rename="aggregationWindowLength")] + pub aggregation_window_length: Option, } -impl NestedType for OperationError {} -impl Part for OperationError {} +impl Part for CpuUtilization {} -/// ! A response that returns all Types supported by Deployment Manager Next available tag: 3 +/// Used to specify how many machine resources an app version needs. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Resources { + /// How much disk size, in GB, an app version needs. + #[serde(rename="diskGb")] + pub disk_gb: Option, + /// How many CPU cores an app version needs. + pub cpu: Option, + /// How much memory, in GB, an app version needs. + #[serde(rename="memoryGb")] + pub memory_gb: Option, +} + +impl Part for Resources {} + + +/// 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). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Status { + /// 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. + pub message: Option, + /// The status code, which should be an enum value of google.rpc.Code. + pub code: Option, + /// A list of messages that carry the error details. There will be a common set of message types for APIs to use. + pub details: Option>>, +} + +impl Part for Status {} + + +/// A service with basic scaling will create an instance when the application receives a request. The instance will be turned down when the app becomes idle. Basic scaling is ideal for work that is intermittent or driven by user activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BasicScaling { + /// The instance will be shut down this amount of time after receiving its last request. + #[serde(rename="idleTimeout")] + pub idle_timeout: Option, + /// The maximum number of instances for App Engine to create for this version. + #[serde(rename="maxInstances")] + pub max_instances: Option, +} + +impl Part for BasicScaling {} + + +/// Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StaticFilesHandler { + /// If specified, all files served by this handler will be served using the specified MIME type. If not specified, the MIME type for a file will be derived from the file's filename extension. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// The length of time a static file served by this handler ought to be cached by web proxies and browsers. + pub expiration: Option, + /// The path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern. + pub path: Option, + /// A regular expression that matches the file paths for all files that will be referenced by this handler. + #[serde(rename="uploadPathRegex")] + pub upload_path_regex: Option, + /// If true, this UrlMap entry does not match the request unless the file referenced by the handler also exists. If no such file exists, processing will continue with the next UrlMap that matches the requested URL. + #[serde(rename="requireMatchingFile")] + pub require_matching_file: Option, + /// HTTP headers to use for all responses from these URLs. + #[serde(rename="httpHeaders")] + pub http_headers: Option>, + /// By default, files declared in static file handlers are uploaded as static data and are only served to end users, they cannot be read by an application. If this field is set to true, the files are also uploaded as code data so your application can read them. Both uploads are charged against your code and static data storage resource quotas. + #[serde(rename="applicationReadable")] + pub application_readable: Option, +} + +impl Part for StaticFilesHandler {} + + +/// Target scaling by network usage (for VM runtimes only). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NetworkUtilization { + /// Target bytes per second received. + #[serde(rename="targetReceivedBytesPerSec")] + pub target_received_bytes_per_sec: Option, + /// Target bytes per second sent. + #[serde(rename="targetSentBytesPerSec")] + pub target_sent_bytes_per_sec: Option, + /// Target packets per second sent. + #[serde(rename="targetSentPacketsPerSec")] + pub target_sent_packets_per_sec: Option, + /// Target packets per second received. + #[serde(rename="targetReceivedPacketsPerSec")] + pub target_received_packets_per_sec: Option, +} + +impl Part for NetworkUtilization {} + + +/// Response message for `Versions.ListVersions`. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list types](struct.TypeListCall.html) (response) +/// * [services versions list apps](struct.AppServiceVersionListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TypesListResponse { - /// ! Types supported by Deployment Manager - pub types: Option>, -} - -impl ResponseResult for TypesListResponse {} - - -/// ! A response containing a partial list of deployments and a page token used ! to build the next request if the request has been truncated. Next available tag: 4 -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list deployments](struct.DeploymentListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeploymentsListResponse { - /// ! A token used to continue a truncated list request. +pub struct ListVersionsResponse { + /// Continuation token for fetching the next page of results. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// ! The deployments contained in this response. - pub deployments: Option>, + /// The versions belonging to the requested application service. + pub versions: Option>, } -impl ResponseResult for DeploymentsListResponse {} +impl ResponseResult for ListVersionsResponse {} -/// Next available tag: 8 +/// Code and application artifacts used to deploy a version to App Engine. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [insert deployments](struct.DeploymentInsertCall.html) (request) -/// * [get deployments](struct.DeploymentGetCall.html) (response) -/// * [list deployments](struct.DeploymentListCall.html) (none) -/// * [delete deployments](struct.DeploymentDeleteCall.html) (none) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Deployment { - /// [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// ! An optional user-provided description of the deployment. - pub description: Option, - /// ! [Input Only] The YAML configuration to use in processing this deployment. ! ! When you create a deployment, the server creates a new manifest with the ! given YAML configuration and sets the `manifest` property to the URL of ! the manifest resource. - #[serde(rename="targetConfig")] - pub target_config: Option, - /// ! The name of the deployment, which must be unique within the project. - pub name: Option, - /// ! [Output Only] URL of the manifest representing the full configuration ! of this deployment. - pub manifest: Option, + /// A manifest of files stored in Google Cloud Storage which should be included as part of this application. All files must be readable using the credentials supplied with this call. + pub files: Option>, + /// The origin of the source code for this deployment. There can be more than one source reference per Version if source code is distributed among multiple repositories. + #[serde(rename="sourceReferences")] + pub source_references: Option>, + /// If supplied, a docker (container) image which should be used to start the application. Only applicable to the 'vm' runtime. + pub container: Option, } -impl RequestValue for Deployment {} -impl Resource for Deployment {} -impl ResponseResult for Deployment {} +impl Part for Deployment {} -/// ! A response containing a partial list of operations and a page token used ! to build the next request if the request has been truncated. Next available tag: 4 +/// Executes a script to handle the request that matches the URL pattern. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list operations](struct.OperationListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OperationsListResponse { - /// ! A token used to continue a truncated list request. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// ! Operations contained in this list response. - pub operations: Option>, +pub struct ScriptHandler { + /// Specifies the path to the script from the application root directory. + #[serde(rename="scriptPath")] + pub script_path: Option, } -impl ResponseResult for OperationsListResponse {} +impl Part for ScriptHandler {} -/// ! An operation resource, used to manage asynchronous API requests. Next available tag: 24 +/// Rules to match an HTTP request and dispatch that request to a service. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UrlDispatchRule { + /// The pathname within the host. This must start with a '/'. A single '*' (glob) can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters. + pub path: Option, + /// The domain name to match on. Supports '*' (glob) wildcarding on the left-hand side of a '.'. If empty, all domains will be matched (the same as '*'). + pub domain: Option, + /// The resource id of a Service in this application that should service the matched request. The Service must already exist. Example: "default". + pub service: Option, +} + +impl Part for UrlDispatchRule {} + + +/// Use Google Cloud Endpoints to handle requests. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ApiEndpointHandler { + /// Specifies the path to the script from the application root directory. + #[serde(rename="scriptPath")] + pub script_path: Option, +} + +impl Part for ApiEndpointHandler {} + + +/// Configure health checking for the VM instances. Unhealthy VM instances will be killed and replaced with new instances. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HealthCheck { + /// The number of consecutive successful health checks before receiving traffic. + #[serde(rename="healthyThreshold")] + pub healthy_threshold: Option, + /// The number of consecutive failed health checks before an instance is restarted. + #[serde(rename="restartThreshold")] + pub restart_threshold: Option, + /// The amount of time before the health check is considered failed. + pub timeout: Option, + /// The interval between health checks. + #[serde(rename="checkInterval")] + pub check_interval: Option, + /// Whether to explicitly disable health checks for this instance. + #[serde(rename="disableHealthCheck")] + pub disable_health_check: Option, + /// The host header to send when performing an HTTP health check (e.g. myapp.appspot.com) + pub host: Option, + /// The number of consecutive failed health checks before removing traffic. + #[serde(rename="unhealthyThreshold")] + pub unhealthy_threshold: Option, +} + +impl Part for HealthCheck {} + + +/// A custom static error page to be served when an error occurs. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ErrorHandler { + /// The error condition this handler applies to. + #[serde(rename="errorCode")] + pub error_code: Option, + /// MIME type of file. If unspecified, "text/html" is assumed. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// Static file content to be served for this error. + #[serde(rename="staticFile")] + pub static_file: Option, +} + +impl Part for ErrorHandler {} + + +/// Automatic scaling is the scaling policy that App Engine has used since its inception. It is based on request rate, response latencies, and other application metrics. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AutomaticScaling { + /// Target scaling by CPU usage. + #[serde(rename="cpuUtilization")] + pub cpu_utilization: Option, + /// Target scaling by network usage. + #[serde(rename="networkUtilization")] + pub network_utilization: Option, + /// The minimum number of idle instances that App Engine should maintain for this version. Only applies to the default version of a service, since other versions are not expected to receive significant traffic. + #[serde(rename="minIdleInstances")] + pub min_idle_instances: Option, + /// The maximum amount of time that App Engine should allow a request to wait in the pending queue before starting a new instance to handle it. + #[serde(rename="maxPendingLatency")] + pub max_pending_latency: Option, + /// The maximum number of idle instances that App Engine should maintain for this version. + #[serde(rename="maxIdleInstances")] + pub max_idle_instances: Option, + /// Target scaling by disk usage. + #[serde(rename="diskUtilization")] + pub disk_utilization: Option, + /// Target scaling by request utilization. + #[serde(rename="requestUtilization")] + pub request_utilization: Option, + /// The amount of time that the [Autoscaler](https://cloud.google.com/compute/docs/autoscaler/) should wait between changes to the number of virtual machines. Applies only to the VM runtime. + #[serde(rename="coolDownPeriod")] + pub cool_down_period: Option, + /// Max number of instances that App Engine should start to handle requests. + #[serde(rename="maxTotalInstances")] + pub max_total_instances: Option, + /// The number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance. Default value is chosen based on the runtime. + #[serde(rename="maxConcurrentRequests")] + pub max_concurrent_requests: Option, + /// Minimum number of instances that App Engine should maintain. + #[serde(rename="minTotalInstances")] + pub min_total_instances: Option, + /// The minimum amount of time that App Engine should allow a request to wait in the pending queue before starting a new instance to handle it. + #[serde(rename="minPendingLatency")] + pub min_pending_latency: Option, +} + +impl Part for AutomaticScaling {} + + +/// A URL pattern and description of how it should be handled. App Engine can handle URLs by executing application code, or by serving static files uploaded with the code, such as images, CSS or JavaScript. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UrlMap { + /// Configures whether security (HTTPS) should be enforced for this URL. + #[serde(rename="securityLevel")] + pub security_level: Option, + /// For users not logged in, how to handle access to resources with required login. Defaults to "redirect". + #[serde(rename="authFailAction")] + pub auth_fail_action: Option, + /// A URL prefix. This value uses regular expression syntax (and so regexp special characters must be escaped), but it should not contain groupings. All URLs that begin with this prefix are handled by this handler, using the portion of the URL after the prefix as part of the file path. This is always required. + #[serde(rename="urlRegex")] + pub url_regex: Option, + /// Executes a script to handle the request that matches the URL pattern. + pub script: Option, + /// Returns the contents of a file, such as an image, as the response. + #[serde(rename="staticFiles")] + pub static_files: Option, + /// Use API Endpoints to handle requests. + #[serde(rename="apiEndpoint")] + pub api_endpoint: Option, + /// What level of login is required to access this resource. + pub login: Option, + /// `30x` code to use when performing redirects for the `secure` field. A `302` is used by default. + #[serde(rename="redirectHttpResponseCode")] + pub redirect_http_response_code: Option, +} + +impl Part for UrlMap {} + + +/// A single source file which is part of the application to be deployed. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileInfo { + /// The MIME type of the file; if unspecified, the value from Google Cloud Storage will be used. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// The URL source to use to fetch this file. Must be a URL to a resource in Google Cloud Storage in the form 'http(s)://storage.googleapis.com/\/\'. + #[serde(rename="sourceUrl")] + pub source_url: Option, + /// The SHA1 (160 bits) hash of the file in hex. + #[serde(rename="sha1Sum")] + pub sha1_sum: Option, +} + +impl Part for FileInfo {} + + +/// The response message for Operations.ListOperations. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list operations](struct.OperationListCall.html) (none) -/// * [delete deployments](struct.DeploymentDeleteCall.html) (response) -/// * [get operations](struct.OperationGetCall.html) (response) -/// * [insert deployments](struct.DeploymentInsertCall.html) (response) +/// * [operations list apps](struct.AppOperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListOperationsResponse { + /// A list of operations that matches the specified filter in the request. + pub operations: Option>, + /// The standard List next-page token. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} + +impl ResponseResult for ListOperationsResponse {} + + +/// A service with manual scaling runs continuously, allowing you to perform complex initialization and rely on the state of its memory over time. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManualScaling { + /// The number of instances to assign to the service at the start. This number can later be altered by using the [Modules API](https://cloud.google.com/appengine/docs/python/modules/functions) `set_num_instances()` function. + pub instances: Option, +} + +impl Part for ManualScaling {} + + +/// A Docker (container) image which should be used to start the application. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ContainerInfo { + /// Reference to a hosted container image. Must be a URI to a resource in a Docker repository. Must be fully qualified, including tag or digest. e.g. gcr.io/my-project/image:tag or gcr.io/my-project/image@digest + pub image: Option, +} + +impl Part for ContainerInfo {} + + +/// API Serving configuration for Cloud Endpoints. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ApiConfigHandler { + /// URL to serve the endpoint at. + pub url: Option, + /// Configures whether security (HTTPS) should be enforced for this URL. + #[serde(rename="securityLevel")] + pub security_level: Option, + /// For users not logged in, how to handle access to resources with required login. Defaults to "redirect". + #[serde(rename="authFailAction")] + pub auth_fail_action: Option, + /// What level of login is required to access this resource. Default is "optional". + pub login: Option, + /// Specifies the path to the script from the application root directory. + pub script: Option, +} + +impl Part for ApiConfigHandler {} + + +/// A Python runtime third-party library required by the application. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Library { + /// The version of the library to select, or "latest". + pub version: Option, + /// The name of the library, e.g. "PIL" or "django". + pub name: Option, +} + +impl Part for Library {} + + +/// A reference to a particular snapshot of the source tree used to build and deploy the application. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SourceReference { + /// The canonical (and persistent) identifier of the deployed revision, i.e. any kind of aliases including tags or branch names are not allowed. Example (git): "2198322f89e0bb2e25021667c2ed489d1fd34e6b" + #[serde(rename="revisionId")] + pub revision_id: Option, + /// Optional. A URI string identifying the repository. Example: "https://source.developers.google.com/p/app-123/r/default" + pub repository: Option, +} + +impl Part for SourceReference {} + + +/// Target scaling by disk usage (for VM runtimes only). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DiskUtilization { + /// Target ops per second written. + #[serde(rename="targetWriteOpsPerSec")] + pub target_write_ops_per_sec: Option, + /// Target bytes per second read. + #[serde(rename="targetReadBytesPerSec")] + pub target_read_bytes_per_sec: Option, + /// Target ops per second read. + #[serde(rename="targetReadOpsPerSec")] + pub target_read_ops_per_sec: Option, + /// Target bytes per second written. + #[serde(rename="targetWriteBytesPerSec")] + pub target_write_bytes_per_sec: Option, +} + +impl Part for DiskUtilization {} + + +/// Target scaling by request utilization (for VM runtimes only). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RequestUtilization { + /// Target number of concurrent requests. + #[serde(rename="targetConcurrentRequests")] + pub target_concurrent_requests: Option, + /// Target requests per second. + #[serde(rename="targetRequestCountPerSec")] + pub target_request_count_per_sec: Option, +} + +impl Part for RequestUtilization {} + + +/// Response message for `Services.ListServices`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [services list apps](struct.AppServiceListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListServicesResponse { + /// The services belonging to the requested application. + pub services: Option>, + /// Continuation token for fetching the next page of results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} + +impl ResponseResult for ListServicesResponse {} + + +/// Configuration for traffic splitting for versions within a single service. Traffic splitting allows traffic directed to the service to be assigned to one of several versions in a fractional way, enabling experiments and canarying new builds, for example. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TrafficSplit { + /// Which mechanism should be used as a selector when choosing a version to send a request to. The traffic selection algorithm will be stable for either type until allocations are changed. + #[serde(rename="shardBy")] + pub shard_by: Option, + /// Mapping from service version IDs within the service to fractional (0.000, 1] allocations of traffic for that version. Each version may only be specified once, but some versions in the service may not have any traffic allocation. Services that have traffic allocated in this field may not be deleted until the service is deleted, or their traffic allocation is removed. Allocations must sum to 1. Supports precision up to two decimal places for IP-based splits and up to three decimal places for cookie-based splits. + pub allocations: Option>, +} + +impl Part for TrafficSplit {} + + +/// This resource represents a long-running operation that is the result of a network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [services versions delete apps](struct.AppServiceVersionDeleteCall.html) (response) +/// * [operations get apps](struct.AppOperationGetCall.html) (response) +/// * [services delete apps](struct.AppServiceDeleteCall.html) (response) +/// * [services versions create apps](struct.AppServiceVersionCreateCall.html) (response) +/// * [services patch apps](struct.AppServicePatchCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Operation { - /// ! [Output Only] Status of the operation. Can be one of the following: ! "PENDING", "RUNNING", or "DONE". - pub status: Option, - /// ! [Output Only] The time that this operation was requested. ! This is in RFC 3339 format. - #[serde(rename="insertTime")] - pub insert_time: Option, - /// ! [Output Only] If warning messages generated during processing of this ! operation, this field will be populated. - pub warnings: Option>, - /// ! [Output Only] If operation fails, the HTTP error message returned, ! e.g. NOT FOUND. - #[serde(rename="httpErrorMessage")] - pub http_error_message: Option, - /// ! [Output Only] Unique target id which identifies a particular ! incarnation of the target. - #[serde(rename="targetId")] - pub target_id: Option, - /// ! [Output Only] URL of the resource the operation is mutating. - #[serde(rename="targetLink")] - pub target_link: Option, - /// ! [Output Only] The time that this operation was started by the server. ! This is in RFC 3339 format. - #[serde(rename="startTime")] - pub start_time: Option, - /// ! [Output Only] Creation timestamp in RFC3339 text format. - #[serde(rename="creationTimestamp")] - pub creation_timestamp: Option, - /// ! [Output Only] Unique identifier for the resource; defined by the server. - pub id: Option, - /// ! [Output Only] Name of the operation. + /// 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. + pub metadata: Option>, + /// 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. + pub done: Option, + /// The normal response of the operation in case of success. 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`. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping above, the `name` should have the format of `operations/some/unique/name`. pub name: Option, - /// [Output Only] Self link for the manifest. - #[serde(rename="selfLink")] - pub self_link: Option, - /// ! [Output Only] Type of the operation. Examples include "insert", or ! "delete" - #[serde(rename="operationType")] - pub operation_type: Option, - /// ! [Output Only] If errors occurred during processing of this operation, ! this field will be populated. - pub error: Option, - /// ! [Output Only] An optional progress indicator that ranges from 0 to 100. ! There is no requirement that this be linear or support any granularity ! of operations. This should not be used to guess at when the operation will ! be complete. This number should be monotonically increasing as the ! operation progresses. - pub progress: Option, - /// ! [Output Only] The time that this operation was completed. This is in ! RFC3339 format. - #[serde(rename="endTime")] - pub end_time: Option, - /// ! [Output Only] If operation fails, the HTTP error status code returned, ! e.g. 404. - #[serde(rename="httpErrorStatusCode")] - pub http_error_status_code: Option, - /// ! [Output Only] An optional textual description of the current status of ! the operation. - #[serde(rename="statusMessage")] - pub status_message: Option, - /// ! [Output Only] User who requested the operation, for example ! "user@example.com" - pub user: Option, + /// The error result of the operation in case of failure. + pub error: Option, } -impl Resource for Operation {} impl ResponseResult for Operation {} -/// ! A type supported by Deployment Manager. Next available tag: 4 -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list types](struct.TypeListCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Type { - /// ! Name of the type. - pub name: Option, -} - -impl Resource for Type {} - - -/// ! A response containing a partial list of manifests and a page token used ! to build the next request if the request has been truncated. Next available tag: 4 -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list manifests](struct.ManifestListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ManifestsListResponse { - /// ! A token used to continue a truncated list request. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// ! Manifests contained in this list response. - pub manifests: Option>, -} - -impl ResponseResult for ManifestsListResponse {} - - // ################### // MethodBuilders ### // ################# -/// A builder providing access to all methods supported on *operation* resources. -/// It is not used directly, but through the `Deploymentmanager` hub. +/// A builder providing access to all methods supported on *app* resources. +/// It is not used directly, but through the `Appengine` hub. /// /// # Example /// @@ -535,126 +899,68 @@ impl ResponseResult for ManifestsListResponse {} /// ```test_harness,no_run /// extern crate hyper; /// extern crate yup_oauth2 as oauth2; -/// extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; +/// extern crate google_appengine1_beta5 as appengine1_beta5; /// /// # #[test] fn egal() { /// use std::default::Default; /// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use deploymentmanager2_beta1::Deploymentmanager; +/// use appengine1_beta5::Appengine; /// /// let secret: ApplicationSecret = Default::default(); /// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// hyper::Client::new(), /// ::default(), None); -/// let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +/// let mut hub = Appengine::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)` and `list(...)` +/// // like `get(...)`, `operations_get(...)`, `operations_list(...)`, `services_delete(...)`, `services_get(...)`, `services_list(...)`, `services_patch(...)`, `services_versions_create(...)`, `services_versions_delete(...)`, `services_versions_get(...)` and `services_versions_list(...)` /// // to build up your call. -/// let rb = hub.operations(); +/// let rb = hub.apps(); /// # } /// ``` -pub struct OperationMethods<'a, C, A> +pub struct AppMethods<'a, C, A> where C: 'a, A: 'a { - hub: &'a Deploymentmanager, + hub: &'a Appengine, } -impl<'a, C, A> MethodsBuilder for OperationMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for AppMethods<'a, C, A> {} -impl<'a, C, A> OperationMethods<'a, C, A> { +impl<'a, C, A> AppMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// ! Gets information about a specific Operation. + /// Lists all the services in the application. /// /// # Arguments /// - /// * `project` - ! The project ID for this request. - /// * `operation` - ! The name of the operation for this request. - pub fn get(&self, project: &str, operation: &str) -> OperationGetCall<'a, C, A> { - OperationGetCall { + /// * `appsId` - Part of `name`. Name of the resource requested. For example: "apps/myapp". + pub fn services_list(&self, apps_id: &str) -> AppServiceListCall<'a, C, A> { + AppServiceListCall { hub: self.hub, - _project: project.to_string(), - _operation: operation.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// ! Lists all Operations for a project. - /// - /// # Arguments - /// - /// * `project` - ! The project ID for this request. - pub fn list(&self, project: &str) -> OperationListCall<'a, C, A> { - OperationListCall { - hub: self.hub, - _project: project.to_string(), + _apps_id: apps_id.to_string(), _page_token: Default::default(), - _max_results: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } -} - - - -/// A builder providing access to all methods supported on *deployment* resources. -/// It is not used directly, but through the `Deploymentmanager` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use deploymentmanager2_beta1::Deploymentmanager; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `get(...)`, `insert(...)` and `list(...)` -/// // to build up your call. -/// let rb = hub.deployments(); -/// # } -/// ``` -pub struct DeploymentMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Deploymentmanager, -} - -impl<'a, C, A> MethodsBuilder for DeploymentMethods<'a, C, A> {} - -impl<'a, C, A> DeploymentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// ! Creates a deployment and all of the resources described by the ! deployment manifest. + /// Deploys new code and resource files to a version. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - ! The project ID for this request. - pub fn insert(&self, request: Deployment, project: &str) -> DeploymentInsertCall<'a, C, A> { - DeploymentInsertCall { + /// * `appsId` - Part of `name`. Name of the resource to update. For example: "apps/myapp/services/default". + /// * `servicesId` - Part of `name`. See documentation of `appsId`. + pub fn services_versions_create(&self, request: Version, apps_id: &str, services_id: &str) -> AppServiceVersionCreateCall<'a, C, A> { + AppServiceVersionCreateCall { hub: self.hub, _request: request, - _project: project.to_string(), + _apps_id: apps_id.to_string(), + _services_id: services_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -663,17 +969,17 @@ impl<'a, C, A> DeploymentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// ! Gets information about a specific deployment. + /// Gets the current configuration of the service. /// /// # Arguments /// - /// * `project` - ! The project ID for this request. - /// * `deployment` - ! The name of the deployment for this request. - pub fn get(&self, project: &str, deployment: &str) -> DeploymentGetCall<'a, C, A> { - DeploymentGetCall { + /// * `appsId` - Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default". + /// * `servicesId` - Part of `name`. See documentation of `appsId`. + pub fn services_get(&self, apps_id: &str, services_id: &str) -> AppServiceGetCall<'a, C, A> { + AppServiceGetCall { hub: self.hub, - _project: project.to_string(), - _deployment: deployment.to_string(), + _apps_id: apps_id.to_string(), + _services_id: services_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -682,17 +988,20 @@ impl<'a, C, A> DeploymentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// ! Lists all deployments for a given project. + /// Lists the versions of a service. /// /// # Arguments /// - /// * `project` - ! The project ID for this request. - pub fn list(&self, project: &str) -> DeploymentListCall<'a, C, A> { - DeploymentListCall { + /// * `appsId` - Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default". + /// * `servicesId` - Part of `name`. See documentation of `appsId`. + pub fn services_versions_list(&self, apps_id: &str, services_id: &str) -> AppServiceVersionListCall<'a, C, A> { + AppServiceVersionListCall { hub: self.hub, - _project: project.to_string(), + _apps_id: apps_id.to_string(), + _services_id: services_id.to_string(), + _view: Default::default(), _page_token: Default::default(), - _max_results: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -701,139 +1010,37 @@ impl<'a, C, A> DeploymentMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// ! Deletes a deployment and all of the resources in the deployment. + /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. /// /// # Arguments /// - /// * `project` - ! The project ID for this request. - /// * `deployment` - ! The name of the deployment for this request. - pub fn delete(&self, project: &str, deployment: &str) -> DeploymentDeleteCall<'a, C, A> { - DeploymentDeleteCall { + /// * `appsId` - Part of `name`. The name of the operation resource. + /// * `operationsId` - Part of `name`. See documentation of `appsId`. + pub fn operations_get(&self, apps_id: &str, operations_id: &str) -> AppOperationGetCall<'a, C, A> { + AppOperationGetCall { hub: self.hub, - _project: project.to_string(), - _deployment: deployment.to_string(), + _apps_id: apps_id.to_string(), + _operations_id: operations_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } -} - - - -/// A builder providing access to all methods supported on *type* resources. -/// It is not used directly, but through the `Deploymentmanager` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use deploymentmanager2_beta1::Deploymentmanager; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `list(...)` -/// // to build up your call. -/// let rb = hub.types(); -/// # } -/// ``` -pub struct TypeMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Deploymentmanager, -} - -impl<'a, C, A> MethodsBuilder for TypeMethods<'a, C, A> {} - -impl<'a, C, A> TypeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// ! Lists all Types for Deployment Manager. + /// 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 below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. /// /// # Arguments /// - /// * `project` - ! The project ID for this request. - pub fn list(&self, project: &str) -> TypeListCall<'a, C, A> { - TypeListCall { + /// * `appsId` - Part of `name`. The name of the operation collection. + pub fn operations_list(&self, apps_id: &str) -> AppOperationListCall<'a, C, A> { + AppOperationListCall { hub: self.hub, - _project: project.to_string(), + _apps_id: apps_id.to_string(), _page_token: Default::default(), - _max_results: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *resource* resources. -/// It is not used directly, but through the `Deploymentmanager` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use deploymentmanager2_beta1::Deploymentmanager; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)` and `list(...)` -/// // to build up your call. -/// let rb = hub.resources(); -/// # } -/// ``` -pub struct ResourceMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Deploymentmanager, -} - -impl<'a, C, A> MethodsBuilder for ResourceMethods<'a, C, A> {} - -impl<'a, C, A> ResourceMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// ! Gets information about a single resource. - /// - /// # Arguments - /// - /// * `project` - ! The project ID for this request. - /// * `deployment` - ! The name of the deployment for this request. - /// * `resource` - ! The name of the resource for this request. - pub fn get(&self, project: &str, deployment: &str, resource: &str) -> ResourceGetCall<'a, C, A> { - ResourceGetCall { - hub: self.hub, - _project: project.to_string(), - _deployment: deployment.to_string(), - _resource: resource.to_string(), + _page_size: Default::default(), + _filter: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -842,81 +1049,19 @@ impl<'a, C, A> ResourceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// ! Lists all resources in a given deployment. + /// Deletes an existing version. /// /// # Arguments /// - /// * `project` - ! The project ID for this request. - /// * `deployment` - ! The name of the deployment for this request. - pub fn list(&self, project: &str, deployment: &str) -> ResourceListCall<'a, C, A> { - ResourceListCall { + /// * `appsId` - Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default/versions/v1". + /// * `servicesId` - Part of `name`. See documentation of `appsId`. + /// * `versionsId` - Part of `name`. See documentation of `appsId`. + pub fn services_versions_delete(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionDeleteCall<'a, C, A> { + AppServiceVersionDeleteCall { hub: self.hub, - _project: project.to_string(), - _deployment: deployment.to_string(), - _page_token: Default::default(), - _max_results: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *manifest* resources. -/// It is not used directly, but through the `Deploymentmanager` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use deploymentmanager2_beta1::Deploymentmanager; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)` and `list(...)` -/// // to build up your call. -/// let rb = hub.manifests(); -/// # } -/// ``` -pub struct ManifestMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Deploymentmanager, -} - -impl<'a, C, A> MethodsBuilder for ManifestMethods<'a, C, A> {} - -impl<'a, C, A> ManifestMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// ! Lists all manifests for a given deployment. - /// - /// # Arguments - /// - /// * `project` - ! The project ID for this request. - /// * `deployment` - ! The name of the deployment for this request. - pub fn list(&self, project: &str, deployment: &str) -> ManifestListCall<'a, C, A> { - ManifestListCall { - hub: self.hub, - _project: project.to_string(), - _deployment: deployment.to_string(), - _page_token: Default::default(), - _max_results: Default::default(), + _apps_id: apps_id.to_string(), + _services_id: services_id.to_string(), + _versions_id: versions_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -925,19 +1070,80 @@ impl<'a, C, A> ManifestMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// ! Gets information about a specific manifest. + /// Updates the configuration of the specified service. /// /// # Arguments /// - /// * `project` - ! The project ID for this request. - /// * `deployment` - ! The name of the deployment for this request. - /// * `manifest` - ! The name of the manifest for this request. - pub fn get(&self, project: &str, deployment: &str, manifest: &str) -> ManifestGetCall<'a, C, A> { - ManifestGetCall { + /// * `request` - No description provided. + /// * `appsId` - Part of `name`. Name of the resource to update. For example: "apps/myapp/services/default". + /// * `servicesId` - Part of `name`. See documentation of `appsId`. + pub fn services_patch(&self, request: Service, apps_id: &str, services_id: &str) -> AppServicePatchCall<'a, C, A> { + AppServicePatchCall { hub: self.hub, - _project: project.to_string(), - _deployment: deployment.to_string(), - _manifest: manifest.to_string(), + _request: request, + _apps_id: apps_id.to_string(), + _services_id: services_id.to_string(), + _migrate_traffic: Default::default(), + _mask: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets information about an application. + /// + /// # Arguments + /// + /// * `appsId` - Part of `name`. Name of the application to get. For example: "apps/myapp". + pub fn get(&self, apps_id: &str) -> AppGetCall<'a, C, A> { + AppGetCall { + hub: self.hub, + _apps_id: apps_id.to_string(), + _ensure_resources_exist: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a service and all enclosed versions. + /// + /// # Arguments + /// + /// * `appsId` - Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default". + /// * `servicesId` - Part of `name`. See documentation of `appsId`. + pub fn services_delete(&self, apps_id: &str, services_id: &str) -> AppServiceDeleteCall<'a, C, A> { + AppServiceDeleteCall { + hub: self.hub, + _apps_id: apps_id.to_string(), + _services_id: services_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets application deployment information. + /// + /// # Arguments + /// + /// * `appsId` - Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default/versions/v1". + /// * `servicesId` - Part of `name`. See documentation of `appsId`. + /// * `versionsId` - Part of `name`. See documentation of `appsId`. + pub fn services_versions_get(&self, apps_id: &str, services_id: &str, versions_id: &str) -> AppServiceVersionGetCall<'a, C, A> { + AppServiceVersionGetCall { + hub: self.hub, + _apps_id: apps_id.to_string(), + _services_id: services_id.to_string(), + _versions_id: versions_id.to_string(), + _view: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -953,10 +1159,10 @@ impl<'a, C, A> ManifestMethods<'a, C, A> { // CallBuilders ### // ################# -/// ! Gets information about a specific Operation. +/// Lists all the services in the application. /// -/// A builder for the *get* method supported by a *operation* resource. -/// It is not used directly, but through a `OperationMethods` instance. +/// A builder for the *services.list* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. /// /// # Example /// @@ -965,42 +1171,45 @@ impl<'a, C, A> ManifestMethods<'a, C, A> { /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; +/// # use appengine1_beta5::Appengine; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::new(), /// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! -/// let result = hub.operations().get("project", "operation") +/// let result = hub.apps().services_list("appsId") +/// .page_token("justo") +/// .page_size(-1) /// .doit(); /// # } /// ``` -pub struct OperationGetCall<'a, C, A> +pub struct AppServiceListCall<'a, C, A> where C: 'a, A: 'a { - hub: &'a Deploymentmanager, - _project: String, - _operation: String, + hub: &'a Appengine, + _apps_id: String, + _page_token: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AppServiceListCall<'a, C, A> {} -impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AppServiceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListServicesResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -1008,12 +1217,17 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.operations.get", + dlg.begin(MethodInfo { id: "appengine.apps.services.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - params.push(("operation", self._operation.to_string())); - for &field in ["alt", "project", "operation"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "appsId", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1025,12 +1239,277 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/operations/{operation}".to_string(); + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/services".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{project}", "project"), ("{operation}", "operation")].iter() { + for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["appsId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Part of `name`. Name of the resource requested. For example: "apps/myapp". + /// + /// Sets the *apps id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn apps_id(mut self, new_value: &str) -> AppServiceListCall<'a, C, A> { + self._apps_id = new_value.to_string(); + self + } + /// Continuation token for fetching the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AppServiceListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum results to return per page. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> AppServiceListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AppServiceListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppServiceListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AppServiceListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deploys new code and resource files to a version. +/// +/// A builder for the *services.versions.create* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; +/// use appengine1_beta5::Version; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use appengine1_beta5::Appengine; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! +/// let mut req = Version::default(); +/// +/// // 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 ! +/// let result = hub.apps().services_versions_create(req, "appsId", "servicesId") +/// .doit(); +/// # } +/// ``` +pub struct AppServiceVersionCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Appengine, + _request: Version, + _apps_id: String, + _services_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AppServiceVersionCreateCall<'a, C, A> {} + +impl<'a, C, A> AppServiceVersionCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "appengine.apps.services.versions.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + params.push(("servicesId", self._services_id.to_string())); + for &field in ["alt", "appsId", "servicesId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/services/{servicesId}/versions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -1042,7 +1521,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } { let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["operation", "project"].iter() { + for param_name in ["servicesId", "appsId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -1051,527 +1530,14 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// ! The project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// ! The name of the operation for this request. - /// - /// Sets the *operation* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn operation(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { - self._operation = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> OperationGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::NdevCloudmanReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> OperationGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// ! Lists all Operations for a project. -/// -/// A builder for the *list* method supported by a *operation* resource. -/// It is not used directly, but through a `OperationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), 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 ! -/// let result = hub.operations().list("project") -/// .page_token("justo") -/// .max_results(-1) -/// .doit(); -/// # } -/// ``` -pub struct OperationListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Deploymentmanager, - _project: String, - _page_token: Option, - _max_results: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OperationListCall<'a, C, A> {} - -impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, OperationsListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "deploymentmanager.operations.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - for &field in ["alt", "project", "pageToken", "maxResults"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/operations".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// ! The project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> OperationListCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// ! Specifies a nextPageToken returned by a previous list request. This ! token can be used to request the next page of results from a previous ! list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// ! Maximum count of results to be returned. ! Acceptable values are 0 to 100, inclusive. (Default: 50) - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: i32) -> OperationListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> OperationListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> OperationListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::NdevCloudmanReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> OperationListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// ! Creates a deployment and all of the resources described by the ! deployment manifest. -/// -/// A builder for the *insert* method supported by a *deployment* resource. -/// It is not used directly, but through a `DeploymentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -/// use deploymentmanager2_beta1::Deployment; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), 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 ! -/// let mut req = Deployment::default(); -/// -/// // 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 ! -/// let result = hub.deployments().insert(req, "project") -/// .doit(); -/// # } -/// ``` -pub struct DeploymentInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Deploymentmanager, - _request: Deployment, - _project: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DeploymentInsertCall<'a, C, A> {} - -impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - for &field in ["alt", "project"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/deployments".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1615,7 +1581,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1625,10 +1591,10 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1660,20 +1626,30 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Deployment) -> DeploymentInsertCall<'a, C, A> { + pub fn request(mut self, new_value: Version) -> AppServiceVersionCreateCall<'a, C, A> { self._request = new_value; self } - /// ! The project ID for this request. + /// Part of `name`. Name of the resource to update. For example: "apps/myapp/services/default". /// - /// Sets the *project* path property to the given value. + /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> DeploymentInsertCall<'a, C, A> { - self._project = new_value.to_string(); + pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionCreateCall<'a, C, A> { + self._apps_id = new_value.to_string(); + self + } + /// Part of `name`. See documentation of `appsId`. + /// + /// Sets the *services id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn services_id(mut self, new_value: &str) -> AppServiceVersionCreateCall<'a, C, A> { + self._services_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -1682,45 +1658,51 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// 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 Delegate) -> DeploymentInsertCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppServiceVersionCreateCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// - /// * *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. Overrides userIp if both are provided. + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DeploymentInsertCall<'a, C, A> + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppServiceVersionCreateCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppServiceVersionCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1728,10 +1710,10 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } -/// ! Gets information about a specific deployment. +/// Gets the current configuration of the service. /// -/// A builder for the *get* method supported by a *deployment* resource. -/// It is not used directly, but through a `DeploymentMethods` instance. +/// A builder for the *services.get* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. /// /// # Example /// @@ -1740,42 +1722,42 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; +/// # use appengine1_beta5::Appengine; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::new(), /// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! -/// let result = hub.deployments().get("project", "deployment") +/// let result = hub.apps().services_get("appsId", "servicesId") /// .doit(); /// # } /// ``` -pub struct DeploymentGetCall<'a, C, A> +pub struct AppServiceGetCall<'a, C, A> where C: 'a, A: 'a { - hub: &'a Deploymentmanager, - _project: String, - _deployment: String, + hub: &'a Appengine, + _apps_id: String, + _services_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for DeploymentGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AppServiceGetCall<'a, C, A> {} -impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AppServiceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Deployment)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Service)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -1783,12 +1765,12 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.get", + dlg.begin(MethodInfo { id: "appengine.apps.services.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - params.push(("deployment", self._deployment.to_string())); - for &field in ["alt", "project", "deployment"].iter() { + params.push(("appsId", self._apps_id.to_string())); + params.push(("servicesId", self._services_id.to_string())); + for &field in ["alt", "appsId", "servicesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1800,12 +1782,12 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/deployments/{deployment}".to_string(); + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/services/{servicesId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{project}", "project"), ("{deployment}", "deployment")].iter() { + for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -1817,7 +1799,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } { let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["deployment", "project"].iter() { + for param_name in ["servicesId", "appsId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -1826,7 +1808,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1862,7 +1844,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1872,10 +1854,10 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1904,24 +1886,24 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } - /// ! The project ID for this request. + /// Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default". /// - /// Sets the *project* path property to the given value. + /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> DeploymentGetCall<'a, C, A> { - self._project = new_value.to_string(); + pub fn apps_id(mut self, new_value: &str) -> AppServiceGetCall<'a, C, A> { + self._apps_id = new_value.to_string(); self } - /// ! The name of the deployment for this request. + /// Part of `name`. See documentation of `appsId`. /// - /// Sets the *deployment* path property to the given value. + /// Sets the *services id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn deployment(mut self, new_value: &str) -> DeploymentGetCall<'a, C, A> { - self._deployment = new_value.to_string(); + pub fn services_id(mut self, new_value: &str) -> AppServiceGetCall<'a, C, A> { + self._services_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -1930,45 +1912,51 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, 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 Delegate) -> DeploymentGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppServiceGetCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// - /// * *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. Overrides userIp if both are provided. + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DeploymentGetCall<'a, C, A> + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppServiceGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::NdevCloudmanReadonly`. + /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppServiceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1976,10 +1964,10 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } -/// ! Lists all deployments for a given project. +/// Lists the versions of a service. /// -/// A builder for the *list* method supported by a *deployment* resource. -/// It is not used directly, but through a `DeploymentMethods` instance. +/// A builder for the *services.versions.list* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. /// /// # Example /// @@ -1988,45 +1976,48 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; +/// # use appengine1_beta5::Appengine; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::new(), /// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! -/// let result = hub.deployments().list("project") -/// .page_token("dolores") -/// .max_results(-61) +/// let result = hub.apps().services_versions_list("appsId", "servicesId") +/// .view("sadipscing") +/// .page_token("aliquyam") +/// .page_size(-66) /// .doit(); /// # } /// ``` -pub struct DeploymentListCall<'a, C, A> +pub struct AppServiceVersionListCall<'a, C, A> where C: 'a, A: 'a { - hub: &'a Deploymentmanager, - _project: String, + hub: &'a Appengine, + _apps_id: String, + _services_id: String, + _view: Option, _page_token: Option, - _max_results: Option, + _page_size: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for DeploymentListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AppServiceVersionListCall<'a, C, A> {} -impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AppServiceVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, DeploymentsListResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, ListVersionsResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -2034,17 +2025,21 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.list", + dlg.begin(MethodInfo { id: "appengine.apps.services.versions.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("project", self._project.to_string())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + params.push(("servicesId", self._services_id.to_string())); + if let Some(value) = self._view { + params.push(("view", value.to_string())); + } if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); } - for &field in ["alt", "project", "pageToken", "maxResults"].iter() { + for &field in ["alt", "appsId", "servicesId", "view", "pageToken", "pageSize"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2056,12 +2051,12 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/deployments".to_string(); + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/services/{servicesId}/versions".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{project}", "project")].iter() { + for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -2072,8 +2067,8 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["project"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["servicesId", "appsId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -2082,7 +2077,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2118,7 +2113,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2128,10 +2123,10 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2160,28 +2155,45 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } - /// ! The project ID for this request. + /// Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default". /// - /// Sets the *project* path property to the given value. + /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { - self._project = new_value.to_string(); + pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C, A> { + self._apps_id = new_value.to_string(); self } - /// ! Specifies a nextPageToken returned by a previous list request. This ! token can be used to request the next page of results from a previous ! list request. + /// Part of `name`. See documentation of `appsId`. + /// + /// Sets the *services id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn services_id(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C, A> { + self._services_id = new_value.to_string(); + self + } + /// Controls the set of fields returned in the `List` response. + /// + /// Sets the *view* query property to the given value. + pub fn view(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C, A> { + self._view = Some(new_value.to_string()); + self + } + /// Continuation token for fetching the next page of results. /// /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { + pub fn page_token(mut self, new_value: &str) -> AppServiceVersionListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// ! Maximum count of results to be returned. ! Acceptable values are 0 to 100, inclusive. (Default: 50) + /// Maximum results to return per page. /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: i32) -> DeploymentListCall<'a, C, A> { - self._max_results = Some(new_value); + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> AppServiceVersionListCall<'a, C, A> { + self._page_size = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -2190,45 +2202,51 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, 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 Delegate) -> DeploymentListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppServiceVersionListCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// - /// * *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. Overrides userIp if both are provided. + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DeploymentListCall<'a, C, A> + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppServiceVersionListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::NdevCloudmanReadonly`. + /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppServiceVersionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2236,10 +2254,10 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } -/// ! Deletes a deployment and all of the resources in the deployment. +/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. /// -/// A builder for the *delete* method supported by a *deployment* resource. -/// It is not used directly, but through a `DeploymentMethods` instance. +/// A builder for the *operations.get* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. /// /// # Example /// @@ -2248,38 +2266,38 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; +/// # use appengine1_beta5::Appengine; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::new(), /// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! -/// let result = hub.deployments().delete("project", "deployment") +/// let result = hub.apps().operations_get("appsId", "operationsId") /// .doit(); /// # } /// ``` -pub struct DeploymentDeleteCall<'a, C, A> +pub struct AppOperationGetCall<'a, C, A> where C: 'a, A: 'a { - hub: &'a Deploymentmanager, - _project: String, - _deployment: String, + hub: &'a Appengine, + _apps_id: String, + _operations_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for DeploymentDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AppOperationGetCall<'a, C, A> {} -impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AppOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -2291,12 +2309,12 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.delete", - http_method: hyper::method::Method::Delete }); + dlg.begin(MethodInfo { id: "appengine.apps.operations.get", + http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - params.push(("deployment", self._deployment.to_string())); - for &field in ["alt", "project", "deployment"].iter() { + params.push(("appsId", self._apps_id.to_string())); + params.push(("operationsId", self._operations_id.to_string())); + for &field in ["alt", "appsId", "operationsId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2308,12 +2326,12 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/deployments/{deployment}".to_string(); + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/operations/{operationsId}".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{project}", "project"), ("{deployment}", "deployment")].iter() { + for &(find_this, param_name) in [("{appsId}", "appsId"), ("{operationsId}", "operationsId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -2325,7 +2343,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } { let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["deployment", "project"].iter() { + for param_name in ["operationsId", "appsId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -2334,7 +2352,541 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Part of `name`. The name of the operation resource. + /// + /// Sets the *apps id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn apps_id(mut self, new_value: &str) -> AppOperationGetCall<'a, C, A> { + self._apps_id = new_value.to_string(); + self + } + /// Part of `name`. See documentation of `appsId`. + /// + /// Sets the *operations id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn operations_id(mut self, new_value: &str) -> AppOperationGetCall<'a, C, A> { + self._operations_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AppOperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppOperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AppOperationGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// 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 below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. +/// +/// A builder for the *operations.list* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use appengine1_beta5::Appengine; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! +/// let result = hub.apps().operations_list("appsId") +/// .page_token("et") +/// .page_size(-17) +/// .filter("diam") +/// .doit(); +/// # } +/// ``` +pub struct AppOperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Appengine, + _apps_id: String, + _page_token: Option, + _page_size: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AppOperationListCall<'a, C, A> {} + +impl<'a, C, A> AppOperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "appengine.apps.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "appsId", "pageToken", "pageSize", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/operations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["appsId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Part of `name`. The name of the operation collection. + /// + /// Sets the *apps id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn apps_id(mut self, new_value: &str) -> AppOperationListCall<'a, C, A> { + self._apps_id = 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) -> AppOperationListCall<'a, C, 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) -> AppOperationListCall<'a, C, A> { + 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) -> AppOperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AppOperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppOperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AppOperationListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing version. +/// +/// A builder for the *services.versions.delete* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use appengine1_beta5::Appengine; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! +/// let result = hub.apps().services_versions_delete("appsId", "servicesId", "versionsId") +/// .doit(); +/// # } +/// ``` +pub struct AppServiceVersionDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Appengine, + _apps_id: String, + _services_id: String, + _versions_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AppServiceVersionDeleteCall<'a, C, A> {} + +impl<'a, C, A> AppServiceVersionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "appengine.apps.services.versions.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + params.push(("servicesId", self._services_id.to_string())); + params.push(("versionsId", self._versions_id.to_string())); + for &field in ["alt", "appsId", "servicesId", "versionsId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/services/{servicesId}/versions/{versionsId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["versionsId", "servicesId", "appsId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2370,7 +2922,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2380,10 +2932,10 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2412,24 +2964,34 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } - /// ! The project ID for this request. + /// Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default/versions/v1". /// - /// Sets the *project* path property to the given value. + /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C, A> { - self._project = new_value.to_string(); + pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, C, A> { + self._apps_id = new_value.to_string(); self } - /// ! The name of the deployment for this request. + /// Part of `name`. See documentation of `appsId`. /// - /// Sets the *deployment* path property to the given value. + /// Sets the *services id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn deployment(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C, A> { - self._deployment = new_value.to_string(); + pub fn services_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, C, A> { + self._services_id = new_value.to_string(); + self + } + /// Part of `name`. See documentation of `appsId`. + /// + /// Sets the *versions id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionDeleteCall<'a, C, A> { + self._versions_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -2438,45 +3000,51 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// 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 Delegate) -> DeploymentDeleteCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppServiceVersionDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// - /// * *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. Overrides userIp if both are provided. + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DeploymentDeleteCall<'a, C, A> + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppServiceVersionDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppServiceVersionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2484,10 +3052,10 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } -/// ! Lists all Types for Deployment Manager. +/// Updates the configuration of the specified service. /// -/// A builder for the *list* method supported by a *type* resource. -/// It is not used directly, but through a `TypeMethods` instance. +/// A builder for the *services.patch* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. /// /// # Example /// @@ -2496,45 +3064,53 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; +/// use appengine1_beta5::Service; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; +/// # use appengine1_beta5::Appengine; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::new(), /// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! +/// let mut req = Service::default(); +/// /// // 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 ! -/// let result = hub.types().list("project") -/// .page_token("no") -/// .max_results(-21) +/// let result = hub.apps().services_patch(req, "appsId", "servicesId") +/// .migrate_traffic(true) +/// .mask("Lorem") /// .doit(); /// # } /// ``` -pub struct TypeListCall<'a, C, A> +pub struct AppServicePatchCall<'a, C, A> where C: 'a, A: 'a { - hub: &'a Deploymentmanager, - _project: String, - _page_token: Option, - _max_results: Option, + hub: &'a Appengine, + _request: Service, + _apps_id: String, + _services_id: String, + _migrate_traffic: Option, + _mask: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for TypeListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AppServicePatchCall<'a, C, A> {} -impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AppServicePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, TypesListResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -2542,17 +3118,18 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.types.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); + dlg.begin(MethodInfo { id: "appengine.apps.services.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + params.push(("servicesId", self._services_id.to_string())); + if let Some(value) = self._migrate_traffic { + params.push(("migrateTraffic", value.to_string())); } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); + if let Some(value) = self._mask { + params.push(("mask", value.to_string())); } - for &field in ["alt", "project", "pageToken", "maxResults"].iter() { + for &field in ["alt", "appsId", "servicesId", "migrateTraffic", "mask"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2564,12 +3141,307 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/types".to_string(); + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/services/{servicesId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{project}", "project")].iter() { + for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["servicesId", "appsId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Service) -> AppServicePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// Part of `name`. Name of the resource to update. For example: "apps/myapp/services/default". + /// + /// Sets the *apps id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn apps_id(mut self, new_value: &str) -> AppServicePatchCall<'a, C, A> { + self._apps_id = new_value.to_string(); + self + } + /// Part of `name`. See documentation of `appsId`. + /// + /// Sets the *services id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn services_id(mut self, new_value: &str) -> AppServicePatchCall<'a, C, A> { + self._services_id = new_value.to_string(); + self + } + /// Whether to use Traffic Migration to shift traffic gradually. Traffic can only be migrated from a single version to another single version. + /// + /// Sets the *migrate traffic* query property to the given value. + pub fn migrate_traffic(mut self, new_value: bool) -> AppServicePatchCall<'a, C, A> { + self._migrate_traffic = Some(new_value); + self + } + /// Standard field mask for the set of fields to be updated. + /// + /// Sets the *mask* query property to the given value. + pub fn mask(mut self, new_value: &str) -> AppServicePatchCall<'a, C, A> { + self._mask = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AppServicePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppServicePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AppServicePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets information about an application. +/// +/// A builder for the *get* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use appengine1_beta5::Appengine; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! +/// let result = hub.apps().get("appsId") +/// .ensure_resources_exist(false) +/// .doit(); +/// # } +/// ``` +pub struct AppGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Appengine, + _apps_id: String, + _ensure_resources_exist: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AppGetCall<'a, C, A> {} + +impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Application)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "appengine.apps.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + if let Some(value) = self._ensure_resources_exist { + params.push(("ensureResourcesExist", value.to_string())); + } + for &field in ["alt", "appsId", "ensureResourcesExist"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{appsId}", "appsId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -2581,7 +3453,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut } { let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["project"].iter() { + for param_name in ["appsId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -2590,7 +3462,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2626,7 +3498,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2636,10 +3508,10 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2668,28 +3540,21 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut } - /// ! The project ID for this request. + /// Part of `name`. Name of the application to get. For example: "apps/myapp". /// - /// Sets the *project* path property to the given value. + /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> TypeListCall<'a, C, A> { - self._project = new_value.to_string(); + pub fn apps_id(mut self, new_value: &str) -> AppGetCall<'a, C, A> { + self._apps_id = new_value.to_string(); self } - /// ! Specifies a nextPageToken returned by a previous list request. This ! token can be used to request the next page of results from a previous ! list request. + /// Certain resources associated with an application are created on-demand. Controls whether these resources should be created when performing the `GET` operation. If specified and any resources could not be created, the request will fail with an error code. Additionally, this parameter can cause the request to take longer to complete. Note: This parameter will be deprecated in a future version of the API. /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> TypeListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// ! Maximum count of results to be returned. ! Acceptable values are 0 to 100, inclusive. (Default: 50) - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: i32) -> TypeListCall<'a, C, A> { - self._max_results = Some(new_value); + /// Sets the *ensure resources exist* query property to the given value. + pub fn ensure_resources_exist(mut self, new_value: bool) -> AppGetCall<'a, C, A> { + self._ensure_resources_exist = Some(new_value); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -2698,45 +3563,51 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut /// 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 Delegate) -> TypeListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppGetCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// - /// * *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. Overrides userIp if both are provided. + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> TypeListCall<'a, C, A> + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::NdevCloudmanReadonly`. + /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2744,10 +3615,10 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut } -/// ! Gets information about a single resource. +/// Deletes a service and all enclosed versions. /// -/// A builder for the *get* method supported by a *resource* resource. -/// It is not used directly, but through a `ResourceMethods` instance. +/// A builder for the *services.delete* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. /// /// # Example /// @@ -2756,43 +3627,42 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; +/// # use appengine1_beta5::Appengine; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::new(), /// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! -/// let result = hub.resources().get("project", "deployment", "resource") +/// let result = hub.apps().services_delete("appsId", "servicesId") /// .doit(); /// # } /// ``` -pub struct ResourceGetCall<'a, C, A> +pub struct AppServiceDeleteCall<'a, C, A> where C: 'a, A: 'a { - hub: &'a Deploymentmanager, - _project: String, - _deployment: String, - _resource: String, + hub: &'a Appengine, + _apps_id: String, + _services_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ResourceGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AppServiceDeleteCall<'a, C, A> {} -impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AppServiceDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ResourceType)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -2800,13 +3670,12 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.resources.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - params.push(("deployment", self._deployment.to_string())); - params.push(("resource", self._resource.to_string())); - for &field in ["alt", "project", "deployment", "resource"].iter() { + dlg.begin(MethodInfo { id: "appengine.apps.services.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("appsId", self._apps_id.to_string())); + params.push(("servicesId", self._services_id.to_string())); + for &field in ["alt", "appsId", "servicesId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2818,280 +3687,12 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/deployments/{deployment}/resources/{resource}".to_string(); + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/services/{servicesId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{project}", "project"), ("{deployment}", "deployment"), ("{resource}", "resource")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["resource", "deployment", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// ! The project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> ResourceGetCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// ! The name of the deployment for this request. - /// - /// Sets the *deployment* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn deployment(mut self, new_value: &str) -> ResourceGetCall<'a, C, A> { - self._deployment = new_value.to_string(); - self - } - /// ! The name of the resource for this request. - /// - /// Sets the *resource* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn resource(mut self, new_value: &str) -> ResourceGetCall<'a, C, A> { - self._resource = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ResourceGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ResourceGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::NdevCloudmanReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ResourceGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// ! Lists all resources in a given deployment. -/// -/// A builder for the *list* method supported by a *resource* resource. -/// It is not used directly, but through a `ResourceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), 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 ! -/// let result = hub.resources().list("project", "deployment") -/// .page_token("Lorem") -/// .max_results(-21) -/// .doit(); -/// # } -/// ``` -pub struct ResourceListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Deploymentmanager, - _project: String, - _deployment: String, - _page_token: Option, - _max_results: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ResourceListCall<'a, C, A> {} - -impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ResourcesListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "deploymentmanager.resources.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - params.push(("deployment", self._deployment.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - for &field in ["alt", "project", "deployment", "pageToken", "maxResults"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/deployments/{deployment}/resources".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{deployment}", "deployment")].iter() { + for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -3103,7 +3704,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: } { let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["deployment", "project"].iter() { + for param_name in ["servicesId", "appsId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -3112,7 +3713,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3137,7 +3738,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -3148,7 +3749,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3158,10 +3759,10 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3190,38 +3791,24 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: } - /// ! The project ID for this request. + /// Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default". /// - /// Sets the *project* path property to the given value. + /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { - self._project = new_value.to_string(); + pub fn apps_id(mut self, new_value: &str) -> AppServiceDeleteCall<'a, C, A> { + self._apps_id = new_value.to_string(); self } - /// ! The name of the deployment for this request. + /// Part of `name`. See documentation of `appsId`. /// - /// Sets the *deployment* path property to the given value. + /// Sets the *services id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn deployment(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { - self._deployment = new_value.to_string(); - self - } - /// ! Specifies a nextPageToken returned by a previous list request. This ! token can be used to request the next page of results from a previous ! list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// ! Maximum count of results to be returned. ! Acceptable values are 0 to 100, inclusive. (Default: 50) - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: i32) -> ResourceListCall<'a, C, A> { - self._max_results = Some(new_value); + pub fn services_id(mut self, new_value: &str) -> AppServiceDeleteCall<'a, C, A> { + self._services_id = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -3230,45 +3817,51 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, 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 Delegate) -> ResourceListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppServiceDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// - /// * *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. Overrides userIp if both are provided. + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ResourceListCall<'a, C, A> + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppServiceDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::NdevCloudmanReadonly`. + /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ResourceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppServiceDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3276,10 +3869,10 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: } -/// ! Lists all manifests for a given deployment. +/// Gets application deployment information. /// -/// A builder for the *list* method supported by a *manifest* resource. -/// It is not used directly, but through a `ManifestMethods` instance. +/// A builder for the *services.versions.get* method supported by a *app* resource. +/// It is not used directly, but through a `AppMethods` instance. /// /// # Example /// @@ -3288,46 +3881,45 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; +/// # extern crate google_appengine1_beta5 as appengine1_beta5; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; +/// # use appengine1_beta5::Appengine; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::new(), /// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +/// # let mut hub = Appengine::new(hyper::Client::new(), 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 ! -/// let result = hub.manifests().list("project", "deployment") -/// .page_token("sea") -/// .max_results(-55) +/// let result = hub.apps().services_versions_get("appsId", "servicesId", "versionsId") +/// .view("no") /// .doit(); /// # } /// ``` -pub struct ManifestListCall<'a, C, A> +pub struct AppServiceVersionGetCall<'a, C, A> where C: 'a, A: 'a { - hub: &'a Deploymentmanager, - _project: String, - _deployment: String, - _page_token: Option, - _max_results: Option, + hub: &'a Appengine, + _apps_id: String, + _services_id: String, + _versions_id: String, + _view: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for ManifestListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for AppServiceVersionGetCall<'a, C, A> {} -impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> AppServiceVersionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ManifestsListResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Version)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -3335,18 +3927,16 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.manifests.list", + dlg.begin(MethodInfo { id: "appengine.apps.services.versions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - params.push(("deployment", self._deployment.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); + params.push(("appsId", self._apps_id.to_string())); + params.push(("servicesId", self._services_id.to_string())); + params.push(("versionsId", self._versions_id.to_string())); + if let Some(value) = self._view { + params.push(("view", value.to_string())); } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - for &field in ["alt", "project", "deployment", "pageToken", "maxResults"].iter() { + for &field in ["alt", "appsId", "servicesId", "versionsId", "view"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -3358,276 +3948,12 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/deployments/{deployment}/manifests".to_string(); + let mut url = "https://appengine.googleapis.com/v1beta5/apps/{appsId}/services/{servicesId}/versions/{versionsId}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{project}", "project"), ("{deployment}", "deployment")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["deployment", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// ! The project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// ! The name of the deployment for this request. - /// - /// Sets the *deployment* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn deployment(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { - self._deployment = new_value.to_string(); - self - } - /// ! Specifies a nextPageToken returned by a previous list request. This ! token can be used to request the next page of results from a previous ! list request. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// ! Maximum count of results to be returned. ! Acceptable values are 0 to 100, inclusive. (Default: 50) - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: i32) -> ManifestListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ManifestListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ManifestListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::NdevCloudmanReadonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ManifestListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// ! Gets information about a specific manifest. -/// -/// A builder for the *get* method supported by a *manifest* resource. -/// It is not used directly, but through a `ManifestMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use deploymentmanager2_beta1::Deploymentmanager; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Deploymentmanager::new(hyper::Client::new(), 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 ! -/// let result = hub.manifests().get("project", "deployment", "manifest") -/// .doit(); -/// # } -/// ``` -pub struct ManifestGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Deploymentmanager, - _project: String, - _deployment: String, - _manifest: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ManifestGetCall<'a, C, A> {} - -impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Manifest)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "deploymentmanager.manifests.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - params.push(("deployment", self._deployment.to_string())); - params.push(("manifest", self._manifest.to_string())); - for &field in ["alt", "project", "deployment", "manifest"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/deploymentmanager/v2beta1/projects/{project}/global/deployments/{deployment}/manifests/{manifest}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{deployment}", "deployment"), ("{manifest}", "manifest")].iter() { + for &(find_this, param_name) in [("{appsId}", "appsId"), ("{servicesId}", "servicesId"), ("{versionsId}", "versionsId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -3639,7 +3965,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o } { let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["manifest", "deployment", "project"].iter() { + for param_name in ["versionsId", "servicesId", "appsId"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -3648,7 +3974,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3684,7 +4010,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3694,10 +4020,10 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3726,34 +4052,41 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o } - /// ! The project ID for this request. + /// Part of `name`. Name of the resource requested. For example: "apps/myapp/services/default/versions/v1". /// - /// Sets the *project* path property to the given value. + /// Sets the *apps id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> ManifestGetCall<'a, C, A> { - self._project = new_value.to_string(); + pub fn apps_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C, A> { + self._apps_id = new_value.to_string(); self } - /// ! The name of the deployment for this request. + /// Part of `name`. See documentation of `appsId`. /// - /// Sets the *deployment* path property to the given value. + /// Sets the *services id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn deployment(mut self, new_value: &str) -> ManifestGetCall<'a, C, A> { - self._deployment = new_value.to_string(); + pub fn services_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C, A> { + self._services_id = new_value.to_string(); self } - /// ! The name of the manifest for this request. + /// Part of `name`. See documentation of `appsId`. /// - /// Sets the *manifest* path property to the given value. + /// Sets the *versions id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn manifest(mut self, new_value: &str) -> ManifestGetCall<'a, C, A> { - self._manifest = new_value.to_string(); + pub fn versions_id(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C, A> { + self._versions_id = new_value.to_string(); + self + } + /// Controls the set of fields returned in the `Get` response. + /// + /// Sets the *view* query property to the given value. + pub fn view(mut self, new_value: &str) -> AppServiceVersionGetCall<'a, C, A> { + self._view = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -3762,45 +4095,51 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// 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 Delegate) -> ManifestGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> AppServiceVersionGetCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// - /// * *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. Overrides userIp if both are provided. + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ManifestGetCall<'a, C, A> + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> AppServiceVersionGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::NdevCloudmanReadonly`. + /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManifestGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppServiceVersionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/appsactivity1-cli/Cargo.toml b/gen/appsactivity1-cli/Cargo.toml index b7b99be8bf..ee8f3068fc 100644 --- a/gen/appsactivity1-cli/Cargo.toml +++ b/gen/appsactivity1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appsactivity1-cli" -version = "0.3.2+20150326" +version = "0.3.3+20150723" authors = ["Sebastian Thiel "] description = "A complete library to interact with appsactivity (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appsactivity1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/appsactivity1-cli/LICENSE.md b/gen/appsactivity1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/appsactivity1-cli/LICENSE.md +++ b/gen/appsactivity1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/appsactivity1-cli/README.md b/gen/appsactivity1-cli/README.md index b58e81e20a..527c2bfcb1 100644 --- a/gen/appsactivity1-cli/README.md +++ b/gen/appsactivity1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *appsactivity* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/appsactivity1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/appsactivity1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/appsactivity1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/appsactivity1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/appsactivity1-cli). # Usage -This documentation was generated from the *appsactivity* API at revision *20150326*. The CLI is at version *0.3.2*. +This documentation was generated from the *appsactivity* API at revision *20150723*. The CLI is at version *0.3.3*. ```bash appsactivity1 [options] @@ -34,18 +34,18 @@ appsactivity1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/appsactivity1-cli/mkdocs.yml b/gen/appsactivity1-cli/mkdocs.yml index b57dc19052..ceedf73dff 100644 --- a/gen/appsactivity1-cli/mkdocs.yml +++ b/gen/appsactivity1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appsactivity v0.3.2+20150326 +site_name: appsactivity v0.3.3+20150723 site_url: http://byron.github.io/google-apis-rs/google-appsactivity1-cli site_description: Write integrating applications with bcore @@ -13,5 +13,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/appsactivity1-cli/src/main.rs b/gen/appsactivity1-cli/src/main.rs index 5dd7d89e67..04ac515e79 100644 --- a/gen/appsactivity1-cli/src/main.rs +++ b/gen/appsactivity1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Appsactivity>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _activities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.activities().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-id" => { @@ -82,7 +82,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["drive-ancestor-id", "page-size", "page-token", "grouping-strategy", "user-id", "drive-file-id", "source"].iter().map(|v|*v)); @@ -96,7 +96,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -152,14 +152,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "appsactivity1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "appsactivity1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -179,7 +179,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -218,7 +218,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("activities", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Returns a list of activities visible to the current logged in user. Visible activities are determined by the visiblity settings of the object that was acted on, e.g. Drive files a user can see. An activity is a record of past events. Multiple events may be merged if they are similar. A request is scoped to activities from a given Google service using the source parameter."##), "Details at http://byron.github.io/google-apis-rs/google_appsactivity1_cli/activities_list", vec![ @@ -240,7 +240,7 @@ fn main() { let mut app = App::new("appsactivity1") .author("Sebastian Thiel ") - .version("0.3.2+20150326") + .version("0.3.3+20150723") .about("Provides a historical view of activity.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appsactivity1_cli") .arg(Arg::with_name("url") @@ -264,7 +264,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -275,7 +275,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/appsactivity1/Cargo.toml b/gen/appsactivity1/Cargo.toml index b5f3bde167..14a8db5409 100644 --- a/gen/appsactivity1/Cargo.toml +++ b/gen/appsactivity1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appsactivity1" -version = "0.1.10+20150326" +version = "0.1.11+20150723" authors = ["Sebastian Thiel "] description = "A complete library to interact with appsactivity (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appsactivity1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/appsactivity1/LICENSE.md b/gen/appsactivity1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/appsactivity1/LICENSE.md +++ b/gen/appsactivity1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/appsactivity1/README.md b/gen/appsactivity1/README.md index bdac8014e1..2d8819500b 100644 --- a/gen/appsactivity1/README.md +++ b/gen/appsactivity1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-appsactivity1` library allows access to all features of the *Google appsactivity* service. -This documentation was generated from *appsactivity* crate version *0.1.10+20150326*, where *20150326* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *appsactivity* crate version *0.1.11+20150723*, where *20150723* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *appsactivity* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/activity/). diff --git a/gen/appsactivity1/src/cmn.rs b/gen/appsactivity1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/appsactivity1/src/cmn.rs +++ b/gen/appsactivity1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/appsactivity1/src/lib.rs b/gen/appsactivity1/src/lib.rs index 87b89bebe5..35a4160ff4 100644 --- a/gen/appsactivity1/src/lib.rs +++ b/gen/appsactivity1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *appsactivity* crate version *0.1.10+20150326*, where *20150326* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *appsactivity* crate version *0.1.11+20150723*, where *20150723* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *appsactivity* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/activity/). diff --git a/gen/appsactivity1/src/lib.rs.in b/gen/appsactivity1/src/lib.rs.in index 0abde13790..79caf1c233 100644 --- a/gen/appsactivity1/src/lib.rs.in +++ b/gen/appsactivity1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -149,7 +150,7 @@ impl<'a, C, A> Appsactivity Appsactivity { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -158,7 +159,7 @@ impl<'a, C, A> Appsactivity } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -325,7 +326,7 @@ impl ResponseResult for ListActivitiesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct User { - /// The profile photo of the user. + /// The profile photo of the user. Not present if the user has no profile photo. pub photo: Option, /// The displayable name of the user. pub name: Option, @@ -524,7 +525,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appsactivity.activities.list", + dlg.begin(MethodInfo { id: "appsactivity.activities.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); if let Some(value) = self._user_id { @@ -565,7 +566,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::DriveMetadataReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -601,7 +602,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -611,10 +612,10 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -705,12 +706,12 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -727,17 +728,17 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DriveMetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ActivityListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ActivityListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/appstate1-cli/Cargo.toml b/gen/appstate1-cli/Cargo.toml index 01968e7606..aa6e79fbce 100644 --- a/gen/appstate1-cli/Cargo.toml +++ b/gen/appstate1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appstate1-cli" -version = "0.3.2+20151013" +version = "0.3.3+20160125" authors = ["Sebastian Thiel "] description = "A complete library to interact with App State (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appstate1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/appstate1-cli/LICENSE.md b/gen/appstate1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/appstate1-cli/LICENSE.md +++ b/gen/appstate1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/appstate1-cli/README.md b/gen/appstate1-cli/README.md index bce7bb4284..e2a8ff6d85 100644 --- a/gen/appstate1-cli/README.md +++ b/gen/appstate1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *App State* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/appstate1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/appstate1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/appstate1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/appstate1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/appstate1-cli). # Usage -This documentation was generated from the *App State* API at revision *20151013*. The CLI is at version *0.3.2*. +This documentation was generated from the *App State* API at revision *20160125*. The CLI is at version *0.3.3*. ```bash appstate1 [options] @@ -38,18 +38,18 @@ appstate1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/appstate1-cli/mkdocs.yml b/gen/appstate1-cli/mkdocs.yml index f564356885..de58ac9ec2 100644 --- a/gen/appstate1-cli/mkdocs.yml +++ b/gen/appstate1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: App State v0.3.2+20151013 +site_name: App State v0.3.3+20160125 site_url: http://byron.github.io/google-apis-rs/google-appstate1-cli site_description: Write integrating applications with bcore @@ -17,5 +17,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/appstate1-cli/src/main.rs b/gen/appstate1-cli/src/main.rs index 9874e79c9a..deb77764c0 100644 --- a/gen/appstate1-cli/src/main.rs +++ b/gen/appstate1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,20 +36,20 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::AppState>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _states_clear(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _states_clear(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let state_key: i32 = arg_from_str(&opt.value_of("state-key").unwrap_or(""), err, "", "integer"); let mut call = self.hub.states().clear(state_key); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "current-data-version" => { @@ -65,7 +65,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["current-data-version"].iter().map(|v|*v)); @@ -79,7 +79,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -102,11 +102,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _states_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _states_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let state_key: i32 = arg_from_str(&opt.value_of("state-key").unwrap_or(""), err, "", "integer"); let mut call = self.hub.states().delete(state_key); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -119,7 +119,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -132,7 +132,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -147,11 +147,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _states_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _states_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let state_key: i32 = arg_from_str(&opt.value_of("state-key").unwrap_or(""), err, "", "integer"); let mut call = self.hub.states().get(state_key); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -164,7 +164,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -177,7 +177,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -200,10 +200,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _states_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _states_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.states().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "include-data" => { @@ -219,7 +219,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-data"].iter().map(|v|*v)); @@ -233,7 +233,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -256,13 +256,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _states_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _states_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -276,8 +276,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -294,7 +294,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::UpdateRequest = json::value::from_value(object).unwrap(); let state_key: i32 = arg_from_str(&opt.value_of("state-key").unwrap_or(""), err, "", "integer"); let mut call = self.hub.states().update(request, state_key); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "current-state-version" => { @@ -310,7 +310,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["current-state-version"].iter().map(|v|*v)); @@ -324,7 +324,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -392,14 +392,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "appstate1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "appstate1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -419,7 +419,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -458,7 +458,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("states", "methods: 'clear', 'delete', 'get', 'list' and 'update'", vec![ - ("clear", + ("clear", Some(r##"Clears (sets to empty) the data for the passed key if and only if the passed version matches the currently stored version. This method results in a conflict error on version mismatch."##), "Details at http://byron.github.io/google-apis-rs/google_appstate1_cli/states_clear", vec![ @@ -480,7 +480,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a key and the data associated with it. The key is removed and no longer counts against the key quota. Note that since this method is not safe in the face of concurrent modifications, it should only be used for development and testing purposes. Invoking this method in shipping code can result in data loss and data corruption."##), "Details at http://byron.github.io/google-apis-rs/google_appstate1_cli/states_delete", vec![ @@ -496,7 +496,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves the data corresponding to the passed key. If the key does not exist on the server, an HTTP 404 will be returned."##), "Details at http://byron.github.io/google-apis-rs/google_appstate1_cli/states_get", vec![ @@ -518,7 +518,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all the states keys, and optionally the state data."##), "Details at http://byron.github.io/google-apis-rs/google_appstate1_cli/states_list", vec![ @@ -534,7 +534,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update the data associated with the input key if and only if the passed version matches the currently stored version. This method is safe in the face of concurrent writes. Maximum per-key size is 128KB."##), "Details at http://byron.github.io/google-apis-rs/google_appstate1_cli/states_update", vec![ @@ -568,7 +568,7 @@ fn main() { let mut app = App::new("appstate1") .author("Sebastian Thiel ") - .version("0.3.2+20151013") + .version("0.3.3+20160125") .about("The Google App State API.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_appstate1_cli") .arg(Arg::with_name("url") @@ -592,7 +592,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -603,7 +603,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/appstate1/Cargo.toml b/gen/appstate1/Cargo.toml index 7e394d29e4..39057b3b8d 100644 --- a/gen/appstate1/Cargo.toml +++ b/gen/appstate1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appstate1" -version = "0.1.10+20151013" +version = "0.1.11+20160125" authors = ["Sebastian Thiel "] description = "A complete library to interact with App State (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appstate1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/appstate1/LICENSE.md b/gen/appstate1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/appstate1/LICENSE.md +++ b/gen/appstate1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/appstate1/README.md b/gen/appstate1/README.md index 3ffa58cefc..d1fcdae42d 100644 --- a/gen/appstate1/README.md +++ b/gen/appstate1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-appstate1` library allows access to all features of the *Google App State* service. -This documentation was generated from *App State* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *App State* crate version *0.1.11+20160125*, where *20160125* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *App State* *v1* API can be found at the [official documentation site](https://developers.google.com/games/services/web/api/states). diff --git a/gen/appstate1/src/cmn.rs b/gen/appstate1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/appstate1/src/cmn.rs +++ b/gen/appstate1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/appstate1/src/lib.rs b/gen/appstate1/src/lib.rs index 8dda367ba3..87a8819e30 100644 --- a/gen/appstate1/src/lib.rs +++ b/gen/appstate1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *App State* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *App State* crate version *0.1.11+20160125*, where *20160125* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *App State* *v1* API can be found at the //! [official documentation site](https://developers.google.com/games/services/web/api/states). diff --git a/gen/appstate1/src/lib.rs.in b/gen/appstate1/src/lib.rs.in index 47569ba742..bc39d0cccc 100644 --- a/gen/appstate1/src/lib.rs.in +++ b/gen/appstate1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -133,7 +134,7 @@ impl<'a, C, A> AppState AppState { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -142,7 +143,7 @@ impl<'a, C, A> AppState } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -441,7 +442,7 @@ impl<'a, C, A> StateDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appstate.states.delete", + dlg.begin(MethodInfo { id: "appstate.states.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("stateKey", self._state_key.to_string())); @@ -482,7 +483,7 @@ impl<'a, C, A> StateDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -518,7 +519,7 @@ impl<'a, C, A> StateDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -528,10 +529,10 @@ impl<'a, C, A> StateDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -554,7 +555,7 @@ impl<'a, C, A> StateDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *state key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn state_key(mut self, new_value: i32) -> StateDeleteCall<'a, C, A> { self._state_key = new_value; @@ -572,12 +573,12 @@ impl<'a, C, A> StateDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -594,17 +595,17 @@ impl<'a, C, A> StateDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StateDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StateDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -666,7 +667,7 @@ impl<'a, C, A> StateGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appstate.states.get", + dlg.begin(MethodInfo { id: "appstate.states.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("stateKey", self._state_key.to_string())); @@ -708,7 +709,7 @@ impl<'a, C, A> StateGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -744,7 +745,7 @@ impl<'a, C, A> StateGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -754,10 +755,10 @@ impl<'a, C, A> StateGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -790,7 +791,7 @@ impl<'a, C, A> StateGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *state key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn state_key(mut self, new_value: i32) -> StateGetCall<'a, C, A> { self._state_key = new_value; @@ -808,12 +809,12 @@ impl<'a, C, A> StateGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -830,17 +831,17 @@ impl<'a, C, A> StateGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StateGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StateGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -904,7 +905,7 @@ impl<'a, C, A> StateClearCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appstate.states.clear", + dlg.begin(MethodInfo { id: "appstate.states.clear", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("stateKey", self._state_key.to_string())); @@ -949,7 +950,7 @@ impl<'a, C, A> StateClearCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -985,7 +986,7 @@ impl<'a, C, A> StateClearCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -995,10 +996,10 @@ impl<'a, C, A> StateClearCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1031,7 +1032,7 @@ impl<'a, C, A> StateClearCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *state key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn state_key(mut self, new_value: i32) -> StateClearCall<'a, C, A> { self._state_key = new_value; @@ -1056,12 +1057,12 @@ impl<'a, C, A> StateClearCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1078,17 +1079,17 @@ impl<'a, C, A> StateClearCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StateClearCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StateClearCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1151,7 +1152,7 @@ impl<'a, C, A> StateListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appstate.states.list", + dlg.begin(MethodInfo { id: "appstate.states.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if let Some(value) = self._include_data { @@ -1174,7 +1175,7 @@ impl<'a, C, A> StateListCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1210,7 +1211,7 @@ impl<'a, C, A> StateListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1220,10 +1221,10 @@ impl<'a, C, A> StateListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1271,12 +1272,12 @@ impl<'a, C, A> StateListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1293,17 +1294,17 @@ impl<'a, C, A> StateListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StateListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StateListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1374,7 +1375,7 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "appstate.states.update", + dlg.begin(MethodInfo { id: "appstate.states.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("stateKey", self._state_key.to_string())); @@ -1419,14 +1420,14 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1470,7 +1471,7 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1480,10 +1481,10 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1515,7 +1516,7 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UpdateRequest) -> StateUpdateCall<'a, C, A> { self._request = new_value; @@ -1525,7 +1526,7 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *state key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn state_key(mut self, new_value: i32) -> StateUpdateCall<'a, C, A> { self._state_key = new_value; @@ -1550,12 +1551,12 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1572,17 +1573,17 @@ impl<'a, C, A> StateUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StateUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StateUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/audit1-cli/Cargo.toml b/gen/audit1-cli/Cargo.toml index 49c1f2e562..93b85f5f65 100644 --- a/gen/audit1-cli/Cargo.toml +++ b/gen/audit1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-audit1-cli" -version = "0.3.2+20150419" +version = "0.3.3+20150419" authors = ["Sebastian Thiel "] description = "A complete library to interact with audit (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/audit1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/audit1-cli/LICENSE.md b/gen/audit1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/audit1-cli/LICENSE.md +++ b/gen/audit1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/audit1-cli/README.md b/gen/audit1-cli/README.md index a2ecf27800..3527b09902 100644 --- a/gen/audit1-cli/README.md +++ b/gen/audit1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *audit* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/audit1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/audit1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/audit1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/audit1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/audit1-cli). # Usage -This documentation was generated from the *audit* API at revision *20150419*. The CLI is at version *0.3.2*. +This documentation was generated from the *audit* API at revision *20150419*. The CLI is at version *0.3.3*. ```bash audit1 [options] @@ -34,14 +34,14 @@ audit1 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/audit1-cli/mkdocs.yml b/gen/audit1-cli/mkdocs.yml index 662ccdebb5..4e34da2210 100644 --- a/gen/audit1-cli/mkdocs.yml +++ b/gen/audit1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: audit v0.3.2+20150419 +site_name: audit v0.3.3+20150419 site_url: http://byron.github.io/google-apis-rs/google-audit1-cli site_description: Write integrating applications with bcore @@ -13,5 +13,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/audit1-cli/src/main.rs b/gen/audit1-cli/src/main.rs index a7b0d0f7ba..3b9c50e809 100644 --- a/gen/audit1-cli/src/main.rs +++ b/gen/audit1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Audit>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _activities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.activities().list(opt.value_of("customer-id").unwrap_or(""), opt.value_of("application-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-time" => { @@ -88,7 +88,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["actor-email", "actor-application-id", "actor-ip-address", "caller", "max-results", "event-name", "start-time", "end-time", "continuation-token"].iter().map(|v|*v)); @@ -155,14 +155,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "audit1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "audit1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -182,7 +182,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -221,7 +221,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("activities", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of activities for a specific customer and application."##), "Details at http://byron.github.io/google-apis-rs/google_audit1_cli/activities_list", vec![ @@ -255,7 +255,7 @@ fn main() { let mut app = App::new("audit1") .author("Sebastian Thiel ") - .version("0.3.2+20150419") + .version("0.3.3+20150419") .about("Lets you access user activities in your enterprise made through various applications.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_audit1_cli") .arg(Arg::with_name("folder") @@ -274,7 +274,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -285,7 +285,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/audit1/Cargo.toml b/gen/audit1/Cargo.toml index 4a7921bf44..1a62297c28 100644 --- a/gen/audit1/Cargo.toml +++ b/gen/audit1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-audit1" -version = "0.1.10+20150419" +version = "0.1.11+20150419" authors = ["Sebastian Thiel "] description = "A complete library to interact with audit (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/audit1" diff --git a/gen/audit1/LICENSE.md b/gen/audit1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/audit1/LICENSE.md +++ b/gen/audit1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/audit1/README.md b/gen/audit1/README.md index 1678d09eb5..144046a57b 100644 --- a/gen/audit1/README.md +++ b/gen/audit1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-audit1` library allows access to all features of the *Google audit* service. -This documentation was generated from *audit* crate version *0.1.10+20150419*, where *20150419* is the exact revision of the *audit:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *audit* crate version *0.1.11+20150419*, where *20150419* is the exact revision of the *audit:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *audit* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/admin-audit/get_started). diff --git a/gen/audit1/src/cmn.rs b/gen/audit1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/audit1/src/cmn.rs +++ b/gen/audit1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/audit1/src/lib.rs b/gen/audit1/src/lib.rs index dd147c1df2..ae24714e04 100644 --- a/gen/audit1/src/lib.rs +++ b/gen/audit1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *audit* crate version *0.1.10+20150419*, where *20150419* is the exact revision of the *audit:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *audit* crate version *0.1.11+20150419*, where *20150419* is the exact revision of the *audit:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *audit* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/admin-audit/get_started). diff --git a/gen/audit1/src/lib.rs.in b/gen/audit1/src/lib.rs.in index 594ffc6136..a3a40f1b1f 100644 --- a/gen/audit1/src/lib.rs.in +++ b/gen/audit1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -113,7 +114,7 @@ impl<'a, C, A> Audit Audit { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -122,7 +123,7 @@ impl<'a, C, A> Audit } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -414,7 +415,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "audit.activities.list", + dlg.begin(MethodInfo { id: "audit.activities.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -493,7 +494,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -514,7 +515,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -524,10 +525,10 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -560,7 +561,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *customer id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn customer_id(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -570,7 +571,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *application id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn application_id(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { self._application_id = new_value.to_string(); @@ -651,12 +652,12 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/autoscaler1_beta2-cli/Cargo.toml b/gen/autoscaler1_beta2-cli/Cargo.toml index 22699daee0..31a1de902a 100644 --- a/gen/autoscaler1_beta2-cli/Cargo.toml +++ b/gen/autoscaler1_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-autoscaler1_beta2-cli" -version = "0.3.2+20150629" +version = "0.3.3+20150629" authors = ["Sebastian Thiel "] description = "A complete library to interact with autoscaler (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/autoscaler1_beta2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/autoscaler1_beta2-cli/LICENSE.md b/gen/autoscaler1_beta2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/autoscaler1_beta2-cli/LICENSE.md +++ b/gen/autoscaler1_beta2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/autoscaler1_beta2-cli/README.md b/gen/autoscaler1_beta2-cli/README.md index 052c85dc41..548c59cef9 100644 --- a/gen/autoscaler1_beta2-cli/README.md +++ b/gen/autoscaler1_beta2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *autoscaler* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/autoscaler1-beta2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/autoscaler1-beta2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/autoscaler1-beta2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/autoscaler1-beta2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/autoscaler1_beta2-cli). # Usage -This documentation was generated from the *autoscaler* API at revision *20150629*. The CLI is at version *0.3.2*. +This documentation was generated from the *autoscaler* API at revision *20150629*. The CLI is at version *0.3.3*. ```bash autoscaler1-beta2 [options] @@ -45,18 +45,18 @@ autoscaler1-beta2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/autoscaler1_beta2-cli/mkdocs.yml b/gen/autoscaler1_beta2-cli/mkdocs.yml index 4fb165eee2..c3ddb9e841 100644 --- a/gen/autoscaler1_beta2-cli/mkdocs.yml +++ b/gen/autoscaler1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: autoscaler v0.3.2+20150629 +site_name: autoscaler v0.3.3+20150629 site_url: http://byron.github.io/google-apis-rs/google-autoscaler1_beta2-cli site_description: Write integrating applications with bcore @@ -22,5 +22,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/autoscaler1_beta2-cli/src/main.rs b/gen/autoscaler1_beta2-cli/src/main.rs index 3ab912e95a..9ba4514d9e 100644 --- a/gen/autoscaler1_beta2-cli/src/main.rs +++ b/gen/autoscaler1_beta2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::AutoscalerHub>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _autoscalers_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _autoscalers_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.autoscalers().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("autoscaler").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.autoscalers().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("autoscaler").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -149,13 +149,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -169,8 +169,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -196,7 +196,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Autoscaler = json::value::from_value(object).unwrap(); let mut call = self.hub.autoscalers().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -209,7 +209,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -222,7 +222,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -245,10 +245,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.autoscalers().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -270,7 +270,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -284,7 +284,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -307,13 +307,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -327,8 +327,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -354,7 +354,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Autoscaler = json::value::from_value(object).unwrap(); let mut call = self.hub.autoscalers().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("autoscaler").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -367,7 +367,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -380,7 +380,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -403,13 +403,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -423,8 +423,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -450,7 +450,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Autoscaler = json::value::from_value(object).unwrap(); let mut call = self.hub.autoscalers().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("autoscaler").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -463,7 +463,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -476,7 +476,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -499,10 +499,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -515,7 +515,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -528,7 +528,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -543,10 +543,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -559,7 +559,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -572,7 +572,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -595,10 +595,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -620,7 +620,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -634,7 +634,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -657,10 +657,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zones_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zones_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zones().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -682,7 +682,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -696,7 +696,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -795,14 +795,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "autoscaler1-beta2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "autoscaler1-beta2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -822,7 +822,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -861,7 +861,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("autoscalers", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified Autoscaler resource."##), "Details at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli/autoscalers_delete", vec![ @@ -895,7 +895,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets the specified Autoscaler resource."##), "Details at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli/autoscalers_get", vec![ @@ -929,7 +929,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Adds new Autoscaler resource."##), "Details at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli/autoscalers_insert", vec![ @@ -963,7 +963,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all Autoscaler resources in this zone."##), "Details at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli/autoscalers_list", vec![ @@ -991,7 +991,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update the entire content of the Autoscaler resource. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli/autoscalers_patch", vec![ @@ -1031,7 +1031,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update the entire content of the Autoscaler resource."##), "Details at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli/autoscalers_update", vec![ @@ -1074,7 +1074,7 @@ fn main() { ]), ("zone-operations", "methods: 'delete', 'get' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified zone-specific operation resource."##), "Details at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli/zone-operations_delete", vec![ @@ -1102,7 +1102,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves the specified zone-specific operation resource."##), "Details at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli/zone-operations_get", vec![ @@ -1136,7 +1136,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of operation resources contained within the specified zone."##), "Details at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli/zone-operations_list", vec![ @@ -1167,7 +1167,7 @@ fn main() { ]), ("zones", "methods: 'list'", vec![ - ("list", + ("list", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli/zones_list", vec![ @@ -1195,7 +1195,7 @@ fn main() { let mut app = App::new("autoscaler1-beta2") .author("Sebastian Thiel ") - .version("0.3.2+20150629") + .version("0.3.3+20150629") .about("The Google Compute Engine Autoscaler API provides autoscaling for groups of Cloud VMs.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_autoscaler1_beta2_cli") .arg(Arg::with_name("url") @@ -1219,7 +1219,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1230,7 +1230,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/autoscaler1_beta2/Cargo.toml b/gen/autoscaler1_beta2/Cargo.toml index d5517de55b..74287a7094 100644 --- a/gen/autoscaler1_beta2/Cargo.toml +++ b/gen/autoscaler1_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-autoscaler1_beta2" -version = "0.1.10+20150629" +version = "0.1.11+20150629" authors = ["Sebastian Thiel "] description = "A complete library to interact with autoscaler (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/autoscaler1_beta2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/autoscaler1_beta2/LICENSE.md b/gen/autoscaler1_beta2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/autoscaler1_beta2/LICENSE.md +++ b/gen/autoscaler1_beta2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/autoscaler1_beta2/README.md b/gen/autoscaler1_beta2/README.md index 0468e26642..d8d3a2f2a1 100644 --- a/gen/autoscaler1_beta2/README.md +++ b/gen/autoscaler1_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-autoscaler1_beta2` library allows access to all features of the *Google autoscaler* service. -This documentation was generated from *autoscaler* crate version *0.1.10+20150629*, where *20150629* is the exact revision of the *autoscaler:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *autoscaler* crate version *0.1.11+20150629*, where *20150629* is the exact revision of the *autoscaler:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *autoscaler* *v1_beta2* API can be found at the [official documentation site](http://developers.google.com/compute/docs/autoscaler). diff --git a/gen/autoscaler1_beta2/src/cmn.rs b/gen/autoscaler1_beta2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/autoscaler1_beta2/src/cmn.rs +++ b/gen/autoscaler1_beta2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/autoscaler1_beta2/src/lib.rs b/gen/autoscaler1_beta2/src/lib.rs index e858f997b8..38fe6d50fc 100644 --- a/gen/autoscaler1_beta2/src/lib.rs +++ b/gen/autoscaler1_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *autoscaler* crate version *0.1.10+20150629*, where *20150629* is the exact revision of the *autoscaler:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *autoscaler* crate version *0.1.11+20150629*, where *20150629* is the exact revision of the *autoscaler:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *autoscaler* *v1_beta2* API can be found at the //! [official documentation site](http://developers.google.com/compute/docs/autoscaler). diff --git a/gen/autoscaler1_beta2/src/lib.rs.in b/gen/autoscaler1_beta2/src/lib.rs.in index b590da4ce8..5423e3f9c4 100644 --- a/gen/autoscaler1_beta2/src/lib.rs.in +++ b/gen/autoscaler1_beta2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -133,7 +134,7 @@ impl<'a, C, A> AutoscalerHub AutoscalerHub { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -148,7 +149,7 @@ impl<'a, C, A> AutoscalerHub } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -992,7 +993,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "autoscaler.zones.list", + dlg.begin(MethodInfo { id: "autoscaler.zones.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1043,7 +1044,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1079,7 +1080,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1089,10 +1090,10 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1124,7 +1125,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1160,12 +1161,12 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1182,17 +1183,17 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ComputeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1261,7 +1262,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "autoscaler.zoneOperations.list", + dlg.begin(MethodInfo { id: "autoscaler.zoneOperations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1313,7 +1314,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1349,7 +1350,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1359,10 +1360,10 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1394,7 +1395,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1403,7 +1404,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1439,12 +1440,12 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1461,17 +1462,17 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ComputeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1535,7 +1536,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "autoscaler.zoneOperations.delete", + dlg.begin(MethodInfo { id: "autoscaler.zoneOperations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1578,7 +1579,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1614,7 +1615,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1624,10 +1625,10 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -1658,7 +1659,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1667,7 +1668,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> { self._operation = new_value.to_string(); @@ -1685,12 +1686,12 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ZoneOperationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1781,7 +1782,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "autoscaler.zoneOperations.get", + dlg.begin(MethodInfo { id: "autoscaler.zoneOperations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1825,7 +1826,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1861,7 +1862,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1871,10 +1872,10 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1906,7 +1907,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -1915,7 +1916,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1924,7 +1925,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *operation* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operation(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -1942,12 +1943,12 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1964,17 +1965,17 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ComputeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2043,7 +2044,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "autoscaler.autoscalers.list", + dlg.begin(MethodInfo { id: "autoscaler.autoscalers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2095,7 +2096,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2131,7 +2132,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2141,10 +2142,10 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2177,7 +2178,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2187,7 +2188,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerListCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2223,12 +2224,12 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2245,17 +2246,17 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ComputeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2326,7 +2327,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "autoscaler.autoscalers.update", + dlg.begin(MethodInfo { id: "autoscaler.autoscalers.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2370,14 +2371,14 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2421,7 +2422,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2431,10 +2432,10 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2466,7 +2467,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Autoscaler) -> AutoscalerUpdateCall<'a, C, A> { self._request = new_value; @@ -2476,7 +2477,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -2486,7 +2487,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerUpdateCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2496,7 +2497,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *autoscaler* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn autoscaler(mut self, new_value: &str) -> AutoscalerUpdateCall<'a, C, A> { self._autoscaler = new_value.to_string(); @@ -2514,12 +2515,12 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2536,17 +2537,17 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Compute`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2617,7 +2618,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "autoscaler.autoscalers.patch", + dlg.begin(MethodInfo { id: "autoscaler.autoscalers.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2661,14 +2662,14 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2712,7 +2713,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2722,10 +2723,10 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2757,7 +2758,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Autoscaler) -> AutoscalerPatchCall<'a, C, A> { self._request = new_value; @@ -2767,7 +2768,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerPatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -2777,7 +2778,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerPatchCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2787,7 +2788,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *autoscaler* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn autoscaler(mut self, new_value: &str) -> AutoscalerPatchCall<'a, C, A> { self._autoscaler = new_value.to_string(); @@ -2805,12 +2806,12 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2827,17 +2828,17 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Compute`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2901,7 +2902,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "autoscaler.autoscalers.delete", + dlg.begin(MethodInfo { id: "autoscaler.autoscalers.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2945,7 +2946,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2981,7 +2982,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2991,10 +2992,10 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3027,7 +3028,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -3037,7 +3038,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3047,7 +3048,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *autoscaler* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn autoscaler(mut self, new_value: &str) -> AutoscalerDeleteCall<'a, C, A> { self._autoscaler = new_value.to_string(); @@ -3065,12 +3066,12 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3087,17 +3088,17 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Compute`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3167,7 +3168,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "autoscaler.autoscalers.insert", + dlg.begin(MethodInfo { id: "autoscaler.autoscalers.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3210,14 +3211,14 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3261,7 +3262,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3271,10 +3272,10 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3306,7 +3307,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Autoscaler) -> AutoscalerInsertCall<'a, C, A> { self._request = new_value; @@ -3316,7 +3317,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -3326,7 +3327,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerInsertCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3344,12 +3345,12 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3366,17 +3367,17 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Compute`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3440,7 +3441,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "autoscaler.autoscalers.get", + dlg.begin(MethodInfo { id: "autoscaler.autoscalers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3484,7 +3485,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3520,7 +3521,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3530,10 +3531,10 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3566,7 +3567,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -3576,7 +3577,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3586,7 +3587,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *autoscaler* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn autoscaler(mut self, new_value: &str) -> AutoscalerGetCall<'a, C, A> { self._autoscaler = new_value.to_string(); @@ -3604,12 +3605,12 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3626,17 +3627,17 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ComputeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/bigquery2-cli/Cargo.toml b/gen/bigquery2-cli/Cargo.toml index 2e720d510e..a35bae4081 100644 --- a/gen/bigquery2-cli/Cargo.toml +++ b/gen/bigquery2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-bigquery2-cli" -version = "0.3.2+20151009" +version = "0.3.3+20160127" authors = ["Sebastian Thiel "] description = "A complete library to interact with bigquery (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/bigquery2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/bigquery2-cli/LICENSE.md b/gen/bigquery2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/bigquery2-cli/LICENSE.md +++ b/gen/bigquery2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/bigquery2-cli/README.md b/gen/bigquery2-cli/README.md index 7e78398791..54d92409e2 100644 --- a/gen/bigquery2-cli/README.md +++ b/gen/bigquery2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *bigquery* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/bigquery2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/bigquery2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/bigquery2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/bigquery2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/bigquery2-cli). # Usage -This documentation was generated from the *bigquery* API at revision *20151009*. The CLI is at version *0.3.2*. +This documentation was generated from the *bigquery* API at revision *20160127*. The CLI is at version *0.3.3*. ```bash bigquery2 [options] @@ -58,18 +58,18 @@ bigquery2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/bigquery2-cli/mkdocs.yml b/gen/bigquery2-cli/mkdocs.yml index 5738978d47..77ffba662c 100644 --- a/gen/bigquery2-cli/mkdocs.yml +++ b/gen/bigquery2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: bigquery v0.3.2+20151009 +site_name: bigquery v0.3.3+20160127 site_url: http://byron.github.io/google-apis-rs/google-bigquery2-cli site_description: Write integrating applications with bcore @@ -33,5 +33,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/bigquery2-cli/src/main.rs b/gen/bigquery2-cli/src/main.rs index e8ce41b13b..d0df3e52e0 100644 --- a/gen/bigquery2-cli/src/main.rs +++ b/gen/bigquery2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Bigquery>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _datasets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _datasets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datasets().delete(opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "delete-contents" => { @@ -64,7 +64,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["delete-contents"].iter().map(|v|*v)); @@ -78,7 +78,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -93,10 +93,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datasets().get(opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -109,7 +109,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -122,7 +122,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -145,13 +145,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -165,8 +165,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -192,7 +192,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Dataset = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().insert(request, opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -205,7 +205,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -218,7 +218,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -241,10 +241,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datasets().list(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -266,7 +266,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "all", "max-results"].iter().map(|v|*v)); @@ -280,7 +280,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -303,13 +303,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -323,8 +323,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -350,7 +350,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Dataset = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().patch(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -363,7 +363,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -376,7 +376,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -399,13 +399,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -419,8 +419,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -446,7 +446,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Dataset = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().update(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -459,7 +459,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -472,7 +472,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -495,10 +495,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_cancel(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().cancel(opt.value_of("project-id").unwrap_or(""), opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -511,7 +511,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -524,7 +524,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -547,10 +547,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().get(opt.value_of("project-id").unwrap_or(""), opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -563,7 +563,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -576,7 +576,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -599,10 +599,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_get_query_results(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_get_query_results(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().get_query_results(opt.value_of("project-id").unwrap_or(""), opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "timeout-ms" => { @@ -627,7 +627,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["timeout-ms", "page-token", "start-index", "max-results"].iter().map(|v|*v)); @@ -641,7 +641,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -664,13 +664,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -684,8 +684,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.state" => Some(("status.state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.error-result.debug-info" => Some(("status.errorResult.debugInfo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -728,14 +728,26 @@ impl<'n, 'a> Engine<'n, 'a> { "configuration.load.allow-quoted-newlines" => Some(("configuration.load.allowQuotedNewlines", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.load.projection-fields" => Some(("configuration.load.projectionFields", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "configuration.load.ignore-unknown-values" => Some(("configuration.load.ignoreUnknownValues", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "configuration.extract.destination-uri" => Some(("configuration.extract.destinationUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.compression" => Some(("configuration.extract.compression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.field-delimiter" => Some(("configuration.extract.fieldDelimiter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.destination-format" => Some(("configuration.extract.destinationFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.print-header" => Some(("configuration.extract.printHeader", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "configuration.extract.destination-uris" => Some(("configuration.extract.destinationUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "configuration.extract.source-table.project-id" => Some(("configuration.extract.sourceTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.source-table.table-id" => Some(("configuration.extract.sourceTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.extract.source-table.dataset-id" => Some(("configuration.extract.sourceTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.create-disposition" => Some(("configuration.copy.createDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.write-disposition" => Some(("configuration.copy.writeDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.destination-table.project-id" => Some(("configuration.copy.destinationTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.destination-table.table-id" => Some(("configuration.copy.destinationTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.destination-table.dataset-id" => Some(("configuration.copy.destinationTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.source-table.project-id" => Some(("configuration.copy.sourceTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.source-table.table-id" => Some(("configuration.copy.sourceTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "configuration.copy.source-table.dataset-id" => Some(("configuration.copy.sourceTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.dry-run" => Some(("configuration.dryRun", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "configuration.link.create-disposition" => Some(("configuration.link.createDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.link.write-disposition" => Some(("configuration.link.writeDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.link.destination-table.project-id" => Some(("configuration.link.destinationTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.link.destination-table.table-id" => Some(("configuration.link.destinationTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.link.destination-table.dataset-id" => Some(("configuration.link.destinationTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.link.source-uri" => Some(("configuration.link.sourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "configuration.query.flatten-results" => Some(("configuration.query.flattenResults", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "configuration.query.maximum-billing-tier" => Some(("configuration.query.maximumBillingTier", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "configuration.query.use-query-cache" => Some(("configuration.query.useQueryCache", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "configuration.query.default-dataset.project-id" => Some(("configuration.query.defaultDataset.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.default-dataset.dataset-id" => Some(("configuration.query.defaultDataset.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -748,27 +760,10 @@ impl<'n, 'a> Engine<'n, 'a> { "configuration.query.create-disposition" => Some(("configuration.query.createDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.query" => Some(("configuration.query.query", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "configuration.query.preserve-nulls" => Some(("configuration.query.preserveNulls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "configuration.copy.create-disposition" => Some(("configuration.copy.createDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.write-disposition" => Some(("configuration.copy.writeDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.destination-table.project-id" => Some(("configuration.copy.destinationTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.destination-table.table-id" => Some(("configuration.copy.destinationTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.destination-table.dataset-id" => Some(("configuration.copy.destinationTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.source-table.project-id" => Some(("configuration.copy.sourceTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.source-table.table-id" => Some(("configuration.copy.sourceTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.copy.source-table.dataset-id" => Some(("configuration.copy.sourceTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.destination-uri" => Some(("configuration.extract.destinationUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.compression" => Some(("configuration.extract.compression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.field-delimiter" => Some(("configuration.extract.fieldDelimiter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.destination-format" => Some(("configuration.extract.destinationFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.print-header" => Some(("configuration.extract.printHeader", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "configuration.extract.destination-uris" => Some(("configuration.extract.destinationUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "configuration.extract.source-table.project-id" => Some(("configuration.extract.sourceTable.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.source-table.table-id" => Some(("configuration.extract.sourceTable.tableId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "configuration.extract.source-table.dataset-id" => Some(("configuration.extract.sourceTable.datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-large-results", "allow-quoted-newlines", "billing-tier", "cache-hit", "compression", "configuration", "copy", "create-disposition", "creation-time", "dataset-id", "debug-info", "default-dataset", "destination-format", "destination-table", "destination-uri", "destination-uri-file-counts", "destination-uris", "dry-run", "encoding", "end-time", "error-result", "etag", "extract", "field-delimiter", "flatten-results", "id", "ignore-unknown-values", "input-file-bytes", "input-files", "job-id", "job-reference", "kind", "link", "load", "location", "max-bad-records", "message", "output-bytes", "output-rows", "preserve-nulls", "print-header", "priority", "project-id", "projection-fields", "query", "quote", "reason", "schema-inline", "schema-inline-format", "self-link", "skip-leading-rows", "source-format", "source-table", "source-uri", "source-uris", "start-time", "state", "statistics", "status", "table-id", "total-bytes-billed", "total-bytes-processed", "use-query-cache", "user-email", "write-disposition"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-jagged-rows", "allow-large-results", "allow-quoted-newlines", "billing-tier", "cache-hit", "compression", "configuration", "copy", "create-disposition", "creation-time", "dataset-id", "debug-info", "default-dataset", "destination-format", "destination-table", "destination-uri", "destination-uri-file-counts", "destination-uris", "dry-run", "encoding", "end-time", "error-result", "etag", "extract", "field-delimiter", "flatten-results", "id", "ignore-unknown-values", "input-file-bytes", "input-files", "job-id", "job-reference", "kind", "load", "location", "max-bad-records", "maximum-billing-tier", "message", "output-bytes", "output-rows", "preserve-nulls", "print-header", "priority", "project-id", "projection-fields", "query", "quote", "reason", "schema-inline", "schema-inline-format", "self-link", "skip-leading-rows", "source-format", "source-table", "source-uris", "start-time", "state", "statistics", "status", "table-id", "total-bytes-billed", "total-bytes-processed", "use-query-cache", "user-email", "write-disposition"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -779,7 +774,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Job = json::value::from_value(object).unwrap(); let mut call = self.hub.jobs().insert(request, opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -792,7 +787,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -800,7 +795,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -808,7 +803,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -832,10 +827,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().list(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "state-filter" => { @@ -863,7 +858,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "all-users", "max-results", "projection", "state-filter"].iter().map(|v|*v)); @@ -877,7 +872,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -900,13 +895,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -920,8 +915,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "timeout-ms" => Some(("timeoutMs", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -944,7 +939,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::QueryRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.jobs().query(request, opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -957,7 +952,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -970,7 +965,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -993,10 +988,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1015,7 +1010,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1029,7 +1024,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1052,13 +1047,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tabledata_insert_all(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tabledata_insert_all(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1072,14 +1067,15 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ignore-unknown-values" => Some(("ignoreUnknownValues", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "template-suffix" => Some(("templateSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "skip-invalid-rows" => Some(("skipInvalidRows", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["ignore-unknown-values", "kind", "skip-invalid-rows"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["ignore-unknown-values", "kind", "skip-invalid-rows", "template-suffix"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1090,7 +1086,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TableDataInsertAllRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.tabledata().insert_all(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or(""), opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1103,7 +1099,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1116,7 +1112,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1139,10 +1135,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tabledata_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tabledata_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tabledata().list(opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or(""), opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -1164,7 +1160,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "start-index", "max-results"].iter().map(|v|*v)); @@ -1178,7 +1174,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1201,10 +1197,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().delete(opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or(""), opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1217,7 +1213,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1230,7 +1226,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1245,10 +1241,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().get(opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or(""), opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1261,7 +1257,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1274,7 +1270,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1297,13 +1293,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1317,8 +1313,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "expiration-time" => Some(("expirationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1363,7 +1359,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Table = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().insert(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1376,7 +1372,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1389,7 +1385,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1412,10 +1408,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().list(opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1434,7 +1430,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1448,7 +1444,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1471,13 +1467,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1491,8 +1487,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "expiration-time" => Some(("expirationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1537,7 +1533,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Table = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().patch(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or(""), opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1550,7 +1546,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1563,7 +1559,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1586,13 +1582,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1606,8 +1602,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "expiration-time" => Some(("expirationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1652,7 +1648,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Table = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().update(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or(""), opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1665,7 +1661,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1678,7 +1674,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1826,14 +1822,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "bigquery2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "bigquery2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1853,7 +1849,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1893,7 +1889,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("datasets", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/datasets_delete", vec![ @@ -1915,7 +1911,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns the dataset specified by datasetID."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/datasets_get", vec![ @@ -1943,7 +1939,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new empty dataset."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/datasets_insert", vec![ @@ -1971,7 +1967,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all datasets in the specified project to which you have been granted the READER dataset role."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/datasets_list", vec![ @@ -1993,7 +1989,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/datasets_patch", vec![ @@ -2027,7 +2023,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/datasets_update", vec![ @@ -2064,19 +2060,19 @@ fn main() { ]), ("jobs", "methods: 'cancel', 'get', 'get-query-results', 'insert', 'list' and 'query'", vec![ - ("cancel", + ("cancel", Some(r##"Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/jobs_cancel", vec![ (Some(r##"project-id"##), None, - Some(r##"Project ID of the job to cancel"##), + Some(r##"[Required] Project ID of the job to cancel"##), Some(true), Some(false)), (Some(r##"job-id"##), None, - Some(r##"Job ID of the job to cancel"##), + Some(r##"[Required] Job ID of the job to cancel"##), Some(true), Some(false)), @@ -2092,19 +2088,19 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/jobs_get", vec![ (Some(r##"project-id"##), None, - Some(r##"Project ID of the requested job"##), + Some(r##"[Required] Project ID of the requested job"##), Some(true), Some(false)), (Some(r##"job-id"##), None, - Some(r##"Job ID of the requested job"##), + Some(r##"[Required] Job ID of the requested job"##), Some(true), Some(false)), @@ -2120,19 +2116,19 @@ fn main() { Some(false), Some(false)), ]), - ("get-query-results", + ("get-query-results", Some(r##"Retrieves the results of a query job."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/jobs_get-query-results", vec![ (Some(r##"project-id"##), None, - Some(r##"Project ID of the query job"##), + Some(r##"[Required] Project ID of the query job"##), Some(true), Some(false)), (Some(r##"job-id"##), None, - Some(r##"Job ID of the query job"##), + Some(r##"[Required] Job ID of the query job"##), Some(true), Some(false)), @@ -2148,7 +2144,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Starts a new asynchronous job. Requires the Can View project role."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/jobs_insert", vec![ @@ -2182,7 +2178,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/jobs_list", vec![ @@ -2204,7 +2200,7 @@ fn main() { Some(false), Some(false)), ]), - ("query", + ("query", Some(r##"Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/jobs_query", vec![ @@ -2235,7 +2231,7 @@ fn main() { ]), ("projects", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Lists all projects to which you have been granted any project role."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/projects_list", vec![ @@ -2254,7 +2250,7 @@ fn main() { ]), ("tabledata", "methods: 'insert-all' and 'list'", vec![ - ("insert-all", + ("insert-all", Some(r##"Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/tabledata_insert-all", vec![ @@ -2294,7 +2290,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves table data from a specified set of rows. Requires the READER dataset role."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/tabledata_list", vec![ @@ -2331,7 +2327,7 @@ fn main() { ]), ("tables", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/tables_delete", vec![ @@ -2359,7 +2355,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/tables_get", vec![ @@ -2393,7 +2389,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new, empty table in the dataset."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/tables_insert", vec![ @@ -2427,7 +2423,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all tables in the specified dataset. Requires the READER dataset role."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/tables_list", vec![ @@ -2455,7 +2451,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/tables_patch", vec![ @@ -2495,7 +2491,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource."##), "Details at http://byron.github.io/google-apis-rs/google_bigquery2_cli/tables_update", vec![ @@ -2541,7 +2537,7 @@ fn main() { let mut app = App::new("bigquery2") .author("Sebastian Thiel ") - .version("0.3.2+20151009") + .version("0.3.3+20160127") .about("A data platform for customers to create, manage, share and query data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_bigquery2_cli") .arg(Arg::with_name("url") @@ -2565,7 +2561,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -2576,7 +2572,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/bigquery2/Cargo.toml b/gen/bigquery2/Cargo.toml index 7a7b738da4..1b614a4ba3 100644 --- a/gen/bigquery2/Cargo.toml +++ b/gen/bigquery2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-bigquery2" -version = "0.1.10+20151009" +version = "0.1.11+20160127" authors = ["Sebastian Thiel "] description = "A complete library to interact with bigquery (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/bigquery2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/bigquery2/LICENSE.md b/gen/bigquery2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/bigquery2/LICENSE.md +++ b/gen/bigquery2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/bigquery2/README.md b/gen/bigquery2/README.md index 4a2f2e04de..6e65138487 100644 --- a/gen/bigquery2/README.md +++ b/gen/bigquery2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-bigquery2` library allows access to all features of the *Google bigquery* service. -This documentation was generated from *bigquery* crate version *0.1.10+20151009*, where *20151009* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *bigquery* crate version *0.1.11+20160127*, where *20160127* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *bigquery* *v2* API can be found at the [official documentation site](https://cloud.google.com/bigquery/). diff --git a/gen/bigquery2/src/cmn.rs b/gen/bigquery2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/bigquery2/src/cmn.rs +++ b/gen/bigquery2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/bigquery2/src/lib.rs b/gen/bigquery2/src/lib.rs index 824bdb4a2d..7062655987 100644 --- a/gen/bigquery2/src/lib.rs +++ b/gen/bigquery2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *bigquery* crate version *0.1.10+20151009*, where *20151009* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *bigquery* crate version *0.1.11+20160127*, where *20160127* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *bigquery* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/bigquery/). diff --git a/gen/bigquery2/src/lib.rs.in b/gen/bigquery2/src/lib.rs.in index e330ec0f53..5ac07a611a 100644 --- a/gen/bigquery2/src/lib.rs.in +++ b/gen/bigquery2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -156,7 +157,7 @@ impl<'a, C, A> Bigquery Bigquery { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -177,7 +178,7 @@ impl<'a, C, A> Bigquery } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -275,6 +276,9 @@ pub struct JobStatistics2 { /// [Output-only] Total bytes billed for the job. #[serde(rename="totalBytesBilled")] pub total_bytes_billed: Option, + /// [Output-only, Experimental] Describes execution plan for the query as a list of stages. + #[serde(rename="queryPlan")] + pub query_plan: Option>, /// [Output-only] Total bytes processed for the job. #[serde(rename="totalBytesProcessed")] pub total_bytes_processed: Option, @@ -465,6 +469,53 @@ pub struct JobReference { impl Part for JobReference {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExplainQueryStage { + /// Relative amount of time the slowest shard spent on CPU-bound tasks. + #[serde(rename="computeRatioMax")] + pub compute_ratio_max: Option, + /// Human-readable name for stage. + pub name: Option, + /// Number of records written by the stage. + #[serde(rename="recordsWritten")] + pub records_written: Option, + /// Relative amount of time the slowest shard spent waiting to be scheduled. + #[serde(rename="waitRatioMax")] + pub wait_ratio_max: Option, + /// Relative amount of time the average shard spent reading input. + #[serde(rename="readRatioAvg")] + pub read_ratio_avg: Option, + /// Relative amount of time the slowest shard spent reading input. + #[serde(rename="readRatioMax")] + pub read_ratio_max: Option, + /// List of operations within the stage in dependency order (approximately chronological). + pub steps: Option>, + /// Number of records read into the stage. + #[serde(rename="recordsRead")] + pub records_read: Option, + /// Relative amount of time the average shard spent on CPU-bound tasks. + #[serde(rename="computeRatioAvg")] + pub compute_ratio_avg: Option, + /// Relative amount of time the slowest shard spent on writing output. + #[serde(rename="writeRatioMax")] + pub write_ratio_max: Option, + /// Relative amount of time the average shard spent waiting to be scheduled. + #[serde(rename="waitRatioAvg")] + pub wait_ratio_avg: Option, + /// Unique ID for stage within plan. + pub id: Option, + /// Relative amount of time the average shard spent on writing output. + #[serde(rename="writeRatioAvg")] + pub write_ratio_avg: Option, +} + +impl Part for ExplainQueryStage {} + + /// An array of the dataset resources in the project. Each resource contains basic information. For full information about a particular dataset resource, use the Datasets: get method. This property is omitted when there are no datasets in the project. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -719,7 +770,7 @@ pub struct JobConfigurationLoad { /// [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats. #[serde(rename="allowJaggedRows")] pub allow_jagged_rows: Option, - /// [Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (','). + /// [Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (','). #[serde(rename="fieldDelimiter")] pub field_delimiter: Option, /// [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default value is CSV. @@ -746,7 +797,7 @@ pub struct JobConfigurationLoad { /// [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT". #[serde(rename="schemaInline")] pub schema_inline: Option, - /// [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists or if the schema can be inferred from the loaded data. + /// [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore. pub schema: Option, } @@ -886,30 +937,45 @@ impl Part for CsvOptions {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ExternalDataConfiguration { - /// [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names + /// [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names Google Cloud Datastore backups: This setting is ignored. #[serde(rename="ignoreUnknownValues")] pub ignore_unknown_values: Option, - /// [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs. + /// [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs. For Google Cloud Datastore backups, exactly one URI can be specified, and it must end with '.backup_info'. Also, the '*' wildcard character is not allowed. #[serde(rename="sourceUris")] pub source_uris: Option>, - /// [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. + /// [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Datastore backups. pub compression: Option, /// Additional properties to set if sourceFormat is set to CSV. #[serde(rename="csvOptions")] pub csv_options: Option, - /// [Required] The data format. For CSV files, specify "CSV". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". + /// [Required] The data format. For CSV files, specify "CSV". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". #[serde(rename="sourceFormat")] pub source_format: Option, - /// [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid. + /// [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Datastore backups. #[serde(rename="maxBadRecords")] pub max_bad_records: Option, - /// [Required] The schema for the data. + /// [Optional] The schema for the data. Schema is required for CSV and JSON formats. Schema is disallowed for Google Cloud Datastore backups. pub schema: Option, } impl Part for ExternalDataConfiguration {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExplainQueryStep { + /// Machine-readable operation type. + pub kind: Option, + /// Human-readable stage descriptions. + pub substeps: Option>, +} + +impl Part for ExplainQueryStep {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -930,29 +996,6 @@ pub struct ErrorProto { impl Part for ErrorProto {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JobConfigurationLink { - /// [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion. - #[serde(rename="createDisposition")] - pub create_disposition: Option, - /// [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion. - #[serde(rename="writeDisposition")] - pub write_disposition: Option, - /// [Required] The destination table of the link job. - #[serde(rename="destinationTable")] - pub destination_table: Option, - /// [Required] URI of source table to link. - #[serde(rename="sourceUri")] - pub source_uri: Option>, -} - -impl Part for JobConfigurationLink {} - - /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -961,6 +1004,9 @@ impl Part for JobConfigurationLink {} pub struct ViewDefinition { /// [Required] A query that BigQuery executes when the view is referenced. pub query: Option, + /// [Experimental] Describes user-defined function resources used in the query. + #[serde(rename="userDefinedFunctionResources")] + pub user_defined_function_resources: Option>, } impl Part for ViewDefinition {} @@ -1063,6 +1109,9 @@ pub struct TableDataInsertAllRequest { /// [Optional] Insert all valid rows of a request, even if invalid rows exist. The default value is false, which causes the entire request to fail if any invalid rows exist. #[serde(rename="skipInvalidRows")] pub skip_invalid_rows: Option, + /// [Optional] If specified, treats the destination table as a base template, and inserts the rows into an instance table named "{destination}{templateSuffix}". BigQuery will manage creation of the instance table, using the schema of the base template table. See https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates tables. + #[serde(rename="templateSuffix")] + pub template_suffix: Option, } impl RequestValue for TableDataInsertAllRequest {} @@ -1131,6 +1180,9 @@ pub struct JobConfigurationQuery { /// [Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false. #[serde(rename="flattenResults")] pub flatten_results: Option, + /// [Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default. + #[serde(rename="maximumBillingTier")] + pub maximum_billing_tier: Option, /// [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true. #[serde(rename="useQueryCache")] pub use_query_cache: Option, @@ -1156,7 +1208,7 @@ pub struct JobConfigurationQuery { /// [Deprecated] This property is deprecated. #[serde(rename="preserveNulls")] pub preserve_nulls: Option, - /// [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. + /// [Optional] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. #[serde(rename="tableDefinitions")] pub table_definitions: Option>, /// [Experimental] Describes user-defined function resources used in the query. @@ -1208,14 +1260,12 @@ pub struct JobConfiguration { /// [Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined. #[serde(rename="dryRun")] pub dry_run: Option, - /// [Pick one] Configures a query job. - pub query: Option, - /// [Pick one] Configures a link job. - pub link: Option, /// [Pick one] Copies a table. pub copy: Option, /// [Pick one] Configures an extract job. pub extract: Option, + /// [Pick one] Configures a query job. + pub query: Option, } impl Part for JobConfiguration {} @@ -1320,7 +1370,7 @@ pub struct Table { /// [Output-only] Contains information regarding this table's streaming buffer, if one is present. This field will be absent if the table is not being streamed to or if there is no data in the streaming buffer. #[serde(rename="streamingBuffer")] pub streaming_buffer: Option, - /// [Experimental] Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. + /// [Optional] Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. #[serde(rename="externalDataConfiguration")] pub external_data_configuration: Option, /// [Required] Reference describing the ID of this table. @@ -1341,7 +1391,7 @@ pub struct Table { pub expiration_time: Option, /// [Optional] Describes the schema of this table. pub schema: Option, - /// [Output-only] Describes the table type. The following values are supported: TABLE: A normal BigQuery table. VIEW: A virtual table defined by a SQL query. The default value is TABLE. + /// [Output-only] Describes the table type. The following values are supported: TABLE: A normal BigQuery table. VIEW: A virtual table defined by a SQL query. EXTERNAL: A table that references data stored in an external storage system, such as Google Cloud Storage. The default value is TABLE. #[serde(rename="type")] pub type_: Option, /// [Output-only] A URL that can be used to access this resource again. @@ -1826,8 +1876,8 @@ impl<'a, C, A> JobMethods<'a, C, A> { /// /// # Arguments /// - /// * `projectId` - Project ID of the job to cancel - /// * `jobId` - Job ID of the job to cancel + /// * `projectId` - [Required] Project ID of the job to cancel + /// * `jobId` - [Required] Job ID of the job to cancel pub fn cancel(&self, project_id: &str, job_id: &str) -> JobCancelCall<'a, C, A> { JobCancelCall { hub: self.hub, @@ -1864,8 +1914,8 @@ impl<'a, C, A> JobMethods<'a, C, A> { /// /// # Arguments /// - /// * `projectId` - Project ID of the query job - /// * `jobId` - Job ID of the query job + /// * `projectId` - [Required] Project ID of the query job + /// * `jobId` - [Required] Job ID of the query job pub fn get_query_results(&self, project_id: &str, job_id: &str) -> JobGetQueryResultCall<'a, C, A> { JobGetQueryResultCall { hub: self.hub, @@ -1909,8 +1959,8 @@ impl<'a, C, A> JobMethods<'a, C, A> { /// /// # Arguments /// - /// * `projectId` - Project ID of the requested job - /// * `jobId` - Job ID of the requested job + /// * `projectId` - [Required] Project ID of the requested job + /// * `jobId` - [Required] Job ID of the requested job pub fn get(&self, project_id: &str, job_id: &str) -> JobGetCall<'a, C, A> { JobGetCall { hub: self.hub, @@ -2156,7 +2206,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.tables.update", + dlg.begin(MethodInfo { id: "bigquery.tables.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2200,14 +2250,14 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2251,7 +2301,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2261,10 +2311,10 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2296,7 +2346,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Table) -> TableUpdateCall<'a, C, A> { self._request = new_value; @@ -2306,7 +2356,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TableUpdateCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2316,7 +2366,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> TableUpdateCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -2326,7 +2376,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TableUpdateCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -2344,12 +2394,12 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2366,17 +2416,17 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2446,7 +2496,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.tables.insert", + dlg.begin(MethodInfo { id: "bigquery.tables.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2489,14 +2539,14 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2540,7 +2590,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2550,10 +2600,10 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2585,7 +2635,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Table) -> TableInsertCall<'a, C, A> { self._request = new_value; @@ -2595,7 +2645,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TableInsertCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2605,7 +2655,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> TableInsertCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -2623,12 +2673,12 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2645,17 +2695,17 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2722,7 +2772,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.tables.list", + dlg.begin(MethodInfo { id: "bigquery.tables.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2771,7 +2821,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2807,7 +2857,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2817,10 +2867,10 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2853,7 +2903,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TableListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2863,7 +2913,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> TableListCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -2895,12 +2945,12 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2917,17 +2967,17 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2991,7 +3041,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.tables.delete", + dlg.begin(MethodInfo { id: "bigquery.tables.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -3034,7 +3084,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3070,7 +3120,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3080,10 +3130,10 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3106,7 +3156,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TableDeleteCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -3116,7 +3166,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> TableDeleteCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -3126,7 +3176,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TableDeleteCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -3144,12 +3194,12 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3166,17 +3216,17 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3240,7 +3290,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.tables.get", + dlg.begin(MethodInfo { id: "bigquery.tables.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -3284,7 +3334,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3320,7 +3370,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3330,10 +3380,10 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3366,7 +3416,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TableGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -3376,7 +3426,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> TableGetCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -3386,7 +3436,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TableGetCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -3404,12 +3454,12 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3426,17 +3476,17 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3507,7 +3557,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.tables.patch", + dlg.begin(MethodInfo { id: "bigquery.tables.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -3551,14 +3601,14 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3602,7 +3652,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3612,10 +3662,10 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3647,7 +3697,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Table) -> TablePatchCall<'a, C, A> { self._request = new_value; @@ -3657,7 +3707,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TablePatchCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -3667,7 +3717,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> TablePatchCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -3677,7 +3727,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TablePatchCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -3695,12 +3745,12 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3717,17 +3767,17 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TablePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TablePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3797,7 +3847,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.datasets.patch", + dlg.begin(MethodInfo { id: "bigquery.datasets.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -3840,14 +3890,14 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3891,7 +3941,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3901,10 +3951,10 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3936,7 +3986,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Dataset) -> DatasetPatchCall<'a, C, A> { self._request = new_value; @@ -3946,7 +3996,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> DatasetPatchCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -3956,7 +4006,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetPatchCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -3974,12 +4024,12 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3996,17 +4046,17 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4069,7 +4119,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.datasets.get", + dlg.begin(MethodInfo { id: "bigquery.datasets.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -4112,7 +4162,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4148,7 +4198,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4158,10 +4208,10 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4194,7 +4244,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> DatasetGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -4204,7 +4254,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetGetCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -4222,12 +4272,12 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4244,17 +4294,17 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4322,7 +4372,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.datasets.list", + dlg.begin(MethodInfo { id: "bigquery.datasets.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -4373,7 +4423,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4409,7 +4459,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4419,10 +4469,10 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4455,7 +4505,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> DatasetListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -4494,12 +4544,12 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4516,17 +4566,17 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4596,7 +4646,7 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.datasets.update", + dlg.begin(MethodInfo { id: "bigquery.datasets.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -4639,14 +4689,14 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4690,7 +4740,7 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4700,10 +4750,10 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4735,7 +4785,7 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Dataset) -> DatasetUpdateCall<'a, C, A> { self._request = new_value; @@ -4745,7 +4795,7 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> DatasetUpdateCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -4755,7 +4805,7 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetUpdateCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -4773,12 +4823,12 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4795,17 +4845,17 @@ impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4870,7 +4920,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.datasets.delete", + dlg.begin(MethodInfo { id: "bigquery.datasets.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -4915,7 +4965,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4951,7 +5001,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4961,10 +5011,10 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4987,7 +5037,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> DatasetDeleteCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -4997,7 +5047,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetDeleteCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -5022,12 +5072,12 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5044,17 +5094,17 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5123,7 +5173,7 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.datasets.insert", + dlg.begin(MethodInfo { id: "bigquery.datasets.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -5165,14 +5215,14 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5216,7 +5266,7 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5226,10 +5276,10 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5261,7 +5311,7 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Dataset) -> DatasetInsertCall<'a, C, A> { self._request = new_value; @@ -5271,7 +5321,7 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> DatasetInsertCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -5289,12 +5339,12 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5311,17 +5361,17 @@ impl<'a, C, A> DatasetInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5384,7 +5434,7 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.jobs.cancel", + dlg.begin(MethodInfo { id: "bigquery.jobs.cancel", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -5427,7 +5477,7 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5463,7 +5513,7 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5473,10 +5523,10 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5505,21 +5555,21 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau } - /// Project ID of the job to cancel + /// [Required] Project ID of the job to cancel /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> JobCancelCall<'a, C, A> { self._project_id = new_value.to_string(); self } - /// Job ID of the job to cancel + /// [Required] Job ID of the job to cancel /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> JobCancelCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -5537,12 +5587,12 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5559,17 +5609,17 @@ impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobCancelCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobCancelCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5638,7 +5688,7 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.jobs.query", + dlg.begin(MethodInfo { id: "bigquery.jobs.query", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -5680,14 +5730,14 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5731,7 +5781,7 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5741,10 +5791,10 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5776,7 +5826,7 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: QueryRequest) -> JobQueryCall<'a, C, A> { self._request = new_value; @@ -5786,7 +5836,7 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> JobQueryCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -5804,12 +5854,12 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5826,17 +5876,17 @@ impl<'a, C, A> JobQueryCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobQueryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobQueryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5907,7 +5957,7 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.jobs.getQueryResults", + dlg.begin(MethodInfo { id: "bigquery.jobs.getQueryResults", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -5962,7 +6012,7 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5998,7 +6048,7 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6008,10 +6058,10 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6040,21 +6090,21 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut } - /// Project ID of the query job + /// [Required] Project ID of the query job /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> JobGetQueryResultCall<'a, C, A> { self._project_id = new_value.to_string(); self } - /// Job ID of the query job + /// [Required] Job ID of the query job /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> JobGetQueryResultCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -6100,12 +6150,12 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6122,17 +6172,17 @@ impl<'a, C, A> JobGetQueryResultCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobGetQueryResultCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobGetQueryResultCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6204,7 +6254,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.jobs.list", + dlg.begin(MethodInfo { id: "bigquery.jobs.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -6265,7 +6315,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6301,7 +6351,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6311,10 +6361,10 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6347,7 +6397,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> JobListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -6401,12 +6451,12 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6423,17 +6473,17 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6496,7 +6546,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.jobs.get", + dlg.begin(MethodInfo { id: "bigquery.jobs.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -6539,7 +6589,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6575,7 +6625,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6585,10 +6635,10 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6617,21 +6667,21 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } - /// Project ID of the requested job + /// [Required] Project ID of the requested job /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> JobGetCall<'a, C, A> { self._project_id = new_value.to_string(); self } - /// Job ID of the requested job + /// [Required] Job ID of the requested job /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> JobGetCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -6649,12 +6699,12 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6671,17 +6721,17 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6752,7 +6802,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.jobs.insert", + dlg.begin(MethodInfo { id: "bigquery.jobs.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -6768,13 +6818,13 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/bigquery/v2/projects/{projectId}/jobs".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/bigquery/v2/projects/{projectId}/jobs".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -6802,14 +6852,14 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6884,7 +6934,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6894,10 +6944,10 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6998,7 +7048,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Job) -> JobInsertCall<'a, C, A> { self._request = new_value; @@ -7008,7 +7058,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> JobInsertCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -7026,12 +7076,12 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7048,17 +7098,17 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7129,7 +7179,7 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.tabledata.insertAll", + dlg.begin(MethodInfo { id: "bigquery.tabledata.insertAll", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -7173,14 +7223,14 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7224,7 +7274,7 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7234,10 +7284,10 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut TabledataInsertAllCall<'a, C, A> where C: BorrowMut TabledataInsertAllCall<'a, C, A> { self._request = new_value; @@ -7279,7 +7329,7 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut TabledataInsertAllCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -7289,7 +7339,7 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut TabledataInsertAllCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -7299,7 +7349,7 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut TabledataInsertAllCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -7317,12 +7367,12 @@ impl<'a, C, A> TabledataInsertAllCall<'a, C, A> where C: BorrowMut TabledataInsertAllCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TabledataInsertAllCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TabledataInsertAllCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7419,7 +7469,7 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.tabledata.list", + dlg.begin(MethodInfo { id: "bigquery.tabledata.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -7472,7 +7522,7 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7508,7 +7558,7 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7518,10 +7568,10 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7554,7 +7604,7 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TabledataListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -7564,7 +7614,7 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> TabledataListCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -7574,7 +7624,7 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TabledataListCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -7613,12 +7663,12 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7635,17 +7685,17 @@ impl<'a, C, A> TabledataListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TabledataListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TabledataListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7710,7 +7760,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "bigquery.projects.list", + dlg.begin(MethodInfo { id: "bigquery.projects.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -7736,7 +7786,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7772,7 +7822,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7782,10 +7832,10 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7840,12 +7890,12 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7862,17 +7912,17 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/blogger3-cli/Cargo.toml b/gen/blogger3-cli/Cargo.toml index 2d8bf29f95..49c96e4b65 100644 --- a/gen/blogger3-cli/Cargo.toml +++ b/gen/blogger3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-blogger3-cli" -version = "0.3.2+20150422" +version = "0.3.3+20150422" authors = ["Sebastian Thiel "] description = "A complete library to interact with blogger (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/blogger3-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/blogger3-cli/LICENSE.md b/gen/blogger3-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/blogger3-cli/LICENSE.md +++ b/gen/blogger3-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/blogger3-cli/README.md b/gen/blogger3-cli/README.md index c646a4ce90..30d4c7af68 100644 --- a/gen/blogger3-cli/README.md +++ b/gen/blogger3-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *blogger* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/blogger3.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/blogger3.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/blogger3.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/blogger3.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/blogger3-cli). # Usage -This documentation was generated from the *blogger* API at revision *20150422*. The CLI is at version *0.3.2*. +This documentation was generated from the *blogger* API at revision *20150422*. The CLI is at version *0.3.3*. ```bash blogger3 [options] @@ -73,18 +73,18 @@ blogger3 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/blogger3-cli/mkdocs.yml b/gen/blogger3-cli/mkdocs.yml index 863fb1beb7..10acb57639 100644 --- a/gen/blogger3-cli/mkdocs.yml +++ b/gen/blogger3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: blogger v0.3.2+20150422 +site_name: blogger v0.3.3+20150422 site_url: http://byron.github.io/google-apis-rs/google-blogger3-cli site_description: Write integrating applications with bcore @@ -45,5 +45,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/blogger3-cli/src/main.rs b/gen/blogger3-cli/src/main.rs index e938b95801..0eb7fd7c89 100644 --- a/gen/blogger3-cli/src/main.rs +++ b/gen/blogger3-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Blogger>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _blog_user_infos_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _blog_user_infos_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.blog_user_infos().get(opt.value_of("user-id").unwrap_or(""), opt.value_of("blog-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "max-posts" => { @@ -64,7 +64,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["max-posts"].iter().map(|v|*v)); @@ -78,7 +78,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -101,10 +101,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _blogs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _blogs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.blogs().get(opt.value_of("blog-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -123,7 +123,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["max-posts", "view"].iter().map(|v|*v)); @@ -137,7 +137,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -160,10 +160,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _blogs_get_by_url(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _blogs_get_by_url(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.blogs().get_by_url(opt.value_of("url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -179,7 +179,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["view"].iter().map(|v|*v)); @@ -193,7 +193,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -216,10 +216,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _blogs_list_by_user(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _blogs_list_by_user(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.blogs().list_by_user(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -244,7 +244,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "fetch-user-info", "role", "view"].iter().map(|v|*v)); @@ -258,7 +258,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -281,10 +281,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_approve(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_approve(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().approve(opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -297,7 +297,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -310,7 +310,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -333,10 +333,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().delete(opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -349,7 +349,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -362,7 +362,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -377,10 +377,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().get(opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -396,7 +396,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["view"].iter().map(|v|*v)); @@ -410,7 +410,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -433,10 +433,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().list(opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -470,7 +470,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "start-date", "end-date", "max-results", "page-token", "fetch-bodies", "view"].iter().map(|v|*v)); @@ -484,7 +484,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -507,10 +507,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_list_by_blog(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_list_by_blog(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().list_by_blog(opt.value_of("blog-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "status" => { @@ -541,7 +541,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "start-date", "end-date", "max-results", "page-token", "fetch-bodies"].iter().map(|v|*v)); @@ -555,7 +555,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -578,10 +578,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_mark_as_spam(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_mark_as_spam(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().mark_as_spam(opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -594,7 +594,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -607,7 +607,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -630,10 +630,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_remove_content(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_remove_content(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().remove_content(opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -646,7 +646,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -659,7 +659,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -682,10 +682,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _page_views_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _page_views_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.page_views().get(opt.value_of("blog-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "range" => { @@ -701,7 +701,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["range"].iter().map(|v|*v)); @@ -715,7 +715,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -738,10 +738,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pages_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pages().delete(opt.value_of("blog-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -754,7 +754,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -767,7 +767,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -782,10 +782,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pages_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pages().get(opt.value_of("blog-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -801,7 +801,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["view"].iter().map(|v|*v)); @@ -815,7 +815,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -838,13 +838,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pages_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pages_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -858,8 +858,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -888,7 +888,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Page = json::value::from_value(object).unwrap(); let mut call = self.hub.pages().insert(request, opt.value_of("blog-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "is-draft" => { @@ -904,7 +904,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["is-draft"].iter().map(|v|*v)); @@ -918,7 +918,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -941,10 +941,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pages_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pages().list(opt.value_of("blog-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -972,7 +972,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "page-token", "fetch-bodies", "max-results", "view"].iter().map(|v|*v)); @@ -986,7 +986,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1009,13 +1009,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pages_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pages_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1029,8 +1029,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1059,7 +1059,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Page = json::value::from_value(object).unwrap(); let mut call = self.hub.pages().patch(request, opt.value_of("blog-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "revert" => { @@ -1078,7 +1078,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["revert", "publish"].iter().map(|v|*v)); @@ -1092,7 +1092,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1115,10 +1115,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pages_publish(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pages_publish(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pages().publish(opt.value_of("blog-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1131,7 +1131,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1144,7 +1144,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1167,10 +1167,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pages_revert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pages_revert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pages().revert(opt.value_of("blog-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1183,7 +1183,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1196,7 +1196,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1219,13 +1219,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pages_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pages_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1239,8 +1239,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1269,7 +1269,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Page = json::value::from_value(object).unwrap(); let mut call = self.hub.pages().update(request, opt.value_of("blog-id").unwrap_or(""), opt.value_of("page-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "revert" => { @@ -1288,7 +1288,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["revert", "publish"].iter().map(|v|*v)); @@ -1302,7 +1302,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1325,10 +1325,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _post_user_infos_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _post_user_infos_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.post_user_infos().get(opt.value_of("user-id").unwrap_or(""), opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "max-comments" => { @@ -1344,7 +1344,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["max-comments"].iter().map(|v|*v)); @@ -1358,7 +1358,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1381,10 +1381,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _post_user_infos_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _post_user_infos_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.post_user_infos().list(opt.value_of("user-id").unwrap_or(""), opt.value_of("blog-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -1424,7 +1424,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "start-date", "end-date", "labels", "max-results", "page-token", "order-by", "fetch-bodies", "view"].iter().map(|v|*v)); @@ -1438,7 +1438,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1461,10 +1461,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _posts_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _posts_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.posts().delete(opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1477,7 +1477,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1490,7 +1490,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1505,10 +1505,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _posts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _posts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.posts().get(opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -1533,7 +1533,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["fetch-body", "max-comments", "fetch-images", "view"].iter().map(|v|*v)); @@ -1547,7 +1547,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1570,10 +1570,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _posts_get_by_path(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _posts_get_by_path(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.posts().get_by_path(opt.value_of("blog-id").unwrap_or(""), opt.value_of("path").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -1592,7 +1592,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["max-comments", "view"].iter().map(|v|*v)); @@ -1606,7 +1606,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1629,13 +1629,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _posts_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _posts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1649,8 +1649,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1689,7 +1689,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Post = json::value::from_value(object).unwrap(); let mut call = self.hub.posts().insert(request, opt.value_of("blog-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "is-draft" => { @@ -1711,7 +1711,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["fetch-images", "is-draft", "fetch-body"].iter().map(|v|*v)); @@ -1725,7 +1725,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1748,10 +1748,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _posts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _posts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.posts().list(opt.value_of("blog-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -1794,7 +1794,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "start-date", "end-date", "labels", "max-results", "page-token", "order-by", "fetch-bodies", "fetch-images", "view"].iter().map(|v|*v)); @@ -1808,7 +1808,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1831,13 +1831,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _posts_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _posts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1851,8 +1851,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1891,7 +1891,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Post = json::value::from_value(object).unwrap(); let mut call = self.hub.posts().patch(request, opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "revert" => { @@ -1919,7 +1919,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["max-comments", "revert", "fetch-images", "publish", "fetch-body"].iter().map(|v|*v)); @@ -1933,7 +1933,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1956,10 +1956,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _posts_publish(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _posts_publish(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.posts().publish(opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "publish-date" => { @@ -1975,7 +1975,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["publish-date"].iter().map(|v|*v)); @@ -1989,7 +1989,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2012,10 +2012,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _posts_revert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _posts_revert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.posts().revert(opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2028,7 +2028,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2041,7 +2041,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2064,10 +2064,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _posts_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _posts_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.posts().search(opt.value_of("blog-id").unwrap_or(""), opt.value_of("q").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "order-by" => { @@ -2086,7 +2086,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "fetch-bodies"].iter().map(|v|*v)); @@ -2100,7 +2100,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2123,13 +2123,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _posts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _posts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2143,8 +2143,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2183,7 +2183,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Post = json::value::from_value(object).unwrap(); let mut call = self.hub.posts().update(request, opt.value_of("blog-id").unwrap_or(""), opt.value_of("post-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "revert" => { @@ -2211,7 +2211,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["max-comments", "revert", "fetch-images", "publish", "fetch-body"].iter().map(|v|*v)); @@ -2225,7 +2225,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2248,10 +2248,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().get(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2264,7 +2264,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2277,7 +2277,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2485,14 +2485,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "blogger3-secret.json", + match cmn::application_secret_from_directory(&config_dir, "blogger3-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -2512,7 +2512,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -2551,7 +2551,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("blog-user-infos", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Gets one blog and user info pair by blogId and userId."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/blog-user-infos_get", vec![ @@ -2582,7 +2582,7 @@ fn main() { ]), ("blogs", "methods: 'get', 'get-by-url' and 'list-by-user'", vec![ - ("get", + ("get", Some(r##"Gets one blog by ID."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/blogs_get", vec![ @@ -2604,7 +2604,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-by-url", + ("get-by-url", Some(r##"Retrieve a Blog by URL."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/blogs_get-by-url", vec![ @@ -2626,7 +2626,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-by-user", + ("list-by-user", Some(r##"Retrieves a list of blogs, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/blogs_list-by-user", vec![ @@ -2651,7 +2651,7 @@ fn main() { ]), ("comments", "methods: 'approve', 'delete', 'get', 'list', 'list-by-blog', 'mark-as-spam' and 'remove-content'", vec![ - ("approve", + ("approve", Some(r##"Marks a comment as not spam."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/comments_approve", vec![ @@ -2685,7 +2685,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete a comment by ID."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/comments_delete", vec![ @@ -2713,7 +2713,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one comment by ID."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/comments_get", vec![ @@ -2747,7 +2747,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the comments for a post, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/comments_list", vec![ @@ -2775,7 +2775,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-by-blog", + ("list-by-blog", Some(r##"Retrieves the comments for a blog, across all posts, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/comments_list-by-blog", vec![ @@ -2797,7 +2797,7 @@ fn main() { Some(false), Some(false)), ]), - ("mark-as-spam", + ("mark-as-spam", Some(r##"Marks a comment as spam."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/comments_mark-as-spam", vec![ @@ -2831,7 +2831,7 @@ fn main() { Some(false), Some(false)), ]), - ("remove-content", + ("remove-content", Some(r##"Removes the content of a comment."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/comments_remove-content", vec![ @@ -2868,7 +2868,7 @@ fn main() { ]), ("page-views", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Retrieve pageview stats for a Blog."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/page-views_get", vec![ @@ -2893,7 +2893,7 @@ fn main() { ]), ("pages", "methods: 'delete', 'get', 'insert', 'list', 'patch', 'publish', 'revert' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Delete a page by ID."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/pages_delete", vec![ @@ -2915,7 +2915,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one blog page by ID."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/pages_get", vec![ @@ -2943,7 +2943,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Add a page."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/pages_insert", vec![ @@ -2971,7 +2971,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the pages for a blog, optionally including non-LIVE statuses."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/pages_list", vec![ @@ -2993,7 +2993,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update a page. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/pages_patch", vec![ @@ -3027,7 +3027,7 @@ fn main() { Some(false), Some(false)), ]), - ("publish", + ("publish", Some(r##"Publishes a draft page."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/pages_publish", vec![ @@ -3055,7 +3055,7 @@ fn main() { Some(false), Some(false)), ]), - ("revert", + ("revert", Some(r##"Revert a published or scheduled page to draft state."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/pages_revert", vec![ @@ -3083,7 +3083,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update a page."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/pages_update", vec![ @@ -3120,7 +3120,7 @@ fn main() { ]), ("post-user-infos", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one post and user info pair, by post ID and user ID. The post user info contains per-user information about the post, such as access rights, specific to the user."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/post-user-infos_get", vec![ @@ -3154,7 +3154,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of post and post user info pairs, possibly filtered. The post user info contains per-user information about the post, such as access rights, specific to the user."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/post-user-infos_list", vec![ @@ -3185,7 +3185,7 @@ fn main() { ]), ("posts", "methods: 'delete', 'get', 'get-by-path', 'insert', 'list', 'patch', 'publish', 'revert', 'search' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Delete a post by ID."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/posts_delete", vec![ @@ -3207,7 +3207,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Get a post by ID."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/posts_get", vec![ @@ -3235,7 +3235,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-by-path", + ("get-by-path", Some(r##"Retrieve a Post by Path."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/posts_get-by-path", vec![ @@ -3263,7 +3263,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Add a post."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/posts_insert", vec![ @@ -3291,7 +3291,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of posts, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/posts_list", vec![ @@ -3313,7 +3313,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update a post. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/posts_patch", vec![ @@ -3347,7 +3347,7 @@ fn main() { Some(false), Some(false)), ]), - ("publish", + ("publish", Some(r##"Publishes a draft post, optionally at the specific time of the given publishDate parameter."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/posts_publish", vec![ @@ -3375,7 +3375,7 @@ fn main() { Some(false), Some(false)), ]), - ("revert", + ("revert", Some(r##"Revert a published or scheduled post to draft state."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/posts_revert", vec![ @@ -3403,7 +3403,7 @@ fn main() { Some(false), Some(false)), ]), - ("search", + ("search", Some(r##"Search for a post."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/posts_search", vec![ @@ -3431,7 +3431,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update a post."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/posts_update", vec![ @@ -3468,7 +3468,7 @@ fn main() { ]), ("users", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Gets one user by ID."##), "Details at http://byron.github.io/google-apis-rs/google_blogger3_cli/users_get", vec![ @@ -3496,7 +3496,7 @@ fn main() { let mut app = App::new("blogger3") .author("Sebastian Thiel ") - .version("0.3.2+20150422") + .version("0.3.3+20150422") .about("API for access to the data within Blogger.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_blogger3_cli") .arg(Arg::with_name("url") @@ -3520,7 +3520,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -3531,7 +3531,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/blogger3/Cargo.toml b/gen/blogger3/Cargo.toml index b67d8139fc..6220719f38 100644 --- a/gen/blogger3/Cargo.toml +++ b/gen/blogger3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-blogger3" -version = "0.1.10+20150422" +version = "0.1.11+20150422" authors = ["Sebastian Thiel "] description = "A complete library to interact with blogger (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/blogger3" diff --git a/gen/blogger3/LICENSE.md b/gen/blogger3/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/blogger3/LICENSE.md +++ b/gen/blogger3/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/blogger3/README.md b/gen/blogger3/README.md index dc7429c6dc..7b4f462e02 100644 --- a/gen/blogger3/README.md +++ b/gen/blogger3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-blogger3` library allows access to all features of the *Google blogger* service. -This documentation was generated from *blogger* crate version *0.1.10+20150422*, where *20150422* is the exact revision of the *blogger:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *blogger* crate version *0.1.11+20150422*, where *20150422* is the exact revision of the *blogger:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *blogger* *v3* API can be found at the [official documentation site](https://developers.google.com/blogger/docs/3.0/getting_started). diff --git a/gen/blogger3/src/cmn.rs b/gen/blogger3/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/blogger3/src/cmn.rs +++ b/gen/blogger3/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/blogger3/src/lib.rs b/gen/blogger3/src/lib.rs index c34613e932..a5646bf961 100644 --- a/gen/blogger3/src/lib.rs +++ b/gen/blogger3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *blogger* crate version *0.1.10+20150422*, where *20150422* is the exact revision of the *blogger:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *blogger* crate version *0.1.11+20150422*, where *20150422* is the exact revision of the *blogger:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *blogger* *v3* API can be found at the //! [official documentation site](https://developers.google.com/blogger/docs/3.0/getting_started). diff --git a/gen/blogger3/src/lib.rs.in b/gen/blogger3/src/lib.rs.in index 409d6e61d5..f2d16a0692 100644 --- a/gen/blogger3/src/lib.rs.in +++ b/gen/blogger3/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -140,7 +141,7 @@ impl<'a, C, A> Blogger Blogger { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -170,7 +171,7 @@ impl<'a, C, A> Blogger } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -2119,7 +2120,7 @@ impl<'a, C, A> PageViewGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.pageViews.get", + dlg.begin(MethodInfo { id: "blogger.pageViews.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -2168,7 +2169,7 @@ impl<'a, C, A> PageViewGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2204,7 +2205,7 @@ impl<'a, C, A> PageViewGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2214,10 +2215,10 @@ impl<'a, C, A> PageViewGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2250,7 +2251,7 @@ impl<'a, C, A> PageViewGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PageViewGetCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -2275,12 +2276,12 @@ impl<'a, C, A> PageViewGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2297,17 +2298,17 @@ impl<'a, C, A> PageViewGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PageViewGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PageViewGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2369,7 +2370,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.users.get", + dlg.begin(MethodInfo { id: "blogger.users.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -2411,7 +2412,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2447,7 +2448,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2457,10 +2458,10 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2493,7 +2494,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2511,12 +2512,12 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2533,17 +2534,17 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2613,7 +2614,7 @@ impl<'a, C, A> BlogListByUserCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.blogs.listByUser", + dlg.begin(MethodInfo { id: "blogger.blogs.listByUser", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -2675,7 +2676,7 @@ impl<'a, C, A> BlogListByUserCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2711,7 +2712,7 @@ impl<'a, C, A> BlogListByUserCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2721,10 +2722,10 @@ impl<'a, C, A> BlogListByUserCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2757,7 +2758,7 @@ impl<'a, C, A> BlogListByUserCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> BlogListByUserCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2805,12 +2806,12 @@ impl<'a, C, A> BlogListByUserCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2827,17 +2828,17 @@ impl<'a, C, A> BlogListByUserCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BlogListByUserCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BlogListByUserCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2903,7 +2904,7 @@ impl<'a, C, A> BlogGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.blogs.get", + dlg.begin(MethodInfo { id: "blogger.blogs.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -2951,7 +2952,7 @@ impl<'a, C, A> BlogGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2987,7 +2988,7 @@ impl<'a, C, A> BlogGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2997,10 +2998,10 @@ impl<'a, C, A> BlogGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3033,7 +3034,7 @@ impl<'a, C, A> BlogGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> BlogGetCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -3065,12 +3066,12 @@ impl<'a, C, A> BlogGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3087,17 +3088,17 @@ impl<'a, C, A> BlogGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BlogGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BlogGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3161,7 +3162,7 @@ impl<'a, C, A> BlogGetByUrlCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.blogs.getByUrl", + dlg.begin(MethodInfo { id: "blogger.blogs.getByUrl", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("url", self._url.to_string())); @@ -3185,7 +3186,7 @@ impl<'a, C, A> BlogGetByUrlCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3221,7 +3222,7 @@ impl<'a, C, A> BlogGetByUrlCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3231,10 +3232,10 @@ impl<'a, C, A> BlogGetByUrlCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3267,7 +3268,7 @@ impl<'a, C, A> BlogGetByUrlCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *url* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn url(mut self, new_value: &str) -> BlogGetByUrlCall<'a, C, A> { self._url = new_value.to_string(); @@ -3292,12 +3293,12 @@ impl<'a, C, A> BlogGetByUrlCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3314,17 +3315,17 @@ impl<'a, C, A> BlogGetByUrlCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BlogGetByUrlCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BlogGetByUrlCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3404,7 +3405,7 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.posts.update", + dlg.begin(MethodInfo { id: "blogger.posts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -3462,14 +3463,14 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3513,7 +3514,7 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3523,10 +3524,10 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3558,7 +3559,7 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Post) -> PostUpdateCall<'a, C, A> { self._request = new_value; @@ -3568,7 +3569,7 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostUpdateCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -3578,7 +3579,7 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> PostUpdateCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -3631,12 +3632,12 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3653,17 +3654,17 @@ impl<'a, C, A> PostUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3730,7 +3731,7 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.posts.getByPath", + dlg.begin(MethodInfo { id: "blogger.posts.getByPath", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -3779,7 +3780,7 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3815,7 +3816,7 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3825,10 +3826,10 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3861,7 +3862,7 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostGetByPathCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -3871,7 +3872,7 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *path* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn path(mut self, new_value: &str) -> PostGetByPathCall<'a, C, A> { self._path = new_value.to_string(); @@ -3903,12 +3904,12 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3925,17 +3926,17 @@ impl<'a, C, A> PostGetByPathCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostGetByPathCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostGetByPathCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4006,7 +4007,7 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.posts.get", + dlg.begin(MethodInfo { id: "blogger.posts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -4061,7 +4062,7 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4097,7 +4098,7 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4107,10 +4108,10 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4143,7 +4144,7 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostGetCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -4153,7 +4154,7 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> PostGetCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -4199,12 +4200,12 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4221,17 +4222,17 @@ impl<'a, C, A> PostGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4306,7 +4307,7 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.posts.insert", + dlg.begin(MethodInfo { id: "blogger.posts.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -4357,14 +4358,14 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4408,7 +4409,7 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4418,10 +4419,10 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4453,7 +4454,7 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Post) -> PostInsertCall<'a, C, A> { self._request = new_value; @@ -4463,7 +4464,7 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostInsertCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -4502,12 +4503,12 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4524,17 +4525,17 @@ impl<'a, C, A> PostInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4599,7 +4600,7 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.posts.publish", + dlg.begin(MethodInfo { id: "blogger.posts.publish", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -4645,7 +4646,7 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4681,7 +4682,7 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4691,10 +4692,10 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4727,7 +4728,7 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostPublishCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -4737,7 +4738,7 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> PostPublishCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -4762,12 +4763,12 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4784,17 +4785,17 @@ impl<'a, C, A> PostPublishCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostPublishCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostPublishCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4857,7 +4858,7 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.posts.delete", + dlg.begin(MethodInfo { id: "blogger.posts.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -4899,7 +4900,7 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4935,7 +4936,7 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4945,10 +4946,10 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4971,7 +4972,7 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostDeleteCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -4981,7 +4982,7 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> PostDeleteCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -4999,12 +5000,12 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5021,17 +5022,17 @@ impl<'a, C, A> PostDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5094,7 +5095,7 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.posts.revert", + dlg.begin(MethodInfo { id: "blogger.posts.revert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -5137,7 +5138,7 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5173,7 +5174,7 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5183,10 +5184,10 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5219,7 +5220,7 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostRevertCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -5229,7 +5230,7 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> PostRevertCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -5247,12 +5248,12 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5269,17 +5270,17 @@ impl<'a, C, A> PostRevertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostRevertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostRevertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5346,7 +5347,7 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.posts.search", + dlg.begin(MethodInfo { id: "blogger.posts.search", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -5395,7 +5396,7 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5431,7 +5432,7 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5441,10 +5442,10 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5477,7 +5478,7 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostSearchCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -5487,7 +5488,7 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *q* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn q(mut self, new_value: &str) -> PostSearchCall<'a, C, A> { self._q = new_value.to_string(); @@ -5519,12 +5520,12 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5541,17 +5542,17 @@ impl<'a, C, A> PostSearchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostSearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostSearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5631,7 +5632,7 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.posts.patch", + dlg.begin(MethodInfo { id: "blogger.posts.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -5689,14 +5690,14 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5740,7 +5741,7 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5750,10 +5751,10 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5785,7 +5786,7 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Post) -> PostPatchCall<'a, C, A> { self._request = new_value; @@ -5795,7 +5796,7 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostPatchCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -5805,7 +5806,7 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> PostPatchCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -5858,12 +5859,12 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5880,17 +5881,17 @@ impl<'a, C, A> PostPatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5972,7 +5973,7 @@ impl<'a, C, A> PostListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.posts.list", + dlg.begin(MethodInfo { id: "blogger.posts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -6048,7 +6049,7 @@ impl<'a, C, A> PostListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6084,7 +6085,7 @@ impl<'a, C, A> PostListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6094,10 +6095,10 @@ impl<'a, C, A> PostListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6130,7 +6131,7 @@ impl<'a, C, A> PostListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostListCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -6219,12 +6220,12 @@ impl<'a, C, A> PostListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6241,17 +6242,17 @@ impl<'a, C, A> PostListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6317,7 +6318,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.comments.get", + dlg.begin(MethodInfo { id: "blogger.comments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -6364,7 +6365,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6400,7 +6401,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6410,10 +6411,10 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6446,7 +6447,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> CommentGetCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -6456,7 +6457,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> CommentGetCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -6466,7 +6467,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> CommentGetCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -6491,12 +6492,12 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6513,17 +6514,17 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6587,7 +6588,7 @@ impl<'a, C, A> CommentRemoveContentCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.comments.removeContent", + dlg.begin(MethodInfo { id: "blogger.comments.removeContent", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -6631,7 +6632,7 @@ impl<'a, C, A> CommentRemoveContentCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6667,7 +6668,7 @@ impl<'a, C, A> CommentRemoveContentCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6677,10 +6678,10 @@ impl<'a, C, A> CommentRemoveContentCall<'a, C, A> where C: BorrowMut CommentRemoveContentCall<'a, C, A> where C: BorrowMut CommentRemoveContentCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -6723,7 +6724,7 @@ impl<'a, C, A> CommentRemoveContentCall<'a, C, A> where C: BorrowMut CommentRemoveContentCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -6733,7 +6734,7 @@ impl<'a, C, A> CommentRemoveContentCall<'a, C, A> where C: BorrowMut CommentRemoveContentCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -6751,12 +6752,12 @@ impl<'a, C, A> CommentRemoveContentCall<'a, C, A> where C: BorrowMut CommentRemoveContentCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CommentRemoveContentCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentRemoveContentCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6857,7 +6858,7 @@ impl<'a, C, A> CommentListByBlogCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.comments.listByBlog", + dlg.begin(MethodInfo { id: "blogger.comments.listByBlog", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -6921,7 +6922,7 @@ impl<'a, C, A> CommentListByBlogCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6957,7 +6958,7 @@ impl<'a, C, A> CommentListByBlogCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6967,10 +6968,10 @@ impl<'a, C, A> CommentListByBlogCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7003,7 +7004,7 @@ impl<'a, C, A> CommentListByBlogCall<'a, C, A> where C: BorrowMut /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> CommentListByBlogCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -7063,12 +7064,12 @@ impl<'a, C, A> CommentListByBlogCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7085,17 +7086,17 @@ impl<'a, C, A> CommentListByBlogCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentListByBlogCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentListByBlogCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7159,7 +7160,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.comments.markAsSpam", + dlg.begin(MethodInfo { id: "blogger.comments.markAsSpam", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -7203,7 +7204,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7239,7 +7240,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7249,10 +7250,10 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7285,7 +7286,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> CommentMarkAsSpamCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -7295,7 +7296,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> CommentMarkAsSpamCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -7305,7 +7306,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> CommentMarkAsSpamCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -7323,12 +7324,12 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7345,17 +7346,17 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentMarkAsSpamCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentMarkAsSpamCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7432,7 +7433,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.comments.list", + dlg.begin(MethodInfo { id: "blogger.comments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -7500,7 +7501,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7536,7 +7537,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7546,10 +7547,10 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7582,7 +7583,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> CommentListCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -7592,7 +7593,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> CommentListCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -7659,12 +7660,12 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7681,17 +7682,17 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7755,7 +7756,7 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.comments.approve", + dlg.begin(MethodInfo { id: "blogger.comments.approve", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -7799,7 +7800,7 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7835,7 +7836,7 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7845,10 +7846,10 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7881,7 +7882,7 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> CommentApproveCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -7891,7 +7892,7 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> CommentApproveCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -7901,7 +7902,7 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> CommentApproveCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -7919,12 +7920,12 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7941,17 +7942,17 @@ impl<'a, C, A> CommentApproveCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentApproveCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentApproveCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8015,7 +8016,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.comments.delete", + dlg.begin(MethodInfo { id: "blogger.comments.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -8058,7 +8059,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8094,7 +8095,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8104,10 +8105,10 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8130,7 +8131,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> CommentDeleteCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -8140,7 +8141,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> CommentDeleteCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -8150,7 +8151,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> CommentDeleteCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -8168,12 +8169,12 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8190,17 +8191,17 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8266,7 +8267,7 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.postUserInfos.get", + dlg.begin(MethodInfo { id: "blogger.postUserInfos.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -8313,7 +8314,7 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8349,7 +8350,7 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8359,10 +8360,10 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8395,7 +8396,7 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> PostUserInfoGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -8405,7 +8406,7 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostUserInfoGetCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -8415,7 +8416,7 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *post id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn post_id(mut self, new_value: &str) -> PostUserInfoGetCall<'a, C, A> { self._post_id = new_value.to_string(); @@ -8440,12 +8441,12 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8462,17 +8463,17 @@ impl<'a, C, A> PostUserInfoGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostUserInfoGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostUserInfoGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8553,7 +8554,7 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.postUserInfos.list", + dlg.begin(MethodInfo { id: "blogger.postUserInfos.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -8627,7 +8628,7 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8663,7 +8664,7 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8673,10 +8674,10 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8709,7 +8710,7 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> PostUserInfoListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -8719,7 +8720,7 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PostUserInfoListCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -8800,12 +8801,12 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8822,17 +8823,17 @@ impl<'a, C, A> PostUserInfoListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostUserInfoListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostUserInfoListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8897,7 +8898,7 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.blogUserInfos.get", + dlg.begin(MethodInfo { id: "blogger.blogUserInfos.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -8943,7 +8944,7 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8979,7 +8980,7 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8989,10 +8990,10 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9025,7 +9026,7 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> BlogUserInfoGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -9035,7 +9036,7 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> BlogUserInfoGetCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -9060,12 +9061,12 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9082,17 +9083,17 @@ impl<'a, C, A> BlogUserInfoGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BlogUserInfoGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BlogUserInfoGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9157,7 +9158,7 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.pages.get", + dlg.begin(MethodInfo { id: "blogger.pages.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -9203,7 +9204,7 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9239,7 +9240,7 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9249,10 +9250,10 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9285,7 +9286,7 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PageGetCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -9295,7 +9296,7 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *page id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn page_id(mut self, new_value: &str) -> PageGetCall<'a, C, A> { self._page_id = new_value.to_string(); @@ -9319,12 +9320,12 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9341,17 +9342,17 @@ impl<'a, C, A> PageGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PageGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PageGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9423,7 +9424,7 @@ impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.pages.list", + dlg.begin(MethodInfo { id: "blogger.pages.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -9484,7 +9485,7 @@ impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9520,7 +9521,7 @@ impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9530,10 +9531,10 @@ impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9566,7 +9567,7 @@ impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PageListCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -9619,12 +9620,12 @@ impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9641,17 +9642,17 @@ impl<'a, C, A> PageListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PageListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PageListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9714,7 +9715,7 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.pages.revert", + dlg.begin(MethodInfo { id: "blogger.pages.revert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -9757,7 +9758,7 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9793,7 +9794,7 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9803,10 +9804,10 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9839,7 +9840,7 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PageRevertCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -9849,7 +9850,7 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *page id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn page_id(mut self, new_value: &str) -> PageRevertCall<'a, C, A> { self._page_id = new_value.to_string(); @@ -9867,12 +9868,12 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9889,17 +9890,17 @@ impl<'a, C, A> PageRevertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PageRevertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PageRevertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9970,7 +9971,7 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.pages.insert", + dlg.begin(MethodInfo { id: "blogger.pages.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -10015,14 +10016,14 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10066,7 +10067,7 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10076,10 +10077,10 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10111,7 +10112,7 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Page) -> PageInsertCall<'a, C, A> { self._request = new_value; @@ -10121,7 +10122,7 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PageInsertCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -10146,12 +10147,12 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10168,17 +10169,17 @@ impl<'a, C, A> PageInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PageInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PageInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10252,7 +10253,7 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.pages.patch", + dlg.begin(MethodInfo { id: "blogger.pages.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -10301,14 +10302,14 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10352,7 +10353,7 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10362,10 +10363,10 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10397,7 +10398,7 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Page) -> PagePatchCall<'a, C, A> { self._request = new_value; @@ -10407,7 +10408,7 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PagePatchCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -10417,7 +10418,7 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *page id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn page_id(mut self, new_value: &str) -> PagePatchCall<'a, C, A> { self._page_id = new_value.to_string(); @@ -10449,12 +10450,12 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10471,17 +10472,17 @@ impl<'a, C, A> PagePatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PagePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PagePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10544,7 +10545,7 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.pages.publish", + dlg.begin(MethodInfo { id: "blogger.pages.publish", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -10587,7 +10588,7 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10623,7 +10624,7 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10633,10 +10634,10 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10669,7 +10670,7 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PagePublishCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -10679,7 +10680,7 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *page id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn page_id(mut self, new_value: &str) -> PagePublishCall<'a, C, A> { self._page_id = new_value.to_string(); @@ -10697,12 +10698,12 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10719,17 +10720,17 @@ impl<'a, C, A> PagePublishCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PagePublishCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PagePublishCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10803,7 +10804,7 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.pages.update", + dlg.begin(MethodInfo { id: "blogger.pages.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -10852,14 +10853,14 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10903,7 +10904,7 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10913,10 +10914,10 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10948,7 +10949,7 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Page) -> PageUpdateCall<'a, C, A> { self._request = new_value; @@ -10958,7 +10959,7 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PageUpdateCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -10968,7 +10969,7 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *page id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn page_id(mut self, new_value: &str) -> PageUpdateCall<'a, C, A> { self._page_id = new_value.to_string(); @@ -11000,12 +11001,12 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11022,17 +11023,17 @@ impl<'a, C, A> PageUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PageUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PageUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11095,7 +11096,7 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "blogger.pages.delete", + dlg.begin(MethodInfo { id: "blogger.pages.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("blogId", self._blog_id.to_string())); @@ -11137,7 +11138,7 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11173,7 +11174,7 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11183,10 +11184,10 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11209,7 +11210,7 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *blog id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn blog_id(mut self, new_value: &str) -> PageDeleteCall<'a, C, A> { self._blog_id = new_value.to_string(); @@ -11219,7 +11220,7 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *page id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn page_id(mut self, new_value: &str) -> PageDeleteCall<'a, C, A> { self._page_id = new_value.to_string(); @@ -11237,12 +11238,12 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11259,17 +11260,17 @@ impl<'a, C, A> PageDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PageDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PageDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/books1-cli/Cargo.toml b/gen/books1-cli/Cargo.toml index 267c8b3dfb..4c0ebe8d0b 100644 --- a/gen/books1-cli/Cargo.toml +++ b/gen/books1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-books1-cli" -version = "0.3.2+20150921" +version = "0.3.3+20151218" authors = ["Sebastian Thiel "] description = "A complete library to interact with books (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/books1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/books1-cli/LICENSE.md b/gen/books1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/books1-cli/LICENSE.md +++ b/gen/books1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/books1-cli/README.md b/gen/books1-cli/README.md index a40ad5e686..111d717d6b 100644 --- a/gen/books1-cli/README.md +++ b/gen/books1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *books* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/books1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/books1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/books1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/books1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/books1-cli). # Usage -This documentation was generated from the *books* API at revision *20150921*. The CLI is at version *0.3.2*. +This documentation was generated from the *books* API at revision *20151218*. The CLI is at version *0.3.3*. ```bash books1 [options] @@ -77,6 +77,9 @@ books1 [options] accept [-p ]... dismiss [-p ]... get [-p ]... [-o ] + series + get ... [-p ]... [-o ] + membership-get [-p ]... [-o ] volumes associated-list [-p ]... [-o ] get [-p ]... [-o ] @@ -89,18 +92,18 @@ books1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/books1-cli/mkdocs.yml b/gen/books1-cli/mkdocs.yml index 9bd0e209ca..153b16cc5d 100644 --- a/gen/books1-cli/mkdocs.yml +++ b/gen/books1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: books v0.3.2+20150921 +site_name: books v0.3.3+20151218 site_url: http://byron.github.io/google-apis-rs/google-books1-cli site_description: Write integrating applications with bcore @@ -48,6 +48,8 @@ pages: - ['promooffer_accept.md', 'Promooffer', 'Accept'] - ['promooffer_dismiss.md', 'Promooffer', 'Dismiss'] - ['promooffer_get.md', 'Promooffer', 'Get'] +- ['series_get.md', 'Series', 'Get'] +- ['series_membership-get.md', 'Series', 'Membership Get'] - ['volumes_associated-list.md', 'Volumes', 'Associated List'] - ['volumes_get.md', 'Volumes', 'Get'] - ['volumes_list.md', 'Volumes', 'List'] @@ -58,5 +60,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/books1-cli/src/main.rs b/gen/books1-cli/src/main.rs index d9fab8df62..28bd2dd0b2 100644 --- a/gen/books1-cli/src/main.rs +++ b/gen/books1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Books>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _bookshelves_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _bookshelves_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.bookshelves().get(opt.value_of("user-id").unwrap_or(""), opt.value_of("shelf").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -64,7 +64,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source"].iter().map(|v|*v)); @@ -78,7 +78,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -101,10 +101,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _bookshelves_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _bookshelves_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.bookshelves().list(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -120,7 +120,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source"].iter().map(|v|*v)); @@ -134,7 +134,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -157,10 +157,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _bookshelves_volumes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _bookshelves_volumes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.bookshelves().volumes_list(opt.value_of("user-id").unwrap_or(""), opt.value_of("shelf").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -185,7 +185,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source", "start-index", "show-preorders", "max-results"].iter().map(|v|*v)); @@ -199,7 +199,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -222,10 +222,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _cloudloading_add_book(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _cloudloading_add_book(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.cloudloading().add_book(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "upload-client-token" => { @@ -250,7 +250,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["mime-type", "name", "upload-client-token", "drive-document-id"].iter().map(|v|*v)); @@ -264,7 +264,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -287,10 +287,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _cloudloading_delete_book(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _cloudloading_delete_book(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.cloudloading().delete_book(opt.value_of("volume-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -303,7 +303,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -316,7 +316,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -331,13 +331,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _cloudloading_update_book(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _cloudloading_update_book(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -351,8 +351,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "processing-state" => Some(("processingState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -370,7 +370,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::BooksCloudloadingResource = json::value::from_value(object).unwrap(); let mut call = self.hub.cloudloading().update_book(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -383,7 +383,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -396,7 +396,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -419,10 +419,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _dictionary_list_offline_metadata(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _dictionary_list_offline_metadata(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.dictionary().list_offline_metadata(opt.value_of("cpksver").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -435,7 +435,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -448,7 +448,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -471,10 +471,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_annotation_data_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_annotation_data_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().annotation_data_get(opt.value_of("volume-id").unwrap_or(""), opt.value_of("layer-id").unwrap_or(""), opt.value_of("annotation-data-id").unwrap_or(""), opt.value_of("content-version").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "w" => { @@ -505,7 +505,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["scale", "locale", "h", "source", "allow-web-definitions", "w"].iter().map(|v|*v)); @@ -519,7 +519,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -542,10 +542,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_annotation_data_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_annotation_data_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().annotation_data_list(opt.value_of("volume-id").unwrap_or(""), opt.value_of("layer-id").unwrap_or(""), opt.value_of("content-version").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "w" => { @@ -588,7 +588,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["scale", "source", "locale", "updated-min", "updated-max", "max-results", "annotation-data-id", "page-token", "w", "h"].iter().map(|v|*v)); @@ -602,7 +602,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -625,10 +625,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().get(opt.value_of("volume-id").unwrap_or(""), opt.value_of("summary-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -647,7 +647,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source", "content-version"].iter().map(|v|*v)); @@ -661,7 +661,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -684,10 +684,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().list(opt.value_of("volume-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -712,7 +712,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source", "content-version", "max-results", "page-token"].iter().map(|v|*v)); @@ -726,7 +726,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -749,10 +749,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_volume_annotations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_volume_annotations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().volume_annotations_get(opt.value_of("volume-id").unwrap_or(""), opt.value_of("layer-id").unwrap_or(""), opt.value_of("annotation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -771,7 +771,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "source"].iter().map(|v|*v)); @@ -785,7 +785,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -808,10 +808,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_volume_annotations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_volume_annotations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().volume_annotations_list(opt.value_of("volume-id").unwrap_or(""), opt.value_of("layer-id").unwrap_or(""), opt.value_of("content-version").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "volume-annotations-version" => { @@ -860,7 +860,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["show-deleted", "volume-annotations-version", "end-position", "updated-max", "start-position", "updated-min", "end-offset", "max-results", "source", "start-offset", "page-token", "locale"].iter().map(|v|*v)); @@ -874,7 +874,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -897,10 +897,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _myconfig_get_user_settings(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _myconfig_get_user_settings(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.myconfig().get_user_settings(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -913,7 +913,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -926,7 +926,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -949,10 +949,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _myconfig_release_download_access(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _myconfig_release_download_access(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.myconfig().release_download_access(&opt.values_of("volume-ids").unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>(), opt.value_of("cpksver").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.myconfig().release_download_access(&opt.values_of("volume-ids").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>(), opt.value_of("cpksver").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -971,7 +971,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "source"].iter().map(|v|*v)); @@ -985,7 +985,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1008,10 +1008,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _myconfig_request_access(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _myconfig_request_access(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.myconfig().request_access(opt.value_of("source").unwrap_or(""), opt.value_of("volume-id").unwrap_or(""), opt.value_of("nonce").unwrap_or(""), opt.value_of("cpksver").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "locale" => { @@ -1030,7 +1030,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "license-types"].iter().map(|v|*v)); @@ -1044,7 +1044,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1067,10 +1067,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _myconfig_sync_volume_licenses(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _myconfig_sync_volume_licenses(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.myconfig().sync_volume_licenses(opt.value_of("source").unwrap_or(""), opt.value_of("nonce").unwrap_or(""), opt.value_of("cpksver").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "volume-ids" => { @@ -1082,6 +1082,9 @@ impl<'n, 'a> Engine<'n, 'a> { "locale" => { call = call.locale(value.unwrap_or("")); }, + "include-non-comics-series" => { + call = call.include_non_comics_series(arg_from_str(value.unwrap_or("false"), err, "include-non-comics-series", "boolean")); + }, "features" => { call = call.add_features(value.unwrap_or("")); }, @@ -1095,10 +1098,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["locale", "show-preorders", "volume-ids", "features"].iter().map(|v|*v)); + v.extend(["locale", "show-preorders", "volume-ids", "include-non-comics-series", "features"].iter().map(|v|*v)); v } )); } } @@ -1109,7 +1112,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1132,13 +1135,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _myconfig_update_user_settings(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _myconfig_update_user_settings(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1152,8 +1155,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "notification.more-from-authors.opted-state" => Some(("notification.moreFromAuthors.opted_state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1171,7 +1174,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Usersettings = json::value::from_value(object).unwrap(); let mut call = self.hub.myconfig().update_user_settings(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1184,7 +1187,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1197,7 +1200,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1220,10 +1223,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_annotations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_annotations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mylibrary().annotations_delete(opt.value_of("annotation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -1239,7 +1242,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source"].iter().map(|v|*v)); @@ -1253,7 +1256,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1268,13 +1271,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_annotations_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_annotations_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1288,8 +1291,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "page-ids" => Some(("pageIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1354,7 +1357,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Annotation = json::value::from_value(object).unwrap(); let mut call = self.hub.mylibrary().annotations_insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -1376,7 +1379,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source", "show-only-summary-in-response", "country"].iter().map(|v|*v)); @@ -1390,7 +1393,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1413,10 +1416,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_annotations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_annotations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mylibrary().annotations_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "volume-id" => { @@ -1459,7 +1462,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "layer-ids", "show-deleted", "updated-min", "updated-max", "volume-id", "max-results", "source", "content-version", "layer-id"].iter().map(|v|*v)); @@ -1473,7 +1476,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1496,10 +1499,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_annotations_summary(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_annotations_summary(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.mylibrary().annotations_summary(&opt.values_of("layer-ids").unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>(), opt.value_of("volume-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.mylibrary().annotations_summary(&opt.values_of("layer-ids").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>(), opt.value_of("volume-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1512,7 +1515,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1525,7 +1528,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1548,13 +1551,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_annotations_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_annotations_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1568,8 +1571,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "page-ids" => Some(("pageIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1634,7 +1637,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Annotation = json::value::from_value(object).unwrap(); let mut call = self.hub.mylibrary().annotations_update(request, opt.value_of("annotation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -1650,7 +1653,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source"].iter().map(|v|*v)); @@ -1664,7 +1667,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1687,10 +1690,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_bookshelves_add_volume(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_bookshelves_add_volume(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mylibrary().bookshelves_add_volume(opt.value_of("shelf").unwrap_or(""), opt.value_of("volume-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -1709,7 +1712,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source", "reason"].iter().map(|v|*v)); @@ -1723,7 +1726,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1738,10 +1741,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_bookshelves_clear_volumes(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_bookshelves_clear_volumes(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mylibrary().bookshelves_clear_volumes(opt.value_of("shelf").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -1757,7 +1760,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source"].iter().map(|v|*v)); @@ -1771,7 +1774,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1786,10 +1789,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_bookshelves_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_bookshelves_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mylibrary().bookshelves_get(opt.value_of("shelf").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -1805,7 +1808,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source"].iter().map(|v|*v)); @@ -1819,7 +1822,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1842,10 +1845,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_bookshelves_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_bookshelves_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mylibrary().bookshelves_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -1861,7 +1864,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source"].iter().map(|v|*v)); @@ -1875,7 +1878,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1898,11 +1901,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_bookshelves_move_volume(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_bookshelves_move_volume(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let volume_position: i32 = arg_from_str(&opt.value_of("volume-position").unwrap_or(""), err, "", "integer"); let mut call = self.hub.mylibrary().bookshelves_move_volume(opt.value_of("shelf").unwrap_or(""), opt.value_of("volume-id").unwrap_or(""), volume_position); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -1918,7 +1921,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source"].iter().map(|v|*v)); @@ -1932,7 +1935,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1947,10 +1950,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_bookshelves_remove_volume(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_bookshelves_remove_volume(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mylibrary().bookshelves_remove_volume(opt.value_of("shelf").unwrap_or(""), opt.value_of("volume-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -1969,7 +1972,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source", "reason"].iter().map(|v|*v)); @@ -1983,7 +1986,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1998,10 +2001,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_bookshelves_volumes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_bookshelves_volumes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mylibrary().bookshelves_volumes_list(opt.value_of("shelf").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -2035,7 +2038,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["projection", "country", "show-preorders", "max-results", "q", "source", "start-index"].iter().map(|v|*v)); @@ -2049,7 +2052,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2072,10 +2075,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_readingpositions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_readingpositions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mylibrary().readingpositions_get(opt.value_of("volume-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -2094,7 +2097,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source", "content-version"].iter().map(|v|*v)); @@ -2108,7 +2111,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2131,10 +2134,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mylibrary_readingpositions_set_position(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mylibrary_readingpositions_set_position(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mylibrary().readingpositions_set_position(opt.value_of("volume-id").unwrap_or(""), opt.value_of("timestamp").unwrap_or(""), opt.value_of("position").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -2159,7 +2162,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["action", "source", "content-version", "device-cookie"].iter().map(|v|*v)); @@ -2173,7 +2176,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2188,12 +2191,15 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _notification_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _notification_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.notification().get(opt.value_of("notification-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "target-ids" => { + call = call.add_target_ids(value.unwrap_or("")); + }, "source" => { call = call.source(value.unwrap_or("")); }, @@ -2210,10 +2216,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["locale", "source"].iter().map(|v|*v)); + v.extend(["locale", "source", "target-ids"].iter().map(|v|*v)); v } )); } } @@ -2224,7 +2230,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2247,10 +2253,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _onboarding_list_categories(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _onboarding_list_categories(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.onboarding().list_categories(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "locale" => { @@ -2266,7 +2272,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale"].iter().map(|v|*v)); @@ -2280,7 +2286,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2303,10 +2309,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _onboarding_list_category_volumes(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _onboarding_list_category_volumes(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.onboarding().list_category_volumes(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2334,7 +2340,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "page-token", "max-allowed-maturity-rating", "category-id", "page-size"].iter().map(|v|*v)); @@ -2348,7 +2354,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2371,12 +2377,15 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _personalizedstream_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _personalizedstream_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.personalizedstream().get(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "target-ids" => { + call = call.add_target_ids(value.unwrap_or("")); + }, "source" => { call = call.source(value.unwrap_or("")); }, @@ -2396,10 +2405,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["locale", "source", "max-allowed-maturity-rating"].iter().map(|v|*v)); + v.extend(["locale", "source", "max-allowed-maturity-rating", "target-ids"].iter().map(|v|*v)); v } )); } } @@ -2410,7 +2419,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2433,10 +2442,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _promooffer_accept(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _promooffer_accept(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.promooffer().accept(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "volume-id" => { @@ -2473,7 +2482,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["product", "volume-id", "offer-id", "android-id", "device", "model", "serial", "manufacturer"].iter().map(|v|*v)); @@ -2487,7 +2496,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2502,10 +2511,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _promooffer_dismiss(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _promooffer_dismiss(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.promooffer().dismiss(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "serial" => { @@ -2539,7 +2548,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["product", "offer-id", "android-id", "device", "model", "serial", "manufacturer"].iter().map(|v|*v)); @@ -2553,7 +2562,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2568,10 +2577,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _promooffer_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _promooffer_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.promooffer().get(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "serial" => { @@ -2602,7 +2611,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["product", "android-id", "device", "model", "serial", "manufacturer"].iter().map(|v|*v)); @@ -2616,7 +2625,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2639,10 +2648,121 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _volumes_associated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _series_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.series().get(&opt.values_of("series-id").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _series_membership_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.series().membership_get(opt.value_of("series-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _volumes_associated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.volumes().associated_list(opt.value_of("volume-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -2667,7 +2787,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "source", "max-allowed-maturity-rating", "association"].iter().map(|v|*v)); @@ -2681,7 +2801,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2704,10 +2824,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _volumes_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _volumes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.volumes().get(opt.value_of("volume-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-library-consistent-read" => { @@ -2722,6 +2842,9 @@ impl<'n, 'a> Engine<'n, 'a> { "partner" => { call = call.partner(value.unwrap_or("")); }, + "include-non-comics-series" => { + call = call.include_non_comics_series(arg_from_str(value.unwrap_or("false"), err, "include-non-comics-series", "boolean")); + }, "country" => { call = call.country(value.unwrap_or("")); }, @@ -2735,10 +2858,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["country", "source", "user-library-consistent-read", "projection", "partner"].iter().map(|v|*v)); + v.extend(["user-library-consistent-read", "projection", "country", "source", "include-non-comics-series", "partner"].iter().map(|v|*v)); v } )); } } @@ -2749,7 +2872,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2772,10 +2895,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _volumes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _volumes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.volumes().list(opt.value_of("q").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -2824,7 +2947,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "projection", "library-restrict", "lang-restrict", "print-type", "show-preorders", "max-results", "filter", "source", "start-index", "download", "partner"].iter().map(|v|*v)); @@ -2838,7 +2961,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2861,10 +2984,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _volumes_mybooks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _volumes_mybooks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.volumes().mybooks_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -2895,7 +3018,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "acquire-method", "max-results", "source", "start-index", "processing-state"].iter().map(|v|*v)); @@ -2909,7 +3032,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2932,12 +3055,15 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _volumes_recommended_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _volumes_recommended_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.volumes().recommended_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "target-ids" => { + call = call.add_target_ids(value.unwrap_or("")); + }, "source" => { call = call.source(value.unwrap_or("")); }, @@ -2957,10 +3083,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["locale", "source", "max-allowed-maturity-rating"].iter().map(|v|*v)); + v.extend(["locale", "source", "max-allowed-maturity-rating", "target-ids"].iter().map(|v|*v)); v } )); } } @@ -2971,7 +3097,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2994,10 +3120,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _volumes_recommended_rate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _volumes_recommended_rate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.volumes().recommended_rate(opt.value_of("rating").unwrap_or(""), opt.value_of("volume-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -3016,7 +3142,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "source"].iter().map(|v|*v)); @@ -3030,7 +3156,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3053,10 +3179,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _volumes_useruploaded_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _volumes_useruploaded_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.volumes().useruploaded_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "volume-id" => { @@ -3087,7 +3213,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "volume-id", "max-results", "source", "start-index", "processing-state"].iter().map(|v|*v)); @@ -3101,7 +3227,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3326,6 +3452,20 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, + ("series", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._series_get(opt, dry_run, &mut err); + }, + ("membership-get", Some(opt)) => { + call_result = self._series_membership_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("series".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("volumes", Some(opt)) => { match opt.subcommand() { ("associated-list", Some(opt)) => { @@ -3372,14 +3512,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "books1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "books1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -3399,7 +3539,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -3438,7 +3578,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("bookshelves", "methods: 'get', 'list' and 'volumes-list'", vec![ - ("get", + ("get", Some(r##"Retrieves metadata for a specific bookshelf for the specified user."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/bookshelves_get", vec![ @@ -3466,7 +3606,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of public bookshelves for the specified user."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/bookshelves_list", vec![ @@ -3488,7 +3628,7 @@ fn main() { Some(false), Some(false)), ]), - ("volumes-list", + ("volumes-list", Some(r##"Retrieves volumes in a specific bookshelf for the specified user."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/bookshelves_volumes-list", vec![ @@ -3519,7 +3659,7 @@ fn main() { ]), ("cloudloading", "methods: 'add-book', 'delete-book' and 'update-book'", vec![ - ("add-book", + ("add-book", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/cloudloading_add-book", vec![ @@ -3535,7 +3675,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete-book", + ("delete-book", Some(r##"Remove the book and its contents"##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/cloudloading_delete-book", vec![ @@ -3551,7 +3691,7 @@ fn main() { Some(false), Some(true)), ]), - ("update-book", + ("update-book", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/cloudloading_update-book", vec![ @@ -3576,7 +3716,7 @@ fn main() { ]), ("dictionary", "methods: 'list-offline-metadata'", vec![ - ("list-offline-metadata", + ("list-offline-metadata", Some(r##"Returns a list of offline dictionary metadata available"##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/dictionary_list-offline-metadata", vec![ @@ -3601,7 +3741,7 @@ fn main() { ]), ("layers", "methods: 'annotation-data-get', 'annotation-data-list', 'get', 'list', 'volume-annotations-get' and 'volume-annotations-list'", vec![ - ("annotation-data-get", + ("annotation-data-get", Some(r##"Gets the annotation data."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/layers_annotation-data-get", vec![ @@ -3641,7 +3781,7 @@ fn main() { Some(false), Some(false)), ]), - ("annotation-data-list", + ("annotation-data-list", Some(r##"Gets the annotation data for a volume and layer."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/layers_annotation-data-list", vec![ @@ -3675,7 +3815,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets the layer summary for a volume."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/layers_get", vec![ @@ -3703,7 +3843,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List the layer summaries for a volume."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/layers_list", vec![ @@ -3725,7 +3865,7 @@ fn main() { Some(false), Some(false)), ]), - ("volume-annotations-get", + ("volume-annotations-get", Some(r##"Gets the volume annotation."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/layers_volume-annotations-get", vec![ @@ -3759,7 +3899,7 @@ fn main() { Some(false), Some(false)), ]), - ("volume-annotations-list", + ("volume-annotations-list", Some(r##"Gets the volume annotations for a volume and layer."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/layers_volume-annotations-list", vec![ @@ -3796,7 +3936,7 @@ fn main() { ]), ("myconfig", "methods: 'get-user-settings', 'release-download-access', 'request-access', 'sync-volume-licenses' and 'update-user-settings'", vec![ - ("get-user-settings", + ("get-user-settings", Some(r##"Gets the current settings for the user."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/myconfig_get-user-settings", vec![ @@ -3812,7 +3952,7 @@ fn main() { Some(false), Some(false)), ]), - ("release-download-access", + ("release-download-access", Some(r##"Release downloaded content access restriction."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/myconfig_release-download-access", vec![ @@ -3840,7 +3980,7 @@ fn main() { Some(false), Some(false)), ]), - ("request-access", + ("request-access", Some(r##"Request concurrent and download access restrictions."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/myconfig_request-access", vec![ @@ -3880,7 +4020,7 @@ fn main() { Some(false), Some(false)), ]), - ("sync-volume-licenses", + ("sync-volume-licenses", Some(r##"Request downloaded content access for specified volumes on the My eBooks shelf."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/myconfig_sync-volume-licenses", vec![ @@ -3914,7 +4054,7 @@ fn main() { Some(false), Some(false)), ]), - ("update-user-settings", + ("update-user-settings", Some(r##"Sets the settings for the user. If a sub-object is specified, it will overwrite the existing sub-object stored in the server. Unspecified sub-objects will retain the existing value."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/myconfig_update-user-settings", vec![ @@ -3939,7 +4079,7 @@ fn main() { ]), ("mylibrary", "methods: 'annotations-delete', 'annotations-insert', 'annotations-list', 'annotations-summary', 'annotations-update', 'bookshelves-add-volume', 'bookshelves-clear-volumes', 'bookshelves-get', 'bookshelves-list', 'bookshelves-move-volume', 'bookshelves-remove-volume', 'bookshelves-volumes-list', 'readingpositions-get' and 'readingpositions-set-position'", vec![ - ("annotations-delete", + ("annotations-delete", Some(r##"Deletes an annotation."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_annotations-delete", vec![ @@ -3955,7 +4095,7 @@ fn main() { Some(false), Some(true)), ]), - ("annotations-insert", + ("annotations-insert", Some(r##"Inserts a new annotation."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_annotations-insert", vec![ @@ -3977,7 +4117,7 @@ fn main() { Some(false), Some(false)), ]), - ("annotations-list", + ("annotations-list", Some(r##"Retrieves a list of annotations, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_annotations-list", vec![ @@ -3993,7 +4133,7 @@ fn main() { Some(false), Some(false)), ]), - ("annotations-summary", + ("annotations-summary", Some(r##"Gets the summary of specified layers."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_annotations-summary", vec![ @@ -4021,7 +4161,7 @@ fn main() { Some(false), Some(false)), ]), - ("annotations-update", + ("annotations-update", Some(r##"Updates an existing annotation."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_annotations-update", vec![ @@ -4049,7 +4189,7 @@ fn main() { Some(false), Some(false)), ]), - ("bookshelves-add-volume", + ("bookshelves-add-volume", Some(r##"Adds a volume to a bookshelf."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_bookshelves-add-volume", vec![ @@ -4071,7 +4211,7 @@ fn main() { Some(false), Some(true)), ]), - ("bookshelves-clear-volumes", + ("bookshelves-clear-volumes", Some(r##"Clears all volumes from a bookshelf."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_bookshelves-clear-volumes", vec![ @@ -4087,7 +4227,7 @@ fn main() { Some(false), Some(true)), ]), - ("bookshelves-get", + ("bookshelves-get", Some(r##"Retrieves metadata for a specific bookshelf belonging to the authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_bookshelves-get", vec![ @@ -4109,7 +4249,7 @@ fn main() { Some(false), Some(false)), ]), - ("bookshelves-list", + ("bookshelves-list", Some(r##"Retrieves a list of bookshelves belonging to the authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_bookshelves-list", vec![ @@ -4125,7 +4265,7 @@ fn main() { Some(false), Some(false)), ]), - ("bookshelves-move-volume", + ("bookshelves-move-volume", Some(r##"Moves a volume within a bookshelf."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_bookshelves-move-volume", vec![ @@ -4153,7 +4293,7 @@ fn main() { Some(false), Some(true)), ]), - ("bookshelves-remove-volume", + ("bookshelves-remove-volume", Some(r##"Removes a volume from a bookshelf."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_bookshelves-remove-volume", vec![ @@ -4175,7 +4315,7 @@ fn main() { Some(false), Some(true)), ]), - ("bookshelves-volumes-list", + ("bookshelves-volumes-list", Some(r##"Gets volume information for volumes on a bookshelf."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_bookshelves-volumes-list", vec![ @@ -4197,7 +4337,7 @@ fn main() { Some(false), Some(false)), ]), - ("readingpositions-get", + ("readingpositions-get", Some(r##"Retrieves my reading position information for a volume."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_readingpositions-get", vec![ @@ -4219,7 +4359,7 @@ fn main() { Some(false), Some(false)), ]), - ("readingpositions-set-position", + ("readingpositions-set-position", Some(r##"Sets my reading position information for a volume."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/mylibrary_readingpositions-set-position", vec![ @@ -4250,7 +4390,7 @@ fn main() { ]), ("notification", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Returns notification details for a given notification id."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/notification_get", vec![ @@ -4275,7 +4415,7 @@ fn main() { ]), ("onboarding", "methods: 'list-categories' and 'list-category-volumes'", vec![ - ("list-categories", + ("list-categories", Some(r##"List categories for onboarding experience."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/onboarding_list-categories", vec![ @@ -4291,7 +4431,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-category-volumes", + ("list-category-volumes", Some(r##"List available volumes under categories for onboarding experience."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/onboarding_list-category-volumes", vec![ @@ -4310,7 +4450,7 @@ fn main() { ]), ("personalizedstream", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Returns a stream of personalized book clusters"##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/personalizedstream_get", vec![ @@ -4329,7 +4469,7 @@ fn main() { ]), ("promooffer", "methods: 'accept', 'dismiss' and 'get'", vec![ - ("accept", + ("accept", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/promooffer_accept", vec![ @@ -4339,7 +4479,7 @@ fn main() { Some(false), Some(true)), ]), - ("dismiss", + ("dismiss", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/promooffer_dismiss", vec![ @@ -4349,7 +4489,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns a list of promo offers available to the user"##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/promooffer_get", vec![ @@ -4367,8 +4507,55 @@ fn main() { ]), ]), + ("series", "methods: 'get' and 'membership-get'", vec![ + ("get", + Some(r##"Returns Series metadata for the given series ids."##), + "Details at http://byron.github.io/google-apis-rs/google_books1_cli/series_get", + vec![ + (Some(r##"series-id"##), + None, + Some(r##"String that identifies the series"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("membership-get", + Some(r##"Returns Series membership data given the series id."##), + "Details at http://byron.github.io/google-apis-rs/google_books1_cli/series_membership-get", + vec![ + (Some(r##"series-id"##), + None, + Some(r##"String that identifies the series"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("volumes", "methods: 'associated-list', 'get', 'list', 'mybooks-list', 'recommended-list', 'recommended-rate' and 'useruploaded-list'", vec![ - ("associated-list", + ("associated-list", Some(r##"Return a list of associated books."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/volumes_associated-list", vec![ @@ -4390,7 +4577,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets volume information for a single volume."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/volumes_get", vec![ @@ -4412,7 +4599,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Performs a book search."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/volumes_list", vec![ @@ -4434,7 +4621,7 @@ fn main() { Some(false), Some(false)), ]), - ("mybooks-list", + ("mybooks-list", Some(r##"Return a list of books in My Library."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/volumes_mybooks-list", vec![ @@ -4450,7 +4637,7 @@ fn main() { Some(false), Some(false)), ]), - ("recommended-list", + ("recommended-list", Some(r##"Return a list of recommended books for the current user."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/volumes_recommended-list", vec![ @@ -4466,7 +4653,7 @@ fn main() { Some(false), Some(false)), ]), - ("recommended-rate", + ("recommended-rate", Some(r##"Rate a recommended book for the current user."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/volumes_recommended-rate", vec![ @@ -4494,7 +4681,7 @@ fn main() { Some(false), Some(false)), ]), - ("useruploaded-list", + ("useruploaded-list", Some(r##"Return a list of books uploaded by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_books1_cli/volumes_useruploaded-list", vec![ @@ -4516,7 +4703,7 @@ fn main() { let mut app = App::new("books1") .author("Sebastian Thiel ") - .version("0.3.2+20150921") + .version("0.3.3+20151218") .about("Lets you search for books and manage your Google Books library.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_books1_cli") .arg(Arg::with_name("url") @@ -4540,7 +4727,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -4551,7 +4738,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/books1/Cargo.toml b/gen/books1/Cargo.toml index 487e8168d8..d3683e1e21 100644 --- a/gen/books1/Cargo.toml +++ b/gen/books1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-books1" -version = "0.1.10+20150921" +version = "0.1.11+20151218" authors = ["Sebastian Thiel "] description = "A complete library to interact with books (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/books1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/books1/LICENSE.md b/gen/books1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/books1/LICENSE.md +++ b/gen/books1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/books1/README.md b/gen/books1/README.md index 057e6c7e1c..59715a3e9f 100644 --- a/gen/books1/README.md +++ b/gen/books1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-books1` library allows access to all features of the *Google books* service. -This documentation was generated from *books* crate version *0.1.10+20150921*, where *20150921* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *books* crate version *0.1.11+20151218*, where *20151218* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *books* *v1* API can be found at the [official documentation site](https://developers.google.com/books/docs/v1/getting_started). @@ -33,6 +33,8 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [*get*](http://byron.github.io/google-apis-rs/google_books1/struct.PersonalizedstreamGetCall.html) * promooffer * [*accept*](http://byron.github.io/google-apis-rs/google_books1/struct.PromoofferAcceptCall.html), [*dismiss*](http://byron.github.io/google-apis-rs/google_books1/struct.PromoofferDismisCall.html) and [*get*](http://byron.github.io/google-apis-rs/google_books1/struct.PromoofferGetCall.html) +* series + * [*get*](http://byron.github.io/google-apis-rs/google_books1/struct.SeryGetCall.html) and [*membership get*](http://byron.github.io/google-apis-rs/google_books1/struct.SeryMembershipGetCall.html) * [volumes](http://byron.github.io/google-apis-rs/google_books1/struct.Volume.html) * [*associated list*](http://byron.github.io/google-apis-rs/google_books1/struct.VolumeAssociatedListCall.html), [*get*](http://byron.github.io/google-apis-rs/google_books1/struct.VolumeGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_books1/struct.VolumeListCall.html), [*mybooks list*](http://byron.github.io/google-apis-rs/google_books1/struct.VolumeMybookListCall.html), [*recommended list*](http://byron.github.io/google-apis-rs/google_books1/struct.VolumeRecommendedListCall.html), [*recommended rate*](http://byron.github.io/google-apis-rs/google_books1/struct.VolumeRecommendedRateCall.html) and [*useruploaded list*](http://byron.github.io/google-apis-rs/google_books1/struct.VolumeUseruploadedListCall.html) diff --git a/gen/books1/src/cmn.rs b/gen/books1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/books1/src/cmn.rs +++ b/gen/books1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/books1/src/lib.rs b/gen/books1/src/lib.rs index ba5d586fd9..75f050d4ee 100644 --- a/gen/books1/src/lib.rs +++ b/gen/books1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *books* crate version *0.1.10+20150921*, where *20150921* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *books* crate version *0.1.11+20151218*, where *20151218* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *books* *v1* API can be found at the //! [official documentation site](https://developers.google.com/books/docs/v1/getting_started). @@ -31,6 +31,8 @@ //! * [*get*](struct.PersonalizedstreamGetCall.html) //! * promooffer //! * [*accept*](struct.PromoofferAcceptCall.html), [*dismiss*](struct.PromoofferDismisCall.html) and [*get*](struct.PromoofferGetCall.html) +//! * series +//! * [*get*](struct.SeryGetCall.html) and [*membership get*](struct.SeryMembershipGetCall.html) //! * [volumes](struct.Volume.html) //! * [*associated list*](struct.VolumeAssociatedListCall.html), [*get*](struct.VolumeGetCall.html), [*list*](struct.VolumeListCall.html), [*mybooks list*](struct.VolumeMybookListCall.html), [*recommended list*](struct.VolumeRecommendedListCall.html), [*recommended rate*](struct.VolumeRecommendedRateCall.html) and [*useruploaded list*](struct.VolumeUseruploadedListCall.html) //! @@ -121,18 +123,18 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.volumes().list("q") -//! .start_index(18) -//! .source("elitr") +//! .start_index(8) +//! .source("diam") //! .show_preorders(false) -//! .projection("ipsum") -//! .print_type("invidunt") -//! .partner("accusam") -//! .order_by("labore") -//! .max_results(22) -//! .library_restrict("nonumy") -//! .lang_restrict("sed") -//! .filter("diam") -//! .download("magna") +//! .projection("dolor") +//! .print_type("Lorem") +//! .partner("dolor") +//! .order_by("vero") +//! .max_results(10) +//! .library_restrict("takimata") +//! .lang_restrict("dolores") +//! .filter("consetetur") +//! .download("erat") //! .doit(); //! //! match result { diff --git a/gen/books1/src/lib.rs.in b/gen/books1/src/lib.rs.in index f3c9e1a289..ee8b544295 100644 --- a/gen/books1/src/lib.rs.in +++ b/gen/books1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -138,7 +139,7 @@ impl<'a, C, A> Books Books { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -172,12 +173,15 @@ impl<'a, C, A> Books pub fn promooffer(&'a self) -> PromoofferMethods<'a, C, A> { PromoofferMethods { hub: &self } } + pub fn series(&'a self) -> SeryMethods<'a, C, A> { + SeryMethods { hub: &self } + } pub fn volumes(&'a self) -> VolumeMethods<'a, C, A> { VolumeMethods { hub: &self } } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -193,42 +197,39 @@ impl<'a, C, A> Books // ########## /// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list categories onboarding](struct.OnboardingListCategoryCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Category { - /// A list of onboarding categories. - pub items: Option>, +pub struct Volumeseriesinfo { + /// The display number string. This should be used only for display purposes and the actual sequence should be inferred from the below orderNumber. + #[serde(rename="bookDisplayNumber")] + pub book_display_number: Option, /// Resource type. pub kind: Option, + /// Short book title in the context of the series. + #[serde(rename="shortSeriesBookTitle")] + pub short_series_book_title: Option, + /// no description provided + #[serde(rename="volumeSeries")] + pub volume_series: Option>, } -impl ResponseResult for Category {} +impl Part for Volumeseriesinfo {} -/// A list of onboarding categories. +/// Author of this review. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CategoryItems { - /// no description provided - #[serde(rename="badgeUrl")] - pub badge_url: Option, - /// no description provided - #[serde(rename="categoryId")] - pub category_id: Option, - /// no description provided - pub name: Option, +pub struct ReviewAuthor { + /// Name of this person. + #[serde(rename="displayName")] + pub display_name: Option, } -impl NestedType for CategoryItems {} -impl Part for CategoryItems {} +impl NestedType for ReviewAuthor {} +impl Part for ReviewAuthor {} /// There is no detailed description. @@ -269,103 +270,6 @@ pub struct ConcurrentAccessRestriction { impl Part for ConcurrentAccessRestriction {} -/// Physical dimensions of this volume. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeVolumeInfoDimensions { - /// Width of this volume (in cm). - pub width: Option, - /// Height or length of this volume (in cm). - pub height: Option, - /// Thickness of this volume (in cm). - pub thickness: Option, -} - -impl NestedType for VolumeVolumeInfoDimensions {} -impl Part for VolumeVolumeInfoDimensions {} - - -/// General volume information. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeVolumeInfo { - /// Volume subtitle. (In LITE projection.) - pub subtitle: Option, - /// A synopsis of the volume. The text of the description is formatted in HTML and includes simple formatting elements, such as b, i, and br tags. (In LITE projection.) - pub description: Option, - /// Total number of pages as per publisher metadata. - #[serde(rename="pageCount")] - pub page_count: Option, - /// A list of image links for all the sizes that are available. (In LITE projection.) - #[serde(rename="imageLinks")] - pub image_links: Option, - /// The number of review ratings for this volume. - #[serde(rename="ratingsCount")] - pub ratings_count: Option, - /// The main category to which this volume belongs. It will be the category from the categories list returned below that has the highest weight. - #[serde(rename="mainCategory")] - pub main_category: Option, - /// The names of the authors and/or editors for this volume. (In LITE projection) - pub authors: Option>, - /// A list of subject categories, such as "Fiction", "Suspense", etc. - pub categories: Option>, - /// Publisher of this volume. (In LITE projection.) - pub publisher: Option, - /// Physical dimensions of this volume. - pub dimensions: Option, - /// Best language for this volume (based on content). It is the two-letter ISO 639-1 code such as 'fr', 'en', etc. - pub language: Option, - /// URL to preview this volume on the Google Books site. - #[serde(rename="previewLink")] - pub preview_link: Option, - /// no description provided - #[serde(rename="maturityRating")] - pub maturity_rating: Option, - /// URL to view information about this volume on the Google Books site. (In LITE projection) - #[serde(rename="infoLink")] - pub info_link: Option, - /// Date of publication. (In LITE projection.) - #[serde(rename="publishedDate")] - pub published_date: Option, - /// Type of publication of this volume. Possible values are BOOK or MAGAZINE. - #[serde(rename="printType")] - pub print_type: Option, - /// Total number of sample pages as per publisher metadata. - #[serde(rename="samplePageCount")] - pub sample_page_count: Option, - /// The reading modes available for this volume. - #[serde(rename="readingModes")] - pub reading_modes: Option, - /// An identifier for the version of the volume content (text & images). (In LITE projection) - #[serde(rename="contentVersion")] - pub content_version: Option, - /// Total number of printed pages in generated pdf representation. - #[serde(rename="printedPageCount")] - pub printed_page_count: Option, - /// Industry standard identifiers for this volume. - #[serde(rename="industryIdentifiers")] - pub industry_identifiers: Option>, - /// Volume title. (In LITE projection.) - pub title: Option, - /// The mean review rating for this volume. (min = 1.0, max = 5.0) - #[serde(rename="averageRating")] - pub average_rating: Option, - /// Whether anonymous logging should be allowed. - #[serde(rename="allowAnonLogging")] - pub allow_anon_logging: Option, - /// Canonical URL for a volume. (In LITE projection.) - #[serde(rename="canonicalVolumeLink")] - pub canonical_volume_link: Option, -} - -impl NestedType for VolumeVolumeInfo {} -impl Part for VolumeVolumeInfo {} - - /// Selection ranges sent from the client. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -445,21 +349,6 @@ pub struct Volumeannotations { impl ResponseResult for Volumeannotations {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UsersettingsNotification { - /// no description provided - #[serde(rename="moreFromAuthors")] - pub more_from_authors: Option, -} - -impl NestedType for UsersettingsNotification {} -impl Part for UsersettingsNotification {} - - /// There is no detailed description. /// /// # Activities @@ -530,73 +419,6 @@ pub struct Metadata { impl ResponseResult for Metadata {} -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [useruploaded list volumes](struct.VolumeUseruploadedListCall.html) (none) -/// * [recommended rate volumes](struct.VolumeRecommendedRateCall.html) (none) -/// * [list volumes](struct.VolumeListCall.html) (none) -/// * [associated list volumes](struct.VolumeAssociatedListCall.html) (none) -/// * [get volumes](struct.VolumeGetCall.html) (response) -/// * [recommended list volumes](struct.VolumeRecommendedListCall.html) (none) -/// * [mybooks list volumes](struct.VolumeMybookListCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Volume { - /// Resource type for a volume. (In LITE projection.) - pub kind: Option, - /// Any information about a volume related to reading or obtaining that volume text. This information can depend on country (books may be public domain in one country but not in another, e.g.). - #[serde(rename="accessInfo")] - pub access_info: Option, - /// Search result information related to this volume. - #[serde(rename="searchInfo")] - pub search_info: Option, - /// Any information about a volume related to the eBookstore and/or purchaseability. This information can depend on the country where the request originates from (i.e. books may not be for sale in certain countries). - #[serde(rename="saleInfo")] - pub sale_info: Option, - /// Opaque identifier for a specific version of a volume resource. (In LITE projection) - pub etag: Option, - /// What layers exist in this volume and high level information about them. - #[serde(rename="layerInfo")] - pub layer_info: Option, - /// General volume information. - #[serde(rename="volumeInfo")] - pub volume_info: Option, - /// Recommendation related information for this volume. - #[serde(rename="recommendedInfo")] - pub recommended_info: Option, - /// Unique identifier for a volume. (In LITE projection.) - pub id: Option, - /// URL to this resource. (In LITE projection.) - #[serde(rename="selfLink")] - pub self_link: Option, - /// User specific information related to this volume. (e.g. page this user last read or whether they purchased this book) - #[serde(rename="userInfo")] - pub user_info: Option, -} - -impl Resource for Volume {} -impl ResponseResult for Volume {} - - -/// What layers exist in this volume and high level information about them. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeLayerInfo { - /// A layer should appear here if and only if the layer exists for this book. - pub layers: Option>, -} - -impl NestedType for VolumeLayerInfo {} -impl Part for VolumeLayerInfo {} - - /// There is no detailed description. /// /// # Activities @@ -620,31 +442,6 @@ pub struct Discoveryclusters { impl ResponseResult for Discoveryclusters {} -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get user settings myconfig](struct.MyconfigGetUserSettingCall.html) (response) -/// * [update user settings myconfig](struct.MyconfigUpdateUserSettingCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Usersettings { - /// no description provided - pub notification: Option, - /// Resource type. - pub kind: Option, - /// User settings in sub-objects, each for different purposes. - #[serde(rename="notesExport")] - pub notes_export: Option, -} - -impl RequestValue for Usersettings {} -impl ResponseResult for Usersettings {} - - /// Recommendation related information for this volume. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -659,26 +456,27 @@ impl NestedType for VolumeRecommendedInfo {} impl Part for VolumeRecommendedInfo {} -/// A list of offline dictionary metadata. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MetadataItems { - /// no description provided - pub encrypted_key: Option, - /// no description provided - pub version: Option, - /// no description provided - pub download_url: Option, - /// no description provided - pub language: Option, - /// no description provided - pub size: Option, +pub struct VolumeseriesinfoVolumeSeries { + /// The book order number in the series. + #[serde(rename="orderNumber")] + pub order_number: Option, + /// The series id. + #[serde(rename="seriesId")] + pub series_id: Option, + /// List of issues. Applicable only for Collection Edition and Omnibus. + pub issue: Option>, + /// The book type in the context of series. Examples - Single Issue, Collection Edition, etc. + #[serde(rename="seriesBookType")] + pub series_book_type: Option, } -impl NestedType for MetadataItems {} -impl Part for MetadataItems {} +impl NestedType for VolumeseriesinfoVolumeSeries {} +impl Part for VolumeseriesinfoVolumeSeries {} /// There is no detailed description. @@ -694,61 +492,29 @@ impl Part for MetadataItems {} pub struct Notification { /// no description provided pub body: Option, - /// no description provided - #[serde(rename="iconUrl")] - pub icon_url: Option, /// Resource type. pub kind: Option, /// no description provided - #[serde(rename="linkUrl")] - pub link_url: Option, - /// no description provided pub title: Option, + /// no description provided + pub dont_show_notification: Option, + /// no description provided + pub show_notification_settings_action: Option, + /// no description provided + #[serde(rename="iconUrl")] + pub icon_url: Option, + /// no description provided + #[serde(rename="targetUrl")] + pub target_url: Option, + /// no description provided + pub notification_type: Option, + /// no description provided + pub pcampaign_id: Option, } impl ResponseResult for Notification {} -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get bookshelves](struct.BookshelveGetCall.html) (response) -/// * [bookshelves get mylibrary](struct.MylibraryBookshelveGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Bookshelf { - /// Resource type for bookshelf metadata. - pub kind: Option, - /// Description of this bookshelf. - pub description: Option, - /// Title of this bookshelf. - pub title: Option, - /// Number of volumes in this bookshelf. - #[serde(rename="volumeCount")] - pub volume_count: Option, - /// Created time for this bookshelf (formatted UTC timestamp with millisecond resolution). - pub created: Option, - /// Last modified time of this bookshelf (formatted UTC timestamp with millisecond resolution). - pub updated: Option, - /// Whether this bookshelf is PUBLIC or PRIVATE. - pub access: Option, - /// Last time a volume was added or removed from this bookshelf (formatted UTC timestamp with millisecond resolution). - #[serde(rename="volumesLastUpdated")] - pub volumes_last_updated: Option, - /// Id of this bookshelf, only unique by user. - pub id: Option, - /// URL to this resource. - #[serde(rename="selfLink")] - pub self_link: Option, -} - -impl ResponseResult for Bookshelf {} - - /// User settings in sub-objects, each for different purposes. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -830,121 +596,6 @@ impl RequestValue for Annotation {} impl ResponseResult for Annotation {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Review { - /// Star rating for this review. Possible values are ONE, TWO, THREE, FOUR, FIVE or NOT_RATED. - pub rating: Option, - /// Resource type for a review. - pub kind: Option, - /// Title for this review. - pub title: Option, - /// Author of this review. - pub author: Option, - /// Volume that this review is for. - #[serde(rename="volumeId")] - pub volume_id: Option, - /// Review text. - pub content: Option, - /// Information regarding the source of this review, when the review is not from a Google Books user. - pub source: Option, - /// Date of this review. - pub date: Option, - /// Source type for this review. Possible values are EDITORIAL, WEB_USER or GOOGLE_USER. - #[serde(rename="type")] - pub type_: Option, - /// URL for the full review text, for reviews gathered from the web. - #[serde(rename="fullTextUrl")] - pub full_text_url: Option, -} - -impl Part for Review {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DownloadAccessRestriction { - /// Client nonce for verification. Download access and client-validation only. - pub nonce: Option, - /// Resource type. - pub kind: Option, - /// If deviceAllowed, whether access was just acquired with this request. - #[serde(rename="justAcquired")] - pub just_acquired: Option, - /// If restricted, the maximum number of content download licenses for this volume. - #[serde(rename="maxDownloadDevices")] - pub max_download_devices: Option, - /// If restricted, the number of content download licenses already acquired (including the requesting client, if licensed). - #[serde(rename="downloadsAcquired")] - pub downloads_acquired: Option, - /// Identifies the volume for which this entry applies. - #[serde(rename="volumeId")] - pub volume_id: Option, - /// If restricted, whether access is granted for this (user, device, volume). - #[serde(rename="deviceAllowed")] - pub device_allowed: Option, - /// Client app identifier for verification. Download access and client-validation only. - pub source: Option, - /// Response signature. - pub signature: Option, - /// Error/warning reason code. Additional codes may be added in the future. 0 OK 100 ACCESS_DENIED_PUBLISHER_LIMIT 101 ACCESS_DENIED_LIMIT 200 WARNING_USED_LAST_ACCESS - #[serde(rename="reasonCode")] - pub reason_code: Option, - /// Error/warning message. - pub message: Option, - /// Whether this volume has any download access restrictions. - pub restricted: Option, -} - -impl Part for DownloadAccessRestriction {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [release download access myconfig](struct.MyconfigReleaseDownloadAccesCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DownloadAccesses { - /// A list of download access responses. - #[serde(rename="downloadAccessList")] - pub download_access_list: Option>, - /// Resource type. - pub kind: Option, -} - -impl ResponseResult for DownloadAccesses {} - - -/// Information regarding the source of this review, when the review is not from a Google Books user. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReviewSource { - /// Extra text about the source of the review. - #[serde(rename="extraDescription")] - pub extra_description: Option, - /// URL of the source of the review. - pub url: Option, - /// Name of the source. - pub description: Option, -} - -impl NestedType for ReviewSource {} -impl Part for ReviewSource {} - - /// There is no detailed description. /// /// # Activities @@ -1013,32 +664,6 @@ impl NestedType for VolumeSearchInfo {} impl Part for VolumeSearchInfo {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AnnotationsSummaryLayers { - /// no description provided - #[serde(rename="limitType")] - pub limit_type: Option, - /// no description provided - #[serde(rename="remainingCharacterCount")] - pub remaining_character_count: Option, - /// no description provided - pub updated: Option, - /// no description provided - #[serde(rename="allowedCharacterCount")] - pub allowed_character_count: Option, - /// no description provided - #[serde(rename="layerId")] - pub layer_id: Option, -} - -impl NestedType for AnnotationsSummaryLayers {} -impl Part for AnnotationsSummaryLayers {} - - /// There is no detailed description. /// /// # Activities @@ -1077,49 +702,6 @@ pub struct Annotationdata { impl ResponseResult for Annotationdata {} -/// A list of image links for all the sizes that are available. (In LITE projection.) -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeVolumeInfoImageLinks { - /// Image link for large size (width of ~800 pixels). (In LITE projection) - pub large: Option, - /// Image link for extra large size (width of ~1280 pixels). (In LITE projection) - #[serde(rename="extraLarge")] - pub extra_large: Option, - /// Image link for medium size (width of ~575 pixels). (In LITE projection) - pub medium: Option, - /// Image link for small thumbnail size (width of ~80 pixels). (In LITE projection) - #[serde(rename="smallThumbnail")] - pub small_thumbnail: Option, - /// Image link for small size (width of ~300 pixels). (In LITE projection) - pub small: Option, - /// Image link for thumbnail size (width of ~128 pixels). (In LITE projection) - pub thumbnail: Option, -} - -impl NestedType for VolumeVolumeInfoImageLinks {} -impl Part for VolumeVolumeInfoImageLinks {} - - -/// The actual selling price of the book. This is the same as the suggested retail or list price unless there are offers or discounts on this volume. (In LITE projection.) -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeSaleInfoRetailPrice { - /// Amount in the currency listed below. (In LITE projection.) - pub amount: Option, - /// An ISO 4217, three-letter currency code. (In LITE projection.) - #[serde(rename="currencyCode")] - pub currency_code: Option, -} - -impl NestedType for VolumeSaleInfoRetailPrice {} -impl Part for VolumeSaleInfoRetailPrice {} - - /// There is no detailed description. /// /// # Activities @@ -1127,120 +709,20 @@ impl Part for VolumeSaleInfoRetailPrice {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [get layers](struct.LayerGetCall.html) (response) +/// * [membership get series](struct.SeryMembershipGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Layersummary { - /// Resource Type - pub kind: Option, - /// The number of annotations for this layer. - #[serde(rename="annotationCount")] - pub annotation_count: Option, - /// The number of data items for this layer. - #[serde(rename="dataCount")] - pub data_count: Option, - /// The list of annotation types contained for this layer. - #[serde(rename="annotationTypes")] - pub annotation_types: Option>, - /// Timestamp for the last time an item in this layer was updated. (RFC 3339 UTC date-time format). - pub updated: Option, - /// The volume id this resource is for. - #[serde(rename="volumeId")] - pub volume_id: Option, - /// Link to get data for this annotation. - #[serde(rename="annotationsDataLink")] - pub annotations_data_link: Option, - /// The link to get the annotations for this layer. - #[serde(rename="annotationsLink")] - pub annotations_link: Option, - /// The content version this resource is for. - #[serde(rename="contentVersion")] - pub content_version: Option, - /// The layer id for this summary. - #[serde(rename="layerId")] - pub layer_id: Option, - /// The current version of this layer's volume annotations. Note that this version applies only to the data in the books.layers.volumeAnnotations.* responses. The actual annotation data is versioned separately. - #[serde(rename="volumeAnnotationsVersion")] - pub volume_annotations_version: Option, - /// Unique id of this layer summary. - pub id: Option, - /// URL to this resource. - #[serde(rename="selfLink")] - pub self_link: Option, -} - -impl ResponseResult for Layersummary {} - - -/// Offer list (=undiscounted) price in Micros. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeSaleInfoOffersListPrice { +pub struct Seriesmembership { /// no description provided - #[serde(rename="currencyCode")] - pub currency_code: Option, + pub member: Option>, /// no description provided - #[serde(rename="amountInMicros")] - pub amount_in_micros: Option, -} - -impl NestedType for VolumeSaleInfoOffersListPrice {} -impl Part for VolumeSaleInfoOffersListPrice {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [volume annotations get layers](struct.LayerVolumeAnnotationGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Volumeannotation { - /// The type of annotation this is. - #[serde(rename="annotationType")] - pub annotation_type: Option, - /// Resource Type + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Resorce type. pub kind: Option, - /// Indicates that this annotation is deleted. - pub deleted: Option, - /// The content ranges to identify the selected text. - #[serde(rename="contentRanges")] - pub content_ranges: Option, - /// Timestamp for the last time this anntoation was updated. (RFC 3339 UTC date-time format). - pub updated: Option, - /// The Volume this annotation is for. - #[serde(rename="volumeId")] - pub volume_id: Option, - /// The annotation data id for this volume annotation. - #[serde(rename="annotationDataId")] - pub annotation_data_id: Option, - /// Link to get data for this annotation. - #[serde(rename="annotationDataLink")] - pub annotation_data_link: Option, - /// Pages the annotation spans. - #[serde(rename="pageIds")] - pub page_ids: Option>, - /// The Layer this annotation is for. - #[serde(rename="layerId")] - pub layer_id: Option, - /// Excerpt from the volume. - #[serde(rename="selectedText")] - pub selected_text: Option, - /// Data for this annotation. - pub data: Option, - /// Unique id of this volume annotation. - pub id: Option, - /// URL to this resource. - #[serde(rename="selfLink")] - pub self_link: Option, } -impl ResponseResult for Volumeannotation {} +impl ResponseResult for Seriesmembership {} /// There is no detailed description. @@ -1269,95 +751,30 @@ pub struct Annotationsdata { impl ResponseResult for Annotationsdata {} -/// There is no detailed description. +/// A list of image links for all the sizes that are available. (In LITE projection.) /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DiscoveryclustersClusters { - /// no description provided - #[serde(rename="totalVolumes")] - pub total_volumes: Option, - /// no description provided - #[serde(rename="subTitle")] - pub sub_title: Option, - /// no description provided - pub uid: Option, - /// no description provided - pub banner_with_content_container: Option, - /// no description provided - pub title: Option, - /// no description provided - pub volumes: Option>, +pub struct VolumeVolumeInfoImageLinks { + /// Image link for large size (width of ~800 pixels). (In LITE projection) + pub large: Option, + /// Image link for extra large size (width of ~1280 pixels). (In LITE projection) + #[serde(rename="extraLarge")] + pub extra_large: Option, + /// Image link for medium size (width of ~575 pixels). (In LITE projection) + pub medium: Option, + /// Image link for small thumbnail size (width of ~80 pixels). (In LITE projection) + #[serde(rename="smallThumbnail")] + pub small_thumbnail: Option, + /// Image link for small size (width of ~300 pixels). (In LITE projection) + pub small: Option, + /// Image link for thumbnail size (width of ~128 pixels). (In LITE projection) + pub thumbnail: Option, } -impl NestedType for DiscoveryclustersClusters {} -impl Part for DiscoveryclustersClusters {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OffersItemsItems { - /// no description provided - pub description: Option, - /// no description provided - pub author: Option, - /// no description provided - pub title: Option, - /// no description provided - #[serde(rename="coverUrl")] - pub cover_url: Option, - /// no description provided - #[serde(rename="volumeId")] - pub volume_id: Option, - /// no description provided - #[serde(rename="canonicalVolumeLink")] - pub canonical_volume_link: Option, -} - -impl NestedType for OffersItemsItems {} -impl Part for OffersItemsItems {} - - -/// Industry standard identifiers for this volume. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeVolumeInfoIndustryIdentifiers { - /// Industry specific volume identifier. - pub identifier: Option, - /// Identifier type. Possible values are ISBN_10, ISBN_13, ISSN and OTHER. - #[serde(rename="type")] - pub type_: Option, -} - -impl NestedType for VolumeVolumeInfoIndustryIdentifiers {} -impl Part for VolumeVolumeInfoIndustryIdentifiers {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AnnotationLayerSummary { - /// Type of limitation on this layer. "limited" or "unlimited" for the "copy" layer. - #[serde(rename="limitType")] - pub limit_type: Option, - /// Remaining allowed characters on this layer, especially for the "copy" layer. - #[serde(rename="remainingCharacterCount")] - pub remaining_character_count: Option, - /// Maximum allowed characters on this layer, especially for the "copy" layer. - #[serde(rename="allowedCharacterCount")] - pub allowed_character_count: Option, -} - -impl NestedType for AnnotationLayerSummary {} -impl Part for AnnotationLayerSummary {} +impl NestedType for VolumeVolumeInfoImageLinks {} +impl Part for VolumeVolumeInfoImageLinks {} /// There is no detailed description. @@ -1403,25 +820,28 @@ impl Part for VolumeAccessInfoEpub {} /// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list category volumes onboarding](struct.OnboardingListCategoryVolumeCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Volume2 { +pub struct DiscoveryclustersClusters { /// no description provided - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// A list of volumes. - pub items: Option>, - /// Resource type. - pub kind: Option, + #[serde(rename="totalVolumes")] + pub total_volumes: Option, + /// no description provided + #[serde(rename="subTitle")] + pub sub_title: Option, + /// no description provided + pub uid: Option, + /// no description provided + pub banner_with_content_container: Option, + /// no description provided + pub title: Option, + /// no description provided + pub volumes: Option>, } -impl ResponseResult for Volume2 {} +impl NestedType for DiscoveryclustersClusters {} +impl Part for DiscoveryclustersClusters {} /// Information about pdf content. (In LITE projection.) @@ -1445,21 +865,6 @@ impl NestedType for VolumeAccessInfoPdf {} impl Part for VolumeAccessInfoPdf {} -/// Author of this review. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReviewAuthor { - /// Name of this person. - #[serde(rename="displayName")] - pub display_name: Option, -} - -impl NestedType for ReviewAuthor {} -impl Part for ReviewAuthor {} - - /// There is no detailed description. /// /// # Activities @@ -1501,22 +906,22 @@ pub struct Bookshelves { impl ResponseResult for Bookshelves {} -/// A layer should appear here if and only if the layer exists for this book. +/// Physical dimensions of this volume. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeLayerInfoLayers { - /// The current version of this layer's volume annotations. Note that this version applies only to the data in the books.layers.volumeAnnotations.* responses. The actual annotation data is versioned separately. - #[serde(rename="volumeAnnotationsVersion")] - pub volume_annotations_version: Option, - /// The layer id of this layer (e.g. "geo"). - #[serde(rename="layerId")] - pub layer_id: Option, +pub struct VolumeVolumeInfoDimensions { + /// Width of this volume (in cm). + pub width: Option, + /// Height or length of this volume (in cm). + pub height: Option, + /// Thickness of this volume (in cm). + pub thickness: Option, } -impl NestedType for VolumeLayerInfoLayers {} -impl Part for VolumeLayerInfoLayers {} +impl NestedType for VolumeVolumeInfoDimensions {} +impl Part for VolumeVolumeInfoDimensions {} /// There is no detailed description. @@ -1617,155 +1022,6 @@ impl NestedType for VolumeUserInfoCopy {} impl Part for VolumeUserInfoCopy {} -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [recommended rate volumes](struct.VolumeRecommendedRateCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BooksVolumesRecommendedRateResponse { - /// no description provided - pub consistency_token: Option, -} - -impl ResponseResult for BooksVolumesRecommendedRateResponse {} - - -/// User specific information related to this volume. (e.g. page this user last read or whether they purchased this book) -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeUserInfo { - /// Whether or not this volume is currently in "my books." - #[serde(rename="isInMyBooks")] - pub is_in_my_books: Option, - /// Period during this book is/was a valid rental. - #[serde(rename="rentalPeriod")] - pub rental_period: Option, - /// How this volume was acquired. - #[serde(rename="acquisitionType")] - pub acquisition_type: Option, - /// no description provided - #[serde(rename="userUploadedVolumeInfo")] - pub user_uploaded_volume_info: Option, - /// Whether this book is an active or an expired rental. - #[serde(rename="rentalState")] - pub rental_state: Option, - /// Whether or not this volume was purchased by the authenticated user making the request. (In LITE projection.) - #[serde(rename="isPurchased")] - pub is_purchased: Option, - /// Timestamp when this volume was last modified by a user action, such as a reading position update, volume purchase or writing a review. (RFC 3339 UTC date-time format). - pub updated: Option, - /// Whether or not this volume was pre-ordered by the authenticated user making the request. (In LITE projection.) - #[serde(rename="isPreordered")] - pub is_preordered: Option, - /// The user's current reading position in the volume, if one is available. (In LITE projection.) - #[serde(rename="readingPosition")] - pub reading_position: Option, - /// Whether this volume is purchased, sample, pd download etc. - #[serde(rename="entitlementType")] - pub entitlement_type: Option, - /// Copy/Paste accounting information. - pub copy: Option, - /// This user's review of this volume, if one exists. - pub review: Option, - /// Whether or not this volume was user uploaded. - #[serde(rename="isUploaded")] - pub is_uploaded: Option, -} - -impl NestedType for VolumeUserInfo {} -impl Part for VolumeUserInfo {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [update book cloudloading](struct.CloudloadingUpdateBookCall.html) (request|response) -/// * [add book cloudloading](struct.CloudloadingAddBookCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BooksCloudloadingResource { - /// no description provided - pub author: Option, - /// no description provided - #[serde(rename="processingState")] - pub processing_state: Option, - /// no description provided - #[serde(rename="volumeId")] - pub volume_id: Option, - /// no description provided - pub title: Option, -} - -impl RequestValue for BooksCloudloadingResource {} -impl ResponseResult for BooksCloudloadingResource {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeUserInfoUserUploadedVolumeInfo { - /// no description provided - #[serde(rename="processingState")] - pub processing_state: Option, -} - -impl NestedType for VolumeUserInfoUserUploadedVolumeInfo {} -impl Part for VolumeUserInfoUserUploadedVolumeInfo {} - - -/// Suggested retail price. (In LITE projection.) -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeSaleInfoListPrice { - /// Amount in the currency listed below. (In LITE projection.) - pub amount: Option, - /// An ISO 4217, three-letter currency code. (In LITE projection.) - #[serde(rename="currencyCode")] - pub currency_code: Option, -} - -impl NestedType for VolumeSaleInfoListPrice {} -impl Part for VolumeSaleInfoListPrice {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BooksAnnotationsRange { - /// The starting position for the range. - #[serde(rename="startPosition")] - pub start_position: Option, - /// The ending position for the range. - #[serde(rename="endPosition")] - pub end_position: Option, - /// The offset from the starting position. - #[serde(rename="startOffset")] - pub start_offset: Option, - /// The offset from the ending position. - #[serde(rename="endOffset")] - pub end_offset: Option, -} - -impl Part for BooksAnnotationsRange {} - - /// Any information about a volume related to reading or obtaining that volume text. This information can depend on country (books may be public domain in one country but not in another, e.g.). /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1815,6 +1071,51 @@ impl NestedType for VolumeAccessInfo {} impl Part for VolumeAccessInfo {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update book cloudloading](struct.CloudloadingUpdateBookCall.html) (request|response) +/// * [add book cloudloading](struct.CloudloadingAddBookCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BooksCloudloadingResource { + /// no description provided + pub author: Option, + /// no description provided + #[serde(rename="processingState")] + pub processing_state: Option, + /// no description provided + #[serde(rename="volumeId")] + pub volume_id: Option, + /// no description provided + pub title: Option, +} + +impl RequestValue for BooksCloudloadingResource {} +impl ResponseResult for BooksCloudloadingResource {} + + +/// Suggested retail price. (In LITE projection.) +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeSaleInfoListPrice { + /// Amount in the currency listed below. (In LITE projection.) + pub amount: Option, + /// An ISO 4217, three-letter currency code. (In LITE projection.) + #[serde(rename="currencyCode")] + pub currency_code: Option, +} + +impl NestedType for VolumeSaleInfoListPrice {} +impl Part for VolumeSaleInfoListPrice {} + + /// Selection ranges for the most recent content version. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1842,39 +1143,6 @@ impl NestedType for AnnotationCurrentVersionRanges {} impl Part for AnnotationCurrentVersionRanges {} -/// Any information about a volume related to the eBookstore and/or purchaseability. This information can depend on the country where the request originates from (i.e. books may not be for sale in certain countries). -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeSaleInfo { - /// The two-letter ISO_3166-1 country code for which this sale information is valid. (In LITE projection.) - pub country: Option, - /// The actual selling price of the book. This is the same as the suggested retail or list price unless there are offers or discounts on this volume. (In LITE projection.) - #[serde(rename="retailPrice")] - pub retail_price: Option, - /// Whether or not this volume is an eBook (can be added to the My eBooks shelf). - #[serde(rename="isEbook")] - pub is_ebook: Option, - /// Offers available for this volume (sales and rentals). - pub offers: Option>, - /// Whether or not this book is available for sale or offered for free in the Google eBookstore for the country listed above. Possible values are FOR_SALE, FOR_RENTAL_ONLY, FOR_SALE_AND_RENTAL, FREE, NOT_FOR_SALE, or FOR_PREORDER. - pub saleability: Option, - /// URL to purchase this volume on the Google Books site. (In LITE projection) - #[serde(rename="buyLink")] - pub buy_link: Option, - /// The date on which this book is available for sale. - #[serde(rename="onSaleDate")] - pub on_sale_date: Option, - /// Suggested retail price. (In LITE projection.) - #[serde(rename="listPrice")] - pub list_price: Option, -} - -impl NestedType for VolumeSaleInfo {} -impl Part for VolumeSaleInfo {} - - /// There is no detailed description. /// /// # Activities @@ -1937,6 +1205,867 @@ impl NestedType for VolumeUserInfoRentalPeriod {} impl Part for VolumeUserInfoRentalPeriod {} +/// What layers exist in this volume and high level information about them. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeLayerInfo { + /// A layer should appear here if and only if the layer exists for this book. + pub layers: Option>, +} + +impl NestedType for VolumeLayerInfo {} +impl Part for VolumeLayerInfo {} + + +/// A layer should appear here if and only if the layer exists for this book. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeLayerInfoLayers { + /// The current version of this layer's volume annotations. Note that this version applies only to the data in the books.layers.volumeAnnotations.* responses. The actual annotation data is versioned separately. + #[serde(rename="volumeAnnotationsVersion")] + pub volume_annotations_version: Option, + /// The layer id of this layer (e.g. "geo"). + #[serde(rename="layerId")] + pub layer_id: Option, +} + +impl NestedType for VolumeLayerInfoLayers {} +impl Part for VolumeLayerInfoLayers {} + + +/// The rental duration (for rental offers only). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeSaleInfoOffersRentalDuration { + /// no description provided + pub count: Option, + /// no description provided + pub unit: Option, +} + +impl NestedType for VolumeSaleInfoOffersRentalDuration {} +impl Part for VolumeSaleInfoOffersRentalDuration {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list categories onboarding](struct.OnboardingListCategoryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Category { + /// A list of onboarding categories. + pub items: Option>, + /// Resource type. + pub kind: Option, +} + +impl ResponseResult for Category {} + + +/// A list of onboarding categories. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CategoryItems { + /// no description provided + #[serde(rename="badgeUrl")] + pub badge_url: Option, + /// no description provided + #[serde(rename="categoryId")] + pub category_id: Option, + /// no description provided + pub name: Option, +} + +impl NestedType for CategoryItems {} +impl Part for CategoryItems {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Review { + /// Star rating for this review. Possible values are ONE, TWO, THREE, FOUR, FIVE or NOT_RATED. + pub rating: Option, + /// Resource type for a review. + pub kind: Option, + /// Title for this review. + pub title: Option, + /// Author of this review. + pub author: Option, + /// Volume that this review is for. + #[serde(rename="volumeId")] + pub volume_id: Option, + /// Review text. + pub content: Option, + /// Information regarding the source of this review, when the review is not from a Google Books user. + pub source: Option, + /// Date of this review. + pub date: Option, + /// Source type for this review. Possible values are EDITORIAL, WEB_USER or GOOGLE_USER. + #[serde(rename="type")] + pub type_: Option, + /// URL for the full review text, for reviews gathered from the web. + #[serde(rename="fullTextUrl")] + pub full_text_url: Option, +} + +impl Part for Review {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OffersItemsItems { + /// no description provided + pub description: Option, + /// no description provided + pub author: Option, + /// no description provided + pub title: Option, + /// no description provided + #[serde(rename="coverUrl")] + pub cover_url: Option, + /// no description provided + #[serde(rename="volumeId")] + pub volume_id: Option, + /// no description provided + #[serde(rename="canonicalVolumeLink")] + pub canonical_volume_link: Option, +} + +impl NestedType for OffersItemsItems {} +impl Part for OffersItemsItems {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get user settings myconfig](struct.MyconfigGetUserSettingCall.html) (response) +/// * [update user settings myconfig](struct.MyconfigUpdateUserSettingCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Usersettings { + /// no description provided + pub notification: Option, + /// Resource type. + pub kind: Option, + /// User settings in sub-objects, each for different purposes. + #[serde(rename="notesExport")] + pub notes_export: Option, +} + +impl RequestValue for Usersettings {} +impl ResponseResult for Usersettings {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get bookshelves](struct.BookshelveGetCall.html) (response) +/// * [bookshelves get mylibrary](struct.MylibraryBookshelveGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Bookshelf { + /// Resource type for bookshelf metadata. + pub kind: Option, + /// Description of this bookshelf. + pub description: Option, + /// Title of this bookshelf. + pub title: Option, + /// Number of volumes in this bookshelf. + #[serde(rename="volumeCount")] + pub volume_count: Option, + /// Created time for this bookshelf (formatted UTC timestamp with millisecond resolution). + pub created: Option, + /// Last modified time of this bookshelf (formatted UTC timestamp with millisecond resolution). + pub updated: Option, + /// Whether this bookshelf is PUBLIC or PRIVATE. + pub access: Option, + /// Last time a volume was added or removed from this bookshelf (formatted UTC timestamp with millisecond resolution). + #[serde(rename="volumesLastUpdated")] + pub volumes_last_updated: Option, + /// Id of this bookshelf, only unique by user. + pub id: Option, + /// URL to this resource. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl ResponseResult for Bookshelf {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get layers](struct.LayerGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Layersummary { + /// Resource Type + pub kind: Option, + /// The number of annotations for this layer. + #[serde(rename="annotationCount")] + pub annotation_count: Option, + /// The number of data items for this layer. + #[serde(rename="dataCount")] + pub data_count: Option, + /// The list of annotation types contained for this layer. + #[serde(rename="annotationTypes")] + pub annotation_types: Option>, + /// Timestamp for the last time an item in this layer was updated. (RFC 3339 UTC date-time format). + pub updated: Option, + /// The volume id this resource is for. + #[serde(rename="volumeId")] + pub volume_id: Option, + /// Link to get data for this annotation. + #[serde(rename="annotationsDataLink")] + pub annotations_data_link: Option, + /// The link to get the annotations for this layer. + #[serde(rename="annotationsLink")] + pub annotations_link: Option, + /// The content version this resource is for. + #[serde(rename="contentVersion")] + pub content_version: Option, + /// The layer id for this summary. + #[serde(rename="layerId")] + pub layer_id: Option, + /// The current version of this layer's volume annotations. Note that this version applies only to the data in the books.layers.volumeAnnotations.* responses. The actual annotation data is versioned separately. + #[serde(rename="volumeAnnotationsVersion")] + pub volume_annotations_version: Option, + /// Unique id of this layer summary. + pub id: Option, + /// URL to this resource. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl ResponseResult for Layersummary {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DownloadAccessRestriction { + /// Client nonce for verification. Download access and client-validation only. + pub nonce: Option, + /// Resource type. + pub kind: Option, + /// If deviceAllowed, whether access was just acquired with this request. + #[serde(rename="justAcquired")] + pub just_acquired: Option, + /// If restricted, the maximum number of content download licenses for this volume. + #[serde(rename="maxDownloadDevices")] + pub max_download_devices: Option, + /// If restricted, the number of content download licenses already acquired (including the requesting client, if licensed). + #[serde(rename="downloadsAcquired")] + pub downloads_acquired: Option, + /// Identifies the volume for which this entry applies. + #[serde(rename="volumeId")] + pub volume_id: Option, + /// If restricted, whether access is granted for this (user, device, volume). + #[serde(rename="deviceAllowed")] + pub device_allowed: Option, + /// Client app identifier for verification. Download access and client-validation only. + pub source: Option, + /// Response signature. + pub signature: Option, + /// Error/warning reason code. Additional codes may be added in the future. 0 OK 100 ACCESS_DENIED_PUBLISHER_LIMIT 101 ACCESS_DENIED_LIMIT 200 WARNING_USED_LAST_ACCESS + #[serde(rename="reasonCode")] + pub reason_code: Option, + /// Error/warning message. + pub message: Option, + /// Whether this volume has any download access restrictions. + pub restricted: Option, +} + +impl Part for DownloadAccessRestriction {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [release download access myconfig](struct.MyconfigReleaseDownloadAccesCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DownloadAccesses { + /// A list of download access responses. + #[serde(rename="downloadAccessList")] + pub download_access_list: Option>, + /// Resource type. + pub kind: Option, +} + +impl ResponseResult for DownloadAccesses {} + + +/// Information regarding the source of this review, when the review is not from a Google Books user. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReviewSource { + /// Extra text about the source of the review. + #[serde(rename="extraDescription")] + pub extra_description: Option, + /// URL of the source of the review. + pub url: Option, + /// Name of the source. + pub description: Option, +} + +impl NestedType for ReviewSource {} +impl Part for ReviewSource {} + + +/// General volume information. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeVolumeInfo { + /// Volume subtitle. (In LITE projection.) + pub subtitle: Option, + /// no description provided + #[serde(rename="seriesInfo")] + pub series_info: Option, + /// Total number of pages as per publisher metadata. + #[serde(rename="pageCount")] + pub page_count: Option, + /// A list of image links for all the sizes that are available. (In LITE projection.) + #[serde(rename="imageLinks")] + pub image_links: Option, + /// The number of review ratings for this volume. + #[serde(rename="ratingsCount")] + pub ratings_count: Option, + /// The main category to which this volume belongs. It will be the category from the categories list returned below that has the highest weight. + #[serde(rename="mainCategory")] + pub main_category: Option, + /// The names of the authors and/or editors for this volume. (In LITE projection) + pub authors: Option>, + /// A list of subject categories, such as "Fiction", "Suspense", etc. + pub categories: Option>, + /// A synopsis of the volume. The text of the description is formatted in HTML and includes simple formatting elements, such as b, i, and br tags. (In LITE projection.) + pub description: Option, + /// Publisher of this volume. (In LITE projection.) + pub publisher: Option, + /// Physical dimensions of this volume. + pub dimensions: Option, + /// Best language for this volume (based on content). It is the two-letter ISO 639-1 code such as 'fr', 'en', etc. + pub language: Option, + /// URL to preview this volume on the Google Books site. + #[serde(rename="previewLink")] + pub preview_link: Option, + /// no description provided + #[serde(rename="maturityRating")] + pub maturity_rating: Option, + /// URL to view information about this volume on the Google Books site. (In LITE projection) + #[serde(rename="infoLink")] + pub info_link: Option, + /// Date of publication. (In LITE projection.) + #[serde(rename="publishedDate")] + pub published_date: Option, + /// Type of publication of this volume. Possible values are BOOK or MAGAZINE. + #[serde(rename="printType")] + pub print_type: Option, + /// Total number of sample pages as per publisher metadata. + #[serde(rename="samplePageCount")] + pub sample_page_count: Option, + /// The reading modes available for this volume. + #[serde(rename="readingModes")] + pub reading_modes: Option, + /// An identifier for the version of the volume content (text & images). (In LITE projection) + #[serde(rename="contentVersion")] + pub content_version: Option, + /// Total number of printed pages in generated pdf representation. + #[serde(rename="printedPageCount")] + pub printed_page_count: Option, + /// Industry standard identifiers for this volume. + #[serde(rename="industryIdentifiers")] + pub industry_identifiers: Option>, + /// Volume title. (In LITE projection.) + pub title: Option, + /// The mean review rating for this volume. (min = 1.0, max = 5.0) + #[serde(rename="averageRating")] + pub average_rating: Option, + /// Whether anonymous logging should be allowed. + #[serde(rename="allowAnonLogging")] + pub allow_anon_logging: Option, + /// Canonical URL for a volume. (In LITE projection.) + #[serde(rename="canonicalVolumeLink")] + pub canonical_volume_link: Option, +} + +impl NestedType for VolumeVolumeInfo {} +impl Part for VolumeVolumeInfo {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AnnotationLayerSummary { + /// Type of limitation on this layer. "limited" or "unlimited" for the "copy" layer. + #[serde(rename="limitType")] + pub limit_type: Option, + /// Remaining allowed characters on this layer, especially for the "copy" layer. + #[serde(rename="remainingCharacterCount")] + pub remaining_character_count: Option, + /// Maximum allowed characters on this layer, especially for the "copy" layer. + #[serde(rename="allowedCharacterCount")] + pub allowed_character_count: Option, +} + +impl NestedType for AnnotationLayerSummary {} +impl Part for AnnotationLayerSummary {} + + +/// The actual selling price of the book. This is the same as the suggested retail or list price unless there are offers or discounts on this volume. (In LITE projection.) +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeSaleInfoRetailPrice { + /// Amount in the currency listed below. (In LITE projection.) + pub amount: Option, + /// An ISO 4217, three-letter currency code. (In LITE projection.) + #[serde(rename="currencyCode")] + pub currency_code: Option, +} + +impl NestedType for VolumeSaleInfoRetailPrice {} +impl Part for VolumeSaleInfoRetailPrice {} + + +/// Offer list (=undiscounted) price in Micros. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeSaleInfoOffersListPrice { + /// no description provided + #[serde(rename="currencyCode")] + pub currency_code: Option, + /// no description provided + #[serde(rename="amountInMicros")] + pub amount_in_micros: Option, +} + +impl NestedType for VolumeSaleInfoOffersListPrice {} +impl Part for VolumeSaleInfoOffersListPrice {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [volume annotations get layers](struct.LayerVolumeAnnotationGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Volumeannotation { + /// The type of annotation this is. + #[serde(rename="annotationType")] + pub annotation_type: Option, + /// Resource Type + pub kind: Option, + /// Indicates that this annotation is deleted. + pub deleted: Option, + /// The content ranges to identify the selected text. + #[serde(rename="contentRanges")] + pub content_ranges: Option, + /// Timestamp for the last time this anntoation was updated. (RFC 3339 UTC date-time format). + pub updated: Option, + /// The Volume this annotation is for. + #[serde(rename="volumeId")] + pub volume_id: Option, + /// The annotation data id for this volume annotation. + #[serde(rename="annotationDataId")] + pub annotation_data_id: Option, + /// Link to get data for this annotation. + #[serde(rename="annotationDataLink")] + pub annotation_data_link: Option, + /// Pages the annotation spans. + #[serde(rename="pageIds")] + pub page_ids: Option>, + /// The Layer this annotation is for. + #[serde(rename="layerId")] + pub layer_id: Option, + /// Excerpt from the volume. + #[serde(rename="selectedText")] + pub selected_text: Option, + /// Data for this annotation. + pub data: Option, + /// Unique id of this volume annotation. + pub id: Option, + /// URL to this resource. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl ResponseResult for Volumeannotation {} + + +/// A list of offline dictionary metadata. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MetadataItems { + /// no description provided + pub encrypted_key: Option, + /// no description provided + pub version: Option, + /// no description provided + pub download_url: Option, + /// no description provided + pub language: Option, + /// no description provided + pub size: Option, +} + +impl NestedType for MetadataItems {} +impl Part for MetadataItems {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list category volumes onboarding](struct.OnboardingListCategoryVolumeCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Volume2 { + /// no description provided + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of volumes. + pub items: Option>, + /// Resource type. + pub kind: Option, +} + +impl ResponseResult for Volume2 {} + + +/// List of issues. Applicable only for Collection Edition and Omnibus. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeseriesinfoVolumeSeriesIssue { + /// no description provided + #[serde(rename="issueOrderNumber")] + pub issue_order_number: Option, + /// no description provided + #[serde(rename="issueDisplayNumber")] + pub issue_display_number: Option, +} + +impl NestedType for VolumeseriesinfoVolumeSeriesIssue {} +impl Part for VolumeseriesinfoVolumeSeriesIssue {} + + +/// Industry standard identifiers for this volume. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeVolumeInfoIndustryIdentifiers { + /// Industry specific volume identifier. + pub identifier: Option, + /// Identifier type. Possible values are ISBN_10, ISBN_13, ISSN and OTHER. + #[serde(rename="type")] + pub type_: Option, +} + +impl NestedType for VolumeVolumeInfoIndustryIdentifiers {} +impl Part for VolumeVolumeInfoIndustryIdentifiers {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UsersettingsNotification { + /// no description provided + #[serde(rename="moreFromAuthors")] + pub more_from_authors: Option, +} + +impl NestedType for UsersettingsNotification {} +impl Part for UsersettingsNotification {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [useruploaded list volumes](struct.VolumeUseruploadedListCall.html) (none) +/// * [recommended rate volumes](struct.VolumeRecommendedRateCall.html) (none) +/// * [list volumes](struct.VolumeListCall.html) (none) +/// * [associated list volumes](struct.VolumeAssociatedListCall.html) (none) +/// * [get volumes](struct.VolumeGetCall.html) (response) +/// * [recommended list volumes](struct.VolumeRecommendedListCall.html) (none) +/// * [mybooks list volumes](struct.VolumeMybookListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Volume { + /// Resource type for a volume. (In LITE projection.) + pub kind: Option, + /// Any information about a volume related to reading or obtaining that volume text. This information can depend on country (books may be public domain in one country but not in another, e.g.). + #[serde(rename="accessInfo")] + pub access_info: Option, + /// Search result information related to this volume. + #[serde(rename="searchInfo")] + pub search_info: Option, + /// Any information about a volume related to the eBookstore and/or purchaseability. This information can depend on the country where the request originates from (i.e. books may not be for sale in certain countries). + #[serde(rename="saleInfo")] + pub sale_info: Option, + /// Opaque identifier for a specific version of a volume resource. (In LITE projection) + pub etag: Option, + /// What layers exist in this volume and high level information about them. + #[serde(rename="layerInfo")] + pub layer_info: Option, + /// General volume information. + #[serde(rename="volumeInfo")] + pub volume_info: Option, + /// Recommendation related information for this volume. + #[serde(rename="recommendedInfo")] + pub recommended_info: Option, + /// Unique identifier for a volume. (In LITE projection.) + pub id: Option, + /// URL to this resource. (In LITE projection.) + #[serde(rename="selfLink")] + pub self_link: Option, + /// User specific information related to this volume. (e.g. page this user last read or whether they purchased this book) + #[serde(rename="userInfo")] + pub user_info: Option, +} + +impl Resource for Volume {} +impl ResponseResult for Volume {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [recommended rate volumes](struct.VolumeRecommendedRateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BooksVolumesRecommendedRateResponse { + /// no description provided + pub consistency_token: Option, +} + +impl ResponseResult for BooksVolumesRecommendedRateResponse {} + + +/// User specific information related to this volume. (e.g. page this user last read or whether they purchased this book) +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeUserInfo { + /// Whether or not the user shared this volume with the family. + #[serde(rename="isFamilySharedFromUser")] + pub is_family_shared_from_user: Option, + /// Period during this book is/was a valid rental. + #[serde(rename="rentalPeriod")] + pub rental_period: Option, + /// How this volume was acquired. + #[serde(rename="acquisitionType")] + pub acquisition_type: Option, + /// Whether or not this volume was purchased by the authenticated user making the request. (In LITE projection.) + #[serde(rename="isPurchased")] + pub is_purchased: Option, + /// Timestamp when this volume was last modified by a user action, such as a reading position update, volume purchase or writing a review. (RFC 3339 UTC date-time format). + pub updated: Option, + /// Whether or not this volume was pre-ordered by the authenticated user making the request. (In LITE projection.) + #[serde(rename="isPreordered")] + pub is_preordered: Option, + /// Copy/Paste accounting information. + pub copy: Option, + /// Whether or not this volume was user uploaded. + #[serde(rename="isUploaded")] + pub is_uploaded: Option, + /// Timestamp when this volume was acquired by the user. (RFC 3339 UTC date-time format) Acquiring includes purchase, user upload, receiving family sharing, etc. + #[serde(rename="acquiredTime")] + pub acquired_time: Option, + /// Whether or not this volume is currently in "my books." + #[serde(rename="isInMyBooks")] + pub is_in_my_books: Option, + /// no description provided + #[serde(rename="userUploadedVolumeInfo")] + pub user_uploaded_volume_info: Option, + /// Whether this book is an active or an expired rental. + #[serde(rename="rentalState")] + pub rental_state: Option, + /// Whether or not this volume can be shared with the family by the user. This includes sharing eligibility of both the volume and the user. If the value is true, the user can initiate a family sharing action. + #[serde(rename="isFamilySharingAllowed")] + pub is_family_sharing_allowed: Option, + /// The user's current reading position in the volume, if one is available. (In LITE projection.) + #[serde(rename="readingPosition")] + pub reading_position: Option, + /// Whether or not the user received this volume through family sharing. + #[serde(rename="isFamilySharedToUser")] + pub is_family_shared_to_user: Option, + /// Whether this volume is purchased, sample, pd download etc. + #[serde(rename="entitlementType")] + pub entitlement_type: Option, + /// This user's review of this volume, if one exists. + pub review: Option, +} + +impl NestedType for VolumeUserInfo {} +impl Part for VolumeUserInfo {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SeriesSeries { + /// no description provided + #[serde(rename="seriesId")] + pub series_id: Option, + /// no description provided + #[serde(rename="bannerImageUrl")] + pub banner_image_url: Option, + /// no description provided + #[serde(rename="imageUrl")] + pub image_url: Option, + /// no description provided + #[serde(rename="seriesType")] + pub series_type: Option, + /// no description provided + pub title: Option, +} + +impl NestedType for SeriesSeries {} +impl Part for SeriesSeries {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeUserInfoUserUploadedVolumeInfo { + /// no description provided + #[serde(rename="processingState")] + pub processing_state: Option, +} + +impl NestedType for VolumeUserInfoUserUploadedVolumeInfo {} +impl Part for VolumeUserInfoUserUploadedVolumeInfo {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BooksAnnotationsRange { + /// The starting position for the range. + #[serde(rename="startPosition")] + pub start_position: Option, + /// The ending position for the range. + #[serde(rename="endPosition")] + pub end_position: Option, + /// The offset from the starting position. + #[serde(rename="startOffset")] + pub start_offset: Option, + /// The offset from the ending position. + #[serde(rename="endOffset")] + pub end_offset: Option, +} + +impl Part for BooksAnnotationsRange {} + + +/// Any information about a volume related to the eBookstore and/or purchaseability. This information can depend on the country where the request originates from (i.e. books may not be for sale in certain countries). +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VolumeSaleInfo { + /// The two-letter ISO_3166-1 country code for which this sale information is valid. (In LITE projection.) + pub country: Option, + /// The actual selling price of the book. This is the same as the suggested retail or list price unless there are offers or discounts on this volume. (In LITE projection.) + #[serde(rename="retailPrice")] + pub retail_price: Option, + /// Whether or not this volume is an eBook (can be added to the My eBooks shelf). + #[serde(rename="isEbook")] + pub is_ebook: Option, + /// Offers available for this volume (sales and rentals). + pub offers: Option>, + /// Whether or not this book is available for sale or offered for free in the Google eBookstore for the country listed above. Possible values are FOR_SALE, FOR_RENTAL_ONLY, FOR_SALE_AND_RENTAL, FREE, NOT_FOR_SALE, or FOR_PREORDER. + pub saleability: Option, + /// URL to purchase this volume on the Google Books site. (In LITE projection) + #[serde(rename="buyLink")] + pub buy_link: Option, + /// The date on which this book is available for sale. + #[serde(rename="onSaleDate")] + pub on_sale_date: Option, + /// Suggested retail price. (In LITE projection.) + #[serde(rename="listPrice")] + pub list_price: Option, +} + +impl NestedType for VolumeSaleInfo {} +impl Part for VolumeSaleInfo {} + + /// The content ranges to identify the selected text. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1961,20 +2090,50 @@ impl NestedType for VolumeannotationContentRanges {} impl Part for VolumeannotationContentRanges {} -/// The rental duration (for rental offers only). +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get series](struct.SeryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Series { + /// no description provided + pub series: Option>, + /// Resource type. + pub kind: Option, +} + +impl ResponseResult for Series {} + + +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VolumeSaleInfoOffersRentalDuration { +pub struct AnnotationsSummaryLayers { /// no description provided - pub count: Option, + #[serde(rename="limitType")] + pub limit_type: Option, /// no description provided - pub unit: Option, + #[serde(rename="remainingCharacterCount")] + pub remaining_character_count: Option, + /// no description provided + pub updated: Option, + /// no description provided + #[serde(rename="allowedCharacterCount")] + pub allowed_character_count: Option, + /// no description provided + #[serde(rename="layerId")] + pub layer_id: Option, } -impl NestedType for VolumeSaleInfoOffersRentalDuration {} -impl Part for VolumeSaleInfoOffersRentalDuration {} +impl NestedType for AnnotationsSummaryLayers {} +impl Part for AnnotationsSummaryLayers {} @@ -2255,6 +2414,7 @@ impl<'a, C, A> VolumeMethods<'a, C, A> { _source: Default::default(), _projection: Default::default(), _partner: Default::default(), + _include_non_comics_series: Default::default(), _country: Default::default(), _delegate: Default::default(), _scopes: Default::default(), @@ -2354,6 +2514,7 @@ impl<'a, C, A> VolumeMethods<'a, C, A> { pub fn recommended_list(&self) -> VolumeRecommendedListCall<'a, C, A> { VolumeRecommendedListCall { hub: self.hub, + _target_ids: Default::default(), _source: Default::default(), _max_allowed_maturity_rating: Default::default(), _locale: Default::default(), @@ -2424,7 +2585,7 @@ impl<'a, C, A> DictionaryMethods<'a, C, A> { -/// A builder providing access to all methods supported on *notification* resources. +/// A builder providing access to all methods supported on *sery* resources. /// It is not used directly, but through the `Books` hub. /// /// # Example @@ -2447,34 +2608,51 @@ impl<'a, C, A> DictionaryMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Books::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)` +/// // like `get(...)` and `membership_get(...)` /// // to build up your call. -/// let rb = hub.notification(); +/// let rb = hub.series(); /// # } /// ``` -pub struct NotificationMethods<'a, C, A> +pub struct SeryMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a Books, } -impl<'a, C, A> MethodsBuilder for NotificationMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for SeryMethods<'a, C, A> {} -impl<'a, C, A> NotificationMethods<'a, C, A> { +impl<'a, C, A> SeryMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns notification details for a given notification id. + /// Returns Series metadata for the given series ids. /// /// # Arguments /// - /// * `notification_id` - String to identify the notification. - pub fn get(&self, notification_id: &str) -> NotificationGetCall<'a, C, A> { - NotificationGetCall { + /// * `series_id` - String that identifies the series + pub fn get(&self, series_id: &Vec) -> SeryGetCall<'a, C, A> { + SeryGetCall { hub: self.hub, - _notification_id: notification_id.to_string(), - _source: Default::default(), - _locale: Default::default(), + _series_id: series_id.clone(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns Series membership data given the series id. + /// + /// # Arguments + /// + /// * `series_id` - String that identifies the series + pub fn membership_get(&self, series_id: &str) -> SeryMembershipGetCall<'a, C, A> { + SeryMembershipGetCall { + hub: self.hub, + _series_id: series_id.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -2728,6 +2906,7 @@ impl<'a, C, A> PersonalizedstreamMethods<'a, C, A> { pub fn get(&self) -> PersonalizedstreamGetCall<'a, C, A> { PersonalizedstreamGetCall { hub: self.hub, + _target_ids: Default::default(), _source: Default::default(), _max_allowed_maturity_rating: Default::default(), _locale: Default::default(), @@ -2913,6 +3092,7 @@ impl<'a, C, A> MyconfigMethods<'a, C, A> { _volume_ids: Default::default(), _show_preorders: Default::default(), _locale: Default::default(), + _include_non_comics_series: Default::default(), _features: Default::default(), _delegate: Default::default(), _scopes: Default::default(), @@ -3273,6 +3453,67 @@ impl<'a, C, A> MylibraryMethods<'a, C, A> { +/// A builder providing access to all methods supported on *notification* resources. +/// It is not used directly, but through the `Books` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_books1 as books1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use books1::Books; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Books::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` +/// // to build up your call. +/// let rb = hub.notification(); +/// # } +/// ``` +pub struct NotificationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Books, +} + +impl<'a, C, A> MethodsBuilder for NotificationMethods<'a, C, A> {} + +impl<'a, C, A> NotificationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Returns notification details for a given notification id. + /// + /// # Arguments + /// + /// * `notification_id` - String to identify the notification. + pub fn get(&self, notification_id: &str) -> NotificationGetCall<'a, C, A> { + NotificationGetCall { + hub: self.hub, + _notification_id: notification_id.to_string(), + _target_ids: Default::default(), + _source: Default::default(), + _locale: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *cloudloading* resources. /// It is not used directly, but through the `Books` hub. /// @@ -3439,7 +3680,7 @@ impl<'a, C, A> LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.layers.annotationData.get", + dlg.begin(MethodInfo { id: "books.layers.annotationData.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); @@ -3502,7 +3743,7 @@ impl<'a, C, A> LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3538,7 +3779,7 @@ impl<'a, C, A> LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3548,10 +3789,10 @@ impl<'a, C, A> LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut LayerAnnotationDataGetCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -3594,7 +3835,7 @@ impl<'a, C, A> LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut LayerAnnotationDataGetCall<'a, C, A> { self._layer_id = new_value.to_string(); @@ -3604,7 +3845,7 @@ impl<'a, C, A> LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut LayerAnnotationDataGetCall<'a, C, A> { self._annotation_data_id = new_value.to_string(); @@ -3614,7 +3855,7 @@ impl<'a, C, A> LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut LayerAnnotationDataGetCall<'a, C, A> { self._content_version = new_value.to_string(); @@ -3674,12 +3915,12 @@ impl<'a, C, A> LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut LayerAnnotationDataGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LayerAnnotationDataGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerAnnotationDataGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3774,7 +4015,7 @@ impl<'a, C, A> LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.layers.volumeAnnotations.get", + dlg.begin(MethodInfo { id: "books.layers.volumeAnnotations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); @@ -3824,7 +4065,7 @@ impl<'a, C, A> LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3860,7 +4101,7 @@ impl<'a, C, A> LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3870,10 +4111,10 @@ impl<'a, C, A> LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationGetCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -3916,7 +4157,7 @@ impl<'a, C, A> LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationGetCall<'a, C, A> { self._layer_id = new_value.to_string(); @@ -3926,7 +4167,7 @@ impl<'a, C, A> LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationGetCall<'a, C, A> { self._annotation_id = new_value.to_string(); @@ -3958,12 +4199,12 @@ impl<'a, C, A> LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LayerVolumeAnnotationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerVolumeAnnotationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4060,7 +4301,7 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.layers.list", + dlg.begin(MethodInfo { id: "books.layers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); @@ -4114,7 +4355,7 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4150,7 +4391,7 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4160,10 +4401,10 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4196,7 +4437,7 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *volume id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn volume_id(mut self, new_value: &str) -> LayerListCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -4242,12 +4483,12 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4264,17 +4505,17 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4341,7 +4582,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.layers.get", + dlg.begin(MethodInfo { id: "books.layers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); @@ -4390,7 +4631,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4426,7 +4667,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4436,10 +4677,10 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4472,7 +4713,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *volume id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn volume_id(mut self, new_value: &str) -> LayerGetCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -4482,7 +4723,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *summary id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn summary_id(mut self, new_value: &str) -> LayerGetCall<'a, C, A> { self._summary_id = new_value.to_string(); @@ -4514,12 +4755,12 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4536,17 +4777,17 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4634,7 +4875,7 @@ impl<'a, C, A> LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.layers.volumeAnnotations.list", + dlg.begin(MethodInfo { id: "books.layers.volumeAnnotations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((17 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); @@ -4714,7 +4955,7 @@ impl<'a, C, A> LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4750,7 +4991,7 @@ impl<'a, C, A> LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4760,10 +5001,10 @@ impl<'a, C, A> LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationListCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -4806,7 +5047,7 @@ impl<'a, C, A> LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationListCall<'a, C, A> { self._layer_id = new_value.to_string(); @@ -4816,7 +5057,7 @@ impl<'a, C, A> LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationListCall<'a, C, A> { self._content_version = new_value.to_string(); @@ -4918,12 +5159,12 @@ impl<'a, C, A> LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut LayerVolumeAnnotationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LayerVolumeAnnotationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerVolumeAnnotationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5034,7 +5275,7 @@ impl<'a, C, A> LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.layers.annotationData.list", + dlg.begin(MethodInfo { id: "books.layers.annotationData.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); @@ -5112,7 +5353,7 @@ impl<'a, C, A> LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5148,7 +5389,7 @@ impl<'a, C, A> LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5158,10 +5399,10 @@ impl<'a, C, A> LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut LayerAnnotationDataListCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -5204,7 +5445,7 @@ impl<'a, C, A> LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut LayerAnnotationDataListCall<'a, C, A> { self._layer_id = new_value.to_string(); @@ -5214,7 +5455,7 @@ impl<'a, C, A> LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut LayerAnnotationDataListCall<'a, C, A> { self._content_version = new_value.to_string(); @@ -5303,12 +5544,12 @@ impl<'a, C, A> LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut LayerAnnotationDataListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LayerAnnotationDataListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerAnnotationDataListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5402,7 +5643,7 @@ impl<'a, C, A> VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.volumes.recommended.rate", + dlg.begin(MethodInfo { id: "books.volumes.recommended.rate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("rating", self._rating.to_string())); @@ -5430,7 +5671,7 @@ impl<'a, C, A> VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5466,7 +5707,7 @@ impl<'a, C, A> VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5476,10 +5717,10 @@ impl<'a, C, A> VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut VolumeRecommendedRateCall<'a, C, A> { self._rating = new_value.to_string(); @@ -5522,7 +5763,7 @@ impl<'a, C, A> VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut VolumeRecommendedRateCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -5554,12 +5795,12 @@ impl<'a, C, A> VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> VolumeRecommendedRateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VolumeRecommendedRateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5625,7 +5866,8 @@ impl<'a, C, A> VolumeRecommendedRateCall<'a, C, A> where C: BorrowMut _source: Option, _projection: Option, _partner: Option, + _include_non_comics_series: Option, _country: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, @@ -5658,9 +5901,9 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.volumes.get", + dlg.begin(MethodInfo { id: "books.volumes.get", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); if let Some(value) = self._user_library_consistent_read { params.push(("user_library_consistent_read", value.to_string())); @@ -5674,10 +5917,13 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau if let Some(value) = self._partner { params.push(("partner", value.to_string())); } + if let Some(value) = self._include_non_comics_series { + params.push(("includeNonComicsSeries", value.to_string())); + } if let Some(value) = self._country { params.push(("country", value.to_string())); } - for &field in ["alt", "volumeId", "user_library_consistent_read", "source", "projection", "partner", "country"].iter() { + for &field in ["alt", "volumeId", "user_library_consistent_read", "source", "projection", "partner", "includeNonComicsSeries", "country"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -5715,7 +5961,7 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5751,7 +5997,7 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5761,10 +6007,10 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5797,7 +6043,7 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *volume id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn volume_id(mut self, new_value: &str) -> VolumeGetCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -5830,6 +6076,13 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau self._partner = Some(new_value.to_string()); self } + /// Set to true to include non-comics series. Defaults to false. + /// + /// Sets the *include non comics series* query property to the given value. + pub fn include_non_comics_series(mut self, new_value: bool) -> VolumeGetCall<'a, C, A> { + self._include_non_comics_series = Some(new_value); + self + } /// ISO-3166-1 code to override the IP-based location. /// /// Sets the *country* query property to the given value. @@ -5849,12 +6102,12 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5871,17 +6124,17 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VolumeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VolumeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5916,12 +6169,12 @@ impl<'a, C, A> VolumeGetCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.volumes().mybooks_list() -/// .start_index(43) -/// .source("nonumy") -/// .add_processing_state("kasd") -/// .max_results(94) -/// .locale("takimata") -/// .add_acquire_method("At") +/// .start_index(61) +/// .source("kasd") +/// .add_processing_state("sanctus") +/// .max_results(43) +/// .locale("At") +/// .add_acquire_method("labore") /// .doit(); /// # } /// ``` @@ -5954,7 +6207,7 @@ impl<'a, C, A> VolumeMybookListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.volumes.mybooks.list", + dlg.begin(MethodInfo { id: "books.volumes.mybooks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); if let Some(value) = self._start_index { @@ -6000,7 +6253,7 @@ impl<'a, C, A> VolumeMybookListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6036,7 +6289,7 @@ impl<'a, C, A> VolumeMybookListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6046,10 +6299,10 @@ impl<'a, C, A> VolumeMybookListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6134,12 +6387,12 @@ impl<'a, C, A> VolumeMybookListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6156,17 +6409,17 @@ impl<'a, C, A> VolumeMybookListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VolumeMybookListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VolumeMybookListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6201,18 +6454,18 @@ impl<'a, C, A> VolumeMybookListCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.volumes().list("q") -/// .start_index(64) -/// .source("ea") +/// .start_index(35) +/// .source("sadipscing") /// .show_preorders(false) -/// .projection("rebum.") -/// .print_type("dolore") -/// .partner("nonumy") -/// .order_by("sed") -/// .max_results(19) -/// .library_restrict("sit") -/// .lang_restrict("eirmod") -/// .filter("consetetur") -/// .download("labore") +/// .projection("dolore") +/// .print_type("nonumy") +/// .partner("sed") +/// .order_by("aliquyam") +/// .max_results(48) +/// .library_restrict("eirmod") +/// .lang_restrict("consetetur") +/// .filter("labore") +/// .download("sed") /// .doit(); /// # } /// ``` @@ -6252,7 +6505,7 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.volumes.list", + dlg.begin(MethodInfo { id: "books.volumes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); params.push(("q", self._q.to_string())); @@ -6309,7 +6562,7 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6345,7 +6598,7 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6355,10 +6608,10 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6391,7 +6644,7 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *q* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn q(mut self, new_value: &str) -> VolumeListCall<'a, C, A> { self._q = new_value.to_string(); @@ -6493,12 +6746,12 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6515,17 +6768,17 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VolumeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VolumeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6560,12 +6813,12 @@ impl<'a, C, A> VolumeListCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.volumes().useruploaded_list() -/// .add_volume_id("sed") -/// .start_index(85) -/// .source("gubergren") -/// .add_processing_state("aliquyam") -/// .max_results(77) -/// .locale("tempor") +/// .add_volume_id("ea") +/// .start_index(39) +/// .source("aliquyam") +/// .add_processing_state("eos") +/// .max_results(63) +/// .locale("sea") /// .doit(); /// # } /// ``` @@ -6598,7 +6851,7 @@ impl<'a, C, A> VolumeUseruploadedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.volumes.useruploaded.list", + dlg.begin(MethodInfo { id: "books.volumes.useruploaded.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); if self._volume_id.len() > 0 { @@ -6644,7 +6897,7 @@ impl<'a, C, A> VolumeUseruploadedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6680,7 +6933,7 @@ impl<'a, C, A> VolumeUseruploadedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6690,10 +6943,10 @@ impl<'a, C, A> VolumeUseruploadedListCall<'a, C, A> where C: BorrowMut VolumeUseruploadedListCall<'a, C, A> where C: BorrowMut VolumeUseruploadedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> VolumeUseruploadedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VolumeUseruploadedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6845,10 +7098,10 @@ impl<'a, C, A> VolumeUseruploadedListCall<'a, C, A> where C: BorrowMut VolumeAssociatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.volumes.associated.list", + dlg.begin(MethodInfo { id: "books.volumes.associated.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); @@ -6934,7 +7187,7 @@ impl<'a, C, A> VolumeAssociatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6970,7 +7223,7 @@ impl<'a, C, A> VolumeAssociatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6980,10 +7233,10 @@ impl<'a, C, A> VolumeAssociatedListCall<'a, C, A> where C: BorrowMut VolumeAssociatedListCall<'a, C, A> where C: BorrowMut VolumeAssociatedListCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -7062,12 +7315,12 @@ impl<'a, C, A> VolumeAssociatedListCall<'a, C, A> where C: BorrowMut VolumeAssociatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> VolumeAssociatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VolumeAssociatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7129,9 +7382,10 @@ impl<'a, C, A> VolumeAssociatedListCall<'a, C, A> where C: BorrowMut where C: 'a, A: 'a { hub: &'a Books, + _target_ids: Vec, _source: Option, _max_allowed_maturity_rating: Option, _locale: Option, @@ -7161,9 +7416,16 @@ impl<'a, C, A> VolumeRecommendedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.volumes.recommended.list", + dlg.begin(MethodInfo { id: "books.volumes.recommended.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + if self._target_ids.len() > 0 { + let mut s = String::new(); + for f in self._target_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("targetIds", s)); + } if let Some(value) = self._source { params.push(("source", value.to_string())); } @@ -7173,7 +7435,7 @@ impl<'a, C, A> VolumeRecommendedListCall<'a, C, A> where C: BorrowMut VolumeRecommendedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7226,7 +7488,7 @@ impl<'a, C, A> VolumeRecommendedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7236,10 +7498,10 @@ impl<'a, C, A> VolumeRecommendedListCall<'a, C, A> where C: BorrowMut VolumeRecommendedListCall<'a, C, A> where C: BorrowMut VolumeRecommendedListCall<'a, C, A> { + self._target_ids.push(new_value.to_string()); + self + } /// String to identify the originator of this request. /// /// Sets the *source* query property to the given value. @@ -7301,12 +7571,12 @@ impl<'a, C, A> VolumeRecommendedListCall<'a, C, A> where C: BorrowMut VolumeRecommendedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> VolumeRecommendedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VolumeRecommendedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7395,7 +7665,7 @@ impl<'a, C, A> DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.dictionary.listOfflineMetadata", + dlg.begin(MethodInfo { id: "books.dictionary.listOfflineMetadata", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("cpksver", self._cpksver.to_string())); @@ -7416,7 +7686,7 @@ impl<'a, C, A> DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7452,7 +7722,7 @@ impl<'a, C, A> DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7462,10 +7732,10 @@ impl<'a, C, A> DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut DictionaryListOfflineMetadataCall<'a, C, A> { self._cpksver = new_value.to_string(); @@ -7516,12 +7786,12 @@ impl<'a, C, A> DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DictionaryListOfflineMetadataCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DictionaryListOfflineMetadataCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7556,10 +7826,10 @@ impl<'a, C, A> DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut DictionaryListOfflineMetadataCall<'a, C, A> where C: BorrowMut +pub struct SeryGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Books, - _notification_id: String, - _source: Option, - _locale: Option, + _series_id: Vec, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for NotificationGetCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for SeryGetCall<'a, C, A> {} -impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> SeryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Notification)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, Series)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -7614,17 +7880,17 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.notification.get", + dlg.begin(MethodInfo { id: "books.series.get", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - params.push(("notification_id", self._notification_id.to_string())); - if let Some(value) = self._source { - params.push(("source", value.to_string())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + if self._series_id.len() > 0 { + let mut s = String::new(); + for f in self._series_id.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("series_id", s)); } - if let Some(value) = self._locale { - params.push(("locale", value.to_string())); - } - for &field in ["alt", "notification_id", "source", "locale"].iter() { + for &field in ["alt", "series_id"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -7636,12 +7902,12 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/books/v1/notification/get".to_string(); + let mut url = "https://www.googleapis.com/books/v1/series/get".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7677,7 +7943,7 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7687,10 +7953,10 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7719,28 +7985,15 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, } - /// String to identify the notification. + /// String that identifies the series /// - /// Sets the *notification_id* query property to the given value. + /// Append the given value to the *series_id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn notification_id(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { - self._notification_id = new_value.to_string(); - self - } - /// String to identify the originator of this request. - /// - /// Sets the *source* query property to the given value. - pub fn source(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { - self._source = Some(new_value.to_string()); - self - } - /// ISO-639-1 language and ISO-3166-1 country code. Ex: 'en_US'. Used for generating notification title and body. - /// - /// Sets the *locale* query property to the given value. - pub fn locale(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { - self._locale = Some(new_value.to_string()); + pub fn add_series_id(mut self, new_value: &str) -> SeryGetCall<'a, C, A> { + self._series_id.push(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -7749,18 +8002,18 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, /// 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 Delegate) -> NotificationGetCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> SeryGetCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7770,24 +8023,263 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> NotificationGetCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> SeryGetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> NotificationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SeryGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns Series membership data given the series id. +/// +/// A builder for the *membership.get* method supported by a *sery* resource. +/// It is not used directly, but through a `SeryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_books1 as books1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use books1::Books; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Books::new(hyper::Client::new(), 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 ! +/// let result = hub.series().membership_get("series_id") +/// .page_token("diam") +/// .page_size(30) +/// .doit(); +/// # } +/// ``` +pub struct SeryMembershipGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Books, + _series_id: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SeryMembershipGetCall<'a, C, A> {} + +impl<'a, C, A> SeryMembershipGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Seriesmembership)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "books.series.membership.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("series_id", self._series_id.to_string())); + if let Some(value) = self._page_token { + params.push(("page_token", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("page_size", value.to_string())); + } + for &field in ["alt", "series_id", "page_token", "page_size"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/books/v1/series/membership/get".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// String that identifies the series + /// + /// Sets the *series_id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn series_id(mut self, new_value: &str) -> SeryMembershipGetCall<'a, C, A> { + self._series_id = new_value.to_string(); + self + } + /// The value of the nextToken from the previous page. + /// + /// Sets the *page_token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SeryMembershipGetCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Number of maximum results per page to be included in the response. + /// + /// Sets the *page_size* query property to the given value. + pub fn page_size(mut self, new_value: u32) -> SeryMembershipGetCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SeryMembershipGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SeryMembershipGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SeryMembershipGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7822,10 +8314,10 @@ impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.bookshelves().volumes_list("userId", "shelf") -/// .start_index(30) -/// .source("est") -/// .show_preorders(false) -/// .max_results(64) +/// .start_index(64) +/// .source("ut") +/// .show_preorders(true) +/// .max_results(77) /// .doit(); /// # } /// ``` @@ -7858,7 +8350,7 @@ impl<'a, C, A> BookshelveVolumeListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.bookshelves.volumes.list", + dlg.begin(MethodInfo { id: "books.bookshelves.volumes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -7913,7 +8405,7 @@ impl<'a, C, A> BookshelveVolumeListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7949,7 +8441,7 @@ impl<'a, C, A> BookshelveVolumeListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7959,10 +8451,10 @@ impl<'a, C, A> BookshelveVolumeListCall<'a, C, A> where C: BorrowMut BookshelveVolumeListCall<'a, C, A> where C: BorrowMut BookshelveVolumeListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -8005,7 +8497,7 @@ impl<'a, C, A> BookshelveVolumeListCall<'a, C, A> where C: BorrowMut BookshelveVolumeListCall<'a, C, A> { self._shelf = new_value.to_string(); @@ -8051,12 +8543,12 @@ impl<'a, C, A> BookshelveVolumeListCall<'a, C, A> where C: BorrowMut BookshelveVolumeListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BookshelveVolumeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BookshelveVolumeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8118,7 +8610,7 @@ impl<'a, C, A> BookshelveVolumeListCall<'a, C, A> where C: BorrowMut BookshelveListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.bookshelves.list", + dlg.begin(MethodInfo { id: "books.bookshelves.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -8192,7 +8684,7 @@ impl<'a, C, A> BookshelveListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8228,7 +8720,7 @@ impl<'a, C, A> BookshelveListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8238,10 +8730,10 @@ impl<'a, C, A> BookshelveListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8274,7 +8766,7 @@ impl<'a, C, A> BookshelveListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> BookshelveListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -8299,12 +8791,12 @@ impl<'a, C, A> BookshelveListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8321,17 +8813,17 @@ impl<'a, C, A> BookshelveListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BookshelveListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BookshelveListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8366,7 +8858,7 @@ impl<'a, C, A> BookshelveListCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.bookshelves().get("userId", "shelf") -/// .source("duo") +/// .source("ea") /// .doit(); /// # } /// ``` @@ -8396,7 +8888,7 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.bookshelves.get", + dlg.begin(MethodInfo { id: "books.bookshelves.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -8442,7 +8934,7 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8478,7 +8970,7 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8488,10 +8980,10 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8524,7 +9016,7 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> BookshelveGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -8534,7 +9026,7 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *shelf* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn shelf(mut self, new_value: &str) -> BookshelveGetCall<'a, C, A> { self._shelf = new_value.to_string(); @@ -8559,12 +9051,12 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8581,17 +9073,17 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BookshelveGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BookshelveGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8626,14 +9118,14 @@ impl<'a, C, A> BookshelveGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.promooffer().accept() -/// .volume_id("sed") -/// .serial("aliquyam") -/// .product("ea") -/// .offer_id("ea") -/// .model("et") -/// .manufacturer("dolor") -/// .device("diam") -/// .android_id("kasd") +/// .volume_id("ea") +/// .serial("et") +/// .product("dolor") +/// .offer_id("diam") +/// .model("kasd") +/// .manufacturer("invidunt") +/// .device("rebum.") +/// .android_id("Lorem") /// .doit(); /// # } /// ``` @@ -8668,7 +9160,7 @@ impl<'a, C, A> PromoofferAcceptCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.promooffer.accept", + dlg.begin(MethodInfo { id: "books.promooffer.accept", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); if let Some(value) = self._volume_id { @@ -8711,7 +9203,7 @@ impl<'a, C, A> PromoofferAcceptCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8747,7 +9239,7 @@ impl<'a, C, A> PromoofferAcceptCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8757,10 +9249,10 @@ impl<'a, C, A> PromoofferAcceptCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8846,12 +9338,12 @@ impl<'a, C, A> PromoofferAcceptCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8868,17 +9360,17 @@ impl<'a, C, A> PromoofferAcceptCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PromoofferAcceptCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PromoofferAcceptCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8913,13 +9405,13 @@ impl<'a, C, A> PromoofferAcceptCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.promooffer().dismiss() -/// .serial("invidunt") -/// .product("rebum.") -/// .offer_id("Lorem") -/// .model("clita") -/// .manufacturer("invidunt") -/// .device("eirmod") -/// .android_id("At") +/// .serial("clita") +/// .product("invidunt") +/// .offer_id("eirmod") +/// .model("At") +/// .manufacturer("consetetur") +/// .device("et") +/// .android_id("sed") /// .doit(); /// # } /// ``` @@ -8953,7 +9445,7 @@ impl<'a, C, A> PromoofferDismisCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.promooffer.dismiss", + dlg.begin(MethodInfo { id: "books.promooffer.dismiss", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); if let Some(value) = self._serial { @@ -8993,7 +9485,7 @@ impl<'a, C, A> PromoofferDismisCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9029,7 +9521,7 @@ impl<'a, C, A> PromoofferDismisCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9039,10 +9531,10 @@ impl<'a, C, A> PromoofferDismisCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9122,12 +9614,12 @@ impl<'a, C, A> PromoofferDismisCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9144,17 +9636,17 @@ impl<'a, C, A> PromoofferDismisCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PromoofferDismisCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PromoofferDismisCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9189,12 +9681,12 @@ impl<'a, C, A> PromoofferDismisCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.promooffer().get() -/// .serial("consetetur") -/// .product("et") -/// .model("sed") -/// .manufacturer("sit") -/// .device("takimata") -/// .android_id("elitr") +/// .serial("sit") +/// .product("takimata") +/// .model("elitr") +/// .manufacturer("nonumy") +/// .device("rebum.") +/// .android_id("Lorem") /// .doit(); /// # } /// ``` @@ -9227,7 +9719,7 @@ impl<'a, C, A> PromoofferGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.promooffer.get", + dlg.begin(MethodInfo { id: "books.promooffer.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); if let Some(value) = self._serial { @@ -9265,7 +9757,7 @@ impl<'a, C, A> PromoofferGetCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9301,7 +9793,7 @@ impl<'a, C, A> PromoofferGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9311,10 +9803,10 @@ impl<'a, C, A> PromoofferGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9397,12 +9889,12 @@ impl<'a, C, A> PromoofferGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9419,17 +9911,17 @@ impl<'a, C, A> PromoofferGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PromoofferGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PromoofferGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9464,9 +9956,10 @@ impl<'a, C, A> PromoofferGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.personalizedstream().get() -/// .source("nonumy") -/// .max_allowed_maturity_rating("rebum.") -/// .locale("Lorem") +/// .add_target_ids("Lorem") +/// .source("diam") +/// .max_allowed_maturity_rating("ut") +/// .locale("ut") /// .doit(); /// # } /// ``` @@ -9474,6 +9967,7 @@ pub struct PersonalizedstreamGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Books, + _target_ids: Vec, _source: Option, _max_allowed_maturity_rating: Option, _locale: Option, @@ -9496,9 +9990,16 @@ impl<'a, C, A> PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.personalizedstream.get", + dlg.begin(MethodInfo { id: "books.personalizedstream.get", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + if self._target_ids.len() > 0 { + let mut s = String::new(); + for f in self._target_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("targetIds", s)); + } if let Some(value) = self._source { params.push(("source", value.to_string())); } @@ -9508,7 +10009,7 @@ impl<'a, C, A> PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9561,7 +10062,7 @@ impl<'a, C, A> PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9571,10 +10072,10 @@ impl<'a, C, A> PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut PersonalizedstreamGetCall<'a, C, A> { + self._target_ids.push(new_value.to_string()); + self + } /// String to identify the originator of this request. /// /// Sets the *source* query property to the given value. @@ -9636,12 +10145,12 @@ impl<'a, C, A> PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PersonalizedstreamGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PersonalizedstreamGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9703,7 +10212,7 @@ impl<'a, C, A> PersonalizedstreamGetCall<'a, C, A> where C: BorrowMut OnboardingListCategoryCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.onboarding.listCategories", + dlg.begin(MethodInfo { id: "books.onboarding.listCategories", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if let Some(value) = self._locale { @@ -9754,7 +10263,7 @@ impl<'a, C, A> OnboardingListCategoryCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9790,7 +10299,7 @@ impl<'a, C, A> OnboardingListCategoryCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9800,10 +10309,10 @@ impl<'a, C, A> OnboardingListCategoryCall<'a, C, A> where C: BorrowMut OnboardingListCategoryCall<'a, C, A> where C: BorrowMut OnboardingListCategoryCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OnboardingListCategoryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OnboardingListCategoryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9918,11 +10427,11 @@ impl<'a, C, A> OnboardingListCategoryCall<'a, C, A> where C: BorrowMut OnboardingListCategoryVolumeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.onboarding.listCategoryVolumes", + dlg.begin(MethodInfo { id: "books.onboarding.listCategoryVolumes", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -9993,7 +10502,7 @@ impl<'a, C, A> OnboardingListCategoryVolumeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10029,7 +10538,7 @@ impl<'a, C, A> OnboardingListCategoryVolumeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10039,10 +10548,10 @@ impl<'a, C, A> OnboardingListCategoryVolumeCall<'a, C, A> where C: BorrowMut OnboardingListCategoryVolumeCall<'a, C, A> where C: BorrowMut OnboardingListCategoryVolumeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OnboardingListCategoryVolumeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OnboardingListCategoryVolumeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10186,8 +10695,8 @@ impl<'a, C, A> OnboardingListCategoryVolumeCall<'a, C, A> where C: BorrowMut MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.myconfig.requestAccess", + dlg.begin(MethodInfo { id: "books.myconfig.requestAccess", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("source", self._source.to_string())); @@ -10250,7 +10759,7 @@ impl<'a, C, A> MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10286,7 +10795,7 @@ impl<'a, C, A> MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10296,10 +10805,10 @@ impl<'a, C, A> MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut MyconfigRequestAccesCall<'a, C, A> { self._source = new_value.to_string(); @@ -10342,7 +10851,7 @@ impl<'a, C, A> MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut MyconfigRequestAccesCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -10352,7 +10861,7 @@ impl<'a, C, A> MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut MyconfigRequestAccesCall<'a, C, A> { self._nonce = new_value.to_string(); @@ -10362,7 +10871,7 @@ impl<'a, C, A> MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut MyconfigRequestAccesCall<'a, C, A> { self._cpksver = new_value.to_string(); @@ -10394,12 +10903,12 @@ impl<'a, C, A> MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MyconfigRequestAccesCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MyconfigRequestAccesCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10461,7 +10970,7 @@ impl<'a, C, A> MyconfigRequestAccesCall<'a, C, A> where C: BorrowMut MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.myconfig.releaseDownloadAccess", + dlg.begin(MethodInfo { id: "books.myconfig.releaseDownloadAccess", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._volume_ids.len() > 0 { @@ -10527,7 +11036,7 @@ impl<'a, C, A> MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10563,7 +11072,7 @@ impl<'a, C, A> MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10573,10 +11082,10 @@ impl<'a, C, A> MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut MyconfigReleaseDownloadAccesCall<'a, C, A> { self._volume_ids.push(new_value.to_string()); @@ -10620,7 +11129,7 @@ impl<'a, C, A> MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut MyconfigReleaseDownloadAccesCall<'a, C, A> { self._cpksver = new_value.to_string(); @@ -10652,12 +11161,12 @@ impl<'a, C, A> MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MyconfigReleaseDownloadAccesCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MyconfigReleaseDownloadAccesCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10719,10 +11228,11 @@ impl<'a, C, A> MyconfigReleaseDownloadAccesCall<'a, C, A> where C: BorrowMut _volume_ids: Vec, _show_preorders: Option, _locale: Option, + _include_non_comics_series: Option, _features: Vec, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, @@ -10756,9 +11267,9 @@ impl<'a, C, A> MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.myconfig.syncVolumeLicenses", + dlg.begin(MethodInfo { id: "books.myconfig.syncVolumeLicenses", http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("source", self._source.to_string())); params.push(("nonce", self._nonce.to_string())); params.push(("cpksver", self._cpksver.to_string())); @@ -10775,6 +11286,9 @@ impl<'a, C, A> MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut 0 { let mut s = String::new(); for f in self._features.iter() { @@ -10782,7 +11296,7 @@ impl<'a, C, A> MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10835,7 +11349,7 @@ impl<'a, C, A> MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10845,10 +11359,10 @@ impl<'a, C, A> MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut MyconfigSyncVolumeLicenseCall<'a, C, A> { self._source = new_value.to_string(); @@ -10891,7 +11405,7 @@ impl<'a, C, A> MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut MyconfigSyncVolumeLicenseCall<'a, C, A> { self._nonce = new_value.to_string(); @@ -10901,7 +11415,7 @@ impl<'a, C, A> MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut MyconfigSyncVolumeLicenseCall<'a, C, A> { self._cpksver = new_value.to_string(); @@ -10929,6 +11443,13 @@ impl<'a, C, A> MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut MyconfigSyncVolumeLicenseCall<'a, C, A> { + self._include_non_comics_series = Some(new_value); + self + } /// List of features supported by the client, i.e., 'RENTALS' /// /// Append the given value to the *features* query property. @@ -10949,12 +11470,12 @@ impl<'a, C, A> MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut MyconfigSyncVolumeLicenseCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MyconfigSyncVolumeLicenseCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MyconfigSyncVolumeLicenseCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11042,7 +11563,7 @@ impl<'a, C, A> MyconfigGetUserSettingCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.myconfig.getUserSettings", + dlg.begin(MethodInfo { id: "books.myconfig.getUserSettings", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -11062,7 +11583,7 @@ impl<'a, C, A> MyconfigGetUserSettingCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11098,7 +11619,7 @@ impl<'a, C, A> MyconfigGetUserSettingCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11108,10 +11629,10 @@ impl<'a, C, A> MyconfigGetUserSettingCall<'a, C, A> where C: BorrowMut MyconfigGetUserSettingCall<'a, C, A> where C: BorrowMut MyconfigGetUserSettingCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MyconfigGetUserSettingCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MyconfigGetUserSettingCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11252,7 +11773,7 @@ impl<'a, C, A> MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.myconfig.updateUserSettings", + dlg.begin(MethodInfo { id: "books.myconfig.updateUserSettings", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -11272,14 +11793,14 @@ impl<'a, C, A> MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11323,7 +11844,7 @@ impl<'a, C, A> MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11333,10 +11854,10 @@ impl<'a, C, A> MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut MyconfigUpdateUserSettingCall<'a, C, A> { self._request = new_value; @@ -11386,12 +11907,12 @@ impl<'a, C, A> MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MyconfigUpdateUserSettingCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MyconfigUpdateUserSettingCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11453,7 +11974,7 @@ impl<'a, C, A> MyconfigUpdateUserSettingCall<'a, C, A> where C: BorrowMut MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.clearVolumes", + dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.clearVolumes", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("shelf", self._shelf.to_string())); @@ -11526,7 +12047,7 @@ impl<'a, C, A> MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11562,7 +12083,7 @@ impl<'a, C, A> MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11572,10 +12093,10 @@ impl<'a, C, A> MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveClearVolumeCall<'a, C, A> { self._shelf = new_value.to_string(); @@ -11623,12 +12144,12 @@ impl<'a, C, A> MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryBookshelveClearVolumeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryBookshelveClearVolumeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11689,8 +12210,8 @@ impl<'a, C, A> MylibraryBookshelveClearVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.moveVolume", + dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.moveVolume", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("shelf", self._shelf.to_string())); @@ -11767,7 +12288,7 @@ impl<'a, C, A> MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11803,7 +12324,7 @@ impl<'a, C, A> MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11813,10 +12334,10 @@ impl<'a, C, A> MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveMoveVolumeCall<'a, C, A> { self._shelf = new_value.to_string(); @@ -11849,7 +12370,7 @@ impl<'a, C, A> MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveMoveVolumeCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -11859,7 +12380,7 @@ impl<'a, C, A> MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveMoveVolumeCall<'a, C, A> { self._volume_position = new_value; @@ -11884,12 +12405,12 @@ impl<'a, C, A> MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryBookshelveMoveVolumeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryBookshelveMoveVolumeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11951,12 +12472,12 @@ impl<'a, C, A> MylibraryBookshelveMoveVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveVolumeListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.volumes.list", + dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.volumes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("shelf", self._shelf.to_string())); @@ -12055,7 +12576,7 @@ impl<'a, C, A> MylibraryBookshelveVolumeListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12091,7 +12612,7 @@ impl<'a, C, A> MylibraryBookshelveVolumeListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12101,10 +12622,10 @@ impl<'a, C, A> MylibraryBookshelveVolumeListCall<'a, C, A> where C: BorrowMut MylibraryBookshelveVolumeListCall<'a, C, A> where C: BorrowMut MylibraryBookshelveVolumeListCall<'a, C, A> { self._shelf = new_value.to_string(); @@ -12204,12 +12725,12 @@ impl<'a, C, A> MylibraryBookshelveVolumeListCall<'a, C, A> where C: BorrowMut MylibraryBookshelveVolumeListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryBookshelveVolumeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryBookshelveVolumeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12299,7 +12820,7 @@ impl<'a, C, A> MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.annotations.summary", + dlg.begin(MethodInfo { id: "books.mylibrary.annotations.summary", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if self._layer_ids.len() > 0 { @@ -12327,7 +12848,7 @@ impl<'a, C, A> MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12363,7 +12884,7 @@ impl<'a, C, A> MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12373,10 +12894,10 @@ impl<'a, C, A> MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut MylibraryAnnotationSummaryCall<'a, C, A> { self._layer_ids.push(new_value.to_string()); @@ -12420,7 +12941,7 @@ impl<'a, C, A> MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut MylibraryAnnotationSummaryCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -12438,12 +12959,12 @@ impl<'a, C, A> MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryAnnotationSummaryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryAnnotationSummaryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12505,7 +13026,7 @@ impl<'a, C, A> MylibraryAnnotationSummaryCall<'a, C, A> where C: BorrowMut MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.annotations.delete", + dlg.begin(MethodInfo { id: "books.mylibrary.annotations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("annotationId", self._annotation_id.to_string())); @@ -12578,7 +13099,7 @@ impl<'a, C, A> MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12614,7 +13135,7 @@ impl<'a, C, A> MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12624,10 +13145,10 @@ impl<'a, C, A> MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut MylibraryAnnotationDeleteCall<'a, C, A> { self._annotation_id = new_value.to_string(); @@ -12675,12 +13196,12 @@ impl<'a, C, A> MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryAnnotationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryAnnotationDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12742,8 +13263,8 @@ impl<'a, C, A> MylibraryAnnotationDeleteCall<'a, C, A> where C: BorrowMut MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.addVolume", + dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.addVolume", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("shelf", self._shelf.to_string())); @@ -12822,7 +13343,7 @@ impl<'a, C, A> MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12858,7 +13379,7 @@ impl<'a, C, A> MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12868,10 +13389,10 @@ impl<'a, C, A> MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveAddVolumeCall<'a, C, A> { self._shelf = new_value.to_string(); @@ -12904,7 +13425,7 @@ impl<'a, C, A> MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveAddVolumeCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -12936,12 +13457,12 @@ impl<'a, C, A> MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryBookshelveAddVolumeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryBookshelveAddVolumeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13009,9 +13530,9 @@ impl<'a, C, A> MylibraryBookshelveAddVolumeCall<'a, C, A> where C: BorrowMut MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.annotations.insert", + dlg.begin(MethodInfo { id: "books.mylibrary.annotations.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if let Some(value) = self._source { @@ -13071,14 +13592,14 @@ impl<'a, C, A> MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13122,7 +13643,7 @@ impl<'a, C, A> MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13132,10 +13653,10 @@ impl<'a, C, A> MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut MylibraryAnnotationInsertCall<'a, C, A> { self._request = new_value; @@ -13206,12 +13727,12 @@ impl<'a, C, A> MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryAnnotationInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryAnnotationInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13273,8 +13794,8 @@ impl<'a, C, A> MylibraryAnnotationInsertCall<'a, C, A> where C: BorrowMut MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.removeVolume", + dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.removeVolume", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("shelf", self._shelf.to_string())); @@ -13353,7 +13874,7 @@ impl<'a, C, A> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13389,7 +13910,7 @@ impl<'a, C, A> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13399,10 +13920,10 @@ impl<'a, C, A> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13425,7 +13946,7 @@ impl<'a, C, A> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< /// /// Sets the *shelf* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn shelf(mut self, new_value: &str) -> MylibraryBookshelveRemoveVolumeCall<'a, C, A> { self._shelf = new_value.to_string(); @@ -13435,7 +13956,7 @@ impl<'a, C, A> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< /// /// Sets the *volume id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn volume_id(mut self, new_value: &str) -> MylibraryBookshelveRemoveVolumeCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -13467,12 +13988,12 @@ impl<'a, C, A> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13489,17 +14010,17 @@ impl<'a, C, A> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MylibraryBookshelveRemoveVolumeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13534,16 +14055,16 @@ impl<'a, C, A> MylibraryBookshelveRemoveVolumeCall<'a, C, A> where C: BorrowMut< /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.mylibrary().annotations_list() -/// .volume_id("sed") -/// .updated_min("dolor") -/// .updated_max("sanctus") -/// .source("dolore") -/// .show_deleted(true) -/// .page_token("consetetur") -/// .max_results(55) -/// .add_layer_ids("eirmod") -/// .layer_id("labore") -/// .content_version("gubergren") +/// .volume_id("consetetur") +/// .updated_min("consetetur") +/// .updated_max("eirmod") +/// .source("labore") +/// .show_deleted(false) +/// .page_token("et") +/// .max_results(56) +/// .add_layer_ids("accusam") +/// .layer_id("magna") +/// .content_version("Lorem") /// .doit(); /// # } /// ``` @@ -13580,7 +14101,7 @@ impl<'a, C, A> MylibraryAnnotationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.annotations.list", + dlg.begin(MethodInfo { id: "books.mylibrary.annotations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); if let Some(value) = self._volume_id { @@ -13634,7 +14155,7 @@ impl<'a, C, A> MylibraryAnnotationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13670,7 +14191,7 @@ impl<'a, C, A> MylibraryAnnotationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13680,10 +14201,10 @@ impl<'a, C, A> MylibraryAnnotationListCall<'a, C, A> where C: BorrowMut MylibraryAnnotationListCall<'a, C, A> where C: BorrowMut MylibraryAnnotationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryAnnotationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryAnnotationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13868,7 +14389,7 @@ impl<'a, C, A> MylibraryAnnotationListCall<'a, C, A> where C: BorrowMut MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.annotations.update", + dlg.begin(MethodInfo { id: "books.mylibrary.annotations.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("annotationId", self._annotation_id.to_string())); @@ -13943,14 +14464,14 @@ impl<'a, C, A> MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13994,7 +14515,7 @@ impl<'a, C, A> MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14004,10 +14525,10 @@ impl<'a, C, A> MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut MylibraryAnnotationUpdateCall<'a, C, A> { self._request = new_value; @@ -14049,7 +14570,7 @@ impl<'a, C, A> MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut MylibraryAnnotationUpdateCall<'a, C, A> { self._annotation_id = new_value.to_string(); @@ -14074,12 +14595,12 @@ impl<'a, C, A> MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryAnnotationUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryAnnotationUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14141,10 +14662,10 @@ impl<'a, C, A> MylibraryAnnotationUpdateCall<'a, C, A> where C: BorrowMut MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.readingpositions.setPosition", + dlg.begin(MethodInfo { id: "books.mylibrary.readingpositions.setPosition", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); @@ -14233,7 +14754,7 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14269,7 +14790,7 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14279,10 +14800,10 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14305,7 +14826,7 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow /// /// Sets the *volume id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn volume_id(mut self, new_value: &str) -> MylibraryReadingpositionSetPositionCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -14315,7 +14836,7 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow /// /// Sets the *timestamp* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn timestamp(mut self, new_value: &str) -> MylibraryReadingpositionSetPositionCall<'a, C, A> { self._timestamp = new_value.to_string(); @@ -14325,7 +14846,7 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow /// /// Sets the *position* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn position(mut self, new_value: &str) -> MylibraryReadingpositionSetPositionCall<'a, C, A> { self._position = new_value.to_string(); @@ -14371,12 +14892,12 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14393,17 +14914,17 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MylibraryReadingpositionSetPositionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryReadingpositionSetPositionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14438,7 +14959,7 @@ impl<'a, C, A> MylibraryReadingpositionSetPositionCall<'a, C, A> where C: Borrow /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.mylibrary().bookshelves_get("shelf") -/// .source("vero") +/// .source("justo") /// .doit(); /// # } /// ``` @@ -14467,7 +14988,7 @@ impl<'a, C, A> MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.get", + dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("shelf", self._shelf.to_string())); @@ -14512,7 +15033,7 @@ impl<'a, C, A> MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14548,7 +15069,7 @@ impl<'a, C, A> MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14558,10 +15079,10 @@ impl<'a, C, A> MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut MylibraryBookshelveGetCall<'a, C, A> { self._shelf = new_value.to_string(); @@ -14619,12 +15140,12 @@ impl<'a, C, A> MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryBookshelveGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryBookshelveGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14686,7 +15207,7 @@ impl<'a, C, A> MylibraryBookshelveGetCall<'a, C, A> where C: BorrowMut MylibraryBookshelveListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.list", + dlg.begin(MethodInfo { id: "books.mylibrary.bookshelves.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if let Some(value) = self._source { @@ -14737,7 +15258,7 @@ impl<'a, C, A> MylibraryBookshelveListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14773,7 +15294,7 @@ impl<'a, C, A> MylibraryBookshelveListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14783,10 +15304,10 @@ impl<'a, C, A> MylibraryBookshelveListCall<'a, C, A> where C: BorrowMut MylibraryBookshelveListCall<'a, C, A> where C: BorrowMut MylibraryBookshelveListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryBookshelveListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryBookshelveListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14901,8 +15422,8 @@ impl<'a, C, A> MylibraryBookshelveListCall<'a, C, A> where C: BorrowMut MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.mylibrary.readingpositions.get", + dlg.begin(MethodInfo { id: "books.mylibrary.readingpositions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); @@ -14980,7 +15501,7 @@ impl<'a, C, A> MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15016,7 +15537,7 @@ impl<'a, C, A> MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15026,10 +15547,10 @@ impl<'a, C, A> MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut MylibraryReadingpositionGetCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -15094,12 +15615,12 @@ impl<'a, C, A> MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MylibraryReadingpositionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MylibraryReadingpositionGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns notification details for a given notification id. +/// +/// A builder for the *get* method supported by a *notification* resource. +/// It is not used directly, but through a `NotificationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_books1 as books1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use books1::Books; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Books::new(hyper::Client::new(), 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 ! +/// let result = hub.notification().get("notification_id") +/// .add_target_ids("magna") +/// .source("elitr") +/// .locale("magna") +/// .doit(); +/// # } +/// ``` +pub struct NotificationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Books, + _notification_id: String, + _target_ids: Vec, + _source: Option, + _locale: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for NotificationGetCall<'a, C, A> {} + +impl<'a, C, A> NotificationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Notification)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "books.notification.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("notification_id", self._notification_id.to_string())); + if self._target_ids.len() > 0 { + let mut s = String::new(); + for f in self._target_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("targetIds", s)); + } + if let Some(value) = self._source { + params.push(("source", value.to_string())); + } + if let Some(value) = self._locale { + params.push(("locale", value.to_string())); + } + for &field in ["alt", "notification_id", "targetIds", "source", "locale"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/books/v1/notification/get".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// String to identify the notification. + /// + /// Sets the *notification_id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn notification_id(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { + self._notification_id = new_value.to_string(); + self + } + /// List of target ids used for experiments or user segments + /// + /// Append the given value to the *target ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_target_ids(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { + self._target_ids.push(new_value.to_string()); + self + } + /// String to identify the originator of this request. + /// + /// Sets the *source* query property to the given value. + pub fn source(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { + self._source = Some(new_value.to_string()); + self + } + /// ISO-639-1 language and ISO-3166-1 country code. Ex: 'en_US'. Used for generating notification title and body. + /// + /// Sets the *locale* query property to the given value. + pub fn locale(mut self, new_value: &str) -> NotificationGetCall<'a, C, A> { + self._locale = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> NotificationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> NotificationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> NotificationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15161,10 +15938,10 @@ impl<'a, C, A> MylibraryReadingpositionGetCall<'a, C, A> where C: BorrowMut CloudloadingAddBookCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.cloudloading.addBook", + dlg.begin(MethodInfo { id: "books.cloudloading.addBook", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if let Some(value) = self._upload_client_token { @@ -15227,7 +16004,7 @@ impl<'a, C, A> CloudloadingAddBookCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15263,7 +16040,7 @@ impl<'a, C, A> CloudloadingAddBookCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15273,10 +16050,10 @@ impl<'a, C, A> CloudloadingAddBookCall<'a, C, A> where C: BorrowMut CloudloadingAddBookCall<'a, C, A> where C: BorrowMut CloudloadingAddBookCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CloudloadingAddBookCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CloudloadingAddBookCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15444,7 +16221,7 @@ impl<'a, C, A> CloudloadingUpdateBookCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.cloudloading.updateBook", + dlg.begin(MethodInfo { id: "books.cloudloading.updateBook", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -15464,14 +16241,14 @@ impl<'a, C, A> CloudloadingUpdateBookCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15515,7 +16292,7 @@ impl<'a, C, A> CloudloadingUpdateBookCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15525,10 +16302,10 @@ impl<'a, C, A> CloudloadingUpdateBookCall<'a, C, A> where C: BorrowMut CloudloadingUpdateBookCall<'a, C, A> where C: BorrowMut CloudloadingUpdateBookCall<'a, C, A> { self._request = new_value; @@ -15578,12 +16355,12 @@ impl<'a, C, A> CloudloadingUpdateBookCall<'a, C, A> where C: BorrowMut CloudloadingUpdateBookCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CloudloadingUpdateBookCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CloudloadingUpdateBookCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15672,7 +16449,7 @@ impl<'a, C, A> CloudloadingDeleteBookCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "books.cloudloading.deleteBook", + dlg.begin(MethodInfo { id: "books.cloudloading.deleteBook", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("volumeId", self._volume_id.to_string())); @@ -15692,7 +16469,7 @@ impl<'a, C, A> CloudloadingDeleteBookCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15728,7 +16505,7 @@ impl<'a, C, A> CloudloadingDeleteBookCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15738,10 +16515,10 @@ impl<'a, C, A> CloudloadingDeleteBookCall<'a, C, A> where C: BorrowMut CloudloadingDeleteBookCall<'a, C, A> where C: BorrowMut CloudloadingDeleteBookCall<'a, C, A> { self._volume_id = new_value.to_string(); @@ -15782,12 +16559,12 @@ impl<'a, C, A> CloudloadingDeleteBookCall<'a, C, A> where C: BorrowMut CloudloadingDeleteBookCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CloudloadingDeleteBookCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CloudloadingDeleteBookCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/calendar3-cli/Cargo.toml b/gen/calendar3-cli/Cargo.toml index 870b31980c..8cb4258b1e 100644 --- a/gen/calendar3-cli/Cargo.toml +++ b/gen/calendar3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-calendar3-cli" -version = "0.3.2+20151011" +version = "0.3.3+20160110" authors = ["Sebastian Thiel "] description = "A complete library to interact with calendar (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/calendar3-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/calendar3-cli/LICENSE.md b/gen/calendar3-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/calendar3-cli/LICENSE.md +++ b/gen/calendar3-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/calendar3-cli/README.md b/gen/calendar3-cli/README.md index 496edb7dcb..71a956ede6 100644 --- a/gen/calendar3-cli/README.md +++ b/gen/calendar3-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *calendar* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/calendar3.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/calendar3.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/calendar3.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/calendar3.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/calendar3-cli). # Usage -This documentation was generated from the *calendar* API at revision *20151011*. The CLI is at version *0.3.2*. +This documentation was generated from the *calendar* API at revision *20160110*. The CLI is at version *0.3.3*. ```bash calendar3 [options] @@ -77,18 +77,18 @@ calendar3 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/calendar3-cli/mkdocs.yml b/gen/calendar3-cli/mkdocs.yml index ec191fc45a..a66550c356 100644 --- a/gen/calendar3-cli/mkdocs.yml +++ b/gen/calendar3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: calendar v0.3.2+20151011 +site_name: calendar v0.3.3+20160110 site_url: http://byron.github.io/google-apis-rs/google-calendar3-cli site_description: Write integrating applications with bcore @@ -49,5 +49,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/calendar3-cli/src/main.rs b/gen/calendar3-cli/src/main.rs index 11acceab15..f23bb337e4 100644 --- a/gen/calendar3-cli/src/main.rs +++ b/gen/calendar3-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::CalendarHub>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _acl_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _acl_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.acl().delete(opt.value_of("calendar-id").unwrap_or(""), opt.value_of("rule-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -89,10 +89,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _acl_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _acl_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.acl().get(opt.value_of("calendar-id").unwrap_or(""), opt.value_of("rule-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -105,7 +105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -141,13 +141,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _acl_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _acl_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -161,8 +161,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "scope.type" => Some(("scope.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "scope.value" => Some(("scope.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -182,7 +182,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AclRule = json::value::from_value(object).unwrap(); let mut call = self.hub.acl().insert(request, opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -195,7 +195,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -208,7 +208,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -231,10 +231,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _acl_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _acl_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.acl().list(opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sync-token" => { @@ -259,7 +259,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sync-token", "max-results", "page-token", "show-deleted"].iter().map(|v|*v)); @@ -273,7 +273,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -296,13 +296,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _acl_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _acl_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -316,8 +316,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "scope.type" => Some(("scope.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "scope.value" => Some(("scope.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -337,7 +337,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AclRule = json::value::from_value(object).unwrap(); let mut call = self.hub.acl().patch(request, opt.value_of("calendar-id").unwrap_or(""), opt.value_of("rule-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -350,7 +350,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -363,7 +363,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -386,13 +386,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _acl_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _acl_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -406,8 +406,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "scope.type" => Some(("scope.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "scope.value" => Some(("scope.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -427,7 +427,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AclRule = json::value::from_value(object).unwrap(); let mut call = self.hub.acl().update(request, opt.value_of("calendar-id").unwrap_or(""), opt.value_of("rule-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -440,7 +440,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -453,7 +453,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -476,13 +476,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _acl_watch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _acl_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -496,8 +496,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -521,7 +521,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.acl().watch(request, opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sync-token" => { @@ -546,7 +546,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sync-token", "max-results", "page-token", "show-deleted"].iter().map(|v|*v)); @@ -560,7 +560,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -583,10 +583,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendar_list_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendar_list_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.calendar_list().delete(opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -599,7 +599,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -612,7 +612,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -627,10 +627,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendar_list_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendar_list_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.calendar_list().get(opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -643,7 +643,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -656,7 +656,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -679,13 +679,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendar_list_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendar_list_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -699,8 +699,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "foreground-color" => Some(("foregroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -730,7 +730,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CalendarListEntry = json::value::from_value(object).unwrap(); let mut call = self.hub.calendar_list().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "color-rgb-format" => { @@ -746,7 +746,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["color-rgb-format"].iter().map(|v|*v)); @@ -760,7 +760,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -783,10 +783,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendar_list_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendar_list_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.calendar_list().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sync-token" => { @@ -817,7 +817,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sync-token", "min-access-role", "show-deleted", "max-results", "page-token", "show-hidden"].iter().map(|v|*v)); @@ -831,7 +831,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -854,13 +854,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendar_list_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendar_list_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -874,8 +874,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "foreground-color" => Some(("foregroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -905,7 +905,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CalendarListEntry = json::value::from_value(object).unwrap(); let mut call = self.hub.calendar_list().patch(request, opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "color-rgb-format" => { @@ -921,7 +921,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["color-rgb-format"].iter().map(|v|*v)); @@ -935,7 +935,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -958,13 +958,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendar_list_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendar_list_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -978,8 +978,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "foreground-color" => Some(("foregroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1009,7 +1009,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CalendarListEntry = json::value::from_value(object).unwrap(); let mut call = self.hub.calendar_list().update(request, opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "color-rgb-format" => { @@ -1025,7 +1025,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["color-rgb-format"].iter().map(|v|*v)); @@ -1039,7 +1039,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1062,13 +1062,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendar_list_watch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendar_list_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1082,8 +1082,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1107,7 +1107,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.calendar_list().watch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sync-token" => { @@ -1138,7 +1138,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sync-token", "min-access-role", "show-deleted", "max-results", "page-token", "show-hidden"].iter().map(|v|*v)); @@ -1152,7 +1152,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1175,10 +1175,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendars_clear(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendars_clear(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.calendars().clear(opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1191,7 +1191,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1204,7 +1204,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1219,10 +1219,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendars_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendars_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.calendars().delete(opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1235,7 +1235,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1248,7 +1248,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1263,10 +1263,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendars_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendars_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.calendars().get(opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1279,7 +1279,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1292,7 +1292,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1315,13 +1315,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendars_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendars_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1335,8 +1335,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1357,7 +1357,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Calendar = json::value::from_value(object).unwrap(); let mut call = self.hub.calendars().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1370,7 +1370,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1383,7 +1383,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1406,13 +1406,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendars_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendars_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1426,8 +1426,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1448,7 +1448,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Calendar = json::value::from_value(object).unwrap(); let mut call = self.hub.calendars().patch(request, opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1461,7 +1461,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1474,7 +1474,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1497,13 +1497,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _calendars_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _calendars_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1517,8 +1517,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1539,7 +1539,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Calendar = json::value::from_value(object).unwrap(); let mut call = self.hub.calendars().update(request, opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1552,7 +1552,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1565,7 +1565,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1588,13 +1588,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channels_stop(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channels_stop(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1608,8 +1608,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1633,7 +1633,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.channels().stop(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1646,7 +1646,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1659,7 +1659,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1674,10 +1674,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _colors_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _colors_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.colors().get(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1690,7 +1690,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1703,7 +1703,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1726,10 +1726,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().delete(opt.value_of("calendar-id").unwrap_or(""), opt.value_of("event-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "send-notifications" => { @@ -1745,7 +1745,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["send-notifications"].iter().map(|v|*v)); @@ -1759,7 +1759,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1774,10 +1774,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().get(opt.value_of("calendar-id").unwrap_or(""), opt.value_of("event-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "time-zone" => { @@ -1799,7 +1799,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["time-zone", "always-include-email", "max-attendees"].iter().map(|v|*v)); @@ -1813,7 +1813,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1836,13 +1836,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_import(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_import(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1856,8 +1856,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "extended-properties.shared" => Some(("extendedProperties.shared", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "extended-properties.private" => Some(("extendedProperties.private", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -1927,7 +1927,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Event = json::value::from_value(object).unwrap(); let mut call = self.hub.events().import(request, opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "supports-attachments" => { @@ -1943,7 +1943,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["supports-attachments"].iter().map(|v|*v)); @@ -1957,7 +1957,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1980,13 +1980,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2000,8 +2000,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "extended-properties.shared" => Some(("extendedProperties.shared", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "extended-properties.private" => Some(("extendedProperties.private", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -2071,7 +2071,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Event = json::value::from_value(object).unwrap(); let mut call = self.hub.events().insert(request, opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "supports-attachments" => { @@ -2093,7 +2093,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["supports-attachments", "max-attendees", "send-notifications"].iter().map(|v|*v)); @@ -2107,7 +2107,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2130,10 +2130,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().instances(opt.value_of("calendar-id").unwrap_or(""), opt.value_of("event-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "time-zone" => { @@ -2173,7 +2173,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["show-deleted", "time-max", "always-include-email", "max-results", "page-token", "time-min", "time-zone", "original-start", "max-attendees"].iter().map(|v|*v)); @@ -2187,7 +2187,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2210,10 +2210,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().list(opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "updated-min" => { @@ -2277,7 +2277,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["show-hidden-invitations", "sync-token", "page-token", "time-max", "updated-min", "single-events", "i-cal-uid", "always-include-email", "order-by", "q", "show-deleted", "max-results", "time-min", "time-zone", "private-extended-property", "shared-extended-property", "max-attendees"].iter().map(|v|*v)); @@ -2291,7 +2291,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2314,10 +2314,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_move(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_move(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().move_(opt.value_of("calendar-id").unwrap_or(""), opt.value_of("event-id").unwrap_or(""), opt.value_of("destination").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "send-notifications" => { @@ -2333,7 +2333,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["send-notifications"].iter().map(|v|*v)); @@ -2347,7 +2347,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2370,13 +2370,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2390,8 +2390,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "extended-properties.shared" => Some(("extendedProperties.shared", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "extended-properties.private" => Some(("extendedProperties.private", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -2461,7 +2461,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Event = json::value::from_value(object).unwrap(); let mut call = self.hub.events().patch(request, opt.value_of("calendar-id").unwrap_or(""), opt.value_of("event-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "supports-attachments" => { @@ -2486,7 +2486,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["supports-attachments", "max-attendees", "always-include-email", "send-notifications"].iter().map(|v|*v)); @@ -2500,7 +2500,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2523,10 +2523,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_quick_add(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_quick_add(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().quick_add(opt.value_of("calendar-id").unwrap_or(""), opt.value_of("text").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "send-notifications" => { @@ -2542,7 +2542,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["send-notifications"].iter().map(|v|*v)); @@ -2556,7 +2556,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2579,13 +2579,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2599,8 +2599,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "extended-properties.shared" => Some(("extendedProperties.shared", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "extended-properties.private" => Some(("extendedProperties.private", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), @@ -2670,7 +2670,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Event = json::value::from_value(object).unwrap(); let mut call = self.hub.events().update(request, opt.value_of("calendar-id").unwrap_or(""), opt.value_of("event-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "supports-attachments" => { @@ -2695,7 +2695,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["supports-attachments", "max-attendees", "always-include-email", "send-notifications"].iter().map(|v|*v)); @@ -2709,7 +2709,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2732,13 +2732,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_watch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2752,8 +2752,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2777,7 +2777,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.events().watch(request, opt.value_of("calendar-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "updated-min" => { @@ -2841,7 +2841,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["show-hidden-invitations", "sync-token", "page-token", "time-max", "updated-min", "single-events", "i-cal-uid", "always-include-email", "order-by", "q", "show-deleted", "max-results", "time-min", "time-zone", "private-extended-property", "shared-extended-property", "max-attendees"].iter().map(|v|*v)); @@ -2855,7 +2855,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2878,13 +2878,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _freebusy_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _freebusy_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2898,8 +2898,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "time-max" => Some(("timeMax", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "calendar-expansion-max" => Some(("calendarExpansionMax", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2918,7 +2918,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FreeBusyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.freebusy().query(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2931,7 +2931,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2944,7 +2944,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2967,10 +2967,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _settings_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _settings_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.settings().get(opt.value_of("setting").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2983,7 +2983,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2996,7 +2996,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3019,10 +3019,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _settings_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _settings_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.settings().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sync-token" => { @@ -3044,7 +3044,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sync-token", "max-results", "page-token"].iter().map(|v|*v)); @@ -3058,7 +3058,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3081,13 +3081,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _settings_watch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _settings_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3101,8 +3101,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3126,7 +3126,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.settings().watch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sync-token" => { @@ -3148,7 +3148,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sync-token", "max-results", "page-token"].iter().map(|v|*v)); @@ -3162,7 +3162,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3382,14 +3382,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "calendar3-secret.json", + match cmn::application_secret_from_directory(&config_dir, "calendar3-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -3409,7 +3409,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -3448,7 +3448,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("acl", "methods: 'delete', 'get', 'insert', 'list', 'patch', 'update' and 'watch'", vec![ - ("delete", + ("delete", Some(r##"Deletes an access control rule."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/acl_delete", vec![ @@ -3470,7 +3470,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns an access control rule."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/acl_get", vec![ @@ -3498,7 +3498,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates an access control rule."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/acl_insert", vec![ @@ -3526,7 +3526,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns the rules in the access control list for the calendar."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/acl_list", vec![ @@ -3548,7 +3548,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an access control rule. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/acl_patch", vec![ @@ -3582,7 +3582,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an access control rule."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/acl_update", vec![ @@ -3616,7 +3616,7 @@ fn main() { Some(false), Some(false)), ]), - ("watch", + ("watch", Some(r##"Watch for changes to ACL resources."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/acl_watch", vec![ @@ -3647,7 +3647,7 @@ fn main() { ]), ("calendar-list", "methods: 'delete', 'get', 'insert', 'list', 'patch', 'update' and 'watch'", vec![ - ("delete", + ("delete", Some(r##"Deletes an entry on the user's calendar list."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendar-list_delete", vec![ @@ -3663,7 +3663,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns an entry on the user's calendar list."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendar-list_get", vec![ @@ -3685,7 +3685,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Adds an entry to the user's calendar list."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendar-list_insert", vec![ @@ -3707,7 +3707,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns entries on the user's calendar list."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendar-list_list", vec![ @@ -3723,7 +3723,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an entry on the user's calendar list. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendar-list_patch", vec![ @@ -3751,7 +3751,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an entry on the user's calendar list."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendar-list_update", vec![ @@ -3779,7 +3779,7 @@ fn main() { Some(false), Some(false)), ]), - ("watch", + ("watch", Some(r##"Watch for changes to CalendarList resources."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendar-list_watch", vec![ @@ -3804,7 +3804,7 @@ fn main() { ]), ("calendars", "methods: 'clear', 'delete', 'get', 'insert', 'patch' and 'update'", vec![ - ("clear", + ("clear", Some(r##"Clears a primary calendar. This operation deletes all events associated with the primary calendar of an account."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendars_clear", vec![ @@ -3820,7 +3820,7 @@ fn main() { Some(false), Some(true)), ]), - ("delete", + ("delete", Some(r##"Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendars_delete", vec![ @@ -3836,7 +3836,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns metadata for a calendar."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendars_get", vec![ @@ -3858,7 +3858,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a secondary calendar."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendars_insert", vec![ @@ -3880,7 +3880,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates metadata for a calendar. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendars_patch", vec![ @@ -3908,7 +3908,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates metadata for a calendar."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/calendars_update", vec![ @@ -3939,7 +3939,7 @@ fn main() { ]), ("channels", "methods: 'stop'", vec![ - ("stop", + ("stop", Some(r##"Stop watching resources through this channel"##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/channels_stop", vec![ @@ -3958,7 +3958,7 @@ fn main() { ]), ("colors", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Returns the color definitions for calendars and events."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/colors_get", vec![ @@ -3977,7 +3977,7 @@ fn main() { ]), ("events", "methods: 'delete', 'get', 'import', 'insert', 'instances', 'list', 'move', 'patch', 'quick-add', 'update' and 'watch'", vec![ - ("delete", + ("delete", Some(r##"Deletes an event."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_delete", vec![ @@ -3999,7 +3999,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns an event."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_get", vec![ @@ -4027,7 +4027,7 @@ fn main() { Some(false), Some(false)), ]), - ("import", + ("import", Some(r##"Imports an event. This operation is used to add a private copy of an existing event to a calendar."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_import", vec![ @@ -4055,7 +4055,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates an event."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_insert", vec![ @@ -4083,7 +4083,7 @@ fn main() { Some(false), Some(false)), ]), - ("instances", + ("instances", Some(r##"Returns instances of the specified recurring event."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_instances", vec![ @@ -4111,7 +4111,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns events on the specified calendar."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_list", vec![ @@ -4133,7 +4133,7 @@ fn main() { Some(false), Some(false)), ]), - ("move", + ("move", Some(r##"Moves an event to another calendar, i.e. changes an event's organizer."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_move", vec![ @@ -4167,7 +4167,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an event. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_patch", vec![ @@ -4201,7 +4201,7 @@ fn main() { Some(false), Some(false)), ]), - ("quick-add", + ("quick-add", Some(r##"Creates an event based on a simple text string."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_quick-add", vec![ @@ -4229,7 +4229,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an event."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_update", vec![ @@ -4263,7 +4263,7 @@ fn main() { Some(false), Some(false)), ]), - ("watch", + ("watch", Some(r##"Watch for changes to Events resources."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/events_watch", vec![ @@ -4294,7 +4294,7 @@ fn main() { ]), ("freebusy", "methods: 'query'", vec![ - ("query", + ("query", Some(r##"Returns free/busy information for a set of calendars."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/freebusy_query", vec![ @@ -4319,7 +4319,7 @@ fn main() { ]), ("settings", "methods: 'get', 'list' and 'watch'", vec![ - ("get", + ("get", Some(r##"Returns a single user setting."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/settings_get", vec![ @@ -4341,7 +4341,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns all user settings for the authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/settings_list", vec![ @@ -4357,7 +4357,7 @@ fn main() { Some(false), Some(false)), ]), - ("watch", + ("watch", Some(r##"Watch for changes to Settings resources."##), "Details at http://byron.github.io/google-apis-rs/google_calendar3_cli/settings_watch", vec![ @@ -4385,7 +4385,7 @@ fn main() { let mut app = App::new("calendar3") .author("Sebastian Thiel ") - .version("0.3.2+20151011") + .version("0.3.3+20160110") .about("Lets you manipulate events and other calendar data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_calendar3_cli") .arg(Arg::with_name("url") @@ -4409,7 +4409,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -4420,7 +4420,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/calendar3/Cargo.toml b/gen/calendar3/Cargo.toml index b67b23c5bf..93c023cbd2 100644 --- a/gen/calendar3/Cargo.toml +++ b/gen/calendar3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-calendar3" -version = "0.1.10+20151011" +version = "0.1.11+20160110" authors = ["Sebastian Thiel "] description = "A complete library to interact with calendar (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/calendar3" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/calendar3/LICENSE.md b/gen/calendar3/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/calendar3/LICENSE.md +++ b/gen/calendar3/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/calendar3/README.md b/gen/calendar3/README.md index bb96bad798..74015e4032 100644 --- a/gen/calendar3/README.md +++ b/gen/calendar3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-calendar3` library allows access to all features of the *Google calendar* service. -This documentation was generated from *calendar* crate version *0.1.10+20151011*, where *20151011* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *calendar* crate version *0.1.11+20160110*, where *20160110* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *calendar* *v3* API can be found at the [official documentation site](https://developers.google.com/google-apps/calendar/firstapp). diff --git a/gen/calendar3/src/cmn.rs b/gen/calendar3/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/calendar3/src/cmn.rs +++ b/gen/calendar3/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/calendar3/src/lib.rs b/gen/calendar3/src/lib.rs index 054815bc80..2a97f34ee0 100644 --- a/gen/calendar3/src/lib.rs +++ b/gen/calendar3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *calendar* crate version *0.1.10+20151011*, where *20151011* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *calendar* crate version *0.1.11+20160110*, where *20160110* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *calendar* *v3* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/calendar/firstapp). diff --git a/gen/calendar3/src/lib.rs.in b/gen/calendar3/src/lib.rs.in index e806c4cd1d..7eb08ae4a5 100644 --- a/gen/calendar3/src/lib.rs.in +++ b/gen/calendar3/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -153,7 +154,7 @@ impl<'a, C, A> CalendarHub CalendarHub { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -183,7 +184,7 @@ impl<'a, C, A> CalendarHub } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1112,7 +1113,7 @@ pub struct Event { /// The color of the event. This is an ID referring to an entry in the event section of the colors definition (see the colors endpoint). Optional. #[serde(rename="colorId")] pub color_id: Option, - /// Whether anyone can invite themselves to the event. Optional. The default is False. + /// Whether anyone can invite themselves to the event (currently works for Google+ events only). Optional. The default is False. #[serde(rename="anyoneCanAddSelf")] pub anyone_can_add_self: Option, /// Information about the event's reminders for the authenticated user. @@ -2292,7 +2293,7 @@ impl<'a, C, A> FreebusyQueryCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.freebusy.query", + dlg.begin(MethodInfo { id: "calendar.freebusy.query", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2312,14 +2313,14 @@ impl<'a, C, A> FreebusyQueryCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2363,7 +2364,7 @@ impl<'a, C, A> FreebusyQueryCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2373,10 +2374,10 @@ impl<'a, C, A> FreebusyQueryCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2408,7 +2409,7 @@ impl<'a, C, A> FreebusyQueryCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: FreeBusyRequest) -> FreebusyQueryCall<'a, C, A> { self._request = new_value; @@ -2426,12 +2427,12 @@ impl<'a, C, A> FreebusyQueryCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2448,17 +2449,17 @@ impl<'a, C, A> FreebusyQueryCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FreebusyQueryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FreebusyQueryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2525,7 +2526,7 @@ impl<'a, C, A> SettingListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.settings.list", + dlg.begin(MethodInfo { id: "calendar.settings.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._sync_token { @@ -2554,7 +2555,7 @@ impl<'a, C, A> SettingListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2590,7 +2591,7 @@ impl<'a, C, A> SettingListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2600,10 +2601,10 @@ impl<'a, C, A> SettingListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2668,12 +2669,12 @@ impl<'a, C, A> SettingListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2690,17 +2691,17 @@ impl<'a, C, A> SettingListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SettingListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SettingListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2774,7 +2775,7 @@ impl<'a, C, A> SettingWatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.settings.watch", + dlg.begin(MethodInfo { id: "calendar.settings.watch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if let Some(value) = self._sync_token { @@ -2803,14 +2804,14 @@ impl<'a, C, A> SettingWatchCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2854,7 +2855,7 @@ impl<'a, C, A> SettingWatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2864,10 +2865,10 @@ impl<'a, C, A> SettingWatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2899,7 +2900,7 @@ impl<'a, C, A> SettingWatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> SettingWatchCall<'a, C, A> { self._request = new_value; @@ -2941,12 +2942,12 @@ impl<'a, C, A> SettingWatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2963,17 +2964,17 @@ impl<'a, C, A> SettingWatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SettingWatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SettingWatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3035,7 +3036,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.settings.get", + dlg.begin(MethodInfo { id: "calendar.settings.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("setting", self._setting.to_string())); @@ -3077,7 +3078,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3113,7 +3114,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3123,10 +3124,10 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3159,7 +3160,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *setting* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn setting(mut self, new_value: &str) -> SettingGetCall<'a, C, A> { self._setting = new_value.to_string(); @@ -3177,12 +3178,12 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3199,17 +3200,17 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SettingGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SettingGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3280,7 +3281,7 @@ impl<'a, C, A> CalendarListUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendarList.update", + dlg.begin(MethodInfo { id: "calendar.calendarList.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -3325,14 +3326,14 @@ impl<'a, C, A> CalendarListUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3376,7 +3377,7 @@ impl<'a, C, A> CalendarListUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3386,10 +3387,10 @@ impl<'a, C, A> CalendarListUpdateCall<'a, C, A> where C: BorrowMut CalendarListUpdateCall<'a, C, A> where C: BorrowMut CalendarListUpdateCall<'a, C, A> { self._request = new_value; @@ -3431,7 +3432,7 @@ impl<'a, C, A> CalendarListUpdateCall<'a, C, A> where C: BorrowMut CalendarListUpdateCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -3456,12 +3457,12 @@ impl<'a, C, A> CalendarListUpdateCall<'a, C, A> where C: BorrowMut CalendarListUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CalendarListUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarListUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3550,7 +3551,7 @@ impl<'a, C, A> CalendarListDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendarList.delete", + dlg.begin(MethodInfo { id: "calendar.calendarList.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -3591,7 +3592,7 @@ impl<'a, C, A> CalendarListDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3627,7 +3628,7 @@ impl<'a, C, A> CalendarListDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3637,10 +3638,10 @@ impl<'a, C, A> CalendarListDeleteCall<'a, C, A> where C: BorrowMut CalendarListDeleteCall<'a, C, A> where C: BorrowMut CalendarListDeleteCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -3681,12 +3682,12 @@ impl<'a, C, A> CalendarListDeleteCall<'a, C, A> where C: BorrowMut CalendarListDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CalendarListDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarListDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3775,7 +3776,7 @@ impl<'a, C, A> CalendarListGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendarList.get", + dlg.begin(MethodInfo { id: "calendar.calendarList.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -3817,7 +3818,7 @@ impl<'a, C, A> CalendarListGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3853,7 +3854,7 @@ impl<'a, C, A> CalendarListGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3863,10 +3864,10 @@ impl<'a, C, A> CalendarListGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3899,7 +3900,7 @@ impl<'a, C, A> CalendarListGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> CalendarListGetCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -3917,12 +3918,12 @@ impl<'a, C, A> CalendarListGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3939,17 +3940,17 @@ impl<'a, C, A> CalendarListGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CalendarListGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarListGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4022,7 +4023,7 @@ impl<'a, C, A> CalendarListListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendarList.list", + dlg.begin(MethodInfo { id: "calendar.calendarList.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); if let Some(value) = self._sync_token { @@ -4060,7 +4061,7 @@ impl<'a, C, A> CalendarListListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4096,7 +4097,7 @@ impl<'a, C, A> CalendarListListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4106,10 +4107,10 @@ impl<'a, C, A> CalendarListListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4196,12 +4197,12 @@ impl<'a, C, A> CalendarListListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4218,17 +4219,17 @@ impl<'a, C, A> CalendarListListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CalendarListListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarListListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4298,7 +4299,7 @@ impl<'a, C, A> CalendarListInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendarList.insert", + dlg.begin(MethodInfo { id: "calendar.calendarList.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._color_rgb_format { @@ -4321,14 +4322,14 @@ impl<'a, C, A> CalendarListInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4372,7 +4373,7 @@ impl<'a, C, A> CalendarListInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4382,10 +4383,10 @@ impl<'a, C, A> CalendarListInsertCall<'a, C, A> where C: BorrowMut CalendarListInsertCall<'a, C, A> where C: BorrowMut CalendarListInsertCall<'a, C, A> { self._request = new_value; @@ -4442,12 +4443,12 @@ impl<'a, C, A> CalendarListInsertCall<'a, C, A> where C: BorrowMut CalendarListInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CalendarListInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarListInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4545,7 +4546,7 @@ impl<'a, C, A> CalendarListPatchCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendarList.patch", + dlg.begin(MethodInfo { id: "calendar.calendarList.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -4590,14 +4591,14 @@ impl<'a, C, A> CalendarListPatchCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4641,7 +4642,7 @@ impl<'a, C, A> CalendarListPatchCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4651,10 +4652,10 @@ impl<'a, C, A> CalendarListPatchCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4686,7 +4687,7 @@ impl<'a, C, A> CalendarListPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CalendarListEntry) -> CalendarListPatchCall<'a, C, A> { self._request = new_value; @@ -4696,7 +4697,7 @@ impl<'a, C, A> CalendarListPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> CalendarListPatchCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -4721,12 +4722,12 @@ impl<'a, C, A> CalendarListPatchCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4743,17 +4744,17 @@ impl<'a, C, A> CalendarListPatchCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CalendarListPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarListPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4833,7 +4834,7 @@ impl<'a, C, A> CalendarListWatchCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendarList.watch", + dlg.begin(MethodInfo { id: "calendar.calendarList.watch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); if let Some(value) = self._sync_token { @@ -4871,14 +4872,14 @@ impl<'a, C, A> CalendarListWatchCall<'a, C, A> where C: BorrowMut self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4922,7 +4923,7 @@ impl<'a, C, A> CalendarListWatchCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4932,10 +4933,10 @@ impl<'a, C, A> CalendarListWatchCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4967,7 +4968,7 @@ impl<'a, C, A> CalendarListWatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> CalendarListWatchCall<'a, C, A> { self._request = new_value; @@ -5031,12 +5032,12 @@ impl<'a, C, A> CalendarListWatchCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5053,17 +5054,17 @@ impl<'a, C, A> CalendarListWatchCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CalendarListWatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarListWatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5132,7 +5133,7 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendars.patch", + dlg.begin(MethodInfo { id: "calendar.calendars.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -5174,14 +5175,14 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5225,7 +5226,7 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5235,10 +5236,10 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5270,7 +5271,7 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Calendar) -> CalendarPatchCall<'a, C, A> { self._request = new_value; @@ -5280,7 +5281,7 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> CalendarPatchCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -5298,12 +5299,12 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5320,17 +5321,17 @@ impl<'a, C, A> CalendarPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CalendarPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5392,7 +5393,7 @@ impl<'a, C, A> CalendarDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendars.delete", + dlg.begin(MethodInfo { id: "calendar.calendars.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -5433,7 +5434,7 @@ impl<'a, C, A> CalendarDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5469,7 +5470,7 @@ impl<'a, C, A> CalendarDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5479,10 +5480,10 @@ impl<'a, C, A> CalendarDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5505,7 +5506,7 @@ impl<'a, C, A> CalendarDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> CalendarDeleteCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -5523,12 +5524,12 @@ impl<'a, C, A> CalendarDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5545,17 +5546,17 @@ impl<'a, C, A> CalendarDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CalendarDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5617,7 +5618,7 @@ impl<'a, C, A> CalendarGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendars.get", + dlg.begin(MethodInfo { id: "calendar.calendars.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -5659,7 +5660,7 @@ impl<'a, C, A> CalendarGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5695,7 +5696,7 @@ impl<'a, C, A> CalendarGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5705,10 +5706,10 @@ impl<'a, C, A> CalendarGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5741,7 +5742,7 @@ impl<'a, C, A> CalendarGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> CalendarGetCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -5759,12 +5760,12 @@ impl<'a, C, A> CalendarGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5781,17 +5782,17 @@ impl<'a, C, A> CalendarGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CalendarGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5853,7 +5854,7 @@ impl<'a, C, A> CalendarClearCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendars.clear", + dlg.begin(MethodInfo { id: "calendar.calendars.clear", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -5894,7 +5895,7 @@ impl<'a, C, A> CalendarClearCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5930,7 +5931,7 @@ impl<'a, C, A> CalendarClearCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5940,10 +5941,10 @@ impl<'a, C, A> CalendarClearCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5966,7 +5967,7 @@ impl<'a, C, A> CalendarClearCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> CalendarClearCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -5984,12 +5985,12 @@ impl<'a, C, A> CalendarClearCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6006,17 +6007,17 @@ impl<'a, C, A> CalendarClearCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CalendarClearCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarClearCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6084,7 +6085,7 @@ impl<'a, C, A> CalendarInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendars.insert", + dlg.begin(MethodInfo { id: "calendar.calendars.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -6104,14 +6105,14 @@ impl<'a, C, A> CalendarInsertCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6155,7 +6156,7 @@ impl<'a, C, A> CalendarInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6165,10 +6166,10 @@ impl<'a, C, A> CalendarInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6200,7 +6201,7 @@ impl<'a, C, A> CalendarInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Calendar) -> CalendarInsertCall<'a, C, A> { self._request = new_value; @@ -6218,12 +6219,12 @@ impl<'a, C, A> CalendarInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6240,17 +6241,17 @@ impl<'a, C, A> CalendarInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CalendarInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6319,7 +6320,7 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.calendars.update", + dlg.begin(MethodInfo { id: "calendar.calendars.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -6361,14 +6362,14 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6412,7 +6413,7 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6422,10 +6423,10 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6457,7 +6458,7 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Calendar) -> CalendarUpdateCall<'a, C, A> { self._request = new_value; @@ -6467,7 +6468,7 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> CalendarUpdateCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -6485,12 +6486,12 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6507,17 +6508,17 @@ impl<'a, C, A> CalendarUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CalendarUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CalendarUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6594,7 +6595,7 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.acl.watch", + dlg.begin(MethodInfo { id: "calendar.acl.watch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -6648,14 +6649,14 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6699,7 +6700,7 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6709,10 +6710,10 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6744,7 +6745,7 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> AclWatchCall<'a, C, A> { self._request = new_value; @@ -6754,7 +6755,7 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> AclWatchCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -6803,12 +6804,12 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6825,17 +6826,17 @@ impl<'a, C, A> AclWatchCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AclWatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AclWatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6904,7 +6905,7 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.acl.insert", + dlg.begin(MethodInfo { id: "calendar.acl.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -6946,14 +6947,14 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6997,7 +6998,7 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7007,10 +7008,10 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7042,7 +7043,7 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AclRule) -> AclInsertCall<'a, C, A> { self._request = new_value; @@ -7052,7 +7053,7 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> AclInsertCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -7070,12 +7071,12 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7092,17 +7093,17 @@ impl<'a, C, A> AclInsertCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AclInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AclInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7172,7 +7173,7 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.acl.update", + dlg.begin(MethodInfo { id: "calendar.acl.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -7215,14 +7216,14 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7266,7 +7267,7 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7276,10 +7277,10 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7311,7 +7312,7 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AclRule) -> AclUpdateCall<'a, C, A> { self._request = new_value; @@ -7321,7 +7322,7 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> AclUpdateCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -7331,7 +7332,7 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *rule id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn rule_id(mut self, new_value: &str) -> AclUpdateCall<'a, C, A> { self._rule_id = new_value.to_string(); @@ -7349,12 +7350,12 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7371,17 +7372,17 @@ impl<'a, C, A> AclUpdateCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AclUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AclUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7451,7 +7452,7 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.acl.patch", + dlg.begin(MethodInfo { id: "calendar.acl.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -7494,14 +7495,14 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7545,7 +7546,7 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7555,10 +7556,10 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7590,7 +7591,7 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AclRule) -> AclPatchCall<'a, C, A> { self._request = new_value; @@ -7600,7 +7601,7 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> AclPatchCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -7610,7 +7611,7 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *rule id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn rule_id(mut self, new_value: &str) -> AclPatchCall<'a, C, A> { self._rule_id = new_value.to_string(); @@ -7628,12 +7629,12 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7650,17 +7651,17 @@ impl<'a, C, A> AclPatchCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AclPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AclPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7730,7 +7731,7 @@ impl<'a, C, A> AclListCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.acl.list", + dlg.begin(MethodInfo { id: "calendar.acl.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -7784,7 +7785,7 @@ impl<'a, C, A> AclListCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7820,7 +7821,7 @@ impl<'a, C, A> AclListCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7830,10 +7831,10 @@ impl<'a, C, A> AclListCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7866,7 +7867,7 @@ impl<'a, C, A> AclListCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> AclListCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -7915,12 +7916,12 @@ impl<'a, C, A> AclListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7937,17 +7938,17 @@ impl<'a, C, A> AclListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AclListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AclListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8010,7 +8011,7 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.acl.delete", + dlg.begin(MethodInfo { id: "calendar.acl.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -8052,7 +8053,7 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8088,7 +8089,7 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8098,10 +8099,10 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8124,7 +8125,7 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> AclDeleteCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -8134,7 +8135,7 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *rule id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn rule_id(mut self, new_value: &str) -> AclDeleteCall<'a, C, A> { self._rule_id = new_value.to_string(); @@ -8152,12 +8153,12 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8174,17 +8175,17 @@ impl<'a, C, A> AclDeleteCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AclDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AclDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8247,7 +8248,7 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.acl.get", + dlg.begin(MethodInfo { id: "calendar.acl.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -8290,7 +8291,7 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8326,7 +8327,7 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8336,10 +8337,10 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8372,7 +8373,7 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> AclGetCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -8382,7 +8383,7 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *rule id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn rule_id(mut self, new_value: &str) -> AclGetCall<'a, C, A> { self._rule_id = new_value.to_string(); @@ -8400,12 +8401,12 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8422,17 +8423,17 @@ impl<'a, C, A> AclGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AclGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AclGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8500,7 +8501,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.channels.stop", + dlg.begin(MethodInfo { id: "calendar.channels.stop", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in [].iter() { @@ -8519,14 +8520,14 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8570,7 +8571,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8580,10 +8581,10 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8605,7 +8606,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> ChannelStopCall<'a, C, A> { self._request = new_value; @@ -8623,12 +8624,12 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8645,17 +8646,17 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChannelStopCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChannelStopCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8716,7 +8717,7 @@ impl<'a, C, A> ColorGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.colors.get", + dlg.begin(MethodInfo { id: "calendar.colors.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -8736,7 +8737,7 @@ impl<'a, C, A> ColorGetCall<'a, C, A> where C: BorrowMut, A: oaut self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8772,7 +8773,7 @@ impl<'a, C, A> ColorGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8782,10 +8783,10 @@ impl<'a, C, A> ColorGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8826,12 +8827,12 @@ impl<'a, C, A> ColorGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8848,17 +8849,17 @@ impl<'a, C, A> ColorGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ColorGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ColorGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8923,7 +8924,7 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.delete", + dlg.begin(MethodInfo { id: "calendar.events.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -8968,7 +8969,7 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9004,7 +9005,7 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9014,10 +9015,10 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9040,7 +9041,7 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventDeleteCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -9050,7 +9051,7 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *event id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn event_id(mut self, new_value: &str) -> EventDeleteCall<'a, C, A> { self._event_id = new_value.to_string(); @@ -9075,12 +9076,12 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9097,17 +9098,17 @@ impl<'a, C, A> EventDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9182,7 +9183,7 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.insert", + dlg.begin(MethodInfo { id: "calendar.events.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -9233,14 +9234,14 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9284,7 +9285,7 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9294,10 +9295,10 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9329,7 +9330,7 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Event) -> EventInsertCall<'a, C, A> { self._request = new_value; @@ -9339,7 +9340,7 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventInsertCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -9378,12 +9379,12 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9400,17 +9401,17 @@ impl<'a, C, A> EventInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9481,7 +9482,7 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.import", + dlg.begin(MethodInfo { id: "calendar.events.import", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -9526,14 +9527,14 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9577,7 +9578,7 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9587,10 +9588,10 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9622,7 +9623,7 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Event) -> EventImportCall<'a, C, A> { self._request = new_value; @@ -9632,7 +9633,7 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventImportCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -9657,12 +9658,12 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9679,17 +9680,17 @@ impl<'a, C, A> EventImportCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventImportCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventImportCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9770,7 +9771,7 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.instances", + dlg.begin(MethodInfo { id: "calendar.events.instances", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -9840,7 +9841,7 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9876,7 +9877,7 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9886,10 +9887,10 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9922,7 +9923,7 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventInstanceCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -9932,7 +9933,7 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *event id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn event_id(mut self, new_value: &str) -> EventInstanceCall<'a, C, A> { self._event_id = new_value.to_string(); @@ -10013,12 +10014,12 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10035,17 +10036,17 @@ impl<'a, C, A> EventInstanceCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10114,7 +10115,7 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.get", + dlg.begin(MethodInfo { id: "calendar.events.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -10166,7 +10167,7 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10202,7 +10203,7 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10212,10 +10213,10 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10248,7 +10249,7 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventGetCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -10258,7 +10259,7 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *event id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn event_id(mut self, new_value: &str) -> EventGetCall<'a, C, A> { self._event_id = new_value.to_string(); @@ -10297,12 +10298,12 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10319,17 +10320,17 @@ impl<'a, C, A> EventGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10425,7 +10426,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.list", + dlg.begin(MethodInfo { id: "calendar.events.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((20 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -10526,7 +10527,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10562,7 +10563,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10572,10 +10573,10 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10608,7 +10609,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventListCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -10760,12 +10761,12 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10782,17 +10783,17 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10870,7 +10871,7 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.patch", + dlg.begin(MethodInfo { id: "calendar.events.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -10925,14 +10926,14 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10976,7 +10977,7 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10986,10 +10987,10 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11021,7 +11022,7 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Event) -> EventPatchCall<'a, C, A> { self._request = new_value; @@ -11031,7 +11032,7 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventPatchCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -11041,7 +11042,7 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *event id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn event_id(mut self, new_value: &str) -> EventPatchCall<'a, C, A> { self._event_id = new_value.to_string(); @@ -11087,12 +11088,12 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11109,17 +11110,17 @@ impl<'a, C, A> EventPatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11185,7 +11186,7 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.move", + dlg.begin(MethodInfo { id: "calendar.events.move", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -11232,7 +11233,7 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11268,7 +11269,7 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11278,10 +11279,10 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11314,7 +11315,7 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventMoveCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -11324,7 +11325,7 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *event id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn event_id(mut self, new_value: &str) -> EventMoveCall<'a, C, A> { self._event_id = new_value.to_string(); @@ -11334,7 +11335,7 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *destination* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn destination(mut self, new_value: &str) -> EventMoveCall<'a, C, A> { self._destination = new_value.to_string(); @@ -11359,12 +11360,12 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11381,17 +11382,17 @@ impl<'a, C, A> EventMoveCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventMoveCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventMoveCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11469,7 +11470,7 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.update", + dlg.begin(MethodInfo { id: "calendar.events.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -11524,14 +11525,14 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11575,7 +11576,7 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11585,10 +11586,10 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11620,7 +11621,7 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Event) -> EventUpdateCall<'a, C, A> { self._request = new_value; @@ -11630,7 +11631,7 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventUpdateCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -11640,7 +11641,7 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *event id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn event_id(mut self, new_value: &str) -> EventUpdateCall<'a, C, A> { self._event_id = new_value.to_string(); @@ -11686,12 +11687,12 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11708,17 +11709,17 @@ impl<'a, C, A> EventUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11821,7 +11822,7 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.watch", + dlg.begin(MethodInfo { id: "calendar.events.watch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((21 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -11922,14 +11923,14 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11973,7 +11974,7 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11983,10 +11984,10 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12018,7 +12019,7 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> EventWatchCall<'a, C, A> { self._request = new_value; @@ -12028,7 +12029,7 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventWatchCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -12180,12 +12181,12 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12202,17 +12203,17 @@ impl<'a, C, A> EventWatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventWatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventWatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12277,7 +12278,7 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "calendar.events.quickAdd", + dlg.begin(MethodInfo { id: "calendar.events.quickAdd", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("calendarId", self._calendar_id.to_string())); @@ -12323,7 +12324,7 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12359,7 +12360,7 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12369,10 +12370,10 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12405,7 +12406,7 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *calendar id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn calendar_id(mut self, new_value: &str) -> EventQuickAddCall<'a, C, A> { self._calendar_id = new_value.to_string(); @@ -12415,7 +12416,7 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *text* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn text(mut self, new_value: &str) -> EventQuickAddCall<'a, C, A> { self._text = new_value.to_string(); @@ -12440,12 +12441,12 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12462,17 +12463,17 @@ impl<'a, C, A> EventQuickAddCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventQuickAddCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventQuickAddCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/civicinfo2-cli/Cargo.toml b/gen/civicinfo2-cli/Cargo.toml index 6acd7f3cf6..1a6bb3aa34 100644 --- a/gen/civicinfo2-cli/Cargo.toml +++ b/gen/civicinfo2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-civicinfo2-cli" -version = "0.3.2+20150820" +version = "0.3.3+20150820" authors = ["Sebastian Thiel "] description = "A complete library to interact with Civic Info (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/civicinfo2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/civicinfo2-cli/LICENSE.md b/gen/civicinfo2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/civicinfo2-cli/LICENSE.md +++ b/gen/civicinfo2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/civicinfo2-cli/README.md b/gen/civicinfo2-cli/README.md index 6fee331824..2cb93de2f1 100644 --- a/gen/civicinfo2-cli/README.md +++ b/gen/civicinfo2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Civic Info* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/civicinfo2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/civicinfo2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/civicinfo2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/civicinfo2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/civicinfo2-cli). # Usage -This documentation was generated from the *Civic Info* API at revision *20150820*. The CLI is at version *0.3.2*. +This documentation was generated from the *Civic Info* API at revision *20150820*. The CLI is at version *0.3.3*. ```bash civicinfo2 [options] @@ -40,14 +40,14 @@ civicinfo2 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/civicinfo2-cli/mkdocs.yml b/gen/civicinfo2-cli/mkdocs.yml index e859aba945..d50cb2f205 100644 --- a/gen/civicinfo2-cli/mkdocs.yml +++ b/gen/civicinfo2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Civic Info v0.3.2+20150820 +site_name: Civic Info v0.3.3+20150820 site_url: http://byron.github.io/google-apis-rs/google-civicinfo2-cli site_description: Write integrating applications with bcore @@ -17,5 +17,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/civicinfo2-cli/src/main.rs b/gen/civicinfo2-cli/src/main.rs index 19d5fc3742..b14faa69f3 100644 --- a/gen/civicinfo2-cli/src/main.rs +++ b/gen/civicinfo2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::CivicInfo>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _divisions_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _divisions_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.divisions().search(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "query" => { @@ -64,7 +64,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["query"].iter().map(|v|*v)); @@ -98,10 +98,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _elections_election_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _elections_election_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.elections().election_query(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -114,7 +114,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -147,10 +147,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _elections_voter_info_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _elections_voter_info_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.elections().voter_info_query(opt.value_of("address").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "official-only" => { @@ -169,7 +169,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["election-id", "official-only"].iter().map(|v|*v)); @@ -203,10 +203,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _representatives_representative_info_by_address(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _representatives_representative_info_by_address(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.representatives().representative_info_by_address(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "roles" => { @@ -231,7 +231,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-offices", "levels", "roles", "address"].iter().map(|v|*v)); @@ -265,10 +265,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _representatives_representative_info_by_division(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _representatives_representative_info_by_division(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.representatives().representative_info_by_division(opt.value_of("ocd-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "roles" => { @@ -290,7 +290,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["levels", "recursive", "roles"].iter().map(|v|*v)); @@ -385,14 +385,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "civicinfo2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "civicinfo2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -412,7 +412,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -451,7 +451,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("divisions", "methods: 'search'", vec![ - ("search", + ("search", Some(r##"Searches for political divisions by their natural name or OCD ID."##), "Details at http://byron.github.io/google-apis-rs/google_civicinfo2_cli/divisions_search", vec![ @@ -470,7 +470,7 @@ fn main() { ]), ("elections", "methods: 'election-query' and 'voter-info-query'", vec![ - ("election-query", + ("election-query", Some(r##"List of available elections to query."##), "Details at http://byron.github.io/google-apis-rs/google_civicinfo2_cli/elections_election-query", vec![ @@ -486,7 +486,7 @@ fn main() { Some(false), Some(false)), ]), - ("voter-info-query", + ("voter-info-query", Some(r##"Looks up information relevant to a voter based on the voter's registered address."##), "Details at http://byron.github.io/google-apis-rs/google_civicinfo2_cli/elections_voter-info-query", vec![ @@ -511,7 +511,7 @@ fn main() { ]), ("representatives", "methods: 'representative-info-by-address' and 'representative-info-by-division'", vec![ - ("representative-info-by-address", + ("representative-info-by-address", Some(r##"Looks up political geography and representative information for a single address."##), "Details at http://byron.github.io/google-apis-rs/google_civicinfo2_cli/representatives_representative-info-by-address", vec![ @@ -527,7 +527,7 @@ fn main() { Some(false), Some(false)), ]), - ("representative-info-by-division", + ("representative-info-by-division", Some(r##"Looks up representative information for a single geographic division."##), "Details at http://byron.github.io/google-apis-rs/google_civicinfo2_cli/representatives_representative-info-by-division", vec![ @@ -555,7 +555,7 @@ fn main() { let mut app = App::new("civicinfo2") .author("Sebastian Thiel ") - .version("0.3.2+20150820") + .version("0.3.3+20150820") .about("An API for accessing civic information.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_civicinfo2_cli") .arg(Arg::with_name("folder") @@ -574,7 +574,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -585,7 +585,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/civicinfo2/Cargo.toml b/gen/civicinfo2/Cargo.toml index 1cd758b1c0..4b67046c6e 100644 --- a/gen/civicinfo2/Cargo.toml +++ b/gen/civicinfo2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-civicinfo2" -version = "0.1.10+20150820" +version = "0.1.11+20150820" authors = ["Sebastian Thiel "] description = "A complete library to interact with Civic Info (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/civicinfo2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/civicinfo2/LICENSE.md b/gen/civicinfo2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/civicinfo2/LICENSE.md +++ b/gen/civicinfo2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/civicinfo2/README.md b/gen/civicinfo2/README.md index 7c9f867dcc..9ab4e67383 100644 --- a/gen/civicinfo2/README.md +++ b/gen/civicinfo2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-civicinfo2` library allows access to all features of the *Google Civic Info* service. -This documentation was generated from *Civic Info* crate version *0.1.10+20150820*, where *20150820* is the exact revision of the *civicinfo:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Civic Info* crate version *0.1.11+20150820*, where *20150820* is the exact revision of the *civicinfo:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Civic Info* *v2* API can be found at the [official documentation site](https://developers.google.com/civic-information). diff --git a/gen/civicinfo2/src/cmn.rs b/gen/civicinfo2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/civicinfo2/src/cmn.rs +++ b/gen/civicinfo2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/civicinfo2/src/lib.rs b/gen/civicinfo2/src/lib.rs index 3335a64e97..e21803b6ed 100644 --- a/gen/civicinfo2/src/lib.rs +++ b/gen/civicinfo2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Civic Info* crate version *0.1.10+20150820*, where *20150820* is the exact revision of the *civicinfo:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Civic Info* crate version *0.1.11+20150820*, where *20150820* is the exact revision of the *civicinfo:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Civic Info* *v2* API can be found at the //! [official documentation site](https://developers.google.com/civic-information). diff --git a/gen/civicinfo2/src/lib.rs.in b/gen/civicinfo2/src/lib.rs.in index 12a116b199..30e5009a6b 100644 --- a/gen/civicinfo2/src/lib.rs.in +++ b/gen/civicinfo2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -106,7 +107,7 @@ impl<'a, C, A> CivicInfo CivicInfo { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -121,7 +122,7 @@ impl<'a, C, A> CivicInfo } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -959,7 +960,7 @@ impl<'a, C, A> DivisionSearchCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "civicinfo.divisions.search", + dlg.begin(MethodInfo { id: "civicinfo.divisions.search", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if let Some(value) = self._query { @@ -991,7 +992,7 @@ impl<'a, C, A> DivisionSearchCall<'a, C, A> where C: BorrowMut, A } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1012,7 +1013,7 @@ impl<'a, C, A> DivisionSearchCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1022,10 +1023,10 @@ impl<'a, C, A> DivisionSearchCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1073,12 +1074,12 @@ impl<'a, C, A> DivisionSearchCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1149,7 +1150,7 @@ impl<'a, C, A> ElectionElectionQueryCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "civicinfo.elections.electionQuery", + dlg.begin(MethodInfo { id: "civicinfo.elections.electionQuery", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1178,7 +1179,7 @@ impl<'a, C, A> ElectionElectionQueryCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1199,7 +1200,7 @@ impl<'a, C, A> ElectionElectionQueryCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1209,10 +1210,10 @@ impl<'a, C, A> ElectionElectionQueryCall<'a, C, A> where C: BorrowMut ElectionElectionQueryCall<'a, C, A> where C: BorrowMut ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "civicinfo.elections.voterInfoQuery", + dlg.begin(MethodInfo { id: "civicinfo.elections.voterInfoQuery", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("address", self._address.to_string())); @@ -1370,7 +1371,7 @@ impl<'a, C, A> ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1391,7 +1392,7 @@ impl<'a, C, A> ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1401,10 +1402,10 @@ impl<'a, C, A> ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut ElectionVoterInfoQueryCall<'a, C, A> { self._address = new_value.to_string(); @@ -1469,12 +1470,12 @@ impl<'a, C, A> ElectionVoterInfoQueryCall<'a, C, A> where C: BorrowMut RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: B Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "civicinfo.representatives.representativeInfoByAddress", + dlg.begin(MethodInfo { id: "civicinfo.representatives.representativeInfoByAddress", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._roles.len() > 0 { @@ -1602,7 +1603,7 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: B } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1623,7 +1624,7 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: B match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1633,10 +1634,10 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: B if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1707,12 +1708,12 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByAddresCall<'a, C, A> where C: B } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1790,7 +1791,7 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> where C: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "civicinfo.representatives.representativeInfoByDivision", + dlg.begin(MethodInfo { id: "civicinfo.representatives.representativeInfoByDivision", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("ocdId", self._ocd_id.to_string())); @@ -1858,7 +1859,7 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> where C: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1879,7 +1880,7 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> where C: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1889,10 +1890,10 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> where C: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1925,7 +1926,7 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> where C: /// /// Sets the *ocd id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ocd_id(mut self, new_value: &str) -> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> { self._ocd_id = new_value.to_string(); @@ -1966,12 +1967,12 @@ impl<'a, C, A> RepresentativeRepresentativeInfoByDivisionCall<'a, C, A> where C: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/classroom1-cli/Cargo.toml b/gen/classroom1-cli/Cargo.toml index 7dfc4a22af..c2c0af7869 100644 --- a/gen/classroom1-cli/Cargo.toml +++ b/gen/classroom1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-classroom1-cli" -version = "0.3.2+20151013" +version = "0.3.3+20151013" authors = ["Sebastian Thiel "] description = "A complete library to interact with classroom (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/classroom1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/classroom1-cli/LICENSE.md b/gen/classroom1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/classroom1-cli/LICENSE.md +++ b/gen/classroom1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/classroom1-cli/README.md b/gen/classroom1-cli/README.md index dddaa48178..e94b88507d 100644 --- a/gen/classroom1-cli/README.md +++ b/gen/classroom1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *classroom* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/classroom1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/classroom1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/classroom1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/classroom1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/classroom1-cli). # Usage -This documentation was generated from the *classroom* API at revision *20151013*. The CLI is at version *0.3.2*. +This documentation was generated from the *classroom* API at revision *20151013*. The CLI is at version *0.3.3*. ```bash classroom1 [options] @@ -58,18 +58,18 @@ classroom1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/classroom1-cli/mkdocs.yml b/gen/classroom1-cli/mkdocs.yml index 22471e0cee..bf534273ec 100644 --- a/gen/classroom1-cli/mkdocs.yml +++ b/gen/classroom1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: classroom v0.3.2+20151013 +site_name: classroom v0.3.3+20151013 site_url: http://byron.github.io/google-apis-rs/google-classroom1-cli site_description: Write integrating applications with bcore @@ -35,5 +35,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/classroom1-cli/src/main.rs b/gen/classroom1-cli/src/main.rs index c89a4f56b6..939c9a4fb0 100644 --- a/gen/classroom1-cli/src/main.rs +++ b/gen/classroom1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Classroom>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _courses_aliases_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _courses_aliases_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "alias" => Some(("alias", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -81,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CourseAlias = json::value::from_value(object).unwrap(); let mut call = self.hub.courses().aliases_create(request, opt.value_of("course-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -94,7 +94,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -107,7 +107,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -130,10 +130,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_aliases_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_aliases_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().aliases_delete(opt.value_of("course-id").unwrap_or(""), opt.value_of("alias").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -146,7 +146,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -159,7 +159,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -182,10 +182,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_aliases_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_aliases_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().aliases_list(opt.value_of("course-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -204,7 +204,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -218,7 +218,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -241,13 +241,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -261,8 +261,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -288,7 +288,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Course = json::value::from_value(object).unwrap(); let mut call = self.hub.courses().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -301,7 +301,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -314,7 +314,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -337,10 +337,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -353,7 +353,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -366,7 +366,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -389,10 +389,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -405,7 +405,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -418,7 +418,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -441,10 +441,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "teacher-id" => { @@ -469,7 +469,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["teacher-id", "page-token", "student-id", "page-size"].iter().map(|v|*v)); @@ -483,7 +483,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -506,13 +506,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -526,8 +526,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -553,7 +553,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Course = json::value::from_value(object).unwrap(); let mut call = self.hub.courses().patch(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "update-mask" => { @@ -569,7 +569,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["update-mask"].iter().map(|v|*v)); @@ -583,7 +583,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -606,13 +606,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_students_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_students_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -626,8 +626,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "course-id" => Some(("courseId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.email-address" => Some(("profile.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -649,7 +649,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Student = json::value::from_value(object).unwrap(); let mut call = self.hub.courses().students_create(request, opt.value_of("course-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "enrollment-code" => { @@ -665,7 +665,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["enrollment-code"].iter().map(|v|*v)); @@ -679,7 +679,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -702,10 +702,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_students_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_students_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().students_delete(opt.value_of("course-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -718,7 +718,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -731,7 +731,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -754,10 +754,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_students_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_students_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().students_get(opt.value_of("course-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -770,7 +770,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -783,7 +783,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -806,10 +806,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_students_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_students_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().students_list(opt.value_of("course-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -828,7 +828,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -842,7 +842,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -865,13 +865,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_teachers_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_teachers_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -885,8 +885,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "course-id" => Some(("courseId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "profile.email-address" => Some(("profile.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -908,7 +908,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Teacher = json::value::from_value(object).unwrap(); let mut call = self.hub.courses().teachers_create(request, opt.value_of("course-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -921,7 +921,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -934,7 +934,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -957,10 +957,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_teachers_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_teachers_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().teachers_delete(opt.value_of("course-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -973,7 +973,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -986,7 +986,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1009,10 +1009,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_teachers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_teachers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().teachers_get(opt.value_of("course-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1025,7 +1025,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1038,7 +1038,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1061,10 +1061,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_teachers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_teachers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.courses().teachers_list(opt.value_of("course-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1083,7 +1083,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -1097,7 +1097,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1120,13 +1120,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _courses_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _courses_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1140,8 +1140,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1167,7 +1167,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Course = json::value::from_value(object).unwrap(); let mut call = self.hub.courses().update(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1180,7 +1180,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1193,7 +1193,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1216,10 +1216,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _invitations_accept(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _invitations_accept(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.invitations().accept(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1232,7 +1232,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1245,7 +1245,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1268,13 +1268,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _invitations_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _invitations_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1288,8 +1288,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "course-id" => Some(("courseId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "role" => Some(("role", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1307,7 +1307,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Invitation = json::value::from_value(object).unwrap(); let mut call = self.hub.invitations().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1320,7 +1320,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1333,7 +1333,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1356,10 +1356,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _invitations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _invitations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.invitations().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1372,7 +1372,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1385,7 +1385,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1408,10 +1408,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _invitations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _invitations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.invitations().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1424,7 +1424,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1437,7 +1437,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1460,10 +1460,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _invitations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _invitations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.invitations().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-id" => { @@ -1488,7 +1488,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["course-id", "page-token", "user-id", "page-size"].iter().map(|v|*v)); @@ -1502,7 +1502,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1525,10 +1525,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_profiles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_profiles().get(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1541,7 +1541,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1554,7 +1554,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1692,14 +1692,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "classroom1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "classroom1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1719,7 +1719,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1762,7 +1762,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("courses", "methods: 'aliases-create', 'aliases-delete', 'aliases-list', 'create', 'delete', 'get', 'list', 'patch', 'students-create', 'students-delete', 'students-get', 'students-list', 'teachers-create', 'teachers-delete', 'teachers-get', 'teachers-list' and 'update'", vec![ - ("aliases-create", + ("aliases-create", Some(r##"Creates an alias for a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create the alias or for access errors. * `NOT_FOUND` if the course does not exist. * `ALREADY_EXISTS` if the alias already exists."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_aliases-create", vec![ @@ -1790,7 +1790,7 @@ fn main() { Some(false), Some(false)), ]), - ("aliases-delete", + ("aliases-delete", Some(r##"Deletes an alias of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to remove the alias or for access errors. * `NOT_FOUND` if the alias does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_aliases-delete", vec![ @@ -1818,7 +1818,7 @@ fn main() { Some(false), Some(false)), ]), - ("aliases-list", + ("aliases-list", Some(r##"Returns a list of aliases for a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the course or for access errors. * `NOT_FOUND` if the course does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_aliases-list", vec![ @@ -1840,7 +1840,7 @@ fn main() { Some(false), Some(false)), ]), - ("create", + ("create", Some(r##"Creates a course. The user specified in `ownerId` is the owner of the created course and added as a teacher. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create courses or for access errors. * `NOT_FOUND` if the primary teacher is not a valid user. * `FAILED_PRECONDITION` if the course owner's account is disabled or for the following request errors: * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if an alias was specified in the `id` and already exists."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_create", vec![ @@ -1862,7 +1862,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_delete", vec![ @@ -1884,7 +1884,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_get", vec![ @@ -1906,7 +1906,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of courses that the requesting user is permitted to view, restricted to those that match the request. This method returns the following error codes: * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the query argument is malformed. * `NOT_FOUND` if any users specified in the query arguments do not exist."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_list", vec![ @@ -1922,7 +1922,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates one or more fields in a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to modify the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID. * `INVALID_ARGUMENT` if invalid fields are specified in the update mask or if no update mask is supplied. * `FAILED_PRECONDITION` for the following request errors: * CourseNotModifiable"##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_patch", vec![ @@ -1950,7 +1950,7 @@ fn main() { Some(false), Some(false)), ]), - ("students-create", + ("students-create", Some(r##"Adds a user as a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create students in this course or for access errors. * `NOT_FOUND` if the requested course ID does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled, for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is already a student or teacher in the course."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_students-create", vec![ @@ -1978,7 +1978,7 @@ fn main() { Some(false), Some(false)), ]), - ("students-delete", + ("students-delete", Some(r##"Deletes a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete students of this course or for access errors. * `NOT_FOUND` if no student of this course has the requested ID or if the course does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_students-delete", vec![ @@ -2006,7 +2006,7 @@ fn main() { Some(false), Some(false)), ]), - ("students-get", + ("students-get", Some(r##"Returns a student of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view students of this course or for access errors. * `NOT_FOUND` if no student of this course has the requested ID or if the course does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_students-get", vec![ @@ -2034,7 +2034,7 @@ fn main() { Some(false), Some(false)), ]), - ("students-list", + ("students-list", Some(r##"Returns a list of students of this course that the requester is permitted to view. This method returns the following error codes: * `NOT_FOUND` if the course does not exist. * `PERMISSION_DENIED` for access errors."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_students-list", vec![ @@ -2056,7 +2056,7 @@ fn main() { Some(false), Some(false)), ]), - ("teachers-create", + ("teachers-create", Some(r##"Creates a teacher of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create teachers in this course or for access errors. * `NOT_FOUND` if the requested course ID does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled, for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * CourseTeacherLimitReached * UserGroupsMembershipLimitReached * `ALREADY_EXISTS` if the user is already a teacher or student in the course."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_teachers-create", vec![ @@ -2084,7 +2084,7 @@ fn main() { Some(false), Some(false)), ]), - ("teachers-delete", + ("teachers-delete", Some(r##"Deletes a teacher of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete teachers of this course or for access errors. * `NOT_FOUND` if no teacher of this course has the requested ID or if the course does not exist. * `FAILED_PRECONDITION` if the requested ID belongs to the primary teacher of this course."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_teachers-delete", vec![ @@ -2112,7 +2112,7 @@ fn main() { Some(false), Some(false)), ]), - ("teachers-get", + ("teachers-get", Some(r##"Returns a teacher of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view teachers of this course or for access errors. * `NOT_FOUND` if no teacher of this course has the requested ID or if the course does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_teachers-get", vec![ @@ -2140,7 +2140,7 @@ fn main() { Some(false), Some(false)), ]), - ("teachers-list", + ("teachers-list", Some(r##"Returns a list of teachers of this course that the requester is permitted to view. This method returns the following error codes: * `NOT_FOUND` if the course does not exist. * `PERMISSION_DENIED` for access errors."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_teachers-list", vec![ @@ -2162,7 +2162,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to modify the requested course or for access errors. * `NOT_FOUND` if no course exists with the requested ID. * `FAILED_PRECONDITION` for the following request errors: * CourseNotModifiable"##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/courses_update", vec![ @@ -2193,7 +2193,7 @@ fn main() { ]), ("invitations", "methods: 'accept', 'create', 'delete', 'get' and 'list'", vec![ - ("accept", + ("accept", Some(r##"Accepts an invitation, removing it and adding the invited user to the teachers or students (as appropriate) of the specified course. Only the invited user may accept an invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to accept the requested invitation or for access errors. * `FAILED_PRECONDITION` for the following request errors: * CourseMemberLimitReached * CourseNotModifiable * CourseTeacherLimitReached * UserGroupsMembershipLimitReached * `NOT_FOUND` if no invitation exists with the requested ID."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/invitations_accept", vec![ @@ -2215,7 +2215,7 @@ fn main() { Some(false), Some(false)), ]), - ("create", + ("create", Some(r##"Creates an invitation. Only one invitation for a user and course may exist at a time. Delete and re-create an invitation to make changes. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create invitations for this course or for access errors. * `NOT_FOUND` if the course or the user does not exist. * `FAILED_PRECONDITION` if the requested user's account is disabled or if the user already has this role or a role with greater permissions. * `ALREADY_EXISTS` if an invitation for the specified user and course already exists."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/invitations_create", vec![ @@ -2237,7 +2237,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes an invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to delete the requested invitation or for access errors. * `NOT_FOUND` if no invitation exists with the requested ID."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/invitations_delete", vec![ @@ -2259,7 +2259,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns an invitation. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to view the requested invitation or for access errors. * `NOT_FOUND` if no invitation exists with the requested ID."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/invitations_get", vec![ @@ -2281,7 +2281,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of invitations that the requesting user is permitted to view, restricted to those that match the list request. *Note:* At least one of `user_id` or `course_id` must be supplied. Both fields can be supplied. This method returns the following error codes: * `PERMISSION_DENIED` for access errors."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/invitations_list", vec![ @@ -2300,7 +2300,7 @@ fn main() { ]), ("user-profiles", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Returns a user profile. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access this user profile or if no profile exists with the requested ID or for access errors."##), "Details at http://byron.github.io/google-apis-rs/google_classroom1_cli/user-profiles_get", vec![ @@ -2328,7 +2328,7 @@ fn main() { let mut app = App::new("classroom1") .author("Sebastian Thiel ") - .version("0.3.2+20151013") + .version("0.3.3+20151013") .about("Google Classroom API") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_classroom1_cli") .arg(Arg::with_name("url") @@ -2352,7 +2352,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -2363,7 +2363,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/classroom1/Cargo.toml b/gen/classroom1/Cargo.toml index 4bccbe92c1..8073112d6a 100644 --- a/gen/classroom1/Cargo.toml +++ b/gen/classroom1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-classroom1" -version = "0.1.10+20151013" +version = "0.1.11+20151013" authors = ["Sebastian Thiel "] description = "A complete library to interact with classroom (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/classroom1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/classroom1/LICENSE.md b/gen/classroom1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/classroom1/LICENSE.md +++ b/gen/classroom1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/classroom1/README.md b/gen/classroom1/README.md index 3a84ffec76..63ed99e974 100644 --- a/gen/classroom1/README.md +++ b/gen/classroom1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-classroom1` library allows access to all features of the *Google classroom* service. -This documentation was generated from *classroom* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *classroom* crate version *0.1.11+20151013*, where *20151013* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *classroom* *v1* API can be found at the [official documentation site](https://developers.google.com/classroom/). diff --git a/gen/classroom1/src/cmn.rs b/gen/classroom1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/classroom1/src/cmn.rs +++ b/gen/classroom1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/classroom1/src/lib.rs b/gen/classroom1/src/lib.rs index ce8b373014..8363fb6e9a 100644 --- a/gen/classroom1/src/lib.rs +++ b/gen/classroom1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *classroom* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *classroom* crate version *0.1.11+20151013*, where *20151013* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *classroom* *v1* API can be found at the //! [official documentation site](https://developers.google.com/classroom/). diff --git a/gen/classroom1/src/lib.rs.in b/gen/classroom1/src/lib.rs.in index fc305f496f..0927ade466 100644 --- a/gen/classroom1/src/lib.rs.in +++ b/gen/classroom1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -150,7 +151,7 @@ impl<'a, C, A> Classroom Classroom { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -165,7 +166,7 @@ impl<'a, C, A> Classroom } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1143,7 +1144,7 @@ impl<'a, C, A> CourseTeacherListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.teachers.list", + dlg.begin(MethodInfo { id: "classroom.courses.teachers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -1191,7 +1192,7 @@ impl<'a, C, A> CourseTeacherListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1227,7 +1228,7 @@ impl<'a, C, A> CourseTeacherListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1237,10 +1238,10 @@ impl<'a, C, A> CourseTeacherListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1273,7 +1274,7 @@ impl<'a, C, A> CourseTeacherListCall<'a, C, A> where C: BorrowMut /// /// Sets the *course id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn course_id(mut self, new_value: &str) -> CourseTeacherListCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -1305,12 +1306,12 @@ impl<'a, C, A> CourseTeacherListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1333,17 +1334,17 @@ impl<'a, C, A> CourseTeacherListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::RosterReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CourseTeacherListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseTeacherListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1405,7 +1406,7 @@ impl<'a, C, A> CourseGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.get", + dlg.begin(MethodInfo { id: "classroom.courses.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -1447,7 +1448,7 @@ impl<'a, C, A> CourseGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1483,7 +1484,7 @@ impl<'a, C, A> CourseGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1493,10 +1494,10 @@ impl<'a, C, A> CourseGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1529,7 +1530,7 @@ impl<'a, C, A> CourseGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CourseGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -1547,12 +1548,12 @@ impl<'a, C, A> CourseGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1575,17 +1576,17 @@ impl<'a, C, A> CourseGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CourseReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CourseGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1648,7 +1649,7 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.students.delete", + dlg.begin(MethodInfo { id: "classroom.courses.students.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -1691,7 +1692,7 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1727,7 +1728,7 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1737,10 +1738,10 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -1783,7 +1784,7 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -1801,12 +1802,12 @@ impl<'a, C, A> CourseStudentDeleteCall<'a, C, A> where C: BorrowMut CourseStudentDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CourseStudentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseStudentDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1902,7 +1903,7 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.teachers.get", + dlg.begin(MethodInfo { id: "classroom.courses.teachers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -1945,7 +1946,7 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1981,7 +1982,7 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1991,10 +1992,10 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2027,7 +2028,7 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *course id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn course_id(mut self, new_value: &str) -> CourseTeacherGetCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -2037,7 +2038,7 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> CourseTeacherGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2055,12 +2056,12 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2083,17 +2084,17 @@ impl<'a, C, A> CourseTeacherGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::RosterReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CourseTeacherGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseTeacherGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2159,7 +2160,7 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.aliases.list", + dlg.begin(MethodInfo { id: "classroom.courses.aliases.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -2207,7 +2208,7 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2243,7 +2244,7 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2253,10 +2254,10 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2289,7 +2290,7 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *course id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn course_id(mut self, new_value: &str) -> CourseAliaseListCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -2321,12 +2322,12 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2349,17 +2350,17 @@ impl<'a, C, A> CourseAliaseListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CourseReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CourseAliaseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseAliaseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2428,7 +2429,7 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.update", + dlg.begin(MethodInfo { id: "classroom.courses.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -2470,14 +2471,14 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2521,7 +2522,7 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2531,10 +2532,10 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2566,7 +2567,7 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Course) -> CourseUpdateCall<'a, C, A> { self._request = new_value; @@ -2576,7 +2577,7 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CourseUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -2594,12 +2595,12 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2622,17 +2623,17 @@ impl<'a, C, A> CourseUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Course`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CourseUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2701,7 +2702,7 @@ impl<'a, C, A> CourseAliaseCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.aliases.create", + dlg.begin(MethodInfo { id: "classroom.courses.aliases.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -2743,14 +2744,14 @@ impl<'a, C, A> CourseAliaseCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2794,7 +2795,7 @@ impl<'a, C, A> CourseAliaseCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2804,10 +2805,10 @@ impl<'a, C, A> CourseAliaseCreateCall<'a, C, A> where C: BorrowMut CourseAliaseCreateCall<'a, C, A> where C: BorrowMut CourseAliaseCreateCall<'a, C, A> { self._request = new_value; @@ -2849,7 +2850,7 @@ impl<'a, C, A> CourseAliaseCreateCall<'a, C, A> where C: BorrowMut CourseAliaseCreateCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -2867,12 +2868,12 @@ impl<'a, C, A> CourseAliaseCreateCall<'a, C, A> where C: BorrowMut CourseAliaseCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CourseAliaseCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseAliaseCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2974,7 +2975,7 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.list", + dlg.begin(MethodInfo { id: "classroom.courses.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if let Some(value) = self._teacher_id { @@ -3006,7 +3007,7 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa self._scopes.insert(Scope::CourseReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3042,7 +3043,7 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3052,10 +3053,10 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3124,12 +3125,12 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3152,17 +3153,17 @@ impl<'a, C, A> CourseListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CourseReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CourseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3233,7 +3234,7 @@ impl<'a, C, A> CourseStudentCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.students.create", + dlg.begin(MethodInfo { id: "classroom.courses.students.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -3278,14 +3279,14 @@ impl<'a, C, A> CourseStudentCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3329,7 +3330,7 @@ impl<'a, C, A> CourseStudentCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3339,10 +3340,10 @@ impl<'a, C, A> CourseStudentCreateCall<'a, C, A> where C: BorrowMut CourseStudentCreateCall<'a, C, A> where C: BorrowMut CourseStudentCreateCall<'a, C, A> { self._request = new_value; @@ -3384,7 +3385,7 @@ impl<'a, C, A> CourseStudentCreateCall<'a, C, A> where C: BorrowMut CourseStudentCreateCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -3409,12 +3410,12 @@ impl<'a, C, A> CourseStudentCreateCall<'a, C, A> where C: BorrowMut CourseStudentCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CourseStudentCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseStudentCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3510,7 +3511,7 @@ impl<'a, C, A> CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.aliases.delete", + dlg.begin(MethodInfo { id: "classroom.courses.aliases.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -3553,7 +3554,7 @@ impl<'a, C, A> CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3589,7 +3590,7 @@ impl<'a, C, A> CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3599,10 +3600,10 @@ impl<'a, C, A> CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut CourseAliaseDeleteCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -3645,7 +3646,7 @@ impl<'a, C, A> CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut CourseAliaseDeleteCall<'a, C, A> { self._alias = new_value.to_string(); @@ -3663,12 +3664,12 @@ impl<'a, C, A> CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut CourseAliaseDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CourseAliaseDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseAliaseDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3769,7 +3770,7 @@ impl<'a, C, A> CourseCreateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.create", + dlg.begin(MethodInfo { id: "classroom.courses.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3789,14 +3790,14 @@ impl<'a, C, A> CourseCreateCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Course.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3840,7 +3841,7 @@ impl<'a, C, A> CourseCreateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3850,10 +3851,10 @@ impl<'a, C, A> CourseCreateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3885,7 +3886,7 @@ impl<'a, C, A> CourseCreateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Course) -> CourseCreateCall<'a, C, A> { self._request = new_value; @@ -3903,12 +3904,12 @@ impl<'a, C, A> CourseCreateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3931,17 +3932,17 @@ impl<'a, C, A> CourseCreateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Course`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CourseCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4007,7 +4008,7 @@ impl<'a, C, A> CourseStudentListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.students.list", + dlg.begin(MethodInfo { id: "classroom.courses.students.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -4055,7 +4056,7 @@ impl<'a, C, A> CourseStudentListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4091,7 +4092,7 @@ impl<'a, C, A> CourseStudentListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4101,10 +4102,10 @@ impl<'a, C, A> CourseStudentListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4137,7 +4138,7 @@ impl<'a, C, A> CourseStudentListCall<'a, C, A> where C: BorrowMut /// /// Sets the *course id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn course_id(mut self, new_value: &str) -> CourseStudentListCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -4169,12 +4170,12 @@ impl<'a, C, A> CourseStudentListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4197,17 +4198,17 @@ impl<'a, C, A> CourseStudentListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::RosterReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CourseStudentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseStudentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4269,7 +4270,7 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.delete", + dlg.begin(MethodInfo { id: "classroom.courses.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -4311,7 +4312,7 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4347,7 +4348,7 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4357,10 +4358,10 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4393,7 +4394,7 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CourseDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -4411,12 +4412,12 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4439,17 +4440,17 @@ impl<'a, C, A> CourseDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Course`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CourseDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4520,7 +4521,7 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.patch", + dlg.begin(MethodInfo { id: "classroom.courses.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -4565,14 +4566,14 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4616,7 +4617,7 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4626,10 +4627,10 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4661,7 +4662,7 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Course) -> CoursePatchCall<'a, C, A> { self._request = new_value; @@ -4671,7 +4672,7 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CoursePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -4696,12 +4697,12 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4724,17 +4725,17 @@ impl<'a, C, A> CoursePatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Course`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CoursePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CoursePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4797,7 +4798,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.students.get", + dlg.begin(MethodInfo { id: "classroom.courses.students.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -4840,7 +4841,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4876,7 +4877,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4886,10 +4887,10 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4922,7 +4923,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *course id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn course_id(mut self, new_value: &str) -> CourseStudentGetCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -4932,7 +4933,7 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> CourseStudentGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4950,12 +4951,12 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4978,17 +4979,17 @@ impl<'a, C, A> CourseStudentGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::RosterReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CourseStudentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseStudentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5051,7 +5052,7 @@ impl<'a, C, A> CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.teachers.delete", + dlg.begin(MethodInfo { id: "classroom.courses.teachers.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -5094,7 +5095,7 @@ impl<'a, C, A> CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5130,7 +5131,7 @@ impl<'a, C, A> CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5140,10 +5141,10 @@ impl<'a, C, A> CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut CourseTeacherDeleteCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -5186,7 +5187,7 @@ impl<'a, C, A> CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut CourseTeacherDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5204,12 +5205,12 @@ impl<'a, C, A> CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut CourseTeacherDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CourseTeacherDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseTeacherDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5311,7 +5312,7 @@ impl<'a, C, A> CourseTeacherCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.courses.teachers.create", + dlg.begin(MethodInfo { id: "classroom.courses.teachers.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("courseId", self._course_id.to_string())); @@ -5353,14 +5354,14 @@ impl<'a, C, A> CourseTeacherCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5404,7 +5405,7 @@ impl<'a, C, A> CourseTeacherCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5414,10 +5415,10 @@ impl<'a, C, A> CourseTeacherCreateCall<'a, C, A> where C: BorrowMut CourseTeacherCreateCall<'a, C, A> where C: BorrowMut CourseTeacherCreateCall<'a, C, A> { self._request = new_value; @@ -5459,7 +5460,7 @@ impl<'a, C, A> CourseTeacherCreateCall<'a, C, A> where C: BorrowMut CourseTeacherCreateCall<'a, C, A> { self._course_id = new_value.to_string(); @@ -5477,12 +5478,12 @@ impl<'a, C, A> CourseTeacherCreateCall<'a, C, A> where C: BorrowMut CourseTeacherCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CourseTeacherCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CourseTeacherCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5577,7 +5578,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.userProfiles.get", + dlg.begin(MethodInfo { id: "classroom.userProfiles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -5619,7 +5620,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5655,7 +5656,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5665,10 +5666,10 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5701,7 +5702,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserProfileGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5719,12 +5720,12 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -5747,17 +5748,17 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::RosterReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserProfileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserProfileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5819,7 +5820,7 @@ impl<'a, C, A> InvitationDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.invitations.delete", + dlg.begin(MethodInfo { id: "classroom.invitations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -5861,7 +5862,7 @@ impl<'a, C, A> InvitationDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5897,7 +5898,7 @@ impl<'a, C, A> InvitationDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5907,10 +5908,10 @@ impl<'a, C, A> InvitationDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5943,7 +5944,7 @@ impl<'a, C, A> InvitationDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> InvitationDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -5961,12 +5962,12 @@ impl<'a, C, A> InvitationDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -5989,17 +5990,17 @@ impl<'a, C, A> InvitationDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Roster`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InvitationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InvitationDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6067,7 +6068,7 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.invitations.create", + dlg.begin(MethodInfo { id: "classroom.invitations.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -6087,14 +6088,14 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Roster.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6138,7 +6139,7 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6148,10 +6149,10 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6183,7 +6184,7 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Invitation) -> InvitationCreateCall<'a, C, A> { self._request = new_value; @@ -6201,12 +6202,12 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -6229,17 +6230,17 @@ impl<'a, C, A> InvitationCreateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Roster`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InvitationCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InvitationCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6308,7 +6309,7 @@ impl<'a, C, A> InvitationListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.invitations.list", + dlg.begin(MethodInfo { id: "classroom.invitations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if let Some(value) = self._user_id { @@ -6340,7 +6341,7 @@ impl<'a, C, A> InvitationListCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::RosterReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6376,7 +6377,7 @@ impl<'a, C, A> InvitationListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6386,10 +6387,10 @@ impl<'a, C, A> InvitationListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6458,12 +6459,12 @@ impl<'a, C, A> InvitationListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -6486,17 +6487,17 @@ impl<'a, C, A> InvitationListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::RosterReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InvitationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InvitationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6558,7 +6559,7 @@ impl<'a, C, A> InvitationGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.invitations.get", + dlg.begin(MethodInfo { id: "classroom.invitations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -6600,7 +6601,7 @@ impl<'a, C, A> InvitationGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6636,7 +6637,7 @@ impl<'a, C, A> InvitationGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6646,10 +6647,10 @@ impl<'a, C, A> InvitationGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6682,7 +6683,7 @@ impl<'a, C, A> InvitationGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> InvitationGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -6700,12 +6701,12 @@ impl<'a, C, A> InvitationGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -6728,17 +6729,17 @@ impl<'a, C, A> InvitationGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::RosterReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InvitationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InvitationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6800,7 +6801,7 @@ impl<'a, C, A> InvitationAcceptCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "classroom.invitations.accept", + dlg.begin(MethodInfo { id: "classroom.invitations.accept", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -6842,7 +6843,7 @@ impl<'a, C, A> InvitationAcceptCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6878,7 +6879,7 @@ impl<'a, C, A> InvitationAcceptCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6888,10 +6889,10 @@ impl<'a, C, A> InvitationAcceptCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6924,7 +6925,7 @@ impl<'a, C, A> InvitationAcceptCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> InvitationAcceptCall<'a, C, A> { self._id = new_value.to_string(); @@ -6942,12 +6943,12 @@ impl<'a, C, A> InvitationAcceptCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -6970,17 +6971,17 @@ impl<'a, C, A> InvitationAcceptCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Roster`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InvitationAcceptCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InvitationAcceptCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/cloudbilling1-cli/Cargo.toml b/gen/cloudbilling1-cli/Cargo.toml index be087bb34f..46ac6ad12e 100644 --- a/gen/cloudbilling1-cli/Cargo.toml +++ b/gen/cloudbilling1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudbilling1-cli" -version = "0.3.2+20150903" +version = "0.3.3+20151222" authors = ["Sebastian Thiel "] description = "A complete library to interact with cloudbilling (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudbilling1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/cloudbilling1-cli/LICENSE.md b/gen/cloudbilling1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudbilling1-cli/LICENSE.md +++ b/gen/cloudbilling1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/cloudbilling1-cli/README.md b/gen/cloudbilling1-cli/README.md index 96a0c71dc9..1cde08b13f 100644 --- a/gen/cloudbilling1-cli/README.md +++ b/gen/cloudbilling1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *cloudbilling* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/cloudbilling1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/cloudbilling1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/cloudbilling1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/cloudbilling1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudbilling1-cli). # Usage -This documentation was generated from the *cloudbilling* API at revision *20150903*. The CLI is at version *0.3.2*. +This documentation was generated from the *cloudbilling* API at revision *20151222*. The CLI is at version *0.3.3*. ```bash cloudbilling1 [options] @@ -39,18 +39,18 @@ cloudbilling1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/cloudbilling1-cli/mkdocs.yml b/gen/cloudbilling1-cli/mkdocs.yml index 0dd4bce2d5..c6bd4438e1 100644 --- a/gen/cloudbilling1-cli/mkdocs.yml +++ b/gen/cloudbilling1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: cloudbilling v0.3.2+20150903 +site_name: cloudbilling v0.3.3+20151222 site_url: http://byron.github.io/google-apis-rs/google-cloudbilling1-cli site_description: Write integrating applications with bcore @@ -17,5 +17,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/cloudbilling1-cli/src/main.rs b/gen/cloudbilling1-cli/src/main.rs index f748ea7057..871c9029ed 100644 --- a/gen/cloudbilling1-cli/src/main.rs +++ b/gen/cloudbilling1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Cloudbilling>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _billing_accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _billing_accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.billing_accounts().get(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _billing_accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _billing_accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.billing_accounts().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -119,7 +119,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -133,7 +133,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -156,10 +156,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _billing_accounts_projects_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _billing_accounts_projects_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.billing_accounts().projects_list(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -178,7 +178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -192,7 +192,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -215,10 +215,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_get_billing_info(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_get_billing_info(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().get_billing_info(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -231,7 +231,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -244,7 +244,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -267,13 +267,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_update_billing_info(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_update_billing_info(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -287,8 +287,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -306,7 +306,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ProjectBillingInfo = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().update_billing_info(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -319,7 +319,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -332,7 +332,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -408,14 +408,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "cloudbilling1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "cloudbilling1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -435,7 +435,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -478,7 +478,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("billing-accounts", "methods: 'get', 'list' and 'projects-list'", vec![ - ("get", + ("get", Some(r##"Gets information about a billing account. The current authenticated user must be an [owner of the billing account](https://support.google.com/cloud/answer/4430947)."##), "Details at http://byron.github.io/google-apis-rs/google_cloudbilling1_cli/billing-accounts_get", vec![ @@ -500,7 +500,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the billing accounts that the current authenticated user [owns](https://support.google.com/cloud/answer/4430947)."##), "Details at http://byron.github.io/google-apis-rs/google_cloudbilling1_cli/billing-accounts_list", vec![ @@ -516,7 +516,7 @@ fn main() { Some(false), Some(false)), ]), - ("projects-list", + ("projects-list", Some(r##"Lists the projects associated with a billing account. The current authenticated user must be an [owner of the billing account](https://support.google.com/cloud/answer/4430947)."##), "Details at http://byron.github.io/google-apis-rs/google_cloudbilling1_cli/billing-accounts_projects-list", vec![ @@ -541,7 +541,7 @@ fn main() { ]), ("projects", "methods: 'get-billing-info' and 'update-billing-info'", vec![ - ("get-billing-info", + ("get-billing-info", Some(r##"Gets the billing information for a project. The current authenticated user must have [permission to view the project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo )."##), "Details at http://byron.github.io/google-apis-rs/google_cloudbilling1_cli/projects_get-billing-info", vec![ @@ -563,7 +563,7 @@ fn main() { Some(false), Some(false)), ]), - ("update-billing-info", + ("update-billing-info", Some(r##"Sets or updates the billing account associated with a project. You specify the new billing account by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges. *Note:* Incurred charges that have not yet been reported in the transaction history of the Google Developers Console may be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project. The current authenticated user must have ownership privileges for both the [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing account](https://support.google.com/cloud/answer/4430947). You can disable billing on the project by setting the `billing_account_name` field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project. Note that associating a project with a *closed* billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an *open* billing account."##), "Details at http://byron.github.io/google-apis-rs/google_cloudbilling1_cli/projects_update-billing-info", vec![ @@ -597,7 +597,7 @@ fn main() { let mut app = App::new("cloudbilling1") .author("Sebastian Thiel ") - .version("0.3.2+20150903") + .version("0.3.3+20151222") .about("Retrieves Google Developers Console billing accounts and associates them with projects.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudbilling1_cli") .arg(Arg::with_name("url") @@ -621,7 +621,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -632,7 +632,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/cloudbilling1/Cargo.toml b/gen/cloudbilling1/Cargo.toml index 7fa3ac05fc..b35dccd27e 100644 --- a/gen/cloudbilling1/Cargo.toml +++ b/gen/cloudbilling1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudbilling1" -version = "0.1.10+20150903" +version = "0.1.11+20151222" authors = ["Sebastian Thiel "] description = "A complete library to interact with cloudbilling (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudbilling1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/cloudbilling1/LICENSE.md b/gen/cloudbilling1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudbilling1/LICENSE.md +++ b/gen/cloudbilling1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/cloudbilling1/README.md b/gen/cloudbilling1/README.md index ade4342216..9f284763cf 100644 --- a/gen/cloudbilling1/README.md +++ b/gen/cloudbilling1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-cloudbilling1` library allows access to all features of the *Google cloudbilling* service. -This documentation was generated from *cloudbilling* crate version *0.1.10+20150903*, where *20150903* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *cloudbilling* crate version *0.1.11+20151222*, where *20151222* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *cloudbilling* *v1* API can be found at the [official documentation site](https://cloud.google.com/billing/). diff --git a/gen/cloudbilling1/src/cmn.rs b/gen/cloudbilling1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/cloudbilling1/src/cmn.rs +++ b/gen/cloudbilling1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/cloudbilling1/src/lib.rs b/gen/cloudbilling1/src/lib.rs index 56a17cea37..f4b4c34eb4 100644 --- a/gen/cloudbilling1/src/lib.rs +++ b/gen/cloudbilling1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *cloudbilling* crate version *0.1.10+20150903*, where *20150903* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *cloudbilling* crate version *0.1.11+20151222*, where *20151222* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *cloudbilling* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/billing/). diff --git a/gen/cloudbilling1/src/lib.rs.in b/gen/cloudbilling1/src/lib.rs.in index f71fe9b497..f67ab4e194 100644 --- a/gen/cloudbilling1/src/lib.rs.in +++ b/gen/cloudbilling1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -128,7 +129,7 @@ impl<'a, C, A> Cloudbilling Cloudbilling { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -140,7 +141,7 @@ impl<'a, C, A> Cloudbilling } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -487,7 +488,7 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudbilling.billingAccounts.get", + dlg.begin(MethodInfo { id: "cloudbilling.billingAccounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -532,7 +533,7 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -568,7 +569,7 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -578,10 +579,10 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -614,7 +615,7 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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) -> BillingAccountGetCall<'a, C, A> { self._name = new_value.to_string(); @@ -632,12 +633,12 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -660,17 +661,17 @@ impl<'a, C, A> BillingAccountGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BillingAccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BillingAccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -735,7 +736,7 @@ impl<'a, C, A> BillingAccountListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudbilling.billingAccounts.list", + dlg.begin(MethodInfo { id: "cloudbilling.billingAccounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -761,7 +762,7 @@ impl<'a, C, A> BillingAccountListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -797,7 +798,7 @@ impl<'a, C, A> BillingAccountListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -807,10 +808,10 @@ impl<'a, C, A> BillingAccountListCall<'a, C, A> where C: BorrowMut BillingAccountListCall<'a, C, A> where C: BorrowMut BillingAccountListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BillingAccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BillingAccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -970,7 +971,7 @@ impl<'a, C, A> BillingAccountProjectListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudbilling.billingAccounts.projects.list", + dlg.begin(MethodInfo { id: "cloudbilling.billingAccounts.projects.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -1021,7 +1022,7 @@ impl<'a, C, A> BillingAccountProjectListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1057,7 +1058,7 @@ impl<'a, C, A> BillingAccountProjectListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1067,10 +1068,10 @@ impl<'a, C, A> BillingAccountProjectListCall<'a, C, A> where C: BorrowMut BillingAccountProjectListCall<'a, C, A> where C: BorrowMut BillingAccountProjectListCall<'a, C, A> { self._name = new_value.to_string(); @@ -1135,12 +1136,12 @@ impl<'a, C, A> BillingAccountProjectListCall<'a, C, A> where C: BorrowMut BillingAccountProjectListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BillingAccountProjectListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BillingAccountProjectListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1236,7 +1237,7 @@ impl<'a, C, A> ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudbilling.projects.getBillingInfo", + dlg.begin(MethodInfo { id: "cloudbilling.projects.getBillingInfo", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -1281,7 +1282,7 @@ impl<'a, C, A> ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1317,7 +1318,7 @@ impl<'a, C, A> ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1327,10 +1328,10 @@ impl<'a, C, A> ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut ProjectGetBillingInfoCall<'a, C, A> { self._name = new_value.to_string(); @@ -1381,12 +1382,12 @@ impl<'a, C, A> ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut ProjectGetBillingInfoCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectGetBillingInfoCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectGetBillingInfoCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1489,7 +1490,7 @@ impl<'a, C, A> ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudbilling.projects.updateBillingInfo", + dlg.begin(MethodInfo { id: "cloudbilling.projects.updateBillingInfo", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -1534,14 +1535,14 @@ impl<'a, C, A> ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1585,7 +1586,7 @@ impl<'a, C, A> ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1595,10 +1596,10 @@ impl<'a, C, A> ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut ProjectUpdateBillingInfoCall<'a, C, A> { self._request = new_value; @@ -1640,7 +1641,7 @@ impl<'a, C, A> ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut ProjectUpdateBillingInfoCall<'a, C, A> { self._name = new_value.to_string(); @@ -1658,12 +1659,12 @@ impl<'a, C, A> ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut ProjectUpdateBillingInfoCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectUpdateBillingInfoCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectUpdateBillingInfoCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/clouddebugger2-cli/Cargo.toml b/gen/clouddebugger2-cli/Cargo.toml index a55828ea92..a0ed952fab 100644 --- a/gen/clouddebugger2-cli/Cargo.toml +++ b/gen/clouddebugger2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-clouddebugger2-cli" -version = "0.3.2+20150725" +version = "0.3.3+20151123" authors = ["Sebastian Thiel "] description = "A complete library to interact with clouddebugger (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/clouddebugger2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/clouddebugger2-cli/LICENSE.md b/gen/clouddebugger2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/clouddebugger2-cli/LICENSE.md +++ b/gen/clouddebugger2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/clouddebugger2-cli/README.md b/gen/clouddebugger2-cli/README.md index 85ce8170ed..670505fab1 100644 --- a/gen/clouddebugger2-cli/README.md +++ b/gen/clouddebugger2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *clouddebugger* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/clouddebugger2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/clouddebugger2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/clouddebugger2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/clouddebugger2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/clouddebugger2-cli). # Usage -This documentation was generated from the *clouddebugger* API at revision *20150725*. The CLI is at version *0.3.2*. +This documentation was generated from the *clouddebugger* API at revision *20151123*. The CLI is at version *0.3.3*. ```bash clouddebugger2 [options] @@ -42,18 +42,18 @@ clouddebugger2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/clouddebugger2-cli/mkdocs.yml b/gen/clouddebugger2-cli/mkdocs.yml index 3b2c07e0e5..97d53a1404 100644 --- a/gen/clouddebugger2-cli/mkdocs.yml +++ b/gen/clouddebugger2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: clouddebugger v0.3.2+20150725 +site_name: clouddebugger v0.3.3+20151123 site_url: http://byron.github.io/google-apis-rs/google-clouddebugger2-cli site_description: Write integrating applications with bcore @@ -20,5 +20,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/clouddebugger2-cli/src/main.rs b/gen/clouddebugger2-cli/src/main.rs index be3d780c88..75d07b1a1e 100644 --- a/gen/clouddebugger2-cli/src/main.rs +++ b/gen/clouddebugger2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,24 +36,27 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Clouddebugger>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _controller_debuggees_breakpoints_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _controller_debuggees_breakpoints_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.controller().debuggees_breakpoints_list(opt.value_of("debuggee-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "wait-token" => { call = call.wait_token(value.unwrap_or("")); }, + "success-on-timeout" => { + call = call.success_on_timeout(arg_from_str(value.unwrap_or("false"), err, "success-on-timeout", "boolean")); + }, _ => { let mut found = false; for param in &self.gp { @@ -64,10 +67,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["wait-token"].iter().map(|v|*v)); + v.extend(["wait-token", "success-on-timeout"].iter().map(|v|*v)); v } )); } } @@ -78,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -101,13 +104,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _controller_debuggees_breakpoints_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _controller_debuggees_breakpoints_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -121,8 +124,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "breakpoint.status.is-error" => Some(("breakpoint.status.isError", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "breakpoint.status.refers-to" => Some(("breakpoint.status.refersTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -152,7 +155,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UpdateActiveBreakpointRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.controller().debuggees_breakpoints_update(request, opt.value_of("debuggee-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -165,7 +168,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -178,7 +181,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -201,13 +204,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _controller_debuggees_register(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _controller_debuggees_register(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -221,8 +224,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "debuggee.status.is-error" => Some(("debuggee.status.isError", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "debuggee.status.refers-to" => Some(("debuggee.status.refersTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -248,7 +251,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RegisterDebuggeeRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.controller().debuggees_register(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -261,7 +264,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -274,7 +277,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -297,10 +300,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _debugger_debuggees_breakpoints_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _debugger_debuggees_breakpoints_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.debugger().debuggees_breakpoints_delete(opt.value_of("debuggee-id").unwrap_or(""), opt.value_of("breakpoint-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -313,7 +316,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -326,7 +329,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -349,10 +352,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _debugger_debuggees_breakpoints_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _debugger_debuggees_breakpoints_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.debugger().debuggees_breakpoints_get(opt.value_of("debuggee-id").unwrap_or(""), opt.value_of("breakpoint-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -365,7 +368,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -378,7 +381,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -401,10 +404,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _debugger_debuggees_breakpoints_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _debugger_debuggees_breakpoints_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.debugger().debuggees_breakpoints_list(opt.value_of("debuggee-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "wait-token" => { @@ -432,7 +435,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["strip-results", "include-inactive", "action-value", "wait-token", "include-all-users"].iter().map(|v|*v)); @@ -446,7 +449,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -469,13 +472,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _debugger_debuggees_breakpoints_set(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _debugger_debuggees_breakpoints_set(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -489,8 +492,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.is-error" => Some(("status.isError", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "status.refers-to" => Some(("status.refersTo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -520,7 +523,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Breakpoint = json::value::from_value(object).unwrap(); let mut call = self.hub.debugger().debuggees_breakpoints_set(request, opt.value_of("debuggee-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -533,7 +536,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -546,7 +549,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -569,10 +572,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _debugger_debuggees_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _debugger_debuggees_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.debugger().debuggees_list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "project" => { @@ -591,7 +594,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["project", "include-inactive"].iter().map(|v|*v)); @@ -605,7 +608,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -690,14 +693,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "clouddebugger2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "clouddebugger2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -717,7 +720,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -760,8 +763,8 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("controller", "methods: 'debuggees-breakpoints-list', 'debuggees-breakpoints-update' and 'debuggees-register'", vec![ - ("debuggees-breakpoints-list", - Some(r##"Returns the list of all active breakpoints for the specified debuggee. The breakpoint specification (location, condition, and expression fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line the breakpoint was set to, but that doesn't change the breakpoint semantics. Thus, an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember breakpoints that are complete until the controller removes them from the active list to avoid setting those breakpoints again."##), + ("debuggees-breakpoints-list", + Some(r##"Returns the list of all active breakpoints for the debuggee. The breakpoint specification (location, condition, and expression fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line where the breakpoint was set, but this doesn't change the breakpoint semantics. This means that an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember the breakpoints that are completed until the controller removes them from the active list to avoid setting those breakpoints again."##), "Details at http://byron.github.io/google-apis-rs/google_clouddebugger2_cli/controller_debuggees-breakpoints-list", vec![ (Some(r##"debuggee-id"##), @@ -782,8 +785,8 @@ fn main() { Some(false), Some(false)), ]), - ("debuggees-breakpoints-update", - Some(r##"Updates the breakpoint state or mutable fields. The entire Breakpoint protobuf must be sent back to the controller. Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the 'location', 'condition' and 'expression' fields should not alter the breakpoint semantics. They are restricted to changes such as canonicalizing a value or snapping the location to the correct line of code."##), + ("debuggees-breakpoints-update", + Some(r##"Updates the breakpoint state or mutable fields. The entire Breakpoint message must be sent back to the controller service. Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the `location`, `condition` and `expression` fields should not alter the breakpoint semantics. These may only make changes such as canonicalizing a value or snapping the location to the correct line of code."##), "Details at http://byron.github.io/google-apis-rs/google_clouddebugger2_cli/controller_debuggees-breakpoints-update", vec![ (Some(r##"debuggee-id"##), @@ -816,8 +819,8 @@ fn main() { Some(false), Some(false)), ]), - ("debuggees-register", - Some(r##"Registers the debuggee with the controller. All agents should call this API with the same request content to get back the same stable 'debuggee_id'. Agents should call this API again whenever ListActiveBreakpoints or UpdateActiveBreakpoint return the error google.rpc.Code.NOT_FOUND. It allows the server to disable the agent or recover from any registration loss. If the debuggee is disabled server, the response will have is_disabled' set to true."##), + ("debuggees-register", + Some(r##"Registers the debuggee with the controller service. All agents attached to the same application should call this method with the same request content to get back the same stable `debuggee_id`. Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` is returned from any controller method. This allows the controller service to disable the agent or recover from any data loss. If the debuggee is disabled by the server, the response will have `is_disabled` set to `true`."##), "Details at http://byron.github.io/google-apis-rs/google_clouddebugger2_cli/controller_debuggees-register", vec![ (Some(r##"kv"##), @@ -841,19 +844,19 @@ fn main() { ]), ("debugger", "methods: 'debuggees-breakpoints-delete', 'debuggees-breakpoints-get', 'debuggees-breakpoints-list', 'debuggees-breakpoints-set' and 'debuggees-list'", vec![ - ("debuggees-breakpoints-delete", + ("debuggees-breakpoints-delete", Some(r##"Deletes the breakpoint from the debuggee."##), "Details at http://byron.github.io/google-apis-rs/google_clouddebugger2_cli/debugger_debuggees-breakpoints-delete", vec![ (Some(r##"debuggee-id"##), None, - Some(r##"The debuggee id to delete the breakpoint from."##), + Some(r##"ID of the debuggee whose breakpoint to delete."##), Some(true), Some(false)), (Some(r##"breakpoint-id"##), None, - Some(r##"The breakpoint to delete."##), + Some(r##"ID of the breakpoint to delete."##), Some(true), Some(false)), @@ -869,19 +872,19 @@ fn main() { Some(false), Some(false)), ]), - ("debuggees-breakpoints-get", + ("debuggees-breakpoints-get", Some(r##"Gets breakpoint information."##), "Details at http://byron.github.io/google-apis-rs/google_clouddebugger2_cli/debugger_debuggees-breakpoints-get", vec![ (Some(r##"debuggee-id"##), None, - Some(r##"The debuggee id to get the breakpoint from."##), + Some(r##"ID of the debuggee whose breakpoint to get."##), Some(true), Some(false)), (Some(r##"breakpoint-id"##), None, - Some(r##"The breakpoint to get."##), + Some(r##"ID of the breakpoint to get."##), Some(true), Some(false)), @@ -897,13 +900,13 @@ fn main() { Some(false), Some(false)), ]), - ("debuggees-breakpoints-list", - Some(r##"Lists all breakpoints of the debuggee that the user has access to."##), + ("debuggees-breakpoints-list", + Some(r##"Lists all breakpoints for the debuggee."##), "Details at http://byron.github.io/google-apis-rs/google_clouddebugger2_cli/debugger_debuggees-breakpoints-list", vec![ (Some(r##"debuggee-id"##), None, - Some(r##"The debuggee id to list breakpoint from."##), + Some(r##"ID of the debuggee whose breakpoints to list."##), Some(true), Some(false)), @@ -919,13 +922,13 @@ fn main() { Some(false), Some(false)), ]), - ("debuggees-breakpoints-set", + ("debuggees-breakpoints-set", Some(r##"Sets the breakpoint to the debuggee."##), "Details at http://byron.github.io/google-apis-rs/google_clouddebugger2_cli/debugger_debuggees-breakpoints-set", vec![ (Some(r##"debuggee-id"##), None, - Some(r##"The debuggee id to set the breakpoint to."##), + Some(r##"ID of the debuggee where the breakpoint is to be set."##), Some(true), Some(false)), @@ -947,7 +950,7 @@ fn main() { Some(false), Some(false)), ]), - ("debuggees-list", + ("debuggees-list", Some(r##"Lists all the debuggees that the user can set breakpoints to."##), "Details at http://byron.github.io/google-apis-rs/google_clouddebugger2_cli/debugger_debuggees-list", vec![ @@ -969,7 +972,7 @@ fn main() { let mut app = App::new("clouddebugger2") .author("Sebastian Thiel ") - .version("0.3.2+20150725") + .version("0.3.3+20151123") .about("Lets you examine the stack and variables of your running application without stopping or slowing it down.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_clouddebugger2_cli") .arg(Arg::with_name("url") @@ -993,7 +996,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1004,7 +1007,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/clouddebugger2/Cargo.toml b/gen/clouddebugger2/Cargo.toml index 5cf7b16189..33b8efa57f 100644 --- a/gen/clouddebugger2/Cargo.toml +++ b/gen/clouddebugger2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-clouddebugger2" -version = "0.1.10+20150725" +version = "0.1.11+20151123" authors = ["Sebastian Thiel "] description = "A complete library to interact with clouddebugger (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/clouddebugger2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/clouddebugger2/LICENSE.md b/gen/clouddebugger2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/clouddebugger2/LICENSE.md +++ b/gen/clouddebugger2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/clouddebugger2/README.md b/gen/clouddebugger2/README.md index 784cf24372..e2862784d1 100644 --- a/gen/clouddebugger2/README.md +++ b/gen/clouddebugger2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-clouddebugger2` library allows access to all features of the *Google clouddebugger* service. -This documentation was generated from *clouddebugger* crate version *0.1.10+20150725*, where *20150725* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *clouddebugger* crate version *0.1.11+20151123*, where *20151123* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *clouddebugger* *v2* API can be found at the [official documentation site](https://cloud.google.com/tools/cloud-debugger). diff --git a/gen/clouddebugger2/src/cmn.rs b/gen/clouddebugger2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/clouddebugger2/src/cmn.rs +++ b/gen/clouddebugger2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/clouddebugger2/src/lib.rs b/gen/clouddebugger2/src/lib.rs index 7623534077..3b321266ff 100644 --- a/gen/clouddebugger2/src/lib.rs +++ b/gen/clouddebugger2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *clouddebugger* crate version *0.1.10+20150725*, where *20150725* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *clouddebugger* crate version *0.1.11+20151123*, where *20151123* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *clouddebugger* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/tools/cloud-debugger). diff --git a/gen/clouddebugger2/src/lib.rs.in b/gen/clouddebugger2/src/lib.rs.in index 5c8bc54b02..6dfac44a02 100644 --- a/gen/clouddebugger2/src/lib.rs.in +++ b/gen/clouddebugger2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -140,7 +141,7 @@ impl<'a, C, A> Clouddebugger Clouddebugger { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -152,7 +153,7 @@ impl<'a, C, A> Clouddebugger } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -166,7 +167,22 @@ impl<'a, C, A> Clouddebugger // ############ // SCHEMAS ### // ########## -/// The response of listing breakpoints. +/// An ExtendedSourceContext is a SourceContext combined with additional details describing the context. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ExtendedSourceContext { + /// Labels with user defined metadata. + pub labels: Option>, + /// Any source context. + pub context: Option, +} + +impl Part for ExtendedSourceContext {} + + +/// Response for listing breakpoints. /// /// # Activities /// @@ -177,10 +193,10 @@ impl<'a, C, A> Clouddebugger /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListBreakpointsResponse { - /// A wait token that can be used in the next call to ListBreakpoints to block until the list of breakpoints has changes. + /// A wait token that can be used in the next call to `list` (REST) or `ListBreakpoints` (RPC) to block until the list of breakpoints has changes. #[serde(rename="nextWaitToken")] pub next_wait_token: Option, - /// List of all breakpoints with complete state. The fields 'id' and 'location' are guranteed to be set on each breakpoint. + /// List of all breakpoints with complete state. The fields `id` and `location` are guaranteed to be set on each breakpoint. pub breakpoints: Option>, } @@ -210,20 +226,20 @@ impl Part for CloudWorkspaceSourceContext {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct StackFrame { - /// The unmangled function name at the call site. + /// Demangled function name at the call site. pub function: Option, - /// The source location of the call site. + /// Source location of the call site. pub location: Option, - /// The set of local variables at the stack frame location. Note that this might not be populated for all stack frames. + /// Set of local variables at the stack frame location. Note that this might not be populated for all stack frames. pub locals: Option>, - /// The set of arguments passed to this function Note that this might not be populated for all stack frames. + /// Set of arguments passed to this function. Note that this might not be populated for all stack frames. pub arguments: Option>, } impl Part for StackFrame {} -/// The response of listing debuggees. +/// Response for listing debuggees. /// /// # Activities /// @@ -234,14 +250,14 @@ impl Part for StackFrame {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListDebuggeesResponse { - /// The list of debuggees accessible to the calling user. Note that the description field is the only human readable field that should be displayed to the user. The fields 'debuggee.id' and 'description' are guranteed to be set on each debuggee. + /// List of debuggees accessible to the calling user. Note that the `description` field is the only human readable field that should be displayed to the user. The fields `debuggee.id` and `description` fields are guaranteed to be set on each debuggee. pub debuggees: Option>, } impl ResponseResult for ListDebuggeesResponse {} -/// The request to register a debuggee. +/// Request to register a debuggee. /// /// # Activities /// @@ -252,14 +268,14 @@ impl ResponseResult for ListDebuggeesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RegisterDebuggeeRequest { - /// The debuggee information to register. The fields 'project', 'uniquifier', 'description' and 'agent_version' of the debuggee must be set. + /// Debuggee information to register. The fields `project`, `uniquifier`, `description` and `agent_version` of the debuggee must be set. pub debuggee: Option, } impl RequestValue for RegisterDebuggeeRequest {} -/// The response of updating an active breakpoint. The message is defined to allow future extensions. +/// Response for updating an active breakpoint. The message is defined to allow future extensions. /// /// # Activities /// @@ -291,7 +307,22 @@ pub struct ProjectRepoId { impl Part for ProjectRepoId {} -/// The response of listing active breakpoints. +/// An alias to a repo revision. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AliasContext { + /// The alias kind. + pub kind: Option, + /// The alias name. + pub name: Option, +} + +impl Part for AliasContext {} + + +/// Response for listing active breakpoints. /// /// # Activities /// @@ -302,10 +333,13 @@ impl Part for ProjectRepoId {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListActiveBreakpointsResponse { + /// The `wait_expired` field is set to true by the server when the request times out and the field `success_on_timeout` is set to true. + #[serde(rename="waitExpired")] + pub wait_expired: Option, /// A wait token that can be used in the next method call to block until the list of breakpoints changes. #[serde(rename="nextWaitToken")] pub next_wait_token: Option, - /// List of all active breakpoints. The fields 'id' and 'location' are guranteed to be set on each breakpoint. + /// List of all active breakpoints. The fields `id` and `location` are guaranteed to be set on each breakpoint. pub breakpoints: Option>, } @@ -318,6 +352,9 @@ impl ResponseResult for ListActiveBreakpointsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CloudRepoSourceContext { + /// An alias, which may be a branch or tag. + #[serde(rename="aliasContext")] + pub alias_context: Option, /// A revision ID. #[serde(rename="revisionId")] pub revision_id: Option, @@ -369,6 +406,9 @@ impl ResponseResult for Empty {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GerritSourceContext { + /// An alias, which may be a branch or tag. + #[serde(rename="aliasContext")] + pub alias_context: Option, /// A revision (commit) ID. #[serde(rename="revisionId")] pub revision_id: Option, @@ -386,7 +426,7 @@ pub struct GerritSourceContext { impl Part for GerritSourceContext {} -/// The response of registering a debuggee. +/// Response for registering a debuggee. /// /// # Activities /// @@ -397,7 +437,7 @@ impl Part for GerritSourceContext {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RegisterDebuggeeResponse { - /// The debuggee resource. The field 'id' is guranteed to be set (in addition to the echoed fields). + /// Debuggee resource. The field `id` is guranteed to be set (in addition to the echoed fields). pub debuggee: Option, } @@ -425,7 +465,7 @@ pub struct SourceContext { impl Part for SourceContext {} -/// The request to update an active breakpoint. +/// Request to update an active breakpoint. /// /// # Activities /// @@ -436,7 +476,7 @@ impl Part for SourceContext {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UpdateActiveBreakpointRequest { - /// The updated breakpoint information. The field 'id' must be set. + /// Updated breakpoint information. The field 'id' must be set. pub breakpoint: Option, } @@ -449,44 +489,47 @@ impl RequestValue for UpdateActiveBreakpointRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SourceLocation { - /// A path to the source file within the source context of the target binary. + /// Path to the source file within the source context of the target binary. pub path: Option, - /// The line inside the file (first line value is '1'). + /// Line inside the file. The first line in the file has the value `1`. pub line: Option, } impl Part for SourceLocation {} -/// Represents the application to debug. The application may include one or more replicated processes executing the same code. Each of these processes is attached with a debugger agent, carrying out the debugging commands. The agents attached to the same debuggee are identified by using exactly the same fields' values when registering. +/// Represents the application to debug. The application may include one or more replicated processes executing the same code. Each of these processes is attached with a debugger agent, carrying out the debugging commands. The agents attached to the same debuggee are identified by using exactly the same field values when registering. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Debuggee { - /// Human readable message to be displayed to the user about this debuggee. Absense of this field indicates no message. The message can be either informational or error. + /// Human readable message to be displayed to the user about this debuggee. Absence of this field indicates no status. The message can be either informational or an error status. pub status: Option, - /// A human readable description of the debuggee. Recommended to include human readable project name, environment name, and version information . + /// Human readable description of the debuggee. Including a human-readable project name, environment name and version information is recommended. pub description: Option, - /// If set to true, indicates that the agent should disable itself and detach from the debuggee. + /// If set to `true`, indicates that the agent should disable itself and detach from the debuggee. #[serde(rename="isDisabled")] pub is_disabled: Option, /// A set of custom debuggee properties, populated by the agent, to be displayed to the user. pub labels: Option>, - /// The debuggee uniqifier within the project. Any string that id the application within the project can be used. Recomended to include environement and version or build id's. + /// Debuggee uniquifier within the project. Any string that identifies the application within the project can be used. Including environment and version or build IDs is recommended. pub uniquifier: Option, - /// The project the debuggee is associated with. Use the project number when registering a Google Cloud Platform project. + /// Project the debuggee is associated with. Use the project number when registering a Google Cloud Platform project. pub project: Option, - /// Repository snapshots containing the source code of the project. + /// References to the locations and revisions of the source code used in the deployed application. NOTE: This field is deprecated. Consumers should use `ext_source_contexts` if it is not empty. Debug agents should populate both this field and `ext_source_contexts`. #[serde(rename="sourceContexts")] pub source_contexts: Option>, - /// Version ID of the agent release. The version ID is structured as following: "domain/type/vmajor.minor" (for example "google.com/gcp-java/v1.1"). + /// References to the locations and revisions of the source code used in the deployed application. Contexts describing a remote repo related to the source code have a `category` label of `remote_repo`. Source snapshot source contexts have a `category` of `snapshot`. + #[serde(rename="extSourceContexts")] + pub ext_source_contexts: Option>, + /// Version ID of the agent release. The version ID is structured as following: `domain/type/vmajor.minor` (for example `google.com/gcp-java/v1.1`). #[serde(rename="agentVersion")] pub agent_version: Option, - /// If set to true indicates that the debuggee has not been seen by the Controller service in the last active time period (defined by the server). + /// If set to `true`, indicates that the debuggee is considered as inactive by the Controller service. #[serde(rename="isInactive")] pub is_inactive: Option, - /// Debuggee unique identifer generated by the server. + /// Unique identifier for the debuggee generated by the controller service. pub id: Option, } @@ -501,7 +544,7 @@ impl Part for Debuggee {} pub struct FormatMessage { /// Optional parameters to be embedded into the message. pub parameters: Option>, - /// Format template of the message. The "format" uses placeholders "$0", "$1", etc. to reference parameters. "$$" can be used to denote the '$' character. Examples: "Failed to load '$0' which helps debug $1 the first time it is loaded. Again, $0 is very important." "Please pay $$10 to use $0 instead of $1." + /// Format template for the message. The `format` uses placeholders `$0`, `$1`, etc. to reference parameters. `$$` can be used to denote the `$` character. Examples: * `Failed to load '$0' which helps debug $1 the first time it is loaded. Again, $0 is very important.` * `Please pay $$10 to use $0 instead of $1.` pub format: Option, } @@ -551,74 +594,77 @@ impl Part for CloudWorkspaceId {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Breakpoint { - /// Breakpoint status. The status includes an error flag and a human readable message. This field will usually stay unset. The message can be either informational or error. Nevertheless, clients should always display the text message back to the user. Error status of a breakpoint indicates complete failure. Example (non-final state): 'Still loading symbols...' Examples (final state): 'Failed to insert breakpoint' referring to breakpoint, 'Field f not found in class C' referring to condition, ... + /// Breakpoint status. The status includes an error flag and a human readable message. This field is usually unset. The message can be either informational or an error message. Regardless, clients should always display the text message back to the user. Error status indicates complete failure of the breakpoint. Example (non-final state): `Still loading symbols...` Examples (final state): * `Invalid line number` referring to location * `Field f not found in class C` referring to condition pub status: Option, - /// The variable_table exists to aid with computation, memory and network traffic optimization. It enables storing a variable once and reference it from multiple variables, including variables stored in the variable_table itself. For example, the object 'this', which may appear at many levels of the stack, can have all of it's data stored once in this table. The stack frame variables then would hold only a reference to it. The variable var_index field is an index into this repeated field. The stored objects are nameless and get their name from the referencing variable. The effective variable is a merge of the referencing veariable and the referenced variable. + /// The `variable_table` exists to aid with computation, memory and network traffic optimization. It enables storing a variable once and reference it from multiple variables, including variables stored in the `variable_table` itself. For example, the same `this` object, which may appear at many levels of the stack, can have all of its data stored once in this table. The stack frame variables then would hold only a reference to it. The variable `var_table_index` field is an index into this repeated field. The stored objects are nameless and get their name from the referencing variable. The effective variable is a merge of the referencing veariable and the referenced variable. #[serde(rename="variableTable")] pub variable_table: Option>, - /// The e-mail of the user that created this breakpoint + /// E-mail address of the user that created this breakpoint #[serde(rename="userEmail")] pub user_email: Option, - /// Indicates the severity of the log. Only relevant when action is "LOG". + /// Indicates the severity of the log. Only relevant when action is `LOG`. #[serde(rename="logLevel")] pub log_level: Option, /// Breakpoint identifier, unique in the scope of the debuggee. pub id: Option, - /// Only relevant when action is "LOG". Defines the message to log when the breakpoint hits. The message may include parameter placeholders "$0", "$1", etc. These placeholders will be replaced with the evaluated value of the appropriate expression. Expressions not referenced in "log_message_format" will not be logged. Example: "Poisonous message received, id = $0, count = $1" with expressions = [ "message.id", "message.count" ]. + /// Only relevant when action is `LOG`. Defines the message to log when the breakpoint hits. The message may include parameter placeholders `$0`, `$1`, etc. These placeholders are replaced with the evaluated value of the appropriate expression. Expressions not referenced in `log_message_format` are not logged. Example: `Message received, id = $0, count = $1` with `expressions` = `[ message.id, message.count ]`. #[serde(rename="logMessageFormat")] pub log_message_format: Option, /// The stack at breakpoint time. #[serde(rename="stackFrames")] pub stack_frames: Option>, - /// The breakpoint source location. + /// Breakpoint source location. pub location: Option, - /// The time this breakpoint was finalized as seen by the server. The value is in seconds resolution. + /// Time this breakpoint was finalized as seen by the server in seconds resolution. #[serde(rename="finalTime")] pub final_time: Option, - /// Defines what to do when the breakpoint hits. + /// Action that the agent should perform when the code at the breakpoint location is hit. pub action: Option, - /// A list of read-only expressions to evaluate at the breakpoint location. The expressions are composed using expressions in the programming language at the source location. If the breakpoint action is "LOG", the evaluated expressions are included in log statements. + /// List of read-only expressions to evaluate at the breakpoint location. The expressions are composed using expressions in the programming language at the source location. If the breakpoint action is `LOG`, the evaluated expressions are included in log statements. pub expressions: Option>, /// When true, indicates that this is a final result and the breakpoint state will not change from here on. #[serde(rename="isFinalState")] pub is_final_state: Option, - /// The evaluated expressions' values at breakpoint time. The evaluated expressions appear in exactly the same order they are listed in the 'expressions' field. The 'name' field holds the original expression text, the 'value'/'members' field holds the result of the evaluated expression. If the expression can not be evaluated, an error text is placed in the value field. + /// Values of evaluated expressions at breakpoint time. The evaluated expressions appear in exactly the same order they are listed in the `expressions` field. The `name` field holds the original expression text, the `value` or `members` field holds the result of the evaluated expression. If the expression cannot be evaluated, the `status` inside the `Variable` will indicate an error and contain the error text. #[serde(rename="evaluatedExpressions")] pub evaluated_expressions: Option>, - /// The time this breakpoint was created by the server. The value is in seconds resolution. + /// Time this breakpoint was created by the server in seconds resolution. #[serde(rename="createTime")] pub create_time: Option, - /// A condition to trigger the breakpoint. The condition is a compound boolean expression composed using expressions in a programming language at the source location. + /// Condition that triggers the breakpoint. The condition is a compound boolean expression composed using expressions in a programming language at the source location. pub condition: Option, } impl RequestValue for Breakpoint {} -/// Represents a variable or an argument possibly of a compound object type. 1. A simple variable such as, int x = 5 is represented as: { name: "x", value: "5" } 2. A compound object such as, struct T { int m1; int m2; }; T x = { 3, 7 }; is represented as: { name: "x", members { name: "m1", value: "3" }, members { name: "m2", value: "7" } } 3. A pointer where the pointee was captured such as, T x = { 3, 7 }; T* p = &x; is represented as: { name: "p", value: "0x00500500", members { name: "m1", value: "3" }, members { name: "m2", value: "7" } } 4. A pointer where the pointee was not captured or is inaccessible such as, T* p = new T; is represented as: { name: "p", value: "0x00400400", members { value: "" } } the value text should decribe the reason for the missing value. such as , , -/// . note that a null pointer should not have members. 5. An unnamed value such as, int* p = new int(7); is represented as, { name: "p", value: "0x00500500", members { value: "7" } } 6. An unnamed pointer where the pointee was not captured such as, int* p = new int(7); int** pp = &p; is represented as: { name: "pp", value: "0x00500500", members { value: "0x00400400", members { value: "" } } } To optimize computation, memory and network traffic, variables that repeat in the output multiple times can be stored once in a shared variable table and be referenced using the var_index field. The variables stored in the shared table are nameless and are essentially a partition of the complete variable. To reconstruct the complete variable merge the referencing variable with the referenced variable. When using the shared variable table, variables can be represented as: T x = { 3, 7 }; T* p = &x; T& r = x; are represented as, { name: "x", var_index: 3 } { name: "p", value "0x00500500", var_index: 3 } { name: "r", var_index: 3 } with shared variable table entry #3: { members { name: "m1", value: "3" }, members { name: "m2", value: "7" } } Note that the pointer address is stored with the referencing variable and not with the referenced variable, to allow the referenced variable to be shared between pointer and references. +/// Represents a variable or an argument possibly of a compound object type. Note how the following variables are represented: 1) A simple variable: int x = 5 { name: "x", value: "5", type: "int" } // Captured variable 2) A compound object: struct T { int m1; int m2; }; T x = { 3, 7 }; { // Captured variable name: "x", type: "T", members { name: "m1", value: "3", type: "int" }, members { name: "m2", value: "7", type: "int" } } 3) A pointer where the pointee was captured: T x = { 3, 7 }; T* p = &x; { // Captured variable name: "p", type: "T*", value: "0x00500500", members { name: "m1", value: "3", type: "int" }, members { name: "m2", value: "7", type: "int" } } 4) A pointer where the pointee was not captured: T* p = new T; { // Captured variable name: "p", type: "T*", value: "0x00400400" status { is_error: true, description { format: "unavailable" } } } The status should describe the reason for the missing value, such as ``, ``, ` +/// `. Note that a null pointer should not have members. 5) An unnamed value: int* p = new int(7); { // Captured variable name: "p", value: "0x00500500", type: "int*", members { value: "7", type: "int" } } 6) An unnamed pointer where the pointee was not captured: int* p = new int(7); int** pp = &p; { // Captured variable name: "pp", value: "0x00500500", type: "int**", members { value: "0x00400400", type: "int*" status { is_error: true, description: { format: "unavailable" } } } } } To optimize computation, memory and network traffic, variables that repeat in the output multiple times can be stored once in a shared variable table and be referenced using the `var_table_index` field. The variables stored in the shared table are nameless and are essentially a partition of the complete variable. To reconstruct the complete variable, merge the referencing variable with the referenced variable. When using the shared variable table, the following variables: T x = { 3, 7 }; T* p = &x; T& r = x; { name: "x", var_table_index: 3, type: "T" } // Captured variables { name: "p", value "0x00500500", type="T*", var_table_index: 3 } { name: "r", type="T&", var_table_index: 3 } { // Shared variable table entry #3: members { name: "m1", value: "3", type: "int" }, members { name: "m2", value: "7", type: "int" } } Note that the pointer address is stored with the referencing variable and not with the referenced variable. This allows the referenced variable to be shared between pointers and references. The type field is optional. The debugger agent may or may not support it. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Variable { - /// Status associated with the variable. This field will usually stay unset. A status of a single variable only applies to that variable or expression. The rest of breakpoint data still remains valid. Variables might be reported in error state even when breakpoint is not in final state. The message may refer to variable name with "refers_to" set to "VARIABLE_NAME". Alternatively "refers_to" will be set to "VARIABLE_VALUE". In either case variable value and members will be unset. Example of error message applied to name: "Invalid expression syntax". Example of information message applied to value: "Not captured". Examples of error message applied to value: "Malformed string", "Field f not found in class C", "Null pointer dereference". + /// Status associated with the variable. This field will usually stay unset. A status of a single variable only applies to that variable or expression. The rest of breakpoint data still remains valid. Variables might be reported in error state even when breakpoint is not in final state. The message may refer to variable name with `refers_to` set to `VARIABLE_NAME`. Alternatively `refers_to` will be set to `VARIABLE_VALUE`. In either case variable value and members will be unset. Example of error message applied to name: `Invalid expression syntax`. Example of information message applied to value: `Not captured`. Examples of error message applied to value: * `Malformed string`, * `Field f not found in class C` * `Null pointer dereference` pub status: Option, - /// The simple value of the variable. - pub value: Option, - /// This is a reference to a variable in the shared variable table. More than one variable can reference the same variable in the table. The var_index field is an index into variable_table in Breakpoint. + /// Name of the variable, if any. + pub name: Option, + /// Reference to a variable in the shared variable table. More than one variable can reference the same variable in the table. The `var_table_index` field is an index into `variable_table` in Breakpoint. #[serde(rename="varTableIndex")] pub var_table_index: Option, - /// The members contained or pointed to by the variable. + /// Variable type (e.g. `MyClass`). If the variable is split with `var_table_index`, `type` goes next to `value`. The interpretation of a type is agent specific. It is recommended to include the dynamic type rather than a static type of an object. + #[serde(rename="type")] + pub type_: Option, + /// Members contained or pointed to by the variable. pub members: Option>, - /// The name of the variable, if any. - pub name: Option, + /// Simple value of the variable. + pub value: Option, } impl Part for Variable {} -/// The response of setting a breakpoint. +/// Response for setting a breakpoint. /// /// # Activities /// @@ -629,14 +675,14 @@ impl Part for Variable {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetBreakpointResponse { - /// The breakpoint resource. The field 'id' is guranteed to be set (in addition to the echoed fileds). + /// Breakpoint resource. The field `id` is guaranteed to be set (in addition to the echoed fileds). pub breakpoint: Option, } impl ResponseResult for SetBreakpointResponse {} -/// Represents a contextual status message. The message can indicate an error or informational status, and refer to specific parts of the containing object. For example, the Breakpoint.status field can indicate an error referring to the BREAKPOINT_SOURCE_LOCATION with the message "Location not found". +/// Represents a contextual status message. The message can indicate an error or informational status, and refer to specific parts of the containing object. For example, the `Breakpoint.status` field can indicate an error referring to the `BREAKPOINT_SOURCE_LOCATION` with the message `Location not found`. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -655,7 +701,7 @@ pub struct StatusMessage { impl Part for StatusMessage {} -/// The response of getting breakpoint information. +/// Response for getting breakpoint information. /// /// # Activities /// @@ -666,7 +712,7 @@ impl Part for StatusMessage {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GetBreakpointResponse { - /// The complete breakpoint state. The fields 'id' and 'location' are guranteed to be set. + /// Complete breakpoint state. The fields `id` and `location` are guaranteed to be set. pub breakpoint: Option, } @@ -718,7 +764,7 @@ impl<'a, C, A> ControllerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the breakpoint state or mutable fields. The entire Breakpoint protobuf must be sent back to the controller. Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the 'location', 'condition' and 'expression' fields should not alter the breakpoint semantics. They are restricted to changes such as canonicalizing a value or snapping the location to the correct line of code. + /// Updates the breakpoint state or mutable fields. The entire Breakpoint message must be sent back to the controller service. Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the `location`, `condition` and `expression` fields should not alter the breakpoint semantics. These may only make changes such as canonicalizing a value or snapping the location to the correct line of code. /// /// # Arguments /// @@ -739,7 +785,7 @@ impl<'a, C, A> ControllerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Registers the debuggee with the controller. All agents should call this API with the same request content to get back the same stable 'debuggee_id'. Agents should call this API again whenever ListActiveBreakpoints or UpdateActiveBreakpoint return the error google.rpc.Code.NOT_FOUND. It allows the server to disable the agent or recover from any registration loss. If the debuggee is disabled server, the response will have is_disabled' set to true. + /// Registers the debuggee with the controller service. All agents attached to the same application should call this method with the same request content to get back the same stable `debuggee_id`. Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` is returned from any controller method. This allows the controller service to disable the agent or recover from any data loss. If the debuggee is disabled by the server, the response will have `is_disabled` set to `true`. /// /// # Arguments /// @@ -756,7 +802,7 @@ impl<'a, C, A> ControllerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns the list of all active breakpoints for the specified debuggee. The breakpoint specification (location, condition, and expression fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line the breakpoint was set to, but that doesn't change the breakpoint semantics. Thus, an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember breakpoints that are complete until the controller removes them from the active list to avoid setting those breakpoints again. + /// Returns the list of all active breakpoints for the debuggee. The breakpoint specification (location, condition, and expression fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line where the breakpoint was set, but this doesn't change the breakpoint semantics. This means that an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember the breakpoints that are completed until the controller removes them from the active list to avoid setting those breakpoints again. /// /// # Arguments /// @@ -766,6 +812,7 @@ impl<'a, C, A> ControllerMethods<'a, C, A> { hub: self.hub, _debuggee_id: debuggee_id.to_string(), _wait_token: Default::default(), + _success_on_timeout: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -819,8 +866,8 @@ impl<'a, C, A> DebuggerMethods<'a, C, A> { /// /// # Arguments /// - /// * `debuggeeId` - The debuggee id to get the breakpoint from. - /// * `breakpointId` - The breakpoint to get. + /// * `debuggeeId` - ID of the debuggee whose breakpoint to get. + /// * `breakpointId` - ID of the breakpoint to get. pub fn debuggees_breakpoints_get(&self, debuggee_id: &str, breakpoint_id: &str) -> DebuggerDebuggeeBreakpointGetCall<'a, C, A> { DebuggerDebuggeeBreakpointGetCall { hub: self.hub, @@ -838,8 +885,8 @@ impl<'a, C, A> DebuggerMethods<'a, C, A> { /// /// # Arguments /// - /// * `debuggeeId` - The debuggee id to delete the breakpoint from. - /// * `breakpointId` - The breakpoint to delete. + /// * `debuggeeId` - ID of the debuggee whose breakpoint to delete. + /// * `breakpointId` - ID of the breakpoint to delete. pub fn debuggees_breakpoints_delete(&self, debuggee_id: &str, breakpoint_id: &str) -> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> { DebuggerDebuggeeBreakpointDeleteCall { hub: self.hub, @@ -872,7 +919,7 @@ impl<'a, C, A> DebuggerMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `debuggeeId` - The debuggee id to set the breakpoint to. + /// * `debuggeeId` - ID of the debuggee where the breakpoint is to be set. pub fn debuggees_breakpoints_set(&self, request: Breakpoint, debuggee_id: &str) -> DebuggerDebuggeeBreakpointSetCall<'a, C, A> { DebuggerDebuggeeBreakpointSetCall { hub: self.hub, @@ -886,11 +933,11 @@ impl<'a, C, A> DebuggerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists all breakpoints of the debuggee that the user has access to. + /// Lists all breakpoints for the debuggee. /// /// # Arguments /// - /// * `debuggeeId` - The debuggee id to list breakpoint from. + /// * `debuggeeId` - ID of the debuggee whose breakpoints to list. pub fn debuggees_breakpoints_list(&self, debuggee_id: &str) -> DebuggerDebuggeeBreakpointListCall<'a, C, A> { DebuggerDebuggeeBreakpointListCall { hub: self.hub, @@ -915,7 +962,7 @@ impl<'a, C, A> DebuggerMethods<'a, C, A> { // CallBuilders ### // ################# -/// Updates the breakpoint state or mutable fields. The entire Breakpoint protobuf must be sent back to the controller. Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the 'location', 'condition' and 'expression' fields should not alter the breakpoint semantics. They are restricted to changes such as canonicalizing a value or snapping the location to the correct line of code. +/// Updates the breakpoint state or mutable fields. The entire Breakpoint message must be sent back to the controller service. Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the `location`, `condition` and `expression` fields should not alter the breakpoint semantics. These may only make changes such as canonicalizing a value or snapping the location to the correct line of code. /// /// A builder for the *debuggees.breakpoints.update* method supported by a *controller* resource. /// It is not used directly, but through a `ControllerMethods` instance. @@ -977,7 +1024,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouddebugger.controller.debuggees.breakpoints.update", + dlg.begin(MethodInfo { id: "clouddebugger.controller.debuggees.breakpoints.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("debuggeeId", self._debuggee_id.to_string())); @@ -1020,14 +1067,14 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1071,7 +1118,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1081,10 +1128,10 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1116,7 +1163,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UpdateActiveBreakpointRequest) -> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> { self._request = new_value; @@ -1126,7 +1173,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM /// /// Sets the *debuggee id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn debuggee_id(mut self, new_value: &str) -> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> { self._debuggee_id = new_value.to_string(); @@ -1136,7 +1183,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -1154,12 +1201,12 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1182,17 +1229,17 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1200,7 +1247,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointUpdateCall<'a, C, A> where C: BorrowM } -/// Registers the debuggee with the controller. All agents should call this API with the same request content to get back the same stable 'debuggee_id'. Agents should call this API again whenever ListActiveBreakpoints or UpdateActiveBreakpoint return the error google.rpc.Code.NOT_FOUND. It allows the server to disable the agent or recover from any registration loss. If the debuggee is disabled server, the response will have is_disabled' set to true. +/// Registers the debuggee with the controller service. All agents attached to the same application should call this method with the same request content to get back the same stable `debuggee_id`. Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` is returned from any controller method. This allows the controller service to disable the agent or recover from any data loss. If the debuggee is disabled by the server, the response will have `is_disabled` set to `true`. /// /// A builder for the *debuggees.register* method supported by a *controller* resource. /// It is not used directly, but through a `ControllerMethods` instance. @@ -1260,7 +1307,7 @@ impl<'a, C, A> ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouddebugger.controller.debuggees.register", + dlg.begin(MethodInfo { id: "clouddebugger.controller.debuggees.register", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1280,14 +1327,14 @@ impl<'a, C, A> ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1331,7 +1378,7 @@ impl<'a, C, A> ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1341,10 +1388,10 @@ impl<'a, C, A> ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut ControllerDebuggeeRegisterCall<'a, C, A> { self._request = new_value; @@ -1394,12 +1441,12 @@ impl<'a, C, A> ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ControllerDebuggeeRegisterCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ControllerDebuggeeRegisterCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1440,7 +1487,7 @@ impl<'a, C, A> ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut ControllerDebuggeeRegisterCall<'a, C, A> where C: BorrowMut hub: &'a Clouddebugger, _debuggee_id: String, _wait_token: Option, + _success_on_timeout: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -1496,14 +1545,17 @@ impl<'a, C, A> ControllerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouddebugger.controller.debuggees.breakpoints.list", + dlg.begin(MethodInfo { id: "clouddebugger.controller.debuggees.breakpoints.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("debuggeeId", self._debuggee_id.to_string())); if let Some(value) = self._wait_token { params.push(("waitToken", value.to_string())); } - for &field in ["alt", "debuggeeId", "waitToken"].iter() { + if let Some(value) = self._success_on_timeout { + params.push(("successOnTimeout", value.to_string())); + } + for &field in ["alt", "debuggeeId", "waitToken", "successOnTimeout"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -1541,7 +1593,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1577,7 +1629,7 @@ impl<'a, C, A> ControllerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1587,10 +1639,10 @@ impl<'a, C, A> ControllerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1623,19 +1675,26 @@ impl<'a, C, A> ControllerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut /// /// Sets the *debuggee id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn debuggee_id(mut self, new_value: &str) -> ControllerDebuggeeBreakpointListCall<'a, C, A> { self._debuggee_id = new_value.to_string(); self } - /// A wait token that, if specified, blocks the method call until the list of active breakpoints has changed, or a server selected timeout has expired. The value should be set from the last returned response. The error code google.rpc.Code.ABORTED is returned on wait timeout (which does not require the agent to re-register with the server) + /// A wait token that, if specified, blocks the method call until the list of active breakpoints has changed, or a server selected timeout has expired. The value should be set from the last returned response. /// /// Sets the *wait token* query property to the given value. pub fn wait_token(mut self, new_value: &str) -> ControllerDebuggeeBreakpointListCall<'a, C, A> { self._wait_token = Some(new_value.to_string()); self } + /// If set to `true`, returns `google.rpc.Code.OK` status and sets the `wait_expired` response field to `true` when the server-selected timeout has expired (recommended). If set to `false`, returns `google.rpc.Code.ABORTED` status when the server-selected timeout has expired (deprecated). + /// + /// Sets the *success on timeout* query property to the given value. + pub fn success_on_timeout(mut self, new_value: bool) -> ControllerDebuggeeBreakpointListCall<'a, C, A> { + self._success_on_timeout = Some(new_value); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -1648,12 +1707,12 @@ impl<'a, C, A> ControllerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1676,17 +1735,17 @@ impl<'a, C, A> ControllerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ControllerDebuggeeBreakpointListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ControllerDebuggeeBreakpointListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1749,7 +1808,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.get", + dlg.begin(MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("debuggeeId", self._debuggee_id.to_string())); @@ -1792,7 +1851,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1828,7 +1887,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1838,10 +1897,10 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointGetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointGetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointGetCall<'a, C, A> { self._debuggee_id = new_value.to_string(); self } - /// The breakpoint to get. + /// ID of the breakpoint to get. /// /// Sets the *breakpoint id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn breakpoint_id(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointGetCall<'a, C, A> { self._breakpoint_id = new_value.to_string(); @@ -1902,12 +1961,12 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointGetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DebuggerDebuggeeBreakpointGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DebuggerDebuggeeBreakpointGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2003,7 +2062,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.delete", + dlg.begin(MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("debuggeeId", self._debuggee_id.to_string())); @@ -2046,7 +2105,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2082,7 +2141,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2092,10 +2151,10 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2124,21 +2183,21 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut } - /// The debuggee id to delete the breakpoint from. + /// ID of the debuggee whose breakpoint to delete. /// /// Sets the *debuggee id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn debuggee_id(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> { self._debuggee_id = new_value.to_string(); self } - /// The breakpoint to delete. + /// ID of the breakpoint to delete. /// /// Sets the *breakpoint id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn breakpoint_id(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> { self._breakpoint_id = new_value.to_string(); @@ -2156,12 +2215,12 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2184,17 +2243,17 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2229,8 +2288,8 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointDeleteCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.debugger().debuggees_list() -/// .project("amet.") -/// .include_inactive(false) +/// .project("erat") +/// .include_inactive(true) /// .doit(); /// # } /// ``` @@ -2259,7 +2318,7 @@ impl<'a, C, A> DebuggerDebuggeeListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouddebugger.debugger.debuggees.list", + dlg.begin(MethodInfo { id: "clouddebugger.debugger.debuggees.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._project { @@ -2285,7 +2344,7 @@ impl<'a, C, A> DebuggerDebuggeeListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2321,7 +2380,7 @@ impl<'a, C, A> DebuggerDebuggeeListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2331,10 +2390,10 @@ impl<'a, C, A> DebuggerDebuggeeListCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeListCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeListCall<'a, C, A> { self._project = Some(new_value.to_string()); self } - /// When set to true the result includes all debuggees, otherwise only debugees that are active. + /// When set to `true`, the result includes all debuggees. Otherwise, the result includes only debuggees that are active. /// /// Sets the *include inactive* query property to the given value. pub fn include_inactive(mut self, new_value: bool) -> DebuggerDebuggeeListCall<'a, C, A> { @@ -2389,12 +2448,12 @@ impl<'a, C, A> DebuggerDebuggeeListCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DebuggerDebuggeeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DebuggerDebuggeeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2496,7 +2555,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.set", + dlg.begin(MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.set", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("debuggeeId", self._debuggee_id.to_string())); @@ -2538,14 +2597,14 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2589,7 +2648,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2599,10 +2658,10 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointSetCall<'a, C, A> { self._request = new_value; self } - /// The debuggee id to set the breakpoint to. + /// ID of the debuggee where the breakpoint is to be set. /// /// Sets the *debuggee id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn debuggee_id(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointSetCall<'a, C, A> { self._debuggee_id = new_value.to_string(); @@ -2662,12 +2721,12 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DebuggerDebuggeeBreakpointSetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DebuggerDebuggeeBreakpointSetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2708,7 +2767,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointSetCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.list", + dlg.begin(MethodInfo { id: "clouddebugger.debugger.debuggees.breakpoints.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("debuggeeId", self._debuggee_id.to_string())); @@ -2829,7 +2888,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2865,7 +2924,7 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2875,10 +2934,10 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointListCall<'a, C, A> { self._debuggee_id = new_value.to_string(); self } - /// A wait token that, if specified, blocks the call until the breakpoints list has changed, or a server selected timeout has expired. The value should be set from the last response to ListBreakpoints. The error code ABORTED is returned on wait timeout, which should be called again with the same wait_token. + /// A wait token that, if specified, blocks the call until the breakpoints list has changed, or a server selected timeout has expired. The value should be set from the last response. The error code `google.rpc.Code.ABORTED` (RPC) is returned on wait timeout, which should be called again with the same `wait_token`. /// /// Sets the *wait token* query property to the given value. pub fn wait_token(mut self, new_value: &str) -> DebuggerDebuggeeBreakpointListCall<'a, C, A> { self._wait_token = Some(new_value.to_string()); self } - /// When set to true the response breakpoints will be stripped of the results fields: stack_frames, evaluated_expressions and variable_table. + /// When set to `true`, the response breakpoints are stripped of the results fields: `stack_frames`, `evaluated_expressions` and `variable_table`. /// /// Sets the *strip results* query property to the given value. pub fn strip_results(mut self, new_value: bool) -> DebuggerDebuggeeBreakpointListCall<'a, C, A> { self._strip_results = Some(new_value); self } - /// When set to true the response includes active and inactive breakpoints, otherwise only active breakpoints are returned. + /// When set to `true`, the response includes active and inactive breakpoints. Otherwise, it includes only active breakpoints. /// /// Sets the *include inactive* query property to the given value. pub fn include_inactive(mut self, new_value: bool) -> DebuggerDebuggeeBreakpointListCall<'a, C, A> { self._include_inactive = Some(new_value); self } - /// When set to true the response includes the list of breakpoints set by any user, otherwise only breakpoints set by the caller. + /// When set to `true`, the response includes the list of breakpoints set by any user. Otherwise, it includes only breakpoints set by the caller. /// /// Sets the *include all users* query property to the given value. pub fn include_all_users(mut self, new_value: bool) -> DebuggerDebuggeeBreakpointListCall<'a, C, A> { @@ -2964,12 +3023,12 @@ impl<'a, C, A> DebuggerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut DebuggerDebuggeeBreakpointListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DebuggerDebuggeeBreakpointListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DebuggerDebuggeeBreakpointListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/cloudlatencytest2-cli/Cargo.toml b/gen/cloudlatencytest2-cli/Cargo.toml index 86478b8fc1..ccb0903759 100644 --- a/gen/cloudlatencytest2-cli/Cargo.toml +++ b/gen/cloudlatencytest2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudlatencytest2-cli" -version = "0.3.2+20150508" +version = "0.3.3+20150508" authors = ["Sebastian Thiel "] description = "A complete library to interact with cloudlatencytest (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudlatencytest2-cli" @@ -20,10 +20,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/cloudlatencytest2-cli/LICENSE.md b/gen/cloudlatencytest2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudlatencytest2-cli/LICENSE.md +++ b/gen/cloudlatencytest2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/cloudlatencytest2-cli/README.md b/gen/cloudlatencytest2-cli/README.md index a6219cebed..0a30a1e2de 100644 --- a/gen/cloudlatencytest2-cli/README.md +++ b/gen/cloudlatencytest2-cli/README.md @@ -14,14 +14,14 @@ If data-structures are requested, these will be returned as pretty-printed JSON, You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/cloudlatencytest2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/cloudlatencytest2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/cloudlatencytest2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/cloudlatencytest2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudlatencytest2-cli). # Usage -This documentation was generated from the *cloudlatencytest* API at revision *20150508*. The CLI is at version *0.3.2*. +This documentation was generated from the *cloudlatencytest* API at revision *20150508*. The CLI is at version *0.3.3*. ```bash cloudlatencytest2 [options] @@ -32,18 +32,18 @@ cloudlatencytest2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/cloudlatencytest2-cli/mkdocs.yml b/gen/cloudlatencytest2-cli/mkdocs.yml index 0ae046a843..b55cead5e5 100644 --- a/gen/cloudlatencytest2-cli/mkdocs.yml +++ b/gen/cloudlatencytest2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: cloudlatencytest v0.3.2+20150508 +site_name: cloudlatencytest v0.3.3+20150508 site_url: http://byron.github.io/google-apis-rs/google-cloudlatencytest2-cli site_description: Write integrating applications with bcore @@ -14,5 +14,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/cloudlatencytest2-cli/src/main.rs b/gen/cloudlatencytest2-cli/src/main.rs index 47721243ca..2e401b695c 100644 --- a/gen/cloudlatencytest2-cli/src/main.rs +++ b/gen/cloudlatencytest2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Cloudlatencytest>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _statscollection_updateaggregatedstats(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _statscollection_updateaggregatedstats(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -80,7 +80,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AggregatedStats = json::value::from_value(object).unwrap(); let mut call = self.hub.statscollection().updateaggregatedstats(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -93,7 +93,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -106,7 +106,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -129,13 +129,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _statscollection_updatestats(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _statscollection_updatestats(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -149,8 +149,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "time" => Some(("time", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), _ => { @@ -165,7 +165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Stats = json::value::from_value(object).unwrap(); let mut call = self.hub.statscollection().updatestats(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -178,7 +178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -191,7 +191,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -250,14 +250,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "cloudlatencytest2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "cloudlatencytest2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -277,7 +277,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -316,7 +316,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("statscollection", "methods: 'updateaggregatedstats' and 'updatestats'", vec![ - ("updateaggregatedstats", + ("updateaggregatedstats", Some(r##"RPC to update the new TCP stats."##), "Details at http://byron.github.io/google-apis-rs/google_cloudlatencytest2_cli/statscollection_updateaggregatedstats", vec![ @@ -338,7 +338,7 @@ fn main() { Some(false), Some(false)), ]), - ("updatestats", + ("updatestats", Some(r##"RPC to update the new TCP stats."##), "Details at http://byron.github.io/google-apis-rs/google_cloudlatencytest2_cli/statscollection_updatestats", vec![ @@ -366,7 +366,7 @@ fn main() { let mut app = App::new("cloudlatencytest2") .author("Sebastian Thiel ") - .version("0.3.2+20150508") + .version("0.3.3+20150508") .about("A Test API to report latency data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudlatencytest2_cli") .arg(Arg::with_name("url") @@ -390,7 +390,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -401,7 +401,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/cloudlatencytest2/Cargo.toml b/gen/cloudlatencytest2/Cargo.toml index f411b47add..c6b4742323 100644 --- a/gen/cloudlatencytest2/Cargo.toml +++ b/gen/cloudlatencytest2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudlatencytest2" -version = "0.1.10+20150508" +version = "0.1.11+20150508" authors = ["Sebastian Thiel "] description = "A complete library to interact with cloudlatencytest (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudlatencytest2" @@ -19,7 +19,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/cloudlatencytest2/LICENSE.md b/gen/cloudlatencytest2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudlatencytest2/LICENSE.md +++ b/gen/cloudlatencytest2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/cloudlatencytest2/README.md b/gen/cloudlatencytest2/README.md index 073e67b925..e61c7133e4 100644 --- a/gen/cloudlatencytest2/README.md +++ b/gen/cloudlatencytest2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-cloudlatencytest2` library allows access to all features of the *Google cloudlatencytest* service. -This documentation was generated from *cloudlatencytest* crate version *0.1.10+20150508*, where *20150508* is the exact revision of the *cloudlatencytest:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *cloudlatencytest* crate version *0.1.11+20150508*, where *20150508* is the exact revision of the *cloudlatencytest:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. # Features Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_cloudlatencytest2/struct.Cloudlatencytest.html) ... diff --git a/gen/cloudlatencytest2/src/cmn.rs b/gen/cloudlatencytest2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/cloudlatencytest2/src/cmn.rs +++ b/gen/cloudlatencytest2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/cloudlatencytest2/src/lib.rs b/gen/cloudlatencytest2/src/lib.rs index d553381a3f..75ebe16742 100644 --- a/gen/cloudlatencytest2/src/lib.rs +++ b/gen/cloudlatencytest2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *cloudlatencytest* crate version *0.1.10+20150508*, where *20150508* is the exact revision of the *cloudlatencytest:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *cloudlatencytest* crate version *0.1.11+20150508*, where *20150508* is the exact revision of the *cloudlatencytest:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudlatencytest2). //! # Features //! diff --git a/gen/cloudlatencytest2/src/lib.rs.in b/gen/cloudlatencytest2/src/lib.rs.in index 6ffc85be12..b479a7ef5b 100644 --- a/gen/cloudlatencytest2/src/lib.rs.in +++ b/gen/cloudlatencytest2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -132,7 +133,7 @@ impl<'a, C, A> Cloudlatencytest Cloudlatencytest { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -141,7 +142,7 @@ impl<'a, C, A> Cloudlatencytest } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -429,7 +430,7 @@ impl<'a, C, A> StatscollectionUpdateaggregatedstatCall<'a, C, A> where C: Borrow Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudlatencytest.statscollection.updateaggregatedstats", + dlg.begin(MethodInfo { id: "cloudlatencytest.statscollection.updateaggregatedstats", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -449,14 +450,14 @@ impl<'a, C, A> StatscollectionUpdateaggregatedstatCall<'a, C, A> where C: Borrow self._scopes.insert(Scope::MonitoringReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -500,7 +501,7 @@ impl<'a, C, A> StatscollectionUpdateaggregatedstatCall<'a, C, A> where C: Borrow match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -510,10 +511,10 @@ impl<'a, C, A> StatscollectionUpdateaggregatedstatCall<'a, C, A> where C: Borrow if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -545,7 +546,7 @@ impl<'a, C, A> StatscollectionUpdateaggregatedstatCall<'a, C, A> where C: Borrow /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AggregatedStats) -> StatscollectionUpdateaggregatedstatCall<'a, C, A> { self._request = new_value; @@ -563,12 +564,12 @@ impl<'a, C, A> StatscollectionUpdateaggregatedstatCall<'a, C, A> where C: Borrow } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -585,17 +586,17 @@ impl<'a, C, A> StatscollectionUpdateaggregatedstatCall<'a, C, A> where C: Borrow } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MonitoringReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StatscollectionUpdateaggregatedstatCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StatscollectionUpdateaggregatedstatCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -663,7 +664,7 @@ impl<'a, C, A> StatscollectionUpdatestatCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudlatencytest.statscollection.updatestats", + dlg.begin(MethodInfo { id: "cloudlatencytest.statscollection.updatestats", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -683,14 +684,14 @@ impl<'a, C, A> StatscollectionUpdatestatCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -734,7 +735,7 @@ impl<'a, C, A> StatscollectionUpdatestatCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -744,10 +745,10 @@ impl<'a, C, A> StatscollectionUpdatestatCall<'a, C, A> where C: BorrowMut StatscollectionUpdatestatCall<'a, C, A> where C: BorrowMut StatscollectionUpdatestatCall<'a, C, A> { self._request = new_value; @@ -797,12 +798,12 @@ impl<'a, C, A> StatscollectionUpdatestatCall<'a, C, A> where C: BorrowMut StatscollectionUpdatestatCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> StatscollectionUpdatestatCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StatscollectionUpdatestatCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/cloudmonitoring2_beta2-cli/Cargo.toml b/gen/cloudmonitoring2_beta2-cli/Cargo.toml index c85fce8f62..b6bf404417 100644 --- a/gen/cloudmonitoring2_beta2-cli/Cargo.toml +++ b/gen/cloudmonitoring2_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudmonitoring2_beta2-cli" -version = "0.3.2+20151012" +version = "0.3.3+20160124" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Monitoring (protocol v2beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudmonitoring2_beta2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/cloudmonitoring2_beta2-cli/LICENSE.md b/gen/cloudmonitoring2_beta2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudmonitoring2_beta2-cli/LICENSE.md +++ b/gen/cloudmonitoring2_beta2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/cloudmonitoring2_beta2-cli/README.md b/gen/cloudmonitoring2_beta2-cli/README.md index 327b5e82bc..a70d4c12a2 100644 --- a/gen/cloudmonitoring2_beta2-cli/README.md +++ b/gen/cloudmonitoring2_beta2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Cloud Monitoring* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/cloudmonitoring2-beta2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/cloudmonitoring2-beta2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/cloudmonitoring2-beta2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/cloudmonitoring2-beta2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudmonitoring2_beta2-cli). # Usage -This documentation was generated from the *Cloud Monitoring* API at revision *20151012*. The CLI is at version *0.3.2*. +This documentation was generated from the *Cloud Monitoring* API at revision *20160124*. The CLI is at version *0.3.3*. ```bash cloudmonitoring2-beta2 [options] @@ -41,18 +41,18 @@ cloudmonitoring2-beta2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/cloudmonitoring2_beta2-cli/mkdocs.yml b/gen/cloudmonitoring2_beta2-cli/mkdocs.yml index b6c3eda800..d2a3d622b8 100644 --- a/gen/cloudmonitoring2_beta2-cli/mkdocs.yml +++ b/gen/cloudmonitoring2_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Monitoring v0.3.2+20151012 +site_name: Cloud Monitoring v0.3.3+20160124 site_url: http://byron.github.io/google-apis-rs/google-cloudmonitoring2_beta2-cli site_description: Write integrating applications with bcore @@ -18,5 +18,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/cloudmonitoring2_beta2-cli/src/main.rs b/gen/cloudmonitoring2_beta2-cli/src/main.rs index bdc16d7fda..0f00e91de0 100644 --- a/gen/cloudmonitoring2_beta2-cli/src/main.rs +++ b/gen/cloudmonitoring2_beta2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::CloudMonitoring>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _metric_descriptors_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _metric_descriptors_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "project" => Some(("project", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type-descriptor.value-type" => Some(("typeDescriptor.valueType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -85,7 +85,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::MetricDescriptor = json::value::from_value(object).unwrap(); let mut call = self.hub.metric_descriptors().create(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -98,7 +98,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -111,7 +111,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -134,10 +134,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _metric_descriptors_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _metric_descriptors_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.metric_descriptors().delete(opt.value_of("project").unwrap_or(""), opt.value_of("metric").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -150,7 +150,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -163,7 +163,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -186,13 +186,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _metric_descriptors_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _metric_descriptors_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -206,8 +206,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -222,7 +222,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ListMetricDescriptorsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.metric_descriptors().list(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "query" => { @@ -244,7 +244,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["count", "query", "page-token"].iter().map(|v|*v)); @@ -258,7 +258,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -281,13 +281,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeseries_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeseries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -301,8 +301,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -317,7 +317,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ListTimeseriesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.timeseries().list(request, opt.value_of("project").unwrap_or(""), opt.value_of("metric").unwrap_or(""), opt.value_of("youngest").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "window" => { @@ -351,7 +351,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["count", "timespan", "aggregator", "labels", "page-token", "window", "oldest"].iter().map(|v|*v)); @@ -365,7 +365,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -388,13 +388,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeseries_write(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeseries_write(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -408,8 +408,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "common-labels" => Some(("commonLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), _ => { @@ -424,7 +424,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::WriteTimeseriesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.timeseries().write(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -437,7 +437,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -450,7 +450,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -473,13 +473,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeseries_descriptors_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeseries_descriptors_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -493,8 +493,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -509,7 +509,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ListTimeseriesDescriptorsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.timeseries_descriptors().list(request, opt.value_of("project").unwrap_or(""), opt.value_of("metric").unwrap_or(""), opt.value_of("youngest").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "window" => { @@ -543,7 +543,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["count", "timespan", "aggregator", "labels", "page-token", "window", "oldest"].iter().map(|v|*v)); @@ -557,7 +557,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -644,14 +644,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "cloudmonitoring2-beta2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "cloudmonitoring2-beta2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -671,7 +671,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -710,7 +710,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("metric-descriptors", "methods: 'create', 'delete' and 'list'", vec![ - ("create", + ("create", Some(r##"Create a new metric."##), "Details at http://byron.github.io/google-apis-rs/google_cloudmonitoring2_beta2_cli/metric-descriptors_create", vec![ @@ -738,7 +738,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete an existing metric."##), "Details at http://byron.github.io/google-apis-rs/google_cloudmonitoring2_beta2_cli/metric-descriptors_delete", vec![ @@ -766,7 +766,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List metric descriptors that match the query. If the query is not set, then all of the metric descriptors will be returned. Large responses will be paginated, use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken."##), "Details at http://byron.github.io/google-apis-rs/google_cloudmonitoring2_beta2_cli/metric-descriptors_list", vec![ @@ -797,7 +797,7 @@ fn main() { ]), ("timeseries", "methods: 'list' and 'write'", vec![ - ("list", + ("list", Some(r##"List the data points of the time series that match the metric and labels values and that have data points in the interval. Large responses are paginated; use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken."##), "Details at http://byron.github.io/google-apis-rs/google_cloudmonitoring2_beta2_cli/timeseries_list", vec![ @@ -837,7 +837,7 @@ fn main() { Some(false), Some(false)), ]), - ("write", + ("write", Some(r##"Put data points to one or more time series for one or more metrics. If a time series does not exist, a new time series will be created. It is not allowed to write a time series point that is older than the existing youngest point of that time series. Points that are older than the existing youngest point of that time series will be discarded silently. Therefore, users should make sure that points of a time series are written sequentially in the order of their end time."##), "Details at http://byron.github.io/google-apis-rs/google_cloudmonitoring2_beta2_cli/timeseries_write", vec![ @@ -868,7 +868,7 @@ fn main() { ]), ("timeseries-descriptors", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"List the descriptors of the time series that match the metric and labels values and that have data points in the interval. Large responses are paginated; use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken."##), "Details at http://byron.github.io/google-apis-rs/google_cloudmonitoring2_beta2_cli/timeseries-descriptors_list", vec![ @@ -914,7 +914,7 @@ fn main() { let mut app = App::new("cloudmonitoring2-beta2") .author("Sebastian Thiel ") - .version("0.3.2+20151012") + .version("0.3.3+20160124") .about("API for accessing Google Cloud and API monitoring data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudmonitoring2_beta2_cli") .arg(Arg::with_name("url") @@ -938,7 +938,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -949,7 +949,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/cloudmonitoring2_beta2/Cargo.toml b/gen/cloudmonitoring2_beta2/Cargo.toml index f7b682cbb0..4ac95d716e 100644 --- a/gen/cloudmonitoring2_beta2/Cargo.toml +++ b/gen/cloudmonitoring2_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudmonitoring2_beta2" -version = "0.1.10+20151012" +version = "0.1.11+20160124" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Monitoring (protocol v2beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudmonitoring2_beta2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/cloudmonitoring2_beta2/LICENSE.md b/gen/cloudmonitoring2_beta2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudmonitoring2_beta2/LICENSE.md +++ b/gen/cloudmonitoring2_beta2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/cloudmonitoring2_beta2/README.md b/gen/cloudmonitoring2_beta2/README.md index 97b94de3ea..bff284d493 100644 --- a/gen/cloudmonitoring2_beta2/README.md +++ b/gen/cloudmonitoring2_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-cloudmonitoring2_beta2` library allows access to all features of the *Google Cloud Monitoring* service. -This documentation was generated from *Cloud Monitoring* crate version *0.1.10+20151012*, where *20151012* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Cloud Monitoring* crate version *0.1.11+20160124*, where *20160124* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Cloud Monitoring* *v2_beta2* API can be found at the [official documentation site](https://cloud.google.com/monitoring/v2beta2/). diff --git a/gen/cloudmonitoring2_beta2/src/cmn.rs b/gen/cloudmonitoring2_beta2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/cloudmonitoring2_beta2/src/cmn.rs +++ b/gen/cloudmonitoring2_beta2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/cloudmonitoring2_beta2/src/lib.rs b/gen/cloudmonitoring2_beta2/src/lib.rs index 6a1a91ec59..a4dc720257 100644 --- a/gen/cloudmonitoring2_beta2/src/lib.rs +++ b/gen/cloudmonitoring2_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud Monitoring* crate version *0.1.10+20151012*, where *20151012* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Cloud Monitoring* crate version *0.1.11+20160124*, where *20160124* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Cloud Monitoring* *v2_beta2* API can be found at the //! [official documentation site](https://cloud.google.com/monitoring/v2beta2/). diff --git a/gen/cloudmonitoring2_beta2/src/lib.rs.in b/gen/cloudmonitoring2_beta2/src/lib.rs.in index 9fa7f845b1..5573c0f0be 100644 --- a/gen/cloudmonitoring2_beta2/src/lib.rs.in +++ b/gen/cloudmonitoring2_beta2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -139,7 +140,7 @@ impl<'a, C, A> CloudMonitoring CloudMonitoring { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -154,7 +155,7 @@ impl<'a, C, A> CloudMonitoring } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -923,7 +924,7 @@ impl<'a, C, A> TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudmonitoring.timeseriesDescriptors.list", + dlg.begin(MethodInfo { id: "cloudmonitoring.timeseriesDescriptors.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -992,14 +993,14 @@ impl<'a, C, A> TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1043,7 +1044,7 @@ impl<'a, C, A> TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1053,10 +1054,10 @@ impl<'a, C, A> TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut TimeseriesDescriptorListCall<'a, C, A> { self._request = new_value; @@ -1098,7 +1099,7 @@ impl<'a, C, A> TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut TimeseriesDescriptorListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1108,7 +1109,7 @@ impl<'a, C, A> TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut TimeseriesDescriptorListCall<'a, C, A> { self._metric = new_value.to_string(); @@ -1118,7 +1119,7 @@ impl<'a, C, A> TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut TimeseriesDescriptorListCall<'a, C, A> { self._youngest = new_value.to_string(); @@ -1202,12 +1203,12 @@ impl<'a, C, A> TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut TimeseriesDescriptorListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TimeseriesDescriptorListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimeseriesDescriptorListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1303,7 +1304,7 @@ impl<'a, C, A> TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudmonitoring.timeseries.write", + dlg.begin(MethodInfo { id: "cloudmonitoring.timeseries.write", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1345,14 +1346,14 @@ impl<'a, C, A> TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1396,7 +1397,7 @@ impl<'a, C, A> TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1406,10 +1407,10 @@ impl<'a, C, A> TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1441,7 +1442,7 @@ impl<'a, C, A> TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: WriteTimeseriesRequest) -> TimeseryWriteCall<'a, C, A> { self._request = new_value; @@ -1451,7 +1452,7 @@ impl<'a, C, A> TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TimeseryWriteCall<'a, C, A> { self._project = new_value.to_string(); @@ -1469,12 +1470,12 @@ impl<'a, C, A> TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1491,17 +1492,17 @@ impl<'a, C, A> TimeseryWriteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TimeseryWriteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimeseryWriteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1586,7 +1587,7 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudmonitoring.timeseries.list", + dlg.begin(MethodInfo { id: "cloudmonitoring.timeseries.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1655,14 +1656,14 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1706,7 +1707,7 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1716,10 +1717,10 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1751,7 +1752,7 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ListTimeseriesRequest) -> TimeseryListCall<'a, C, A> { self._request = new_value; @@ -1761,7 +1762,7 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TimeseryListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1771,7 +1772,7 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *metric* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn metric(mut self, new_value: &str) -> TimeseryListCall<'a, C, A> { self._metric = new_value.to_string(); @@ -1781,7 +1782,7 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *youngest* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn youngest(mut self, new_value: &str) -> TimeseryListCall<'a, C, A> { self._youngest = new_value.to_string(); @@ -1865,12 +1866,12 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1887,17 +1888,17 @@ impl<'a, C, A> TimeseryListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TimeseryListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimeseryListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1972,7 +1973,7 @@ impl<'a, C, A> MetricDescriptorListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudmonitoring.metricDescriptors.list", + dlg.begin(MethodInfo { id: "cloudmonitoring.metricDescriptors.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2023,14 +2024,14 @@ impl<'a, C, A> MetricDescriptorListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2074,7 +2075,7 @@ impl<'a, C, A> MetricDescriptorListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2084,10 +2085,10 @@ impl<'a, C, A> MetricDescriptorListCall<'a, C, A> where C: BorrowMut MetricDescriptorListCall<'a, C, A> where C: BorrowMut MetricDescriptorListCall<'a, C, A> { self._request = new_value; @@ -2129,7 +2130,7 @@ impl<'a, C, A> MetricDescriptorListCall<'a, C, A> where C: BorrowMut MetricDescriptorListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2168,12 +2169,12 @@ impl<'a, C, A> MetricDescriptorListCall<'a, C, A> where C: BorrowMut MetricDescriptorListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MetricDescriptorListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MetricDescriptorListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2263,7 +2264,7 @@ impl<'a, C, A> MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudmonitoring.metricDescriptors.delete", + dlg.begin(MethodInfo { id: "cloudmonitoring.metricDescriptors.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2306,7 +2307,7 @@ impl<'a, C, A> MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2342,7 +2343,7 @@ impl<'a, C, A> MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2352,10 +2353,10 @@ impl<'a, C, A> MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut MetricDescriptorDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -2398,7 +2399,7 @@ impl<'a, C, A> MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut MetricDescriptorDeleteCall<'a, C, A> { self._metric = new_value.to_string(); @@ -2416,12 +2417,12 @@ impl<'a, C, A> MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut MetricDescriptorDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MetricDescriptorDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MetricDescriptorDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2517,7 +2518,7 @@ impl<'a, C, A> MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudmonitoring.metricDescriptors.create", + dlg.begin(MethodInfo { id: "cloudmonitoring.metricDescriptors.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2559,14 +2560,14 @@ impl<'a, C, A> MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2610,7 +2611,7 @@ impl<'a, C, A> MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2620,10 +2621,10 @@ impl<'a, C, A> MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut MetricDescriptorCreateCall<'a, C, A> { self._request = new_value; @@ -2665,7 +2666,7 @@ impl<'a, C, A> MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut MetricDescriptorCreateCall<'a, C, A> { self._project = new_value.to_string(); @@ -2683,12 +2684,12 @@ impl<'a, C, A> MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut MetricDescriptorCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MetricDescriptorCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MetricDescriptorCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/cloudresourcemanager1_beta1-cli/Cargo.toml b/gen/cloudresourcemanager1_beta1-cli/Cargo.toml index 719ff82ddd..b5239760f4 100644 --- a/gen/cloudresourcemanager1_beta1-cli/Cargo.toml +++ b/gen/cloudresourcemanager1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudresourcemanager1_beta1-cli" -version = "0.3.2+20150909" +version = "0.3.3+20160112" authors = ["Sebastian Thiel "] description = "A complete library to interact with cloudresourcemanager (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1_beta1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/cloudresourcemanager1_beta1-cli/LICENSE.md b/gen/cloudresourcemanager1_beta1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudresourcemanager1_beta1-cli/LICENSE.md +++ b/gen/cloudresourcemanager1_beta1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/cloudresourcemanager1_beta1-cli/README.md b/gen/cloudresourcemanager1_beta1-cli/README.md index 9ee50ba276..8f19bb4c14 100644 --- a/gen/cloudresourcemanager1_beta1-cli/README.md +++ b/gen/cloudresourcemanager1_beta1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *cloudresourcemanager* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/cloudresourcemanager1-beta1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/cloudresourcemanager1-beta1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/cloudresourcemanager1-beta1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/cloudresourcemanager1-beta1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1_beta1-cli). # Usage -This documentation was generated from the *cloudresourcemanager* API at revision *20150909*. The CLI is at version *0.3.2*. +This documentation was generated from the *cloudresourcemanager* API at revision *20160112*. The CLI is at version *0.3.3*. ```bash cloudresourcemanager1-beta1 [options] @@ -49,18 +49,18 @@ cloudresourcemanager1-beta1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml b/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml index 993c61d1da..daf7017010 100644 --- a/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml +++ b/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: cloudresourcemanager v0.3.2+20150909 +site_name: cloudresourcemanager v0.3.3+20160112 site_url: http://byron.github.io/google-apis-rs/google-cloudresourcemanager1_beta1-cli site_description: Write integrating applications with bcore @@ -27,5 +27,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/cloudresourcemanager1_beta1-cli/src/main.rs b/gen/cloudresourcemanager1_beta1-cli/src/main.rs index f2fddf9b94..243055cca9 100644 --- a/gen/cloudresourcemanager1_beta1-cli/src/main.rs +++ b/gen/cloudresourcemanager1_beta1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Cloudresourcemanager>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _organizations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _organizations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.organizations().get(opt.value_of("organization-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,13 +97,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _organizations_get_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _organizations_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -117,8 +117,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -132,7 +132,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.organizations().get_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -145,7 +145,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -158,7 +158,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -181,10 +181,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _organizations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _organizations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.organizations().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -206,7 +206,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); @@ -220,7 +220,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -243,13 +243,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _organizations_set_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _organizations_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -263,8 +263,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -280,7 +280,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.organizations().set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -293,7 +293,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -306,7 +306,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -329,13 +329,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _organizations_test_iam_permissions(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _organizations_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -349,8 +349,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -365,7 +365,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.organizations().test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -378,7 +378,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -391,7 +391,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -414,13 +414,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _organizations_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _organizations_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -434,14 +434,15 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "organization-id" => Some(("organizationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "owner.directory-customer-id" => Some(("owner.directoryCustomerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creation-time" => Some(("creationTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["directory-customer-id", "display-name", "organization-id", "owner"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-time", "directory-customer-id", "display-name", "organization-id", "owner"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -452,7 +453,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Organization = json::value::from_value(object).unwrap(); let mut call = self.hub.organizations().update(request, opt.value_of("organization-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -465,7 +466,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -478,7 +479,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -501,13 +502,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -521,8 +522,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "parent.type" => Some(("parent.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -544,7 +545,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Project = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -557,7 +558,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -570,7 +571,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -593,10 +594,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().delete(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -609,7 +610,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -622,7 +623,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -645,10 +646,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().get(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -661,7 +662,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -674,7 +675,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -697,13 +698,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_get_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -717,8 +718,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -732,7 +733,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().get_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -745,7 +746,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -758,7 +759,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -781,10 +782,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -806,7 +807,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); @@ -820,7 +821,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -843,13 +844,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_set_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -863,8 +864,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -880,7 +881,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -893,7 +894,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -906,7 +907,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -929,13 +930,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_test_iam_permissions(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -949,8 +950,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -965,7 +966,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -978,7 +979,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -991,7 +992,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1014,10 +1015,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_undelete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_undelete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().undelete(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1030,7 +1031,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1043,7 +1044,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1066,13 +1067,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1086,8 +1087,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "parent.type" => Some(("parent.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1109,7 +1110,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Project = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().update(request, opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1122,7 +1123,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1135,7 +1136,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1241,14 +1242,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "cloudresourcemanager1-beta1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "cloudresourcemanager1-beta1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1268,7 +1269,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1311,8 +1312,8 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("organizations", "methods: 'get', 'get-iam-policy', 'list', 'set-iam-policy', 'test-iam-permissions' and 'update'", vec![ - ("get", - Some(r##"Fetches an Organization resource by id."##), + ("get", + Some(r##"Fetches an Organization resource identified by the specified `organization_id`."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/organizations_get", vec![ (Some(r##"organization-id"##), @@ -1333,13 +1334,13 @@ fn main() { Some(false), Some(false)), ]), - ("get-iam-policy", - Some(r##"Gets the access control policy for a Organization resource. May be empty if no such policy or resource exists."##), + ("get-iam-policy", + Some(r##"Gets the access control policy for an Organization resource. May be empty if no such policy or resource exists."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/organizations_get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), Some(true), Some(false)), @@ -1361,8 +1362,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Query Organization resources."##), + ("list", + Some(r##"Lists Organization resources that are visible to the user and satisfy the specified filter. This method returns Organizations in an unspecified order. New Organizations do not necessarily appear at the end of the list."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/organizations_list", vec![ (Some(r##"v"##), @@ -1377,13 +1378,13 @@ fn main() { Some(false), Some(false)), ]), - ("set-iam-policy", - Some(r##"Sets the access control policy on a Organization resource. Replaces any existing policy."##), + ("set-iam-policy", + Some(r##"Sets the access control policy on an Organization resource. Replaces any existing policy."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/organizations_set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`."##), + Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), Some(true), Some(false)), @@ -1405,13 +1406,13 @@ fn main() { Some(false), Some(false)), ]), - ("test-iam-permissions", + ("test-iam-permissions", Some(r##"Returns permissions that a caller has on the specified Organization."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/organizations_test-iam-permissions", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), Some(true), Some(false)), @@ -1433,8 +1434,8 @@ fn main() { Some(false), Some(false)), ]), - ("update", - Some(r##"Updates an Organization resource."##), + ("update", + Some(r##"Updates an Organization resource identified by the specified `organization_id`."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/organizations_update", vec![ (Some(r##"organization-id"##), @@ -1464,8 +1465,8 @@ fn main() { ]), ("projects", "methods: 'create', 'delete', 'get', 'get-iam-policy', 'list', 'set-iam-policy', 'test-iam-permissions', 'undelete' and 'update'", vec![ - ("create", - Some(r##"Creates a project resource. Initially, the project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the project. Several APIs are activated automatically for the project, including Google Cloud Storage."##), + ("create", + Some(r##"Creates a Project resource. Initially, the Project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the Project. Several APIs are activated automatically for the Project, including Google Cloud Storage."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_create", vec![ (Some(r##"kv"##), @@ -1486,13 +1487,13 @@ fn main() { Some(false), Some(false)), ]), - ("delete", - Some(r##"Marks the project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the project if the following criteria are met: + The project does not have a billing account associated with it. + The project has a lifecycle state of [ACTIVE][google.cloudresourcemanager.projects.v1beta1.LifecycleState.ACTIVE]. This method changes the project's lifecycle state from [ACTIVE][google.cloudresourcemanager.projects.v1beta1.LifecycleState.ACTIVE] to [DELETE_REQUESTED] [google.cloudresourcemanager.projects.v1beta1.LifecycleState.DELETE_REQUESTED]. The deletion starts at an unspecified time, at which point the lifecycle state changes to [DELETE_IN_PROGRESS] [google.cloudresourcemanager.projects.v1beta1.LifecycleState.DELETE_IN_PROGRESS]. Until the deletion completes, you can check the lifecycle state checked by retrieving the project with [GetProject] [google.cloudresourcemanager.projects.v1beta1.DeveloperProjects.GetProject], and the project remains visible to [ListProjects] [google.cloudresourcemanager.projects.v1beta1.DeveloperProjects.ListProjects]. However, you cannot update the project. After the deletion completes, the project is not retrievable by the [GetProject] [google.cloudresourcemanager.projects.v1beta1.DeveloperProjects.GetProject] and [ListProjects] [google.cloudresourcemanager.projects.v1beta1.DeveloperProjects.ListProjects] methods. The caller must have modify permissions for this project."##), + ("delete", + Some(r##"Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the lifecycle state changes to DELETE_IN_PROGRESS. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_delete", vec![ (Some(r##"project-id"##), None, - Some(r##"The project ID (for example, `foo-bar-123`). Required."##), + Some(r##"The Project ID (for example, `foo-bar-123`). Required."##), Some(true), Some(false)), @@ -1508,13 +1509,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", - Some(r##"Retrieves the project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this project."##), + ("get", + Some(r##"Retrieves the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_get", vec![ (Some(r##"project-id"##), None, - Some(r##"The project ID (for example, `my-project-123`). Required."##), + Some(r##"The Project ID (for example, `my-project-123`). Required."##), Some(true), Some(false)), @@ -1530,13 +1531,13 @@ fn main() { Some(false), Some(false)), ]), - ("get-iam-policy", - Some(r##"Returns the IAM access control policy for specified project."##), + ("get-iam-policy", + Some(r##"Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), Some(true), Some(false)), @@ -1558,8 +1559,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Lists projects that are visible to the user and satisfy the specified filter. This method returns projects in an unspecified order. New projects do not necessarily appear at the end of the list."##), + ("list", + Some(r##"Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_list", vec![ (Some(r##"v"##), @@ -1574,13 +1575,13 @@ fn main() { Some(false), Some(false)), ]), - ("set-iam-policy", - Some(r##"Sets the IAM access control policy for the specified project. We do not currently support 'domain:' prefixed members in a Binding of a Policy. Calling this method requires enabling the App Engine Admin API."##), + ("set-iam-policy", + Some(r##"Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project currently supports only `user:{emailid}` and `serviceAccount:{emailid}` members in a `Binding` of a `Policy`. + To be added as an `owner`, a user must be invited via Cloud Platform console and must accept the invitation. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`."##), + Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), Some(true), Some(false)), @@ -1602,13 +1603,13 @@ fn main() { Some(false), Some(false)), ]), - ("test-iam-permissions", - Some(r##"Tests the specified permissions against the IAM access control policy for the specified project."##), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_test-iam-permissions", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), Some(true), Some(false)), @@ -1630,8 +1631,8 @@ fn main() { Some(false), Some(false)), ]), - ("undelete", - Some(r##"Restores the project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a project that has a lifecycle state of [DELETE_REQUESTED] [google.cloudresourcemanager.projects.v1beta1.LifecycleState.DELETE_REQUESTED]. After deletion starts, as indicated by a lifecycle state of [DELETE_IN_PROGRESS] [google.cloudresourcemanager.projects.v1beta1.LifecycleState.DELETE_IN_PROGRESS], the project cannot be restored. The caller must have modify permissions for this project."##), + ("undelete", + Some(r##"Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, as indicated by a lifecycle state of DELETE_IN_PROGRESS, the Project cannot be restored. The caller must have modify permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_undelete", vec![ (Some(r##"project-id"##), @@ -1652,8 +1653,8 @@ fn main() { Some(false), Some(false)), ]), - ("update", - Some(r##"Updates the attributes of the project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this project."##), + ("update", + Some(r##"Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project."##), "Details at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli/projects_update", vec![ (Some(r##"project-id"##), @@ -1686,8 +1687,8 @@ fn main() { let mut app = App::new("cloudresourcemanager1-beta1") .author("Sebastian Thiel ") - .version("0.3.2+20150909") - .about("The Google Cloud Resource Manager API provides methods for creating, reading, and updating of project metadata.") + .version("0.3.3+20160112") + .about("The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudresourcemanager1_beta1_cli") .arg(Arg::with_name("url") .long("scope") @@ -1710,7 +1711,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1721,7 +1722,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/cloudresourcemanager1_beta1/Cargo.toml b/gen/cloudresourcemanager1_beta1/Cargo.toml index 4641de2a1b..fdcb04772c 100644 --- a/gen/cloudresourcemanager1_beta1/Cargo.toml +++ b/gen/cloudresourcemanager1_beta1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudresourcemanager1_beta1" -version = "0.1.10+20150909" +version = "0.1.11+20160112" authors = ["Sebastian Thiel "] description = "A complete library to interact with cloudresourcemanager (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1_beta1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/cloudresourcemanager1_beta1/LICENSE.md b/gen/cloudresourcemanager1_beta1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudresourcemanager1_beta1/LICENSE.md +++ b/gen/cloudresourcemanager1_beta1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/cloudresourcemanager1_beta1/README.md b/gen/cloudresourcemanager1_beta1/README.md index 175bb55e37..5c64180c25 100644 --- a/gen/cloudresourcemanager1_beta1/README.md +++ b/gen/cloudresourcemanager1_beta1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-cloudresourcemanager1_beta1` library allows access to all features of the *Google cloudresourcemanager* service. -This documentation was generated from *cloudresourcemanager* crate version *0.1.10+20150909*, where *20150909* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *cloudresourcemanager* crate version *0.1.11+20160112*, where *20160112* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *cloudresourcemanager* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/resource-manager). diff --git a/gen/cloudresourcemanager1_beta1/src/cmn.rs b/gen/cloudresourcemanager1_beta1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/cloudresourcemanager1_beta1/src/cmn.rs +++ b/gen/cloudresourcemanager1_beta1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/cloudresourcemanager1_beta1/src/lib.rs b/gen/cloudresourcemanager1_beta1/src/lib.rs index a83fee9c60..d2bd13f5f0 100644 --- a/gen/cloudresourcemanager1_beta1/src/lib.rs +++ b/gen/cloudresourcemanager1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *cloudresourcemanager* crate version *0.1.10+20150909*, where *20150909* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *cloudresourcemanager* crate version *0.1.11+20160112*, where *20160112* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *cloudresourcemanager* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/resource-manager). diff --git a/gen/cloudresourcemanager1_beta1/src/lib.rs.in b/gen/cloudresourcemanager1_beta1/src/lib.rs.in index 6021a121d2..340a4678f7 100644 --- a/gen/cloudresourcemanager1_beta1/src/lib.rs.in +++ b/gen/cloudresourcemanager1_beta1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -37,12 +38,16 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, pub enum Scope { /// View and manage your data across Google Cloud Platform services CloudPlatform, + + /// View your data across Google Cloud Platform services + CloudPlatformReadOnly, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", } } } @@ -129,7 +134,7 @@ impl<'a, C, A> Cloudresourcemanager Cloudresourcemanager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -141,7 +146,7 @@ impl<'a, C, A> Cloudresourcemanager } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -174,14 +179,14 @@ impl<'a, C, A> Cloudresourcemanager /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Project { - /// The user-assigned name of the project. It must be 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: My Project Read-write. + /// The user-assigned name of the Project. It must be 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: My Project Read-write. pub name: Option, /// An optional reference to a parent Resource. The only supported parent type is "organization". Once set, the parent cannot be modified. Read-write. pub parent: Option, - /// The unique, user-assigned ID of the project. It must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: tokyo-rain-123 Read-only after creation. + /// The unique, user-assigned ID of the Project. It must be 6 to 30 lowercase letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: tokyo-rain-123 Read-only after creation. #[serde(rename="projectId")] pub project_id: Option, - /// The labels associated with this project. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. Label values must be between 0 and 63 characters long and must conform to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. No more than 256 labels can be associated with a given resource. Clients should store labels in a representation such as JSON that does not depend on specific characters being disallowed. Example: "environment" : "dev" Read-write. + /// The labels associated with this Project. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. Label values must be between 0 and 63 characters long and must conform to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. No more than 256 labels can be associated with a given resource. Clients should store labels in a representation such as JSON that does not depend on specific characters being disallowed. Example: "environment" : "dev" Read-write. pub labels: Option>, /// The number uniquely identifying the project. Example: 415104041262 Read-only. #[serde(rename="projectNumber")] @@ -189,7 +194,7 @@ pub struct Project { /// Creation time. Read-only. #[serde(rename="createTime")] pub create_time: Option, - /// The project lifecycle state. Read-only. + /// The Project lifecycle state. Read-only. #[serde(rename="lifecycleState")] pub lifecycle_state: Option, } @@ -246,7 +251,7 @@ impl RequestValue for GetIamPolicyRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TestIamPermissionsRequest { - /// The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. + /// The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview. pub permissions: Option>, } @@ -272,7 +277,7 @@ pub struct SetIamPolicyRequest { impl RequestValue for SetIamPolicyRequest {} -/// A container to reference an id for any resource type. A 'resource' in Google Cloud Platform is a generic term for something you (a developer) may want to interact with through one of our API's. Some examples are an AppEngine app, a Compute Engine instance, Cloud SQL database, ... +/// A container to reference an id for any resource type. A `resource` in Google Cloud Platform is a generic term for something you (a developer) may want to interact with through one of our API's. Some examples are an AppEngine app, a Compute Engine instance, a Cloud SQL database, and so on. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -296,14 +301,14 @@ impl Part for ResourceId {} pub struct Binding { /// Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required pub role: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following formats: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. + /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. pub members: Option>, } impl Part for Binding {} -/// The response returned from the ListOrganizations method. +/// The response returned from the `ListOrganizations` method. /// /// # Activities /// @@ -324,7 +329,7 @@ pub struct ListOrganizationsResponse { impl ResponseResult for ListOrganizationsResponse {} -/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** ``` { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com"] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } ``` For a description of IAM and its features, see the [IAM developer's guide][https://cloud.google.com/iam]. +/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com"] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). /// /// # Activities /// @@ -342,7 +347,7 @@ pub struct Policy { pub bindings: Option>, /// Version of the `Policy`. The default version is 0. pub version: Option, - /// Can be used to perform a read-modify-write. + /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly. pub etag: Option, } @@ -368,11 +373,14 @@ pub struct Organization { /// An immutable id for the Organization that is assigned on creation. This should be omitted when creating a new Organization. This field is read-only. #[serde(rename="organizationId")] pub organization_id: Option, - /// The owner of this Organization. The owner should be specified upon creation. Once set, it cannot be changed. This field is required. + /// The owner of this Organization. The owner should be specified on creation. Once set, it cannot be changed. This field is required. pub owner: Option, /// A friendly string to be used to refer to the Organization in the UI. This field is required. #[serde(rename="displayName")] pub display_name: Option, + /// Timestamp when the Organization was created. Assigned by the server. @OutputOnly + #[serde(rename="creationTime")] + pub creation_time: Option, } impl RequestValue for Organization {} @@ -380,7 +388,7 @@ impl Resource for Organization {} impl ResponseResult for Organization {} -/// A page of the response received from the [ListProjects][google.cloudresourcemanager.projects.v1beta1.DeveloperProjects.ListProjects] method. A paginated response where more pages are available has `next_page_token` set. This token can be used in a subsequent request to retrieve the next request page. +/// A page of the response received from the ListProjects method. A paginated response where more pages are available has `next_page_token` set. This token can be used in a subsequent request to retrieve the next request page. /// /// # Activities /// @@ -391,10 +399,10 @@ impl ResponseResult for Organization {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListProjectsResponse { - /// Pagination token. If the result set is too large to fit in a single response, this token is returned. It encodes the position of the current result cursor. Feeding this value into a new list request with the `page_token` parameter gives the next page of the results. When `next_page_token` is not filled in, there is no next page and the list returned is the last page in the result set. Pagination tokens have a limited lifetime. Note: pagination is not yet supported; the server will not set this field. + /// Pagination token. If the result set is too large to fit in a single response, this token is returned. It encodes the position of the current result cursor. Feeding this value into a new list request with the `page_token` parameter gives the next page of the results. When `next_page_token` is not filled in, there is no next page and the list returned is the last page in the result set. Pagination tokens have a limited lifetime. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The list of projects that matched the list filter. This list can be paginated. + /// The list of Projects that matched the list filter. This list can be paginated. pub projects: Option>, } @@ -417,7 +425,7 @@ pub struct Empty; impl ResponseResult for Empty {} -/// The entity that owns an Organization. The lifetime of the Organization and all of its descendants are bound to the OrganizationOwner. If the OrganizationOwner is deleted, the Organization and all its descendants will be deleted. +/// The entity that owns an Organization. The lifetime of the Organization and all of its descendants are bound to the `OrganizationOwner`. If the `OrganizationOwner` is deleted, the Organization and all its descendants will be deleted. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -476,12 +484,12 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the access control policy on a Organization resource. Replaces any existing policy. + /// Sets the access control policy on an Organization resource. Replaces any existing policy. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> OrganizationSetIamPolicyCall<'a, C, A> { OrganizationSetIamPolicyCall { hub: self.hub, @@ -495,12 +503,12 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the access control policy for a Organization resource. May be empty if no such policy or resource exists. + /// Gets the access control policy for an Organization resource. May be empty if no such policy or resource exists. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> OrganizationGetIamPolicyCall<'a, C, A> { OrganizationGetIamPolicyCall { hub: self.hub, @@ -519,7 +527,7 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> OrganizationTestIamPermissionCall<'a, C, A> { OrganizationTestIamPermissionCall { hub: self.hub, @@ -533,7 +541,7 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Fetches an Organization resource by id. + /// Fetches an Organization resource identified by the specified `organization_id`. /// /// # Arguments /// @@ -550,7 +558,7 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates an Organization resource. + /// Updates an Organization resource identified by the specified `organization_id`. /// /// # Arguments /// @@ -569,7 +577,7 @@ impl<'a, C, A> OrganizationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Query Organization resources. + /// Lists Organization resources that are visible to the user and satisfy the specified filter. This method returns Organizations in an unspecified order. New Organizations do not necessarily appear at the end of the list. pub fn list(&self) -> OrganizationListCall<'a, C, A> { OrganizationListCall { hub: self.hub, @@ -625,12 +633,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Tests the specified permissions against the IAM access control policy for the specified project. + /// Returns permissions that a caller has on the specified Project. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectTestIamPermissionCall<'a, C, A> { ProjectTestIamPermissionCall { hub: self.hub, @@ -644,7 +652,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Restores the project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a project that has a lifecycle state of [DELETE_REQUESTED] [google.cloudresourcemanager.projects.v1beta1.LifecycleState.DELETE_REQUESTED]. After deletion starts, as indicated by a lifecycle state of [DELETE_IN_PROGRESS] [google.cloudresourcemanager.projects.v1beta1.LifecycleState.DELETE_IN_PROGRESS], the project cannot be restored. The caller must have modify permissions for this project. + /// Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, as indicated by a lifecycle state of DELETE_IN_PROGRESS, the Project cannot be restored. The caller must have modify permissions for this Project. /// /// # Arguments /// @@ -661,7 +669,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a project resource. Initially, the project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the project. Several APIs are activated automatically for the project, including Google Cloud Storage. + /// Creates a Project resource. Initially, the Project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the Project. Several APIs are activated automatically for the Project, including Google Cloud Storage. /// /// # Arguments /// @@ -678,12 +686,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the IAM access control policy for the specified project. We do not currently support 'domain:' prefixed members in a Binding of a Policy. Calling this method requires enabling the App Engine Admin API. + /// Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project currently supports only `user:{emailid}` and `serviceAccount:{emailid}` members in a `Binding` of a `Policy`. + To be added as an `owner`, a user must be invited via Cloud Platform console and must accept the invitation. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectSetIamPolicyCall<'a, C, A> { ProjectSetIamPolicyCall { hub: self.hub, @@ -697,11 +705,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this project. + /// Retrieves the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have read permissions for this Project. /// /// # Arguments /// - /// * `projectId` - The project ID (for example, `my-project-123`). Required. + /// * `projectId` - The Project ID (for example, `my-project-123`). Required. pub fn get(&self, project_id: &str) -> ProjectGetCall<'a, C, A> { ProjectGetCall { hub: self.hub, @@ -714,7 +722,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the attributes of the project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this project. + /// Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project. /// /// # Arguments /// @@ -733,12 +741,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns the IAM access control policy for specified project. + /// Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist. /// /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> ProjectGetIamPolicyCall<'a, C, A> { ProjectGetIamPolicyCall { hub: self.hub, @@ -752,11 +760,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Marks the project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the project if the following criteria are met: + The project does not have a billing account associated with it. + The project has a lifecycle state of [ACTIVE][google.cloudresourcemanager.projects.v1beta1.LifecycleState.ACTIVE]. This method changes the project's lifecycle state from [ACTIVE][google.cloudresourcemanager.projects.v1beta1.LifecycleState.ACTIVE] to [DELETE_REQUESTED] [google.cloudresourcemanager.projects.v1beta1.LifecycleState.DELETE_REQUESTED]. The deletion starts at an unspecified time, at which point the lifecycle state changes to [DELETE_IN_PROGRESS] [google.cloudresourcemanager.projects.v1beta1.LifecycleState.DELETE_IN_PROGRESS]. Until the deletion completes, you can check the lifecycle state checked by retrieving the project with [GetProject] [google.cloudresourcemanager.projects.v1beta1.DeveloperProjects.GetProject], and the project remains visible to [ListProjects] [google.cloudresourcemanager.projects.v1beta1.DeveloperProjects.ListProjects]. However, you cannot update the project. After the deletion completes, the project is not retrievable by the [GetProject] [google.cloudresourcemanager.projects.v1beta1.DeveloperProjects.GetProject] and [ListProjects] [google.cloudresourcemanager.projects.v1beta1.DeveloperProjects.ListProjects] methods. The caller must have modify permissions for this project. + /// Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the lifecycle state changes to DELETE_IN_PROGRESS. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project. /// /// # Arguments /// - /// * `projectId` - The project ID (for example, `foo-bar-123`). Required. + /// * `projectId` - The Project ID (for example, `foo-bar-123`). Required. pub fn delete(&self, project_id: &str) -> ProjectDeleteCall<'a, C, A> { ProjectDeleteCall { hub: self.hub, @@ -769,7 +777,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists projects that are visible to the user and satisfy the specified filter. This method returns projects in an unspecified order. New projects do not necessarily appear at the end of the list. + /// Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list. pub fn list(&self) -> ProjectListCall<'a, C, A> { ProjectListCall { hub: self.hub, @@ -791,7 +799,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Sets the access control policy on a Organization resource. Replaces any existing policy. +/// Sets the access control policy on an Organization resource. Replaces any existing policy. /// /// A builder for the *setIamPolicy* method supported by a *organization* resource. /// It is not used directly, but through a `OrganizationMethods` instance. @@ -852,7 +860,7 @@ impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.setIamPolicy", + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.setIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -894,14 +902,14 @@ impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -945,7 +953,7 @@ impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -955,10 +963,10 @@ impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetIamPolicyCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> OrganizationSetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -1018,12 +1026,12 @@ impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrganizationSetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrganizationSetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1064,7 +1072,7 @@ impl<'a, C, A> OrganizationSetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.getIamPolicy", + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.getIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -1167,14 +1175,14 @@ impl<'a, C, A> OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1218,7 +1226,7 @@ impl<'a, C, A> OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1228,10 +1236,10 @@ impl<'a, C, A> OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`. + /// REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> OrganizationGetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -1291,12 +1299,12 @@ impl<'a, C, A> OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut OrganizationGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrganizationGetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrganizationGetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1398,7 +1406,7 @@ impl<'a, C, A> OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.testIamPermissions", + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.testIamPermissions", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -1440,14 +1448,14 @@ impl<'a, C, A> OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1491,7 +1499,7 @@ impl<'a, C, A> OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1501,10 +1509,10 @@ impl<'a, C, A> OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationTestIamPermissionCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> OrganizationTestIamPermissionCall<'a, C, A> { self._resource = new_value.to_string(); @@ -1564,12 +1572,12 @@ impl<'a, C, A> OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrganizationTestIamPermissionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrganizationTestIamPermissionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1610,7 +1618,7 @@ impl<'a, C, A> OrganizationTestIamPermissionCall<'a, C, A> where C: BorrowMut OrganizationGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.get", + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("organizationId", self._organization_id.to_string())); @@ -1706,7 +1714,7 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1742,7 +1750,7 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1752,10 +1760,10 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1788,7 +1796,7 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *organization id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn organization_id(mut self, new_value: &str) -> OrganizationGetCall<'a, C, A> { self._organization_id = new_value.to_string(); @@ -1806,12 +1814,12 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1834,17 +1842,17 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrganizationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrganizationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1852,7 +1860,7 @@ impl<'a, C, A> OrganizationGetCall<'a, C, A> where C: BorrowMut, } -/// Updates an Organization resource. +/// Updates an Organization resource identified by the specified `organization_id`. /// /// A builder for the *update* method supported by a *organization* resource. /// It is not used directly, but through a `OrganizationMethods` instance. @@ -1913,7 +1921,7 @@ impl<'a, C, A> OrganizationUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.update", + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("organizationId", self._organization_id.to_string())); @@ -1955,14 +1963,14 @@ impl<'a, C, A> OrganizationUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2006,7 +2014,7 @@ impl<'a, C, A> OrganizationUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2016,10 +2024,10 @@ impl<'a, C, A> OrganizationUpdateCall<'a, C, A> where C: BorrowMut OrganizationUpdateCall<'a, C, A> where C: BorrowMut OrganizationUpdateCall<'a, C, A> { self._request = new_value; @@ -2061,7 +2069,7 @@ impl<'a, C, A> OrganizationUpdateCall<'a, C, A> where C: BorrowMut OrganizationUpdateCall<'a, C, A> { self._organization_id = new_value.to_string(); @@ -2079,12 +2087,12 @@ impl<'a, C, A> OrganizationUpdateCall<'a, C, A> where C: BorrowMut OrganizationUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrganizationUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrganizationUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2125,7 +2133,7 @@ impl<'a, C, A> OrganizationUpdateCall<'a, C, A> where C: BorrowMut OrganizationListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.list", + dlg.begin(MethodInfo { id: "cloudresourcemanager.organizations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -2213,7 +2221,7 @@ impl<'a, C, A> OrganizationListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2249,7 +2257,7 @@ impl<'a, C, A> OrganizationListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2259,10 +2267,10 @@ impl<'a, C, A> OrganizationListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2291,7 +2299,7 @@ impl<'a, C, A> OrganizationListCall<'a, C, A> where C: BorrowMut, } - /// A pagination token returned from a previous call to ListOrganizations that indicates from where listing should continue. This field is optional. + /// A pagination token returned from a previous call to `ListOrganizations` that indicates from where listing should continue. This field is optional. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> OrganizationListCall<'a, C, A> { @@ -2305,7 +2313,7 @@ impl<'a, C, A> OrganizationListCall<'a, C, A> where C: BorrowMut, self._page_size = Some(new_value); self } - /// An optional query string used to filter the Organizations to be return in the response. Filter rules are case-insensitive. Organizations may be filtered by `owner.directoryCustomerId` or by `domain`, where the domain is a Google for Work domain, for example: |Filter|Description| |------|-----------| |owner.directorycustomerid:123456789|Organizations with `owner.directory_customer_id` equal to `123456789`.| |domain:google.com|Organizations corresponding to the domain `google.com`.| This field is optional. + /// An optional query string used to filter the Organizations to return in the response. Filter rules are case-insensitive. Organizations may be filtered by `owner.directoryCustomerId` or by `domain`, where the domain is a Google for Work domain, for example: |Filter|Description| |------|-----------| |owner.directorycustomerid:123456789|Organizations with `owner.directory_customer_id` equal to `123456789`.| |domain:google.com|Organizations corresponding to the domain `google.com`.| This field is optional. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> OrganizationListCall<'a, C, A> { @@ -2324,12 +2332,12 @@ impl<'a, C, A> OrganizationListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2352,17 +2360,17 @@ impl<'a, C, A> OrganizationListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrganizationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrganizationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2370,7 +2378,7 @@ impl<'a, C, A> OrganizationListCall<'a, C, A> where C: BorrowMut, } -/// Tests the specified permissions against the IAM access control policy for the specified project. +/// Returns permissions that a caller has on the specified Project. /// /// A builder for the *testIamPermissions* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -2431,7 +2439,7 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.testIamPermissions", + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.testIamPermissions", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -2473,14 +2481,14 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2524,7 +2532,7 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2534,10 +2542,10 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTestIamPermissionCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectTestIamPermissionCall<'a, C, A> { self._resource = new_value.to_string(); @@ -2597,12 +2605,12 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTestIamPermissionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTestIamPermissionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2643,7 +2651,7 @@ impl<'a, C, A> ProjectTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectUndeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.undelete", + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.undelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2739,7 +2747,7 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2775,7 +2783,7 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2785,10 +2793,10 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2821,7 +2829,7 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectUndeleteCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2839,12 +2847,12 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2867,17 +2875,17 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectUndeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectUndeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2885,7 +2893,7 @@ impl<'a, C, A> ProjectUndeleteCall<'a, C, A> where C: BorrowMut, } -/// Creates a project resource. Initially, the project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the project. Several APIs are activated automatically for the project, including Google Cloud Storage. +/// Creates a Project resource. Initially, the Project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the Project. Several APIs are activated automatically for the Project, including Google Cloud Storage. /// /// A builder for the *create* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -2945,7 +2953,7 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.create", + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2965,14 +2973,14 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3016,7 +3024,7 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3026,10 +3034,10 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3061,7 +3069,7 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Project) -> ProjectCreateCall<'a, C, A> { self._request = new_value; @@ -3079,12 +3087,12 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3107,17 +3115,17 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3125,7 +3133,7 @@ impl<'a, C, A> ProjectCreateCall<'a, C, A> where C: BorrowMut, A: } -/// Sets the IAM access control policy for the specified project. We do not currently support 'domain:' prefixed members in a Binding of a Policy. Calling this method requires enabling the App Engine Admin API. +/// Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project currently supports only `user:{emailid}` and `serviceAccount:{emailid}` members in a `Binding` of a `Policy`. + To be added as an `owner`, a user must be invited via Cloud Platform console and must accept the invitation. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. /// /// A builder for the *setIamPolicy* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3186,7 +3194,7 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.setIamPolicy", + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.setIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -3228,14 +3236,14 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3279,7 +3287,7 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3289,10 +3297,10 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSetIamPolicyCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectSetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -3352,12 +3360,12 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3398,7 +3406,7 @@ impl<'a, C, A> ProjectSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.get", + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -3494,7 +3502,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3530,7 +3538,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3540,10 +3548,10 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3572,11 +3580,11 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } - /// The project ID (for example, `my-project-123`). Required. + /// The Project ID (for example, `my-project-123`). Required. /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -3594,12 +3602,12 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3622,17 +3630,17 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3640,7 +3648,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Updates the attributes of the project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this project. +/// Updates the attributes of the Project identified by the specified `project_id` (for example, `my-project-123`). The caller must have modify permissions for this Project. /// /// A builder for the *update* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3701,7 +3709,7 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.update", + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -3743,14 +3751,14 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3794,7 +3802,7 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3804,10 +3812,10 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3839,7 +3847,7 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Project) -> ProjectUpdateCall<'a, C, A> { self._request = new_value; @@ -3849,7 +3857,7 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectUpdateCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -3867,12 +3875,12 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3895,17 +3903,17 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3913,7 +3921,7 @@ impl<'a, C, A> ProjectUpdateCall<'a, C, A> where C: BorrowMut, A: } -/// Returns the IAM access control policy for specified project. +/// Returns the IAM access control policy for the specified Project. Permission is denied if the policy or the resource does not exist. /// /// A builder for the *getIamPolicy* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -3974,7 +3982,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.getIamPolicy", + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.getIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -4016,14 +4024,14 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4067,7 +4075,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4077,10 +4085,10 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetIamPolicyCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`. + /// REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectGetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -4140,12 +4148,12 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectGetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectGetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4186,7 +4194,7 @@ impl<'a, C, A> ProjectGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.delete", + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -4282,7 +4290,7 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4318,7 +4326,7 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4328,10 +4336,10 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4360,11 +4368,11 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: } - /// The project ID (for example, `foo-bar-123`). Required. + /// The Project ID (for example, `foo-bar-123`). Required. /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectDeleteCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -4382,12 +4390,12 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4410,17 +4418,17 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4428,7 +4436,7 @@ impl<'a, C, A> ProjectDeleteCall<'a, C, A> where C: BorrowMut, A: } -/// Lists projects that are visible to the user and satisfy the specified filter. This method returns projects in an unspecified order. New projects do not necessarily appear at the end of the list. +/// Lists Projects that are visible to the user and satisfy the specified filter. This method returns Projects in an unspecified order. New Projects do not necessarily appear at the end of the list. /// /// A builder for the *list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -4487,7 +4495,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.list", + dlg.begin(MethodInfo { id: "cloudresourcemanager.projects.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -4516,7 +4524,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4552,7 +4560,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4562,10 +4570,10 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4594,14 +4602,14 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } - /// A pagination token returned from a previous call to ListProject that indicates from where listing should continue. Note: pagination is not yet supported; the server ignores this field. Optional. + /// A pagination token returned from a previous call to ListProjects that indicates from where listing should continue. Optional. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// The maximum number of Projects to return in the response. The server can return fewer projects than requested. If unspecified, server picks an appropriate default. Note: pagination is not yet supported; the server ignores this field. Optional. + /// The maximum number of Projects to return in the response. The server can return fewer Projects than requested. If unspecified, server picks an appropriate default. Optional. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> ProjectListCall<'a, C, A> { @@ -4627,12 +4635,12 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4655,17 +4663,17 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/cloudsearch1-cli/Cargo.toml b/gen/cloudsearch1-cli/Cargo.toml deleted file mode 100644 index 9d29499cd6..0000000000 --- a/gen/cloudsearch1-cli/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -# DO NOT EDIT ! -# This file was generated automatically from 'src/mako/Cargo.toml.mako' -# DO NOT EDIT ! -[package] - -name = "google-cloudsearch1-cli" -version = "0.1.0+20150416" -authors = ["Sebastian Thiel "] -description = "A complete library to interact with cloudsearch (protocol v1)" -repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudsearch1-cli" -documentation = "http://byron.github.io/google-apis-rs/google_cloudsearch1_cli" -license = "MIT" -keywords = ["cloudsearch", "google", "cli"] - -[[bin]] -name = "cloudsearch1" - -[dependencies] -hyper = "*" -mime = "*" -yup-oauth2 = "*" -docopt = "*" -docopt_macros = "*" -rustc-serialize = "*" -yup-hyper-mock = "*" -serde = ">= 0.3.0" -serde_macros = "*" - -[dependencies.google-cloudsearch1] -path = "../cloudsearch1" diff --git a/gen/cloudsearch1-cli/mkdocs.yml b/gen/cloudsearch1-cli/mkdocs.yml deleted file mode 100644 index deb3e655fe..0000000000 --- a/gen/cloudsearch1-cli/mkdocs.yml +++ /dev/null @@ -1,16 +0,0 @@ -site_name: cloudsearch v0.1.0+20150416 -site_url: http://byron.github.io/google-apis-rs/google-cloudsearch1-cli -site_description: Write integrating applications with bcore - -repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/cloudsearch1-cli - -docs_dir: docs -site_dir: build_html - -pages: -- ['index.md', 'Home'] - -theme: readthedocs - -copyright: Copyright © 2015, `Sebastian Thiel` - diff --git a/gen/cloudsearch1-cli/src/cmn.rs b/gen/cloudsearch1-cli/src/cmn.rs deleted file mode 100644 index 4ba65df643..0000000000 --- a/gen/cloudsearch1-cli/src/cmn.rs +++ /dev/null @@ -1,454 +0,0 @@ -// COPY OF 'src/rust/cli/cmn.rs' -// DO NOT EDIT -use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; -use rustc_serialize::json; -use mime::Mime; - -use std::fs; -use std::env; -use std::io; -use std::fmt; -use std::path::{Path, PathBuf}; -use std::str::FromStr; -use std::string::ToString; -use std::io::{Write, Read, stdout}; - -use std::default::Default; - -const FIELD_SEP: char = '.'; - -#[derive(Clone, Default)] -pub struct FieldCursor(Vec); - -impl ToString for FieldCursor { - fn to_string(&self) -> String { - self.0.connect(".") - } -} - -impl FieldCursor { - pub fn set(&mut self, value: &str) -> Result<(), CLIError> { - if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) - } - - let mut first_is_field_sep = false; - let mut char_count: usize = 0; - let mut last_c = FIELD_SEP; - let mut num_conscutive_field_seps = 0; - - let mut field = String::new(); - let mut fields = self.0.clone(); - - let push_field = |fs: &mut Vec, f: &mut String| { - if f.len() > 0 { - fs.push(f.clone()); - f.truncate(0); - } - }; - - for (cid, c) in value.chars().enumerate() { - char_count += 1; - - if c == FIELD_SEP { - if cid == 0 { - first_is_field_sep = true; - } - num_conscutive_field_seps += 1; - if cid > 0 && last_c == FIELD_SEP { - if fields.pop().is_none() { - return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) - } - } else { - push_field(&mut fields, &mut field); - } - } else { - num_conscutive_field_seps = 0; - if cid == 1 { - if first_is_field_sep { - fields.truncate(0); - } - } - field.push(c); - } - - last_c = c; - } - - push_field(&mut fields, &mut field); - - if char_count == 1 && first_is_field_sep { - fields.truncate(0); - } - if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) - } - - self.0 = fields; - Ok(()) - } - - pub fn num_fields(&self) -> usize { - self.0.len() - } -} - -pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) - -> (&'a str, Option<&'a str>) { - let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); - match kv.find('=') { - None => { - add_err(); - return (kv, None) - }, - Some(pos) => { - let key = &kv[..pos]; - if kv.len() <= pos + 1 { - add_err(); - return (key, Some("")) - } - (key, Some(&kv[pos+1..])) - } - } -} - -pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { - match fs::File::open(file_path) { - Ok(f) => Some(f), - Err(io_err) => { - err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); - None - } - } -} - -pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { - match mime.parse() { - Ok(m) => Some(m), - Err(_) => { - err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); - None - } - } -} - -// May panic if we can't open the file - this is anticipated, we can't currently communicate this -// kind of error: TODO: fix this architecture :) -pub fn writer_from_opts(flag: bool, arg: &str) -> Box { - if !flag || arg == "-" { - Box::new(stdout()) - } else { - Box::new(fs::OpenOptions::new().create(true).write(true).open(arg).unwrap()) - } -} - - -pub fn arg_from_str(arg: &str, err: &mut InvalidOptionsError, - arg_name: &'static str, - arg_type: &'static str) -> T - where T: FromStr + Default, - ::Err: fmt::Display { - match FromStr::from_str(arg) { - Err(perr) => { - err.issues.push( - CLIError::ParseError((arg_name, arg_type, arg.to_string(), format!("{}", perr))) - ); - Default::default() - }, - Ok(v) => v, - } -} - -pub struct JsonTokenStorage { - pub program_name: &'static str, - pub db_dir: String, -} - -impl JsonTokenStorage { - fn path(&self, scope_hash: u64) -> PathBuf { - Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) - } -} - -impl TokenStorage for JsonTokenStorage { - type Error = io::Error; - - // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Option { - match token { - None => { - match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => None, - _ => Some(err) - }, - Ok(_) => None - } - } - Some(token) => { - let json_token = json::encode(&token).unwrap(); - match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { - Ok(mut f) => { - match f.write(json_token.as_bytes()) { - Ok(_) => None, - Err(io_err) => Some(io_err), - } - }, - Err(io_err) => Some(io_err) - } - } - } - } - - fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, io::Error> { - match fs::File::open(&self.path(scope_hash)) { - Ok(mut f) => { - let mut json_string = String::new(); - match f.read_to_string(&mut json_string) { - Ok(_) => Ok(Some(json::decode::(&json_string).unwrap())), - Err(io_err) => Err(io_err), - } - }, - Err(io_err) => { - match io_err.kind() { - io::ErrorKind::NotFound => Ok(None), - _ => Err(io_err) - } - } - } - } -} - - -#[derive(Debug)] -pub enum ApplicationSecretError { - DecoderError((String, json::DecoderError)), - FormatError(String), -} - -impl fmt::Display for ApplicationSecretError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - match *self { - ApplicationSecretError::DecoderError((ref path, ref err)) - => writeln!(f, "Could not decode file at '{}' with error: {}", - path, err), - ApplicationSecretError::FormatError(ref path) - => writeln!(f, "'installed' field is unset in secret file at '{}'", - path), - } - } -} - -#[derive(Debug)] -pub enum ConfigurationError { - DirectoryCreationFailed((String, io::Error)), - DirectoryUnset, - HomeExpansionFailed(String), - Secret(ApplicationSecretError), - IOError((String, io::Error)), -} - -impl fmt::Display for ConfigurationError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - match *self { - ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) - => writeln!(f, "Directory '{}' could not be created with error: {}", dir, err), - ConfigurationError::DirectoryUnset - => writeln!(f, "--config-dir was unset or empty"), - ConfigurationError::HomeExpansionFailed(ref dir) - => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'", dir), - ConfigurationError::Secret(ref err) - => writeln!(f, "Secret -> {}", err), - ConfigurationError::IOError((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}", path, err), - } - } -} - -#[derive(Debug)] -pub enum InputError { - IOError((String, io::Error)), - Mime(String), -} - -impl fmt::Display for InputError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - match *self { - InputError::IOError((ref file_path, ref io_err)) - => writeln!(f, "Failed to open '{}' for reading with error: {}", file_path, io_err), - InputError::Mime(ref mime) - => writeln!(f, "'{}' is not a known mime-type", mime), - } - } -} - -#[derive(Debug)] -pub enum FieldError { - PopOnEmpty(String), - TrailingFieldSep(String), - Unknown(String), - Empty, -} - - -impl fmt::Display for FieldError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - match *self { - FieldError::PopOnEmpty(ref field) - => writeln!(f, "'{}': Cannot move up on empty field cursor", field), - FieldError::TrailingFieldSep(ref field) - => writeln!(f, "'{}': Single field separator may not be last character", field), - FieldError::Unknown(ref field) - => writeln!(f, "Field '{}' does not exist", field), - FieldError::Empty - => writeln!(f, "Field names must not be empty"), - } - } -} - - -#[derive(Debug)] -pub enum CLIError { - Configuration(ConfigurationError), - ParseError((&'static str, &'static str, String, String)), - UnknownParameter(String), - InvalidKeyValueSyntax(String, bool), - Input(InputError), - Field(FieldError), -} - -impl fmt::Display for CLIError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - match *self { - CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), - CLIError::Input(ref err) => write!(f, "Input -> {}", err), - CLIError::Field(ref err) => write!(f, "Field -> {}", err), - CLIError::ParseError((arg_name, type_name, ref value, ref err_desc)) - => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}", - arg_name, value, type_name, err_desc), - CLIError::UnknownParameter(ref param_name) - => writeln!(f, "Parameter '{}' is unknown.", param_name), - CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { - let hashmap_info = if is_hashmap { "hashmap " } else { "" }; - writeln!(f, "'{}' does not match {}pattern =", kv, hashmap_info) - }, - } - } -} - -#[derive(Debug)] -pub struct InvalidOptionsError { - pub issues: Vec, - pub exit_code: i32, -} - -impl fmt::Display for InvalidOptionsError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - for issue in &self.issues { - try!(issue.fmt(f)); - } - Ok(()) - } -} - -impl InvalidOptionsError { - pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { - InvalidOptionsError { - issues: vec![err], - exit_code: exit_code, - } - } - - pub fn new() -> InvalidOptionsError { - InvalidOptionsError { - issues: Vec::new(), - exit_code: 1, - } - } -} - -pub fn assure_config_dir_exists(dir: &str) -> Result { - let trdir = dir.trim(); - if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) - } - - let expanded_config_dir = - if trdir.as_bytes()[0] == b'~' { - match env::var("HOME").ok().or(env::var("UserProfile").ok()) { - None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), - Some(mut user) => { - user.push_str(&trdir[1..]); - user - } - } - } else { - trdir.to_string() - }; - - if let Err(err) = fs::create_dir(&expanded_config_dir) { - if err.kind() != io::ErrorKind::AlreadyExists { - return Err(CLIError::Configuration( - ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) - } - } - - Ok(expanded_config_dir) -} - -pub fn application_secret_from_directory(dir: &str, - secret_basename: &str, - json_app_secret: &str) - -> Result { - let secret_path = Path::new(dir).join(secret_basename); - let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); - let secret_io_error = |io_err: io::Error| { - Err(CLIError::Configuration(ConfigurationError::IOError( - (secret_str(), io_err) - ))) - }; - - for _ in 0..2 { - match fs::File::open(&secret_path) { - Err(mut err) => { - if err.kind() == io::ErrorKind::NotFound { - // Write our built-in one - user may adjust the written file at will - - err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { - Err(cfe) => cfe, - Ok(mut f) => { - match f.write(json_app_secret.as_bytes()) { - Err(io_err) => io_err, - Ok(_) => continue, - } - } - }; - // fall through to IO error handling - } - return secret_io_error(err) - }, - Ok(mut f) => { - let mut json_encoded_secret = String::new(); - if let Err(io_err) = f.read_to_string(&mut json_encoded_secret) { - return secret_io_error(io_err) - } - match json::decode::(&json_encoded_secret) { - Err(json_decode_error) => return Err(CLIError::Configuration( - ConfigurationError::Secret(ApplicationSecretError::DecoderError( - (secret_str(), json_decode_error) - )))), - Ok(console_secret) => match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( - CLIError::Configuration( - ConfigurationError::Secret( - ApplicationSecretError::FormatError(secret_str()) - ))) - }, - } - } - } - } - unreachable!(); -} \ No newline at end of file diff --git a/gen/cloudsearch1-cli/src/main.rs b/gen/cloudsearch1-cli/src/main.rs deleted file mode 100644 index 75e153a3a7..0000000000 --- a/gen/cloudsearch1-cli/src/main.rs +++ /dev/null @@ -1,146 +0,0 @@ -// DO NOT EDIT ! -// This file was generated automatically from 'src/mako/cli/main.rs.mako' -// DO NOT EDIT ! -#![feature(plugin, exit_status)] -#![plugin(docopt_macros)] -#![allow(unused_variables, unused_imports, dead_code, unused_mut)] - -extern crate docopt; -extern crate yup_oauth2 as oauth2; -extern crate yup_hyper_mock as mock; -extern crate rustc_serialize; -extern crate serde; -extern crate hyper; -extern crate mime; -extern crate google_cloudsearch1 as api; - -use std::env; -use std::io::{self, Write}; - -docopt!(Options derive Debug, " -Usage: - cloudsearch1 --help - -All documentation details can be found at -http://byron.github.io/google-apis-rs/google_cloudsearch1_cli/index.html - -Configuration: - --config-dir - A directory into which we will store our persistent data. Defaults to - a user-writable directory that we will create during the first invocation. - [default: ~/.google-service-cli] - --debug - Output all server communication to standard error. `tx` and `rx` are placed - into the same stream. - --debug-auth - Output all communication related to authentication to standard error. `tx` - and `rx` are placed into the same stream. -"); - -mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, - input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError}; - -use std::default::Default; -use std::str::FromStr; - -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; -use rustc_serialize::json; - -struct Engine { - opt: Options, - hub: api::Cloudsearch>, -} - - -impl Engine { - fn _doit(&self, dry_run: bool) -> (Option, Option) { - let mut err = InvalidOptionsError::new(); - let mut call_result: Option; - let mut err_opt: Option = None; - else { - unreachable!(); - } - - if dry_run { - if err.issues.len() > 0 { - err_opt = Some(err); - } - } - (call_result, err_opt) - } - - // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: Options) -> Result { - let (config_dir, secret) = { - let config_dir = match cmn::assure_config_dir_exists(&opt.flag_config_dir) { - Err(e) => return Err(InvalidOptionsError::single(e, 3)), - Ok(p) => p, - }; - - match cmn::application_secret_from_directory(&config_dir, "cloudsearch1-secret.json", - "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { - Ok(secret) => (config_dir, secret), - Err(e) => return Err(InvalidOptionsError::single(e, 4)) - } - }; - - let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, - if opt.flag_debug_auth { - hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) - }) - } else { - hyper::Client::new() - }, - JsonTokenStorage { - program_name: "cloudsearch1", - db_dir: config_dir.clone(), - }, None); - - let client = - if opt.flag_debug { - hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) - }) - } else { - hyper::Client::new() - }; - let engine = Engine { - opt: opt, - hub: api::Cloudsearch::new(client, auth), - }; - - match engine._doit(true) { - (_, Some(err)) => Err(err), - _ => Ok(engine), - } - } - - // Execute the call with all the bells and whistles, informing the caller only if there was an error. - // The absense of one indicates success. - fn doit(&self) -> Option { - self._doit(false).0 - } -} - -fn main() { - let opts: Options = Options::docopt().decode().unwrap_or_else(|e| e.exit()); - let debug = opts.flag_debug; - match Engine::new(opts) { - Err(err) => { - writeln!(io::stderr(), "{}", err).ok(); - env::set_exit_status(err.exit_code); - }, - Ok(engine) => { - if let Some(err) = engine.doit() { - if debug { - writeln!(io::stderr(), "{:?}", err).ok(); - } else { - writeln!(io::stderr(), "{}", err).ok(); - } - env::set_exit_status(1); - } - } - } -} \ No newline at end of file diff --git a/gen/cloudsearch1/Cargo.toml b/gen/cloudsearch1/Cargo.toml deleted file mode 100644 index d8281b802b..0000000000 --- a/gen/cloudsearch1/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -# DO NOT EDIT ! -# This file was generated automatically from 'src/mako/Cargo.toml.mako' -# DO NOT EDIT ! -[package] - -name = "google-cloudsearch1" -version = "0.1.6+20150416" -authors = ["Sebastian Thiel "] -description = "A complete library to interact with cloudsearch (protocol v1)" -repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudsearch1" -documentation = "http://byron.github.io/google-apis-rs/google_cloudsearch1" -license = "MIT" -keywords = ["cloudsearch", "google", "protocol", "web", "api"] - - -[dependencies] -hyper = "*" -mime = "*" -yup-oauth2 = "*" -url = "*" -serde = ">= 0.3.0" -serde_macros = "*" diff --git a/gen/cloudtrace1-cli/Cargo.toml b/gen/cloudtrace1-cli/Cargo.toml index 9532db3b1e..4a0f8d2dc1 100644 --- a/gen/cloudtrace1-cli/Cargo.toml +++ b/gen/cloudtrace1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudtrace1-cli" -version = "0.3.2+20150825" +version = "0.3.3+20151207" authors = ["Sebastian Thiel "] description = "A complete library to interact with cloudtrace (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtrace1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/cloudtrace1-cli/LICENSE.md b/gen/cloudtrace1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudtrace1-cli/LICENSE.md +++ b/gen/cloudtrace1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/cloudtrace1-cli/README.md b/gen/cloudtrace1-cli/README.md index ccf913392b..41909a91ac 100644 --- a/gen/cloudtrace1-cli/README.md +++ b/gen/cloudtrace1-cli/README.md @@ -17,19 +17,17 @@ Everything else about the *cloudtrace* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/cloudtrace1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/cloudtrace1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/cloudtrace1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/cloudtrace1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtrace1-cli). # Usage -This documentation was generated from the *cloudtrace* API at revision *20150825*. The CLI is at version *0.3.2*. +This documentation was generated from the *cloudtrace* API at revision *20151207*. The CLI is at version *0.3.3*. ```bash cloudtrace1 [options] - methods - get-discovery [-p ]... projects patch-traces (-r )... [-p ]... [-o ] traces-get [-p ]... [-o ] @@ -38,18 +36,18 @@ cloudtrace1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/cloudtrace1-cli/mkdocs.yml b/gen/cloudtrace1-cli/mkdocs.yml index d36268754a..1c46848344 100644 --- a/gen/cloudtrace1-cli/mkdocs.yml +++ b/gen/cloudtrace1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: cloudtrace v0.3.2+20150825 +site_name: cloudtrace v0.3.3+20151207 site_url: http://byron.github.io/google-apis-rs/google-cloudtrace1-cli site_description: Write integrating applications with bcore @@ -9,12 +9,11 @@ site_dir: build_html pages: - ['index.md', 'Home'] -- ['methods_get-discovery.md', 'Methods', 'Get Discovery'] - ['projects_patch-traces.md', 'Projects', 'Patch Traces'] - ['projects_traces-get.md', 'Projects', 'Traces Get'] - ['projects_traces-list.md', 'Projects', 'Traces List'] theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/cloudtrace1-cli/src/main.rs b/gen/cloudtrace1-cli/src/main.rs index c944223915..ca4e163a2b 100644 --- a/gen/cloudtrace1-cli/src/main.rs +++ b/gen/cloudtrace1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,76 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Cloudtrace>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _methods_get_discovery(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.methods().get_discovery(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "version" => { - call = call.version(value.unwrap_or("")); - }, - "labels" => { - call = call.add_labels(value.unwrap_or("")); - }, - "format" => { - call = call.format(value.unwrap_or("")); - }, - "args" => { - call = call.add_args(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["labels", "version", "args", "format"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _projects_patch_traces(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _projects_patch_traces(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -119,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -134,7 +80,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Traces = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().patch_traces(request, opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -147,7 +93,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -160,7 +106,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -183,10 +129,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_traces_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_traces_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().traces_get(opt.value_of("project-id").unwrap_or(""), opt.value_of("trace-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -199,7 +145,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -212,7 +158,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -235,10 +181,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_traces_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_traces_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().traces_list(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -272,7 +218,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "page-size", "filter", "page-token", "start-time", "end-time", "view"].iter().map(|v|*v)); @@ -286,7 +232,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -314,17 +260,6 @@ impl<'n, 'a> Engine<'n, 'a> { let mut call_result: Result<(), DoitError> = Ok(()); let mut err_opt: Option = None; match self.opt.subcommand() { - ("methods", Some(opt)) => { - match opt.subcommand() { - ("get-discovery", Some(opt)) => { - call_result = self._methods_get_discovery(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("methods".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, ("projects", Some(opt)) => { match opt.subcommand() { ("patch-traces", Some(opt)) => { @@ -359,14 +294,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "cloudtrace1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "cloudtrace1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -386,7 +321,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -428,27 +363,14 @@ impl<'n, 'a> Engine<'n, 'a> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("methods", "methods: 'get-discovery'", vec![ - ("get-discovery", - Some(r##"Returns a discovery document in the specified `format`. The typeurl in the returned google.protobuf.Any value depends on the requested format."##), - "Details at http://byron.github.io/google-apis-rs/google_cloudtrace1_cli/methods_get-discovery", - vec![ - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ]), - ("projects", "methods: 'patch-traces', 'traces-get' and 'traces-list'", vec![ - ("patch-traces", - Some(r##"Updates the existing traces specified by PatchTracesRequest and inserts the new traces. Any existing trace or span fields included in an update are overwritten by the update, and any additional fields in an update are merged with the existing trace data."##), + ("patch-traces", + Some(r##"Sends new traces to Cloud Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created."##), "Details at http://byron.github.io/google-apis-rs/google_cloudtrace1_cli/projects_patch-traces", vec![ (Some(r##"project-id"##), None, - Some(r##"The project id of the trace to patch."##), + Some(r##"ID of the Cloud project where the trace data is stored."##), Some(true), Some(false)), @@ -470,19 +392,19 @@ fn main() { Some(false), Some(false)), ]), - ("traces-get", - Some(r##"Gets one trace by id."##), + ("traces-get", + Some(r##"Gets a single trace by its ID."##), "Details at http://byron.github.io/google-apis-rs/google_cloudtrace1_cli/projects_traces-get", vec![ (Some(r##"project-id"##), None, - Some(r##"The project id of the trace to return."##), + Some(r##"ID of the Cloud project where the trace data is stored."##), Some(true), Some(false)), (Some(r##"trace-id"##), None, - Some(r##"The trace id of the trace to return."##), + Some(r##"ID of the trace to return."##), Some(true), Some(false)), @@ -498,13 +420,13 @@ fn main() { Some(false), Some(false)), ]), - ("traces-list", - Some(r##"List traces matching the filter expression."##), + ("traces-list", + Some(r##"Returns of a list of traces that match the specified filter conditions."##), "Details at http://byron.github.io/google-apis-rs/google_cloudtrace1_cli/projects_traces-list", vec![ (Some(r##"project-id"##), None, - Some(r##"The stringified-version of the project id."##), + Some(r##"ID of the Cloud project where the trace data is stored."##), Some(true), Some(false)), @@ -526,8 +448,8 @@ fn main() { let mut app = App::new("cloudtrace1") .author("Sebastian Thiel ") - .version("0.3.2+20150825") - .about("The Google Cloud Trace API provides services for reading and writing runtime trace data for Cloud applications.") + .version("0.3.3+20151207") + .about("The Cloud Trace API allows you to send traces to and retrieve traces from Google Cloud Trace.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudtrace1_cli") .arg(Arg::with_name("url") .long("scope") @@ -550,7 +472,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -561,7 +483,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/cloudtrace1/Cargo.toml b/gen/cloudtrace1/Cargo.toml index 70e92dc5a5..dbe95c99d9 100644 --- a/gen/cloudtrace1/Cargo.toml +++ b/gen/cloudtrace1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudtrace1" -version = "0.1.10+20150825" +version = "0.1.11+20151207" authors = ["Sebastian Thiel "] description = "A complete library to interact with cloudtrace (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudtrace1" diff --git a/gen/cloudtrace1/LICENSE.md b/gen/cloudtrace1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudtrace1/LICENSE.md +++ b/gen/cloudtrace1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/cloudtrace1/README.md b/gen/cloudtrace1/README.md index cb889a0241..d20961c913 100644 --- a/gen/cloudtrace1/README.md +++ b/gen/cloudtrace1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-cloudtrace1` library allows access to all features of the *Google cloudtrace* service. -This documentation was generated from *cloudtrace* crate version *0.1.10+20150825*, where *20150825* is the exact revision of the *cloudtrace:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *cloudtrace* crate version *0.1.11+20151207*, where *20151207* is the exact revision of the *cloudtrace:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *cloudtrace* *v1* API can be found at the [official documentation site](https://cloud.google.com/tools/cloud-trace). @@ -16,9 +16,6 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * projects * [*patch traces*](http://byron.github.io/google-apis-rs/google_cloudtrace1/struct.ProjectPatchTraceCall.html), [*traces get*](http://byron.github.io/google-apis-rs/google_cloudtrace1/struct.ProjectTraceGetCall.html) and [*traces list*](http://byron.github.io/google-apis-rs/google_cloudtrace1/struct.ProjectTraceListCall.html) -Other activities are ... - -* [get discovery](http://byron.github.io/google-apis-rs/google_cloudtrace1/struct.MethodGetDiscoveryCall.html) diff --git a/gen/cloudtrace1/src/cmn.rs b/gen/cloudtrace1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/cloudtrace1/src/cmn.rs +++ b/gen/cloudtrace1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/cloudtrace1/src/lib.rs b/gen/cloudtrace1/src/lib.rs index 0a9f412d8f..c7d5c451ea 100644 --- a/gen/cloudtrace1/src/lib.rs +++ b/gen/cloudtrace1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *cloudtrace* crate version *0.1.10+20150825*, where *20150825* is the exact revision of the *cloudtrace:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *cloudtrace* crate version *0.1.11+20151207*, where *20151207* is the exact revision of the *cloudtrace:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *cloudtrace* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/tools/cloud-trace). @@ -14,9 +14,6 @@ //! * projects //! * [*patch traces*](struct.ProjectPatchTraceCall.html), [*traces get*](struct.ProjectTraceGetCall.html) and [*traces list*](struct.ProjectTraceListCall.html) //! -//! Other activities are ... -//! -//! * [get discovery](struct.MethodGetDiscoveryCall.html) //! //! //! diff --git a/gen/cloudtrace1/src/lib.rs.in b/gen/cloudtrace1/src/lib.rs.in index e960421e5c..19c1289636 100644 --- a/gen/cloudtrace1/src/lib.rs.in +++ b/gen/cloudtrace1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -126,19 +127,16 @@ impl<'a, C, A> Cloudtrace Cloudtrace { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } - pub fn methods(&'a self) -> MethodMethods<'a, C, A> { - MethodMethods { hub: &self } - } pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { ProjectMethods { hub: &self } } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -152,7 +150,7 @@ impl<'a, C, A> Cloudtrace // ############ // SCHEMAS ### // ########## -/// The response message for the ListTraces method. +/// The response message for the `ListTraces` method. /// /// # Activities /// @@ -163,17 +161,17 @@ impl<'a, C, A> Cloudtrace /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListTracesResponse { - /// If defined, indicates that there are more topics that match the request, and this value should be passed to the next ListTopicsRequest to continue. + /// If defined, indicates that there are more traces that match the request and that this value should be passed to the next request to continue retrieving additional traces. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// The list of trace records returned. + /// List of trace records returned. pub traces: Option>, } impl ResponseResult for ListTracesResponse {} -/// A list of traces for the PatchTraces method. +/// List of new or updated traces. /// /// # Activities /// @@ -184,35 +182,35 @@ impl ResponseResult for ListTracesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Traces { - /// A list of traces. + /// List of traces. pub traces: Option>, } impl RequestValue for Traces {} -/// A span is the data recorded with a single span. +/// A span represents a single timed event within a trace. Spans can be nested and form a trace tree. Often, a trace contains a root span that describes the end-to-end latency of an operation and, optionally, one or more subspans for its suboperations. Spans do not need to be contiguous. There may be gaps between spans in a trace. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TraceSpan { - /// SpanKind distinguishes spans generated in a particular context. For example, two spans with the same name, one with the kind RPC_CLIENT, and the other with RPC_SERVER can indicate the queueing latency associated with the span. + /// Distinguishes between spans generated in a particular context. For example, two spans with the same name may be distinguished using `RPC_CLIENT` and `RPC_SERVER` to identify queueing latency associated with the span. pub kind: Option, - /// Identifies the parent of the current span. May be missing. Serialized bytes representation of SpanId. + /// ID of the parent span, if any. Optional. #[serde(rename="parentSpanId")] pub parent_span_id: Option, - /// The name of the trace. This is sanitized and displayed on the UI. This may be a method name or some other per-callsite name. For the same binary and the same call point, it is a good practice to choose a consistent name in order to correlate cross-trace spans. + /// Name of the trace. The trace name is sanitized and displayed in the Cloud Trace tool in the Google Developers Console. The name may be a method name or some other per-call site name. For the same executable and the same call point, a best practice is to use a consistent name, which makes it easier to correlate cross-trace spans. pub name: Option, - /// The start time of the span in nanoseconds from the UNIX epoch. + /// Start time of the span in nanoseconds from the UNIX epoch. #[serde(rename="startTime")] pub start_time: Option, - /// Identifier of the span within the trace. Each span should have an identifier that is unique per trace. + /// Identifier for the span. This identifier must be unique within a trace. #[serde(rename="spanId")] pub span_id: Option, - /// Annotations via labels. + /// Collection of labels associated with the span. pub labels: Option>, - /// The end time of the span in nanoseconds from the UNIX epoch. + /// End time of the span in nanoseconds from the UNIX epoch. #[serde(rename="endTime")] pub end_time: Option, } @@ -235,7 +233,7 @@ pub struct Empty; impl ResponseResult for Empty {} -/// A Trace is a collection of spans describing the execution timings of a single operation. +/// A trace describes how long it takes for an application to perform an operation. It consists of a set of spans, each of which represent a single timed event within the operation. /// /// # Activities /// @@ -246,13 +244,13 @@ impl ResponseResult for Empty {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Trace { - /// The Project ID of the Google Cloud project. + /// Project ID of the Cloud project where the trace data is stored. #[serde(rename="projectId")] pub project_id: Option, - /// A 128-bit numeric value, formatted as a 32-byte hex string, that represents a trace. Each trace should have an identifier that is globally unique. + /// Globally unique identifier for the trace. This identifier is a 128-bit numeric value formatted as a 32-byte hex string. #[serde(rename="traceId")] pub trace_id: Option, - /// The collection of span records within this trace. Spans that appear in calls to PatchTraces may be incomplete or partial. + /// Collection of spans in the trace. pub spans: Option>, } @@ -264,62 +262,6 @@ impl ResponseResult for Trace {} // MethodBuilders ### // ################# -/// A builder providing access to all free methods, which are not associated with a particular resource. -/// It is not used directly, but through the `Cloudtrace` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_cloudtrace1 as cloudtrace1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use cloudtrace1::Cloudtrace; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Cloudtrace::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get_discovery(...)` -/// // to build up your call. -/// let rb = hub.methods(); -/// # } -/// ``` -pub struct MethodMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Cloudtrace, -} - -impl<'a, C, A> MethodsBuilder for MethodMethods<'a, C, A> {} - -impl<'a, C, A> MethodMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Returns a discovery document in the specified `format`. The typeurl in the returned google.protobuf.Any value depends on the requested format. - pub fn get_discovery(&self) -> MethodGetDiscoveryCall<'a, C, A> { - MethodGetDiscoveryCall { - hub: self.hub, - _version: Default::default(), - _labels: Default::default(), - _format: Default::default(), - _args: Default::default(), - _delegate: Default::default(), - _additional_params: Default::default(), - } - } -} - - - /// A builder providing access to all methods supported on *project* resources. /// It is not used directly, but through the `Cloudtrace` hub. /// @@ -360,12 +302,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets one trace by id. + /// Gets a single trace by its ID. /// /// # Arguments /// - /// * `projectId` - The project id of the trace to return. - /// * `traceId` - The trace id of the trace to return. + /// * `projectId` - ID of the Cloud project where the trace data is stored. + /// * `traceId` - ID of the trace to return. pub fn traces_get(&self, project_id: &str, trace_id: &str) -> ProjectTraceGetCall<'a, C, A> { ProjectTraceGetCall { hub: self.hub, @@ -379,12 +321,12 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates the existing traces specified by PatchTracesRequest and inserts the new traces. Any existing trace or span fields included in an update are overwritten by the update, and any additional fields in an update are merged with the existing trace data. + /// Sends new traces to Cloud Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created. /// /// # Arguments /// /// * `request` - No description provided. - /// * `projectId` - The project id of the trace to patch. + /// * `projectId` - ID of the Cloud project where the trace data is stored. pub fn patch_traces(&self, request: Traces, project_id: &str) -> ProjectPatchTraceCall<'a, C, A> { ProjectPatchTraceCall { hub: self.hub, @@ -398,11 +340,11 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// List traces matching the filter expression. + /// Returns of a list of traces that match the specified filter conditions. /// /// # Arguments /// - /// * `projectId` - The stringified-version of the project id. + /// * `projectId` - ID of the Cloud project where the trace data is stored. pub fn traces_list(&self, project_id: &str) -> ProjectTraceListCall<'a, C, A> { ProjectTraceListCall { hub: self.hub, @@ -429,240 +371,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { // CallBuilders ### // ################# -/// Returns a discovery document in the specified `format`. The typeurl in the returned google.protobuf.Any value depends on the requested format. -/// -/// A builder for the *getDiscovery* method. -/// It is not used directly, but through a `MethodMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_cloudtrace1 as cloudtrace1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use cloudtrace1::Cloudtrace; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Cloudtrace::new(hyper::Client::new(), 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 ! -/// let result = hub.methods().get_discovery() -/// .version("et") -/// .add_labels("dolores") -/// .format("kasd") -/// .add_args("accusam") -/// .doit(); -/// # } -/// ``` -pub struct MethodGetDiscoveryCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Cloudtrace, - _version: Option, - _labels: Vec, - _format: Option, - _args: Vec, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, -} - -impl<'a, C, A> CallBuilder for MethodGetDiscoveryCall<'a, C, A> {} - -impl<'a, C, A> MethodGetDiscoveryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "cloudtrace.getDiscovery", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - if let Some(value) = self._version { - params.push(("version", value.to_string())); - } - if self._labels.len() > 0 { - let mut s = String::new(); - for f in self._labels.iter() { - s.push_str(&("/".to_string() + &f.to_string())); - } - params.push(("labels", s)); - } - if let Some(value) = self._format { - params.push(("format", value.to_string())); - } - if self._args.len() > 0 { - let mut s = String::new(); - for f in self._args.iter() { - s.push_str(&("/".to_string() + &f.to_string())); - } - params.push(("args", s)); - } - for &field in ["version", "labels", "format", "args"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://cloudtrace.googleapis.com/v1/discovery".to_string(); - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The API version of the requested discovery doc. - /// - /// Sets the *version* query property to the given value. - pub fn version(mut self, new_value: &str) -> MethodGetDiscoveryCall<'a, C, A> { - self._version = Some(new_value.to_string()); - self - } - /// A list of labels (like visibility) influencing the scope of the requested doc. - /// - /// Append the given value to the *labels* query property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - pub fn add_labels(mut self, new_value: &str) -> MethodGetDiscoveryCall<'a, C, A> { - self._labels.push(new_value.to_string()); - self - } - /// The format requested for discovery. - /// - /// Sets the *format* query property to the given value. - pub fn format(mut self, new_value: &str) -> MethodGetDiscoveryCall<'a, C, A> { - self._format = Some(new_value.to_string()); - self - } - /// Any additional arguments. - /// - /// Append the given value to the *args* query property. - /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. - pub fn add_args(mut self, new_value: &str) -> MethodGetDiscoveryCall<'a, C, A> { - self._args.push(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MethodGetDiscoveryCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *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. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> MethodGetDiscoveryCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - -} - - -/// Gets one trace by id. +/// Gets a single trace by its ID. /// /// A builder for the *traces.get* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -717,7 +426,7 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudtrace.projects.traces.get", + dlg.begin(MethodInfo { id: "cloudtrace.projects.traces.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -760,7 +469,7 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -796,7 +505,7 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -806,10 +515,10 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -838,21 +547,21 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, } - /// The project id of the trace to return. + /// ID of the Cloud project where the trace data is stored. /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectTraceGetCall<'a, C, A> { self._project_id = new_value.to_string(); self } - /// The trace id of the trace to return. + /// ID of the trace to return. /// /// Sets the *trace id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn trace_id(mut self, new_value: &str) -> ProjectTraceGetCall<'a, C, A> { self._trace_id = new_value.to_string(); @@ -870,12 +579,12 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -898,17 +607,17 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectTraceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTraceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -916,7 +625,7 @@ impl<'a, C, A> ProjectTraceGetCall<'a, C, A> where C: BorrowMut, } -/// Updates the existing traces specified by PatchTracesRequest and inserts the new traces. Any existing trace or span fields included in an update are overwritten by the update, and any additional fields in an update are merged with the existing trace data. +/// Sends new traces to Cloud Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created. /// /// A builder for the *patchTraces* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -977,7 +686,7 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudtrace.projects.patchTraces", + dlg.begin(MethodInfo { id: "cloudtrace.projects.patchTraces", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1019,14 +728,14 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1070,7 +779,7 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1080,10 +789,10 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1115,17 +824,17 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Traces) -> ProjectPatchTraceCall<'a, C, A> { self._request = new_value; self } - /// The project id of the trace to patch. + /// ID of the Cloud project where the trace data is stored. /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectPatchTraceCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1143,12 +852,12 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1171,17 +880,17 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectPatchTraceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectPatchTraceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1189,7 +898,7 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut } -/// List traces matching the filter expression. +/// Returns of a list of traces that match the specified filter conditions. /// /// A builder for the *traces.list* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. @@ -1216,13 +925,13 @@ impl<'a, C, A> ProjectPatchTraceCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.projects().traces_list("projectId") -/// .view("labore") -/// .start_time("sea") -/// .page_token("nonumy") -/// .page_size(-19) -/// .order_by("gubergren") -/// .filter("sadipscing") -/// .end_time("aliquyam") +/// .view("takimata") +/// .start_time("justo") +/// .page_token("amet.") +/// .page_size(-81) +/// .order_by("labore") +/// .filter("sea") +/// .end_time("nonumy") /// .doit(); /// # } /// ``` @@ -1257,7 +966,7 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "cloudtrace.projects.traces.list", + dlg.begin(MethodInfo { id: "cloudtrace.projects.traces.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1320,7 +1029,7 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1356,7 +1065,7 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1366,10 +1075,10 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1398,45 +1107,45 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, } - /// The stringified-version of the project id. + /// ID of the Cloud project where the trace data is stored. /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectTraceListCall<'a, C, A> { self._project_id = new_value.to_string(); self } - /// ViewType specifies the projection of the result. + /// Type of data returned for traces in the list. Optional. Default is `MINIMAL`. /// /// Sets the *view* query property to the given value. pub fn view(mut self, new_value: &str) -> ProjectTraceListCall<'a, C, A> { self._view = Some(new_value.to_string()); self } - /// End of the time interval (inclusive). + /// End of the time interval (inclusive) during which the trace data was collected from the application. /// /// Sets the *start time* query property to the given value. pub fn start_time(mut self, new_value: &str) -> ProjectTraceListCall<'a, C, A> { self._start_time = Some(new_value.to_string()); self } - /// The token identifying the page of results to return from the ListTraces method. If present, this value is should be taken from the next_page_token field of a previous ListTracesResponse. + /// Token identifying the page of results to return. If provided, use the value of the `next_page_token` field from a previous request. Optional. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ProjectTraceListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum number of topics to return. If not specified or <= 0, the implementation will select a reasonable value. The implemenation may always return fewer than the requested page_size. + /// Maximum number of traces to return. If not specified or <= 0, the implementation selects a reasonable value. The implementation may return fewer traces than the requested page size. Optional. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> ProjectTraceListCall<'a, C, A> { self._page_size = Some(new_value); self } - /// The trace field used to establish the order of traces returned by the ListTraces method. Possible options are: trace_id name (name field of root span) duration (different between end_time and start_time fields of root span) start (start_time field of root span) Descending order can be specified by appending "desc" to the sort field: name desc Only one sort field is permitted, though this may change in the future. + /// Field used to sort the returned traces. Optional. Can be one of the following: * `trace_id` * `name` (`name` field of root span in the trace) * `duration` (difference between `end_time` and `start_time` fields of the root span) * `start` (`start_time` field of the root span) Descending order can be specified by appending `desc` to the sort field (for example, `name desc`). Only one sort field is permitted. /// /// Sets the *order by* query property to the given value. pub fn order_by(mut self, new_value: &str) -> ProjectTraceListCall<'a, C, A> { @@ -1450,7 +1159,7 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, self._filter = Some(new_value.to_string()); self } - /// Start of the time interval (exclusive). + /// Start of the time interval (inclusive) during which the trace data was collected from the application. /// /// Sets the *end time* query property to the given value. pub fn end_time(mut self, new_value: &str) -> ProjectTraceListCall<'a, C, A> { @@ -1469,12 +1178,12 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1497,17 +1206,17 @@ impl<'a, C, A> ProjectTraceListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectTraceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTraceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/clouduseraccountsvm_beta-cli/Cargo.toml b/gen/clouduseraccountsvm_beta-cli/Cargo.toml index 48ecd13e95..48000c89ff 100644 --- a/gen/clouduseraccountsvm_beta-cli/Cargo.toml +++ b/gen/clouduseraccountsvm_beta-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-clouduseraccountsvm_beta-cli" -version = "0.3.2+20150924" +version = "0.3.3+20150924" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud User Accounts (protocol vm_beta)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/clouduseraccountsvm_beta-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/clouduseraccountsvm_beta-cli/LICENSE.md b/gen/clouduseraccountsvm_beta-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/clouduseraccountsvm_beta-cli/LICENSE.md +++ b/gen/clouduseraccountsvm_beta-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/clouduseraccountsvm_beta-cli/README.md b/gen/clouduseraccountsvm_beta-cli/README.md index f2a3694880..3c4fa0138f 100644 --- a/gen/clouduseraccountsvm_beta-cli/README.md +++ b/gen/clouduseraccountsvm_beta-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Cloud User Accounts* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/clouduseraccountsvm-beta.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/clouduseraccountsvm-beta.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/clouduseraccountsvm-beta.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/clouduseraccountsvm-beta.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/clouduseraccountsvm_beta-cli). # Usage -This documentation was generated from the *Cloud User Accounts* API at revision *20150924*. The CLI is at version *0.3.2*. +This documentation was generated from the *Cloud User Accounts* API at revision *20150924*. The CLI is at version *0.3.3*. ```bash clouduseraccountsvm-beta [options] @@ -53,18 +53,18 @@ clouduseraccountsvm-beta [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/clouduseraccountsvm_beta-cli/mkdocs.yml b/gen/clouduseraccountsvm_beta-cli/mkdocs.yml index 08da5113af..b235de043e 100644 --- a/gen/clouduseraccountsvm_beta-cli/mkdocs.yml +++ b/gen/clouduseraccountsvm_beta-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud User Accounts v0.3.2+20150924 +site_name: Cloud User Accounts v0.3.3+20150924 site_url: http://byron.github.io/google-apis-rs/google-clouduseraccountsvm_beta-cli site_description: Write integrating applications with bcore @@ -29,5 +29,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/clouduseraccountsvm_beta-cli/src/main.rs b/gen/clouduseraccountsvm_beta-cli/src/main.rs index daeffaffd1..4b05c3b784 100644 --- a/gen/clouduseraccountsvm_beta-cli/src/main.rs +++ b/gen/clouduseraccountsvm_beta-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::CloudUserAccounts>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _global_accounts_operations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _global_accounts_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_accounts_operations().delete(opt.value_of("project").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -89,10 +89,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_accounts_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_accounts_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_accounts_operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -105,7 +105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -141,10 +141,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_accounts_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_accounts_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_accounts_operations().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -169,7 +169,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); @@ -183,7 +183,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -206,13 +206,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_add_member(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_add_member(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -226,8 +226,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "users" => Some(("users", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -242,7 +242,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::GroupsAddMemberRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().add_member(request, opt.value_of("project").unwrap_or(""), opt.value_of("group-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -255,7 +255,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -268,7 +268,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -291,10 +291,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().delete(opt.value_of("project").unwrap_or(""), opt.value_of("group-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -307,7 +307,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -320,7 +320,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -343,10 +343,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().get(opt.value_of("project").unwrap_or(""), opt.value_of("group-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -359,7 +359,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -372,7 +372,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -395,13 +395,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -415,8 +415,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -437,7 +437,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Group = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -450,7 +450,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -463,7 +463,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -486,10 +486,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -514,7 +514,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); @@ -528,7 +528,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -551,13 +551,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_remove_member(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_remove_member(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -571,8 +571,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "users" => Some(("users", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -587,7 +587,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::GroupsRemoveMemberRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().remove_member(request, opt.value_of("project").unwrap_or(""), opt.value_of("group-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -600,7 +600,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -613,7 +613,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -636,10 +636,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _linux_get_authorized_keys_view(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _linux_get_authorized_keys_view(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.linux().get_authorized_keys_view(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("user").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "login" => { @@ -655,7 +655,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["login"].iter().map(|v|*v)); @@ -669,7 +669,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -692,10 +692,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _linux_get_linux_account_views(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _linux_get_linux_account_views(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.linux().get_linux_account_views(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -720,7 +720,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); @@ -734,7 +734,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -757,13 +757,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_add_public_key(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_add_public_key(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -777,8 +777,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "expiration-timestamp" => Some(("expirationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -797,7 +797,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PublicKey = json::value::from_value(object).unwrap(); let mut call = self.hub.users().add_public_key(request, opt.value_of("project").unwrap_or(""), opt.value_of("user").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -810,7 +810,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -823,7 +823,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -846,10 +846,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().delete(opt.value_of("project").unwrap_or(""), opt.value_of("user").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -862,7 +862,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -875,7 +875,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -898,10 +898,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().get(opt.value_of("project").unwrap_or(""), opt.value_of("user").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -914,7 +914,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -927,7 +927,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -950,13 +950,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -970,8 +970,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -993,7 +993,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::User = json::value::from_value(object).unwrap(); let mut call = self.hub.users().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1006,7 +1006,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1019,7 +1019,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1042,10 +1042,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1070,7 +1070,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); @@ -1084,7 +1084,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1107,10 +1107,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_remove_public_key(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_remove_public_key(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().remove_public_key(opt.value_of("project").unwrap_or(""), opt.value_of("user").unwrap_or(""), opt.value_of("fingerprint").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1123,7 +1123,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1136,7 +1136,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1264,14 +1264,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "clouduseraccountsvm-beta-secret.json", + match cmn::application_secret_from_directory(&config_dir, "clouduseraccountsvm-beta-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1291,7 +1291,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1330,7 +1330,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("global-accounts-operations", "methods: 'delete', 'get' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified operation resource."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/global-accounts-operations_delete", vec![ @@ -1352,7 +1352,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves the specified operation resource."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/global-accounts-operations_get", vec![ @@ -1380,7 +1380,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of operation resources contained within the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/global-accounts-operations_list", vec![ @@ -1405,7 +1405,7 @@ fn main() { ]), ("groups", "methods: 'add-member', 'delete', 'get', 'insert', 'list' and 'remove-member'", vec![ - ("add-member", + ("add-member", Some(r##"Adds users to the specified group."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/groups_add-member", vec![ @@ -1439,7 +1439,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified Group resource."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/groups_delete", vec![ @@ -1467,7 +1467,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified Group resource."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/groups_get", vec![ @@ -1495,7 +1495,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a Group resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/groups_insert", vec![ @@ -1523,7 +1523,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of groups contained within the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/groups_list", vec![ @@ -1545,7 +1545,7 @@ fn main() { Some(false), Some(false)), ]), - ("remove-member", + ("remove-member", Some(r##"Removes users from the specified group."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/groups_remove-member", vec![ @@ -1582,7 +1582,7 @@ fn main() { ]), ("linux", "methods: 'get-authorized-keys-view' and 'get-linux-account-views'", vec![ - ("get-authorized-keys-view", + ("get-authorized-keys-view", Some(r##"Returns a list of authorized public keys for a specific user account."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/linux_get-authorized-keys-view", vec![ @@ -1622,7 +1622,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-linux-account-views", + ("get-linux-account-views", Some(r##"Retrieves a list of user accounts for an instance within a specific project."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/linux_get-linux-account-views", vec![ @@ -1659,7 +1659,7 @@ fn main() { ]), ("users", "methods: 'add-public-key', 'delete', 'get', 'insert', 'list' and 'remove-public-key'", vec![ - ("add-public-key", + ("add-public-key", Some(r##"Adds a public key to the specified User resource with the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/users_add-public-key", vec![ @@ -1693,7 +1693,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified User resource."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/users_delete", vec![ @@ -1721,7 +1721,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified User resource."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/users_get", vec![ @@ -1749,7 +1749,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a User resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/users_insert", vec![ @@ -1777,7 +1777,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of users contained within the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/users_list", vec![ @@ -1799,7 +1799,7 @@ fn main() { Some(false), Some(false)), ]), - ("remove-public-key", + ("remove-public-key", Some(r##"Removes the specified public key from the user."##), "Details at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli/users_remove-public-key", vec![ @@ -1839,7 +1839,7 @@ fn main() { let mut app = App::new("clouduseraccountsvm-beta") .author("Sebastian Thiel ") - .version("0.3.2+20150924") + .version("0.3.3+20150924") .about("API for the Google Cloud User Accounts service.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_clouduseraccountsvm_beta_cli") .arg(Arg::with_name("url") @@ -1863,7 +1863,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1874,7 +1874,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/clouduseraccountsvm_beta/Cargo.toml b/gen/clouduseraccountsvm_beta/Cargo.toml index 3ed72d3c98..bd8c0065d6 100644 --- a/gen/clouduseraccountsvm_beta/Cargo.toml +++ b/gen/clouduseraccountsvm_beta/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-clouduseraccountsvm_beta" -version = "0.1.10+20150924" +version = "0.1.11+20150924" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud User Accounts (protocol vm_beta)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/clouduseraccountsvm_beta" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/clouduseraccountsvm_beta/LICENSE.md b/gen/clouduseraccountsvm_beta/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/clouduseraccountsvm_beta/LICENSE.md +++ b/gen/clouduseraccountsvm_beta/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/clouduseraccountsvm_beta/README.md b/gen/clouduseraccountsvm_beta/README.md index f123ffc737..4f98380cea 100644 --- a/gen/clouduseraccountsvm_beta/README.md +++ b/gen/clouduseraccountsvm_beta/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-clouduseraccountsvm_beta` library allows access to all features of the *Google Cloud User Accounts* service. -This documentation was generated from *Cloud User Accounts* crate version *0.1.10+20150924*, where *20150924* is the exact revision of the *clouduseraccounts:vm_beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Cloud User Accounts* crate version *0.1.11+20150924*, where *20150924* is the exact revision of the *clouduseraccounts:vm_beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Cloud User Accounts* *vm_beta* API can be found at the [official documentation site](https://cloud.google.com/compute/docs/access/user-accounts/api/latest/). diff --git a/gen/clouduseraccountsvm_beta/src/cmn.rs b/gen/clouduseraccountsvm_beta/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/clouduseraccountsvm_beta/src/cmn.rs +++ b/gen/clouduseraccountsvm_beta/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/clouduseraccountsvm_beta/src/lib.rs b/gen/clouduseraccountsvm_beta/src/lib.rs index 8c6342dea1..159a84c0b4 100644 --- a/gen/clouduseraccountsvm_beta/src/lib.rs +++ b/gen/clouduseraccountsvm_beta/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Cloud User Accounts* crate version *0.1.10+20150924*, where *20150924* is the exact revision of the *clouduseraccounts:vm_beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Cloud User Accounts* crate version *0.1.11+20150924*, where *20150924* is the exact revision of the *clouduseraccounts:vm_beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Cloud User Accounts* *vm_beta* API can be found at the //! [official documentation site](https://cloud.google.com/compute/docs/access/user-accounts/api/latest/). diff --git a/gen/clouduseraccountsvm_beta/src/lib.rs.in b/gen/clouduseraccountsvm_beta/src/lib.rs.in index 5057cdc0b4..9cf85aa7f1 100644 --- a/gen/clouduseraccountsvm_beta/src/lib.rs.in +++ b/gen/clouduseraccountsvm_beta/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -144,7 +145,7 @@ impl<'a, C, A> CloudUserAccounts CloudUserAccounts { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -162,7 +163,7 @@ impl<'a, C, A> CloudUserAccounts } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1243,7 +1244,7 @@ impl<'a, C, A> GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.globalAccountsOperations.delete", + dlg.begin(MethodInfo { id: "clouduseraccounts.globalAccountsOperations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1285,7 +1286,7 @@ impl<'a, C, A> GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1321,7 +1322,7 @@ impl<'a, C, A> GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1331,10 +1332,10 @@ impl<'a, C, A> GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -1367,7 +1368,7 @@ impl<'a, C, A> GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationDeleteCall<'a, C, A> { self._operation = new_value.to_string(); @@ -1385,12 +1386,12 @@ impl<'a, C, A> GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalAccountsOperationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalAccountsOperationDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1487,7 +1488,7 @@ impl<'a, C, A> GlobalAccountsOperationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.globalAccountsOperations.list", + dlg.begin(MethodInfo { id: "clouduseraccounts.globalAccountsOperations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1541,7 +1542,7 @@ impl<'a, C, A> GlobalAccountsOperationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1577,7 +1578,7 @@ impl<'a, C, A> GlobalAccountsOperationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1587,10 +1588,10 @@ impl<'a, C, A> GlobalAccountsOperationListCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationListCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1677,12 +1678,12 @@ impl<'a, C, A> GlobalAccountsOperationListCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalAccountsOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalAccountsOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1772,7 +1773,7 @@ impl<'a, C, A> GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.globalAccountsOperations.get", + dlg.begin(MethodInfo { id: "clouduseraccounts.globalAccountsOperations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1815,7 +1816,7 @@ impl<'a, C, A> GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1851,7 +1852,7 @@ impl<'a, C, A> GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1861,10 +1862,10 @@ impl<'a, C, A> GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -1907,7 +1908,7 @@ impl<'a, C, A> GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -1925,12 +1926,12 @@ impl<'a, C, A> GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut GlobalAccountsOperationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalAccountsOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalAccountsOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2027,7 +2028,7 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.users.addPublicKey", + dlg.begin(MethodInfo { id: "clouduseraccounts.users.addPublicKey", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2070,14 +2071,14 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2121,7 +2122,7 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2131,10 +2132,10 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2166,7 +2167,7 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: PublicKey) -> UserAddPublicKeyCall<'a, C, A> { self._request = new_value; @@ -2176,7 +2177,7 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UserAddPublicKeyCall<'a, C, A> { self._project = new_value.to_string(); @@ -2186,7 +2187,7 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user(mut self, new_value: &str) -> UserAddPublicKeyCall<'a, C, A> { self._user = new_value.to_string(); @@ -2204,12 +2205,12 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2226,17 +2227,17 @@ impl<'a, C, A> UserAddPublicKeyCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserAddPublicKeyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserAddPublicKeyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2306,7 +2307,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.users.list", + dlg.begin(MethodInfo { id: "clouduseraccounts.users.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2360,7 +2361,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2396,7 +2397,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2406,10 +2407,10 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2442,7 +2443,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UserListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2496,12 +2497,12 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2518,17 +2519,17 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudUseraccountReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2597,7 +2598,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.users.insert", + dlg.begin(MethodInfo { id: "clouduseraccounts.users.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2639,14 +2640,14 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2690,7 +2691,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2700,10 +2701,10 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2735,7 +2736,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: User) -> UserInsertCall<'a, C, A> { self._request = new_value; @@ -2745,7 +2746,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UserInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -2763,12 +2764,12 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2785,17 +2786,17 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2858,7 +2859,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.users.get", + dlg.begin(MethodInfo { id: "clouduseraccounts.users.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2901,7 +2902,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2937,7 +2938,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2947,10 +2948,10 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2983,7 +2984,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UserGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -2993,7 +2994,7 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *user* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user(mut self, new_value: &str) -> UserGetCall<'a, C, A> { self._user = new_value.to_string(); @@ -3011,12 +3012,12 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3033,17 +3034,17 @@ impl<'a, C, A> UserGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudUseraccountReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3107,7 +3108,7 @@ impl<'a, C, A> UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.users.removePublicKey", + dlg.begin(MethodInfo { id: "clouduseraccounts.users.removePublicKey", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3151,7 +3152,7 @@ impl<'a, C, A> UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3187,7 +3188,7 @@ impl<'a, C, A> UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3197,10 +3198,10 @@ impl<'a, C, A> UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut UserRemovePublicKeyCall<'a, C, A> { self._project = new_value.to_string(); @@ -3243,7 +3244,7 @@ impl<'a, C, A> UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut UserRemovePublicKeyCall<'a, C, A> { self._user = new_value.to_string(); @@ -3253,7 +3254,7 @@ impl<'a, C, A> UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut UserRemovePublicKeyCall<'a, C, A> { self._fingerprint = new_value.to_string(); @@ -3271,12 +3272,12 @@ impl<'a, C, A> UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut UserRemovePublicKeyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserRemovePublicKeyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRemovePublicKeyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3366,7 +3367,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.users.delete", + dlg.begin(MethodInfo { id: "clouduseraccounts.users.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3409,7 +3410,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3445,7 +3446,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3455,10 +3456,10 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3491,7 +3492,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UserDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -3501,7 +3502,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *user* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user(mut self, new_value: &str) -> UserDeleteCall<'a, C, A> { self._user = new_value.to_string(); @@ -3519,12 +3520,12 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3541,17 +3542,17 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3614,7 +3615,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.groups.delete", + dlg.begin(MethodInfo { id: "clouduseraccounts.groups.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3657,7 +3658,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3693,7 +3694,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3703,10 +3704,10 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3739,7 +3740,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> GroupDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -3749,7 +3750,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *group name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_name(mut self, new_value: &str) -> GroupDeleteCall<'a, C, A> { self._group_name = new_value.to_string(); @@ -3767,12 +3768,12 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3789,17 +3790,17 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3862,7 +3863,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.groups.get", + dlg.begin(MethodInfo { id: "clouduseraccounts.groups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3905,7 +3906,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3941,7 +3942,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3951,10 +3952,10 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3987,7 +3988,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> GroupGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -3997,7 +3998,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *group name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_name(mut self, new_value: &str) -> GroupGetCall<'a, C, A> { self._group_name = new_value.to_string(); @@ -4015,12 +4016,12 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4037,17 +4038,17 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudUseraccountReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4117,7 +4118,7 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.groups.addMember", + dlg.begin(MethodInfo { id: "clouduseraccounts.groups.addMember", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4160,14 +4161,14 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4211,7 +4212,7 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4221,10 +4222,10 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4256,7 +4257,7 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: GroupsAddMemberRequest) -> GroupAddMemberCall<'a, C, A> { self._request = new_value; @@ -4266,7 +4267,7 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> GroupAddMemberCall<'a, C, A> { self._project = new_value.to_string(); @@ -4276,7 +4277,7 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *group name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_name(mut self, new_value: &str) -> GroupAddMemberCall<'a, C, A> { self._group_name = new_value.to_string(); @@ -4294,12 +4295,12 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4316,17 +4317,17 @@ impl<'a, C, A> GroupAddMemberCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupAddMemberCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupAddMemberCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4395,7 +4396,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.groups.insert", + dlg.begin(MethodInfo { id: "clouduseraccounts.groups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4437,14 +4438,14 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4488,7 +4489,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4498,10 +4499,10 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4533,7 +4534,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Group) -> GroupInsertCall<'a, C, A> { self._request = new_value; @@ -4543,7 +4544,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> GroupInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -4561,12 +4562,12 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4583,17 +4584,17 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4663,7 +4664,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.groups.list", + dlg.begin(MethodInfo { id: "clouduseraccounts.groups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4717,7 +4718,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4753,7 +4754,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4763,10 +4764,10 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4799,7 +4800,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> GroupListCall<'a, C, A> { self._project = new_value.to_string(); @@ -4853,12 +4854,12 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4875,17 +4876,17 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudUseraccountReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4955,7 +4956,7 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.groups.removeMember", + dlg.begin(MethodInfo { id: "clouduseraccounts.groups.removeMember", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4998,14 +4999,14 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5049,7 +5050,7 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5059,10 +5060,10 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5094,7 +5095,7 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: GroupsRemoveMemberRequest) -> GroupRemoveMemberCall<'a, C, A> { self._request = new_value; @@ -5104,7 +5105,7 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> GroupRemoveMemberCall<'a, C, A> { self._project = new_value.to_string(); @@ -5114,7 +5115,7 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut /// /// Sets the *group name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_name(mut self, new_value: &str) -> GroupRemoveMemberCall<'a, C, A> { self._group_name = new_value.to_string(); @@ -5132,12 +5133,12 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5154,17 +5155,17 @@ impl<'a, C, A> GroupRemoveMemberCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupRemoveMemberCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupRemoveMemberCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5236,7 +5237,7 @@ impl<'a, C, A> LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.linux.getLinuxAccountViews", + dlg.begin(MethodInfo { id: "clouduseraccounts.linux.getLinuxAccountViews", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -5292,7 +5293,7 @@ impl<'a, C, A> LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5328,7 +5329,7 @@ impl<'a, C, A> LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5338,10 +5339,10 @@ impl<'a, C, A> LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut LinuxGetLinuxAccountViewCall<'a, C, A> { self._project = new_value.to_string(); @@ -5384,7 +5385,7 @@ impl<'a, C, A> LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut LinuxGetLinuxAccountViewCall<'a, C, A> { self._zone = new_value.to_string(); @@ -5394,7 +5395,7 @@ impl<'a, C, A> LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut LinuxGetLinuxAccountViewCall<'a, C, A> { self._instance = new_value.to_string(); @@ -5448,12 +5449,12 @@ impl<'a, C, A> LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut LinuxGetLinuxAccountViewCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LinuxGetLinuxAccountViewCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LinuxGetLinuxAccountViewCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5547,7 +5548,7 @@ impl<'a, C, A> LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "clouduseraccounts.linux.getAuthorizedKeysView", + dlg.begin(MethodInfo { id: "clouduseraccounts.linux.getAuthorizedKeysView", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -5595,7 +5596,7 @@ impl<'a, C, A> LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5631,7 +5632,7 @@ impl<'a, C, A> LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5641,10 +5642,10 @@ impl<'a, C, A> LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut LinuxGetAuthorizedKeysViewCall<'a, C, A> { self._project = new_value.to_string(); @@ -5687,7 +5688,7 @@ impl<'a, C, A> LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut LinuxGetAuthorizedKeysViewCall<'a, C, A> { self._zone = new_value.to_string(); @@ -5697,7 +5698,7 @@ impl<'a, C, A> LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut LinuxGetAuthorizedKeysViewCall<'a, C, A> { self._user = new_value.to_string(); @@ -5707,7 +5708,7 @@ impl<'a, C, A> LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut LinuxGetAuthorizedKeysViewCall<'a, C, A> { self._instance = new_value.to_string(); @@ -5732,12 +5733,12 @@ impl<'a, C, A> LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut LinuxGetAuthorizedKeysViewCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LinuxGetAuthorizedKeysViewCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LinuxGetAuthorizedKeysViewCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/compute1-cli/Cargo.toml b/gen/compute1-cli/Cargo.toml index 97d14a4a23..e0923e5950 100644 --- a/gen/compute1-cli/Cargo.toml +++ b/gen/compute1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-compute1-cli" -version = "0.3.2+20151015" +version = "0.3.3+20160120" authors = ["Sebastian Thiel "] description = "A complete library to interact with compute (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/compute1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/compute1-cli/LICENSE.md b/gen/compute1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/compute1-cli/LICENSE.md +++ b/gen/compute1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/compute1-cli/README.md b/gen/compute1-cli/README.md index 903df10eed..8b42d78bbc 100644 --- a/gen/compute1-cli/README.md +++ b/gen/compute1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *compute* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/compute1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/compute1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/compute1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/compute1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/compute1-cli). # Usage -This documentation was generated from the *compute* API at revision *20151015*. The CLI is at version *0.3.2*. +This documentation was generated from the *compute* API at revision *20160120*. The CLI is at version *0.3.3*. ```bash compute1 [options] @@ -152,6 +152,7 @@ compute1 [options] list [-p ]... [-o ] reset [-p ]... [-o ] set-disk-auto-delete [-p ]... [-o ] + set-machine-type (-r )... [-p ]... [-o ] set-metadata (-r )... [-p ]... [-o ] set-scheduling (-r )... [-p ]... [-o ] set-tags (-r )... [-p ]... [-o ] @@ -195,6 +196,12 @@ compute1 [options] get [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] + subnetworks + aggregated-list [-p ]... [-o ] + delete [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] target-http-proxies delete [-p ]... [-o ] get [-p ]... [-o ] @@ -257,18 +264,18 @@ compute1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/compute1-cli/mkdocs.yml b/gen/compute1-cli/mkdocs.yml index ef8bcea35d..d101e53f5d 100644 --- a/gen/compute1-cli/mkdocs.yml +++ b/gen/compute1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: compute v0.3.2+20151015 +site_name: compute v0.3.3+20160120 site_url: http://byron.github.io/google-apis-rs/google-compute1-cli site_description: Write integrating applications with bcore @@ -116,6 +116,7 @@ pages: - ['instances_list.md', 'Instances', 'List'] - ['instances_reset.md', 'Instances', 'Reset'] - ['instances_set-disk-auto-delete.md', 'Instances', 'Set Disk Auto Delete'] +- ['instances_set-machine-type.md', 'Instances', 'Set Machine Type'] - ['instances_set-metadata.md', 'Instances', 'Set Metadata'] - ['instances_set-scheduling.md', 'Instances', 'Set Scheduling'] - ['instances_set-tags.md', 'Instances', 'Set Tags'] @@ -150,6 +151,11 @@ pages: - ['ssl-certificates_get.md', 'Ssl Certificates', 'Get'] - ['ssl-certificates_insert.md', 'Ssl Certificates', 'Insert'] - ['ssl-certificates_list.md', 'Ssl Certificates', 'List'] +- ['subnetworks_aggregated-list.md', 'Subnetworks', 'Aggregated List'] +- ['subnetworks_delete.md', 'Subnetworks', 'Delete'] +- ['subnetworks_get.md', 'Subnetworks', 'Get'] +- ['subnetworks_insert.md', 'Subnetworks', 'Insert'] +- ['subnetworks_list.md', 'Subnetworks', 'List'] - ['target-http-proxies_delete.md', 'Target Http Proxies', 'Delete'] - ['target-http-proxies_get.md', 'Target Http Proxies', 'Get'] - ['target-http-proxies_insert.md', 'Target Http Proxies', 'Insert'] @@ -202,5 +208,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/compute1-cli/src/main.rs b/gen/compute1-cli/src/main.rs index 0635d18403..2844596477 100644 --- a/gen/compute1-cli/src/main.rs +++ b/gen/compute1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Compute>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _addresses_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _addresses_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.addresses().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -70,7 +70,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -84,7 +84,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -107,10 +107,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _addresses_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _addresses_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.addresses().delete(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("address").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -123,7 +123,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -136,7 +136,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -159,10 +159,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _addresses_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _addresses_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.addresses().get(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("address").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -175,7 +175,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -188,7 +188,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -211,13 +211,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _addresses_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _addresses_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -231,8 +231,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -256,7 +256,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Address = json::value::from_value(object).unwrap(); let mut call = self.hub.addresses().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -269,7 +269,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -282,7 +282,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -305,10 +305,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _addresses_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _addresses_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.addresses().list(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -330,7 +330,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -344,7 +344,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -367,10 +367,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.autoscalers().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -392,7 +392,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -406,7 +406,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -429,10 +429,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.autoscalers().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("autoscaler").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -445,7 +445,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -458,7 +458,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -481,10 +481,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.autoscalers().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("autoscaler").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -497,7 +497,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -510,7 +510,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -533,13 +533,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -553,8 +553,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -581,7 +581,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Autoscaler = json::value::from_value(object).unwrap(); let mut call = self.hub.autoscalers().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -594,7 +594,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -607,7 +607,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -630,10 +630,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.autoscalers().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -655,7 +655,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -669,7 +669,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -692,13 +692,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -712,8 +712,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -740,7 +740,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Autoscaler = json::value::from_value(object).unwrap(); let mut call = self.hub.autoscalers().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("autoscaler").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -753,7 +753,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -766,7 +766,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -789,13 +789,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _autoscalers_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _autoscalers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -809,8 +809,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -837,7 +837,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Autoscaler = json::value::from_value(object).unwrap(); let mut call = self.hub.autoscalers().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "autoscaler" => { @@ -853,7 +853,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["autoscaler"].iter().map(|v|*v)); @@ -867,7 +867,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -890,10 +890,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _backend_services_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _backend_services_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.backend_services().delete(opt.value_of("project").unwrap_or(""), opt.value_of("backend-service").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -906,7 +906,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -919,7 +919,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -942,10 +942,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _backend_services_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _backend_services_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.backend_services().get(opt.value_of("project").unwrap_or(""), opt.value_of("backend-service").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -958,7 +958,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -971,7 +971,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -994,13 +994,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _backend_services_get_health(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _backend_services_get_health(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1014,8 +1014,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "group" => Some(("group", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -1030,7 +1030,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ResourceGroupReference = json::value::from_value(object).unwrap(); let mut call = self.hub.backend_services().get_health(request, opt.value_of("project").unwrap_or(""), opt.value_of("backend-service").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1043,7 +1043,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1056,7 +1056,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1079,13 +1079,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _backend_services_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _backend_services_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1099,8 +1099,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "protocol" => Some(("protocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1126,7 +1126,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::BackendService = json::value::from_value(object).unwrap(); let mut call = self.hub.backend_services().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1139,7 +1139,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1152,7 +1152,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1175,10 +1175,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _backend_services_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _backend_services_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.backend_services().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1200,7 +1200,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -1214,7 +1214,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1237,13 +1237,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _backend_services_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _backend_services_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1257,8 +1257,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "protocol" => Some(("protocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1284,7 +1284,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::BackendService = json::value::from_value(object).unwrap(); let mut call = self.hub.backend_services().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("backend-service").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1297,7 +1297,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1310,7 +1310,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1333,13 +1333,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _backend_services_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _backend_services_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1353,8 +1353,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "protocol" => Some(("protocol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1380,7 +1380,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::BackendService = json::value::from_value(object).unwrap(); let mut call = self.hub.backend_services().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("backend-service").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1393,7 +1393,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1406,7 +1406,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1429,10 +1429,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _disk_types_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _disk_types_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.disk_types().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1454,7 +1454,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -1468,7 +1468,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1491,10 +1491,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _disk_types_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _disk_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.disk_types().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("disk-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1507,7 +1507,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1520,7 +1520,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1543,10 +1543,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _disk_types_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _disk_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.disk_types().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1568,7 +1568,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -1582,7 +1582,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1605,10 +1605,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _disks_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _disks_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.disks().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1630,7 +1630,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -1644,7 +1644,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1667,13 +1667,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _disks_create_snapshot(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _disks_create_snapshot(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1687,8 +1687,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1715,7 +1715,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Snapshot = json::value::from_value(object).unwrap(); let mut call = self.hub.disks().create_snapshot(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("disk").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1728,7 +1728,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1741,7 +1741,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1764,10 +1764,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _disks_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _disks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.disks().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("disk").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1780,7 +1780,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1793,7 +1793,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1816,10 +1816,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _disks_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _disks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.disks().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("disk").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1832,7 +1832,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1845,7 +1845,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1868,13 +1868,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _disks_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _disks_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1888,8 +1888,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "source-snapshot" => Some(("sourceSnapshot", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1922,7 +1922,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Disk = json::value::from_value(object).unwrap(); let mut call = self.hub.disks().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source-image" => { @@ -1938,7 +1938,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source-image"].iter().map(|v|*v)); @@ -1952,7 +1952,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1975,10 +1975,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _disks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _disks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.disks().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2000,7 +2000,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -2014,7 +2014,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2037,10 +2037,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _firewalls_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _firewalls_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.firewalls().delete(opt.value_of("project").unwrap_or(""), opt.value_of("firewall").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2053,7 +2053,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2066,7 +2066,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2089,10 +2089,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _firewalls_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _firewalls_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.firewalls().get(opt.value_of("project").unwrap_or(""), opt.value_of("firewall").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2105,7 +2105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2118,7 +2118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2141,13 +2141,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _firewalls_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _firewalls_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2161,8 +2161,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2186,7 +2186,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Firewall = json::value::from_value(object).unwrap(); let mut call = self.hub.firewalls().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2199,7 +2199,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2212,7 +2212,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2235,10 +2235,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _firewalls_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _firewalls_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.firewalls().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2260,7 +2260,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -2274,7 +2274,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2297,13 +2297,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _firewalls_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _firewalls_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2317,8 +2317,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2342,7 +2342,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Firewall = json::value::from_value(object).unwrap(); let mut call = self.hub.firewalls().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("firewall").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2355,7 +2355,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2368,7 +2368,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2391,13 +2391,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _firewalls_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _firewalls_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2411,8 +2411,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2436,7 +2436,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Firewall = json::value::from_value(object).unwrap(); let mut call = self.hub.firewalls().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("firewall").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2449,7 +2449,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2462,7 +2462,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2485,10 +2485,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _forwarding_rules_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _forwarding_rules_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.forwarding_rules().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2510,7 +2510,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -2524,7 +2524,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2547,10 +2547,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _forwarding_rules_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _forwarding_rules_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.forwarding_rules().delete(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("forwarding-rule").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2563,7 +2563,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2576,7 +2576,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2599,10 +2599,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _forwarding_rules_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _forwarding_rules_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.forwarding_rules().get(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("forwarding-rule").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2615,7 +2615,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2628,7 +2628,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2651,13 +2651,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _forwarding_rules_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _forwarding_rules_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2671,8 +2671,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2697,7 +2697,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ForwardingRule = json::value::from_value(object).unwrap(); let mut call = self.hub.forwarding_rules().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2710,7 +2710,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2723,7 +2723,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2746,10 +2746,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _forwarding_rules_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _forwarding_rules_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.forwarding_rules().list(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2771,7 +2771,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -2785,7 +2785,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2808,13 +2808,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _forwarding_rules_set_target(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _forwarding_rules_set_target(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2828,8 +2828,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "target" => Some(("target", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -2844,7 +2844,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetReference = json::value::from_value(object).unwrap(); let mut call = self.hub.forwarding_rules().set_target(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("forwarding-rule").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2857,7 +2857,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2870,7 +2870,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2893,10 +2893,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_addresses_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_addresses_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_addresses().delete(opt.value_of("project").unwrap_or(""), opt.value_of("address").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2909,7 +2909,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2922,7 +2922,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2945,10 +2945,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_addresses_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_addresses_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_addresses().get(opt.value_of("project").unwrap_or(""), opt.value_of("address").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2961,7 +2961,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2974,7 +2974,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2997,13 +2997,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_addresses_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_addresses_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3017,8 +3017,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3042,7 +3042,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Address = json::value::from_value(object).unwrap(); let mut call = self.hub.global_addresses().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3055,7 +3055,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3068,7 +3068,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3091,10 +3091,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_addresses_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_addresses_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_addresses().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3116,7 +3116,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -3130,7 +3130,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3153,10 +3153,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_forwarding_rules_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_forwarding_rules_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_forwarding_rules().delete(opt.value_of("project").unwrap_or(""), opt.value_of("forwarding-rule").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3169,7 +3169,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3182,7 +3182,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3205,10 +3205,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_forwarding_rules_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_forwarding_rules_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_forwarding_rules().get(opt.value_of("project").unwrap_or(""), opt.value_of("forwarding-rule").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3221,7 +3221,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3234,7 +3234,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3257,13 +3257,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_forwarding_rules_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_forwarding_rules_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3277,8 +3277,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3303,7 +3303,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ForwardingRule = json::value::from_value(object).unwrap(); let mut call = self.hub.global_forwarding_rules().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3316,7 +3316,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3329,7 +3329,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3352,10 +3352,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_forwarding_rules_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_forwarding_rules_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_forwarding_rules().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3377,7 +3377,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -3391,7 +3391,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3414,13 +3414,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_forwarding_rules_set_target(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_forwarding_rules_set_target(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3434,8 +3434,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "target" => Some(("target", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -3450,7 +3450,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetReference = json::value::from_value(object).unwrap(); let mut call = self.hub.global_forwarding_rules().set_target(request, opt.value_of("project").unwrap_or(""), opt.value_of("forwarding-rule").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3463,7 +3463,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3476,7 +3476,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3499,10 +3499,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_operations_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_operations_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_operations().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3524,7 +3524,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -3538,7 +3538,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3561,10 +3561,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_operations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_operations().delete(opt.value_of("project").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3577,7 +3577,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3590,7 +3590,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3605,10 +3605,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3621,7 +3621,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3634,7 +3634,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3657,10 +3657,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _global_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _global_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.global_operations().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3682,7 +3682,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -3696,7 +3696,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3719,10 +3719,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _http_health_checks_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _http_health_checks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.http_health_checks().delete(opt.value_of("project").unwrap_or(""), opt.value_of("http-health-check").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3735,7 +3735,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3748,7 +3748,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3771,10 +3771,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _http_health_checks_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _http_health_checks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.http_health_checks().get(opt.value_of("project").unwrap_or(""), opt.value_of("http-health-check").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3787,7 +3787,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3800,7 +3800,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3823,13 +3823,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _http_health_checks_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _http_health_checks_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3843,8 +3843,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3871,7 +3871,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::HttpHealthCheck = json::value::from_value(object).unwrap(); let mut call = self.hub.http_health_checks().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3884,7 +3884,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3897,7 +3897,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3920,10 +3920,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _http_health_checks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _http_health_checks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.http_health_checks().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3945,7 +3945,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -3959,7 +3959,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3982,13 +3982,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _http_health_checks_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _http_health_checks_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4002,8 +4002,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4030,7 +4030,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::HttpHealthCheck = json::value::from_value(object).unwrap(); let mut call = self.hub.http_health_checks().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("http-health-check").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4043,7 +4043,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4056,7 +4056,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4079,13 +4079,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _http_health_checks_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _http_health_checks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4099,8 +4099,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4127,7 +4127,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::HttpHealthCheck = json::value::from_value(object).unwrap(); let mut call = self.hub.http_health_checks().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("http-health-check").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4140,7 +4140,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4153,7 +4153,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4176,10 +4176,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _https_health_checks_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _https_health_checks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.https_health_checks().delete(opt.value_of("project").unwrap_or(""), opt.value_of("https-health-check").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4192,7 +4192,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4205,7 +4205,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4228,10 +4228,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _https_health_checks_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _https_health_checks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.https_health_checks().get(opt.value_of("project").unwrap_or(""), opt.value_of("https-health-check").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4244,7 +4244,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4257,7 +4257,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4280,13 +4280,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _https_health_checks_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _https_health_checks_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4300,8 +4300,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4328,7 +4328,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::HttpsHealthCheck = json::value::from_value(object).unwrap(); let mut call = self.hub.https_health_checks().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4341,7 +4341,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4354,7 +4354,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4377,10 +4377,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _https_health_checks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _https_health_checks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.https_health_checks().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -4402,7 +4402,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -4416,7 +4416,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4439,13 +4439,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _https_health_checks_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _https_health_checks_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4459,8 +4459,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4487,7 +4487,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::HttpsHealthCheck = json::value::from_value(object).unwrap(); let mut call = self.hub.https_health_checks().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("https-health-check").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4500,7 +4500,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4513,7 +4513,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4536,13 +4536,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _https_health_checks_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _https_health_checks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4556,8 +4556,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4584,7 +4584,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::HttpsHealthCheck = json::value::from_value(object).unwrap(); let mut call = self.hub.https_health_checks().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("https-health-check").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4597,7 +4597,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4610,7 +4610,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4633,10 +4633,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _images_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _images_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.images().delete(opt.value_of("project").unwrap_or(""), opt.value_of("image").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4649,7 +4649,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4662,7 +4662,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4685,13 +4685,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _images_deprecate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _images_deprecate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4705,8 +4705,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "deleted" => Some(("deleted", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "deprecated" => Some(("deprecated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4725,7 +4725,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DeprecationStatus = json::value::from_value(object).unwrap(); let mut call = self.hub.images().deprecate(request, opt.value_of("project").unwrap_or(""), opt.value_of("image").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4738,7 +4738,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4751,7 +4751,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4774,10 +4774,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _images_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _images_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.images().get(opt.value_of("project").unwrap_or(""), opt.value_of("image").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4790,7 +4790,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4803,7 +4803,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4826,13 +4826,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _images_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _images_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4846,8 +4846,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4882,7 +4882,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Image = json::value::from_value(object).unwrap(); let mut call = self.hub.images().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4895,7 +4895,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4908,7 +4908,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4931,10 +4931,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _images_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _images_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.images().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -4956,7 +4956,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -4970,7 +4970,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4993,13 +4993,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_abandon_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_abandon_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5013,8 +5013,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "instances" => Some(("instances", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -5029,7 +5029,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManagersAbandonInstancesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().abandon_instances(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5042,7 +5042,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5055,7 +5055,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5078,10 +5078,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_group_managers().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -5103,7 +5103,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -5117,7 +5117,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5140,10 +5140,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_group_managers().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5156,7 +5156,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5169,7 +5169,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5192,13 +5192,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_delete_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_delete_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5212,8 +5212,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "instances" => Some(("instances", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -5228,7 +5228,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManagersDeleteInstancesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().delete_instances(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5241,7 +5241,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5254,7 +5254,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5277,10 +5277,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_group_managers().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5293,7 +5293,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5306,7 +5306,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5329,13 +5329,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5349,8 +5349,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "current-actions.none" => Some(("currentActions.none", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "current-actions.recreating" => Some(("currentActions.recreating", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -5384,7 +5384,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManager = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5397,7 +5397,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5410,7 +5410,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5433,10 +5433,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_group_managers().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -5458,7 +5458,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -5472,7 +5472,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5495,10 +5495,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_list_managed_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_list_managed_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_group_managers().list_managed_instances(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5511,7 +5511,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5524,7 +5524,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5547,13 +5547,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_recreate_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_recreate_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5567,8 +5567,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "instances" => Some(("instances", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -5583,7 +5583,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManagersRecreateInstancesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().recreate_instances(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5596,7 +5596,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5609,7 +5609,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5632,11 +5632,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_resize(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_resize(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let size: i32 = arg_from_str(&opt.value_of("size").unwrap_or(""), err, "", "integer"); let mut call = self.hub.instance_group_managers().resize(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or(""), size); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5649,7 +5649,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5662,7 +5662,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5685,13 +5685,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_set_instance_template(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_set_instance_template(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5705,8 +5705,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "instance-template" => Some(("instanceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -5721,7 +5721,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManagersSetInstanceTemplateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().set_instance_template(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5734,7 +5734,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5747,7 +5747,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5770,13 +5770,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_set_target_pools(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_set_target_pools(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5790,8 +5790,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "target-pools" => Some(("targetPools", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5807,7 +5807,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManagersSetTargetPoolsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().set_target_pools(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5820,7 +5820,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5833,7 +5833,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5856,13 +5856,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_groups_add_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_groups_add_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5876,8 +5876,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -5891,7 +5891,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupsAddInstancesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_groups().add_instances(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5904,7 +5904,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5917,7 +5917,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5940,10 +5940,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_groups_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_groups_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_groups().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -5965,7 +5965,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -5979,7 +5979,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6002,10 +6002,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_groups_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_groups().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6018,7 +6018,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6031,7 +6031,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6054,10 +6054,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_groups().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6070,7 +6070,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6083,7 +6083,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6106,13 +6106,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6126,21 +6126,22 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "zone" => Some(("zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subnetwork" => Some(("subnetwork", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "size" => Some(("size", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "fingerprint", "id", "kind", "name", "network", "self-link", "size", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "fingerprint", "id", "kind", "name", "network", "self-link", "size", "subnetwork", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -6151,7 +6152,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_groups().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6164,7 +6165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6177,7 +6178,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6200,10 +6201,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_groups().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -6225,7 +6226,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -6239,7 +6240,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6262,13 +6263,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_groups_list_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_groups_list_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6282,8 +6283,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "instance-state" => Some(("instanceState", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -6298,7 +6299,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupsListInstancesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_groups().list_instances(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -6320,7 +6321,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -6334,7 +6335,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6357,13 +6358,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_groups_remove_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_groups_remove_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6377,8 +6378,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -6392,7 +6393,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupsRemoveInstancesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_groups().remove_instances(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6405,7 +6406,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6418,7 +6419,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6441,13 +6442,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_groups_set_named_ports(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_groups_set_named_ports(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6461,8 +6462,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -6477,7 +6478,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupsSetNamedPortsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_groups().set_named_ports(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6490,7 +6491,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6503,7 +6504,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6526,10 +6527,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_templates_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_templates_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_templates().delete(opt.value_of("project").unwrap_or(""), opt.value_of("instance-template").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6542,7 +6543,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6555,7 +6556,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6578,10 +6579,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_templates_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_templates_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_templates().get(opt.value_of("project").unwrap_or(""), opt.value_of("instance-template").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6594,7 +6595,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6607,7 +6608,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6630,13 +6631,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_templates_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_templates_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6650,8 +6651,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6681,7 +6682,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceTemplate = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_templates().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6694,7 +6695,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6707,7 +6708,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6730,10 +6731,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_templates_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_templates_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_templates().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -6755,7 +6756,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -6769,7 +6770,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6792,13 +6793,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_add_access_config(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_add_access_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6812,8 +6813,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6831,7 +6832,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccessConfig = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().add_access_config(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("network-interface").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6844,7 +6845,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6857,7 +6858,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6880,10 +6881,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -6905,7 +6906,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -6919,7 +6920,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6942,13 +6943,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_attach_disk(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_attach_disk(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6962,8 +6963,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "device-name" => Some(("deviceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6991,7 +6992,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AttachedDisk = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().attach_disk(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7004,7 +7005,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7017,7 +7018,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7040,10 +7041,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7056,7 +7057,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7069,7 +7070,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7092,10 +7093,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_delete_access_config(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_delete_access_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().delete_access_config(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("access-config").unwrap_or(""), opt.value_of("network-interface").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7108,7 +7109,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7121,7 +7122,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7144,10 +7145,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_detach_disk(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_detach_disk(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().detach_disk(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("device-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7160,7 +7161,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7173,7 +7174,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7196,10 +7197,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7212,7 +7213,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7225,7 +7226,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7248,10 +7249,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_get_serial_port_output(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_get_serial_port_output(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().get_serial_port_output(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "port" => { @@ -7267,7 +7268,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["port"].iter().map(|v|*v)); @@ -7281,7 +7282,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7304,13 +7305,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7324,8 +7325,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "cpu-platform" => Some(("cpuPlatform", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -7358,7 +7359,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Instance = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7371,7 +7372,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7384,7 +7385,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7407,10 +7408,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -7432,7 +7433,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -7446,7 +7447,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7469,10 +7470,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_reset(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_reset(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().reset(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7485,7 +7486,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7498,7 +7499,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7521,11 +7522,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_set_disk_auto_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_set_disk_auto_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let auto_delete: bool = arg_from_str(&opt.value_of("auto-delete").unwrap_or(""), err, "", "boolean"); let mut call = self.hub.instances().set_disk_auto_delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or(""), auto_delete, opt.value_of("device-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7538,7 +7539,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7551,7 +7552,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7574,13 +7575,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_set_metadata(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_set_machine_type(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7594,8 +7595,93 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "machine-type" => Some(("machineType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["machine-type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::InstancesSetMachineTypeRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.instances().set_machine_type(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _instances_set_metadata(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -7611,7 +7697,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Metadata = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().set_metadata(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7624,7 +7710,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7637,7 +7723,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7660,13 +7746,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_set_scheduling(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_set_scheduling(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7680,8 +7766,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "automatic-restart" => Some(("automaticRestart", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "preemptible" => Some(("preemptible", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -7698,7 +7784,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Scheduling = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().set_scheduling(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7711,7 +7797,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7724,7 +7810,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7747,13 +7833,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_set_tags(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_set_tags(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7767,8 +7853,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "items" => Some(("items", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -7784,7 +7870,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Tags = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().set_tags(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7797,7 +7883,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7810,7 +7896,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7833,10 +7919,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_start(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_start(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().start(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7849,7 +7935,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7862,7 +7948,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7885,10 +7971,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_stop(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_stop(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().stop(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7901,7 +7987,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7914,7 +8000,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7937,10 +8023,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _licenses_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _licenses_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.licenses().get(opt.value_of("project").unwrap_or(""), opt.value_of("license").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7953,7 +8039,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7966,7 +8052,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7989,10 +8075,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _machine_types_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _machine_types_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.machine_types().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -8014,7 +8100,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -8028,7 +8114,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8051,10 +8137,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _machine_types_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _machine_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.machine_types().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("machine-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8067,7 +8153,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8080,7 +8166,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8103,10 +8189,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _machine_types_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _machine_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.machine_types().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -8128,7 +8214,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -8142,7 +8228,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8165,10 +8251,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _networks_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _networks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.networks().delete(opt.value_of("project").unwrap_or(""), opt.value_of("network").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8181,7 +8267,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8194,7 +8280,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8217,10 +8303,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _networks_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _networks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.networks().get(opt.value_of("project").unwrap_or(""), opt.value_of("network").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8233,7 +8319,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8246,7 +8332,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8269,13 +8355,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _networks_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _networks_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8289,11 +8375,13 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subnetworks" => Some(("subnetworks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "auto-create-subnetworks" => Some(("autoCreateSubnetworks", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "i-pv4-range" => Some(("IPv4Range", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "gateway-i-pv4" => Some(("gatewayIPv4", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8301,7 +8389,7 @@ impl<'n, 'a> Engine<'n, 'a> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["i-pv4-range", "creation-timestamp", "description", "gateway-i-pv4", "id", "kind", "name", "self-link"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["i-pv4-range", "auto-create-subnetworks", "creation-timestamp", "description", "gateway-i-pv4", "id", "kind", "name", "self-link", "subnetworks"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -8312,7 +8400,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Network = json::value::from_value(object).unwrap(); let mut call = self.hub.networks().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8325,7 +8413,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8338,7 +8426,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8361,10 +8449,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _networks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _networks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.networks().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -8386,7 +8474,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -8400,7 +8488,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8423,10 +8511,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().get(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8439,7 +8527,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8452,7 +8540,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8475,13 +8563,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_move_disk(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_move_disk(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8495,8 +8583,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "target-disk" => Some(("targetDisk", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination-zone" => Some(("destinationZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8512,7 +8600,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DiskMoveRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().move_disk(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8525,7 +8613,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8538,7 +8626,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8561,13 +8649,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_move_instance(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_move_instance(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8581,8 +8669,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "target-instance" => Some(("targetInstance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination-zone" => Some(("destinationZone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8598,7 +8686,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceMoveRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().move_instance(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8611,7 +8699,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8624,7 +8712,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8647,13 +8735,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_set_common_instance_metadata(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_set_common_instance_metadata(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8667,8 +8755,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8684,7 +8772,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Metadata = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().set_common_instance_metadata(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8697,7 +8785,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8710,7 +8798,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8733,13 +8821,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_set_usage_export_bucket(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_set_usage_export_bucket(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8753,8 +8841,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "bucket-name" => Some(("bucketName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "report-name-prefix" => Some(("reportNamePrefix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8770,7 +8858,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UsageExportLocation = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().set_usage_export_bucket(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8783,7 +8871,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8796,7 +8884,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8819,10 +8907,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _region_operations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _region_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.region_operations().delete(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8835,7 +8923,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8848,7 +8936,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -8863,10 +8951,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _region_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _region_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.region_operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8879,7 +8967,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8892,7 +8980,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8915,10 +9003,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _region_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _region_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.region_operations().list(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -8940,7 +9028,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -8954,7 +9042,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8977,10 +9065,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _regions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _regions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.regions().get(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8993,7 +9081,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9006,7 +9094,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9029,10 +9117,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _regions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _regions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.regions().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -9054,7 +9142,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -9068,7 +9156,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9091,10 +9179,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _routes_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _routes_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.routes().delete(opt.value_of("project").unwrap_or(""), opt.value_of("route").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9107,7 +9195,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9120,7 +9208,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9143,10 +9231,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _routes_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _routes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.routes().get(opt.value_of("project").unwrap_or(""), opt.value_of("route").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9159,7 +9247,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9172,7 +9260,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9195,13 +9283,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _routes_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _routes_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -9215,8 +9303,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "next-hop-gateway" => Some(("nextHopGateway", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "priority" => Some(("priority", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -9245,7 +9333,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Route = json::value::from_value(object).unwrap(); let mut call = self.hub.routes().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9258,7 +9346,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9271,7 +9359,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9294,10 +9382,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _routes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _routes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.routes().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -9319,7 +9407,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -9333,7 +9421,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9356,10 +9444,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _snapshots_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _snapshots_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.snapshots().delete(opt.value_of("project").unwrap_or(""), opt.value_of("snapshot").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9372,7 +9460,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9385,7 +9473,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9408,10 +9496,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _snapshots_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _snapshots_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.snapshots().get(opt.value_of("project").unwrap_or(""), opt.value_of("snapshot").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9424,7 +9512,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9437,7 +9525,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9460,10 +9548,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _snapshots_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _snapshots_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.snapshots().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -9485,7 +9573,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -9499,7 +9587,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9522,10 +9610,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ssl_certificates_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ssl_certificates_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ssl_certificates().delete(opt.value_of("project").unwrap_or(""), opt.value_of("ssl-certificate").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9538,7 +9626,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9551,7 +9639,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9574,10 +9662,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ssl_certificates_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ssl_certificates_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ssl_certificates().get(opt.value_of("project").unwrap_or(""), opt.value_of("ssl-certificate").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9590,7 +9678,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9603,7 +9691,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9626,13 +9714,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ssl_certificates_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ssl_certificates_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -9646,8 +9734,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -9669,7 +9757,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SslCertificate = json::value::from_value(object).unwrap(); let mut call = self.hub.ssl_certificates().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9682,7 +9770,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9695,7 +9783,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9718,10 +9806,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ssl_certificates_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ssl_certificates_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ssl_certificates().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -9743,7 +9831,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -9757,7 +9845,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9780,10 +9868,72 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_http_proxies_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subnetworks_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.target_http_proxies().delete(opt.value_of("project").unwrap_or(""), opt.value_of("target-http-proxy").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.subnetworks().aggregated_list(opt.value_of("project").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subnetworks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.subnetworks().delete(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("subnetwork").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9796,7 +9946,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9809,7 +9959,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9832,10 +9982,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_http_proxies_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subnetworks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.target_http_proxies().get(opt.value_of("project").unwrap_or(""), opt.value_of("target-http-proxy").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.subnetworks().get(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("subnetwork").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9848,7 +9998,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9861,7 +10011,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9884,13 +10034,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_http_proxies_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subnetworks_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -9904,8 +10054,268 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ip-cidr-range" => Some(("ipCidrRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "gateway-address" => Some(("gatewayAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "gateway-address", "id", "ip-cidr-range", "kind", "name", "network", "region", "self-link"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Subnetwork = json::value::from_value(object).unwrap(); + let mut call = self.hub.subnetworks().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subnetworks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.subnetworks().list(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _target_http_proxies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.target_http_proxies().delete(opt.value_of("project").unwrap_or(""), opt.value_of("target-http-proxy").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _target_http_proxies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.target_http_proxies().get(opt.value_of("project").unwrap_or(""), opt.value_of("target-http-proxy").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _target_http_proxies_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -9926,7 +10336,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetHttpProxy = json::value::from_value(object).unwrap(); let mut call = self.hub.target_http_proxies().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9939,7 +10349,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9952,7 +10362,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9975,10 +10385,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_http_proxies_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_http_proxies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_http_proxies().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -10000,7 +10410,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -10014,7 +10424,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10037,13 +10447,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_http_proxies_set_url_map(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_http_proxies_set_url_map(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10057,8 +10467,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "url-map" => Some(("urlMap", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -10073,7 +10483,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UrlMapReference = json::value::from_value(object).unwrap(); let mut call = self.hub.target_http_proxies().set_url_map(request, opt.value_of("project").unwrap_or(""), opt.value_of("target-http-proxy").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10086,7 +10496,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10099,7 +10509,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10122,10 +10532,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_https_proxies_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_https_proxies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_https_proxies().delete(opt.value_of("project").unwrap_or(""), opt.value_of("target-https-proxy").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10138,7 +10548,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10151,7 +10561,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10174,10 +10584,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_https_proxies_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_https_proxies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_https_proxies().get(opt.value_of("project").unwrap_or(""), opt.value_of("target-https-proxy").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10190,7 +10600,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10203,7 +10613,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10226,13 +10636,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_https_proxies_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_https_proxies_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10246,8 +10656,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10269,7 +10679,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetHttpsProxy = json::value::from_value(object).unwrap(); let mut call = self.hub.target_https_proxies().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10282,7 +10692,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10295,7 +10705,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10318,10 +10728,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_https_proxies_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_https_proxies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_https_proxies().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -10343,7 +10753,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -10357,7 +10767,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10380,13 +10790,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_https_proxies_set_ssl_certificates(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_https_proxies_set_ssl_certificates(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10400,8 +10810,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ssl-certificates" => Some(("sslCertificates", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -10416,7 +10826,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetHttpsProxiesSetSslCertificatesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.target_https_proxies().set_ssl_certificates(request, opt.value_of("project").unwrap_or(""), opt.value_of("target-https-proxy").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10429,7 +10839,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10442,7 +10852,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10465,13 +10875,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_https_proxies_set_url_map(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_https_proxies_set_url_map(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10485,8 +10895,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "url-map" => Some(("urlMap", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -10501,7 +10911,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UrlMapReference = json::value::from_value(object).unwrap(); let mut call = self.hub.target_https_proxies().set_url_map(request, opt.value_of("project").unwrap_or(""), opt.value_of("target-https-proxy").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10514,7 +10924,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10527,7 +10937,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10550,10 +10960,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_instances_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_instances_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_instances().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -10575,7 +10985,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -10589,7 +10999,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10612,10 +11022,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_instances_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_instances_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_instances().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("target-instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10628,7 +11038,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10641,7 +11051,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10664,10 +11074,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_instances_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_instances_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_instances().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("target-instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10680,7 +11090,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10693,7 +11103,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10716,13 +11126,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_instances_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_instances_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10736,8 +11146,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "nat-policy" => Some(("natPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10760,7 +11170,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetInstance = json::value::from_value(object).unwrap(); let mut call = self.hub.target_instances().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10773,7 +11183,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10786,7 +11196,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10809,10 +11219,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_instances_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_instances_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_instances().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -10834,7 +11244,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -10848,7 +11258,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10871,13 +11281,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_add_health_check(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_add_health_check(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10891,8 +11301,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -10906,7 +11316,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetPoolsAddHealthCheckRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.target_pools().add_health_check(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("target-pool").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10919,7 +11329,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10932,7 +11342,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10955,13 +11365,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_add_instance(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_add_instance(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10975,8 +11385,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -10990,7 +11400,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetPoolsAddInstanceRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.target_pools().add_instance(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("target-pool").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11003,7 +11413,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11016,7 +11426,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11039,10 +11449,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_pools().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -11064,7 +11474,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -11078,7 +11488,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11101,10 +11511,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_pools().delete(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("target-pool").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11117,7 +11527,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11130,7 +11540,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11153,10 +11563,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_pools().get(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("target-pool").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11169,7 +11579,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11182,7 +11592,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11205,13 +11615,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_get_health(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_get_health(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11225,8 +11635,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "instance" => Some(("instance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -11241,7 +11651,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceReference = json::value::from_value(object).unwrap(); let mut call = self.hub.target_pools().get_health(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("target-pool").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11254,7 +11664,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11267,7 +11677,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11290,13 +11700,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11310,8 +11720,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "failover-ratio" => Some(("failoverRatio", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -11337,7 +11747,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetPool = json::value::from_value(object).unwrap(); let mut call = self.hub.target_pools().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11350,7 +11760,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11363,7 +11773,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11386,10 +11796,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_pools().list(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -11411,7 +11821,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -11425,7 +11835,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11448,13 +11858,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_remove_health_check(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_remove_health_check(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11468,8 +11878,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -11483,7 +11893,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetPoolsRemoveHealthCheckRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.target_pools().remove_health_check(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("target-pool").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11496,7 +11906,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11509,7 +11919,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11532,13 +11942,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_remove_instance(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_remove_instance(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11552,8 +11962,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -11567,7 +11977,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetPoolsRemoveInstanceRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.target_pools().remove_instance(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("target-pool").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11580,7 +11990,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11593,7 +12003,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11616,13 +12026,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_pools_set_backup(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_pools_set_backup(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11636,8 +12046,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "target" => Some(("target", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -11652,7 +12062,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetReference = json::value::from_value(object).unwrap(); let mut call = self.hub.target_pools().set_backup(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("target-pool").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "failover-ratio" => { @@ -11668,7 +12078,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["failover-ratio"].iter().map(|v|*v)); @@ -11682,7 +12092,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11705,10 +12115,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_vpn_gateways_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_vpn_gateways_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_vpn_gateways().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -11730,7 +12140,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -11744,7 +12154,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11767,10 +12177,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_vpn_gateways_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_vpn_gateways_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_vpn_gateways().delete(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("target-vpn-gateway").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11783,7 +12193,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11796,7 +12206,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11819,10 +12229,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_vpn_gateways_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_vpn_gateways_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_vpn_gateways().get(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("target-vpn-gateway").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11835,7 +12245,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11848,7 +12258,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11871,13 +12281,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_vpn_gateways_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_vpn_gateways_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11891,8 +12301,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -11917,7 +12327,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TargetVpnGateway = json::value::from_value(object).unwrap(); let mut call = self.hub.target_vpn_gateways().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11930,7 +12340,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11943,7 +12353,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11966,10 +12376,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _target_vpn_gateways_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _target_vpn_gateways_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.target_vpn_gateways().list(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -11991,7 +12401,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -12005,7 +12415,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12028,10 +12438,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _url_maps_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _url_maps_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.url_maps().delete(opt.value_of("project").unwrap_or(""), opt.value_of("url-map").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12044,7 +12454,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12057,7 +12467,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12080,10 +12490,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _url_maps_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _url_maps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.url_maps().get(opt.value_of("project").unwrap_or(""), opt.value_of("url-map").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12096,7 +12506,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12109,7 +12519,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12132,13 +12542,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _url_maps_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _url_maps_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12152,8 +12562,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12175,7 +12585,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UrlMap = json::value::from_value(object).unwrap(); let mut call = self.hub.url_maps().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12188,7 +12598,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12201,7 +12611,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12224,10 +12634,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _url_maps_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _url_maps_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.url_maps().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -12249,7 +12659,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -12263,7 +12673,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12286,13 +12696,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _url_maps_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _url_maps_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12306,8 +12716,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12329,7 +12739,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UrlMap = json::value::from_value(object).unwrap(); let mut call = self.hub.url_maps().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("url-map").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12342,7 +12752,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12355,7 +12765,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12378,13 +12788,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _url_maps_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _url_maps_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12398,8 +12808,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12421,7 +12831,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UrlMap = json::value::from_value(object).unwrap(); let mut call = self.hub.url_maps().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("url-map").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12434,7 +12844,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12447,7 +12857,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12470,13 +12880,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _url_maps_validate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _url_maps_validate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12490,8 +12900,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource.kind" => Some(("resource.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "resource.description" => Some(("resource.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12513,7 +12923,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UrlMapsValidateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.url_maps().validate(request, opt.value_of("project").unwrap_or(""), opt.value_of("url-map").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12526,7 +12936,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12539,7 +12949,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12562,10 +12972,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _vpn_tunnels_aggregated_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _vpn_tunnels_aggregated_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.vpn_tunnels().aggregated_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -12587,7 +12997,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -12601,7 +13011,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12624,10 +13034,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _vpn_tunnels_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _vpn_tunnels_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.vpn_tunnels().delete(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("vpn-tunnel").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12640,7 +13050,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12653,7 +13063,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12676,10 +13086,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _vpn_tunnels_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _vpn_tunnels_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.vpn_tunnels().get(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("vpn-tunnel").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12692,7 +13102,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12705,7 +13115,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12728,13 +13138,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _vpn_tunnels_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _vpn_tunnels_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12748,8 +13158,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "detailed-status" => Some(("detailedStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ike-version" => Some(("ikeVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -12757,6 +13167,7 @@ impl<'n, 'a> Engine<'n, 'a> { "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "peer-ip" => Some(("peerIp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "local-traffic-selector" => Some(("localTrafficSelector", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "shared-secret-hash" => Some(("sharedSecretHash", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "target-vpn-gateway" => Some(("targetVpnGateway", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12766,7 +13177,7 @@ impl<'n, 'a> Engine<'n, 'a> { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "detailed-status", "id", "ike-version", "kind", "name", "peer-ip", "region", "self-link", "shared-secret", "shared-secret-hash", "status", "target-vpn-gateway"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["creation-timestamp", "description", "detailed-status", "id", "ike-version", "kind", "local-traffic-selector", "name", "peer-ip", "region", "self-link", "shared-secret", "shared-secret-hash", "status", "target-vpn-gateway"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -12777,7 +13188,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::VpnTunnel = json::value::from_value(object).unwrap(); let mut call = self.hub.vpn_tunnels().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12790,7 +13201,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12803,7 +13214,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12826,10 +13237,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _vpn_tunnels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _vpn_tunnels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.vpn_tunnels().list(opt.value_of("project").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -12851,7 +13262,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -12865,7 +13276,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12888,10 +13299,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12904,7 +13315,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12917,7 +13328,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -12932,10 +13343,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12948,7 +13359,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12961,7 +13372,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12984,10 +13395,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -13009,7 +13420,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -13023,7 +13434,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13046,10 +13457,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zones_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zones_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zones().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13062,7 +13473,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13075,7 +13486,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13098,10 +13509,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zones_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zones_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zones().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -13123,7 +13534,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -13137,7 +13548,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13616,6 +14027,9 @@ impl<'n, 'a> Engine<'n, 'a> { ("set-disk-auto-delete", Some(opt)) => { call_result = self._instances_set_disk_auto_delete(opt, dry_run, &mut err); }, + ("set-machine-type", Some(opt)) => { + call_result = self._instances_set_machine_type(opt, dry_run, &mut err); + }, ("set-metadata", Some(opt)) => { call_result = self._instances_set_metadata(opt, dry_run, &mut err); }, @@ -13796,6 +14210,29 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, + ("subnetworks", Some(opt)) => { + match opt.subcommand() { + ("aggregated-list", Some(opt)) => { + call_result = self._subnetworks_aggregated_list(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._subnetworks_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._subnetworks_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._subnetworks_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._subnetworks_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("subnetworks".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("target-http-proxies", Some(opt)) => { match opt.subcommand() { ("delete", Some(opt)) => { @@ -14032,14 +14469,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "compute1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "compute1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -14059,7 +14496,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -14098,8 +14535,8 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("addresses", "methods: 'aggregated-list', 'delete', 'get', 'insert' and 'list'", vec![ - ("aggregated-list", - Some(r##"Retrieves the list of addresses grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of addresses."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/addresses_aggregated-list", vec![ (Some(r##"project"##), @@ -14120,7 +14557,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified address resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/addresses_delete", vec![ @@ -14154,7 +14591,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified address resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/addresses_get", vec![ @@ -14188,7 +14625,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates an address resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/addresses_insert", vec![ @@ -14222,8 +14659,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of address resources contained within the specified region."##), + ("list", + Some(r##"Retrieves a list of address resources contained within the specified region."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/addresses_list", vec![ (Some(r##"project"##), @@ -14253,13 +14690,13 @@ fn main() { ]), ("autoscalers", "methods: 'aggregated-list', 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("aggregated-list", - Some(r##"Retrieves the list of autoscalers grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of autoscalers."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/autoscalers_aggregated-list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14275,13 +14712,13 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified autoscaler resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/autoscalers_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14309,13 +14746,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified autoscaler resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/autoscalers_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14343,13 +14780,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates an autoscaler resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/autoscalers_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14377,13 +14814,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of autoscaler resources contained within the specified zone."##), + ("list", + Some(r##"Retrieves a list of autoscaler resources contained within the specified zone."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/autoscalers_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14405,13 +14842,13 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an autoscaler resource in the specified project using the data included in the request. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/autoscalers_patch", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14445,13 +14882,13 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an autoscaler resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/autoscalers_update", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14482,13 +14919,13 @@ fn main() { ]), ("backend-services", "methods: 'delete', 'get', 'get-health', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified BackendService resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/backend-services_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14510,13 +14947,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified BackendService resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/backend-services_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14538,7 +14975,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-health", + ("get-health", Some(r##"Gets the most recent health check results for this BackendService."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/backend-services_get-health", vec![ @@ -14572,13 +15009,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", - Some(r##"Creates a BackendService resource in the specified project using the data included in the request."##), + ("insert", + Some(r##"Creates a BackendService resource in the specified project using the data included in the request. There are several restrictions and guidelines to keep in mind when creating a backend service. Read Restrictions and Guidelines for more information."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/backend-services_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14600,13 +15037,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of BackendService resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/backend-services_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14622,13 +15059,13 @@ fn main() { Some(false), Some(false)), ]), - ("patch", - Some(r##"Update the entire content of the BackendService resource. This method supports patch semantics."##), + ("patch", + Some(r##"Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/backend-services_patch", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14656,13 +15093,13 @@ fn main() { Some(false), Some(false)), ]), - ("update", - Some(r##"Update the entire content of the BackendService resource."##), + ("update", + Some(r##"Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/backend-services_update", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -14693,8 +15130,8 @@ fn main() { ]), ("disk-types", "methods: 'aggregated-list', 'get' and 'list'", vec![ - ("aggregated-list", - Some(r##"Retrieves the list of disk type resources grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of disk type resources."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disk-types_aggregated-list", vec![ (Some(r##"project"##), @@ -14715,7 +15152,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified disk type resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disk-types_get", vec![ @@ -14749,8 +15186,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of disk type resources available to the specified project."##), + ("list", + Some(r##"Retrieves a list of disk type resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disk-types_list", vec![ (Some(r##"project"##), @@ -14780,8 +15217,8 @@ fn main() { ]), ("disks", "methods: 'aggregated-list', 'create-snapshot', 'delete', 'get', 'insert' and 'list'", vec![ - ("aggregated-list", - Some(r##"Retrieves the list of disks grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of persistent disks."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disks_aggregated-list", vec![ (Some(r##"project"##), @@ -14802,8 +15239,8 @@ fn main() { Some(false), Some(false)), ]), - ("create-snapshot", - Some(r##"Creates a snapshot of this disk."##), + ("create-snapshot", + Some(r##"Creates a snapshot of a specified persistent disk."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disks_create-snapshot", vec![ (Some(r##"project"##), @@ -14842,7 +15279,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified persistent disk. Deleting a disk removes its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disks_delete", vec![ @@ -14876,7 +15313,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns a specified persistent disk."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disks_get", vec![ @@ -14910,7 +15347,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a persistent disk in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disks_insert", vec![ @@ -14944,8 +15381,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of persistent disks contained within the specified zone."##), + ("list", + Some(r##"Retrieves a list of persistent disks contained within the specified zone."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/disks_list", vec![ (Some(r##"project"##), @@ -14975,7 +15412,7 @@ fn main() { ]), ("firewalls", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified firewall resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/firewalls_delete", vec![ @@ -15003,7 +15440,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified firewall resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/firewalls_get", vec![ @@ -15031,7 +15468,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a firewall resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/firewalls_insert", vec![ @@ -15059,7 +15496,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of firewall resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/firewalls_list", vec![ @@ -15081,7 +15518,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates the specified firewall resource with the data included in the request. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/firewalls_patch", vec![ @@ -15115,7 +15552,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates the specified firewall resource with the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/firewalls_update", vec![ @@ -15152,13 +15589,13 @@ fn main() { ]), ("forwarding-rules", "methods: 'aggregated-list', 'delete', 'get', 'insert', 'list' and 'set-target'", vec![ - ("aggregated-list", - Some(r##"Retrieves the list of forwarding rules grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of forwarding rules."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/forwarding-rules_aggregated-list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15174,13 +15611,13 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified ForwardingRule resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/forwarding-rules_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15208,13 +15645,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified ForwardingRule resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/forwarding-rules_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15242,13 +15679,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a ForwardingRule resource in the specified project and region using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/forwarding-rules_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15276,13 +15713,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of ForwardingRule resources available to the specified project and region."##), + ("list", + Some(r##"Retrieves a list of ForwardingRule resources available to the specified project and region."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/forwarding-rules_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15304,13 +15741,13 @@ fn main() { Some(false), Some(false)), ]), - ("set-target", - Some(r##"Changes target url for forwarding rule."##), + ("set-target", + Some(r##"Changes target URL for forwarding rule. The new target should be of the same type as the old target."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/forwarding-rules_set-target", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15347,7 +15784,7 @@ fn main() { ]), ("global-addresses", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified address resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-addresses_delete", vec![ @@ -15375,7 +15812,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified address resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-addresses_get", vec![ @@ -15403,7 +15840,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates an address resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-addresses_insert", vec![ @@ -15431,8 +15868,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of global address resources."##), + ("list", + Some(r##"Retrieves a list of global address resources."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-addresses_list", vec![ (Some(r##"project"##), @@ -15456,13 +15893,13 @@ fn main() { ]), ("global-forwarding-rules", "methods: 'delete', 'get', 'insert', 'list' and 'set-target'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified ForwardingRule resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-forwarding-rules_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15484,13 +15921,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified ForwardingRule resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-forwarding-rules_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15512,13 +15949,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a ForwardingRule resource in the specified project and region using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-forwarding-rules_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15540,13 +15977,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of ForwardingRule resources available to the specified project."##), + ("list", + Some(r##"Retrieves a list of ForwardingRule resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-forwarding-rules_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15562,13 +15999,13 @@ fn main() { Some(false), Some(false)), ]), - ("set-target", - Some(r##"Changes target url for forwarding rule."##), + ("set-target", + Some(r##"Changes target URL for forwarding rule. The new target should be of the same type as the old target."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-forwarding-rules_set-target", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15599,8 +16036,8 @@ fn main() { ]), ("global-operations", "methods: 'aggregated-list', 'delete', 'get' and 'list'", vec![ - ("aggregated-list", - Some(r##"Retrieves the list of all operations grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of all operations."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-operations_aggregated-list", vec![ (Some(r##"project"##), @@ -15621,7 +16058,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified Operations resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-operations_delete", vec![ @@ -15643,7 +16080,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves the specified Operations resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-operations_get", vec![ @@ -15671,8 +16108,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of Operation resources contained within the specified project."##), + ("list", + Some(r##"Retrieves a list of Operation resources contained within the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/global-operations_list", vec![ (Some(r##"project"##), @@ -15696,13 +16133,13 @@ fn main() { ]), ("http-health-checks", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified HttpHealthCheck resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/http-health-checks_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15724,13 +16161,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified HttpHealthCheck resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/http-health-checks_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15752,13 +16189,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a HttpHealthCheck resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/http-health-checks_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15780,13 +16217,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of HttpHealthCheck resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/http-health-checks_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15802,13 +16239,13 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a HttpHealthCheck resource in the specified project using the data included in the request. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/http-health-checks_patch", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15836,13 +16273,13 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a HttpHealthCheck resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/http-health-checks_update", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15873,13 +16310,13 @@ fn main() { ]), ("https-health-checks", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified HttpsHealthCheck resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/https-health-checks_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15901,13 +16338,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified HttpsHealthCheck resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/https-health-checks_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15929,13 +16366,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a HttpsHealthCheck resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/https-health-checks_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15957,13 +16394,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of HttpsHealthCheck resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/https-health-checks_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -15979,13 +16416,13 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a HttpsHealthCheck resource in the specified project using the data included in the request. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/https-health-checks_patch", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16013,13 +16450,13 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a HttpsHealthCheck resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/https-health-checks_update", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16050,7 +16487,7 @@ fn main() { ]), ("images", "methods: 'delete', 'deprecate', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified image resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/images_delete", vec![ @@ -16078,7 +16515,7 @@ fn main() { Some(false), Some(false)), ]), - ("deprecate", + ("deprecate", Some(r##"Sets the deprecation status of an image. If an empty request body is given, clears the deprecation status instead."##), @@ -16114,7 +16551,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified image resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/images_get", vec![ @@ -16142,7 +16579,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates an image resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/images_insert", vec![ @@ -16170,7 +16607,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of private images available to the specified project. Private images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 7. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud. See Accessing images for more information."##), @@ -16197,13 +16634,13 @@ fn main() { ]), ("instance-group-managers", "methods: 'abandon-instances', 'aggregated-list', 'delete', 'delete-instances', 'get', 'insert', 'list', 'list-managed-instances', 'recreate-instances', 'resize', 'set-instance-template' and 'set-target-pools'", vec![ - ("abandon-instances", + ("abandon-instances", Some(r##"Schedules a group action to remove the specified instances from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_abandon-instances", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16237,13 +16674,13 @@ fn main() { Some(false), Some(false)), ]), - ("aggregated-list", + ("aggregated-list", Some(r##"Retrieves the list of managed instance groups and groups them by zone."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_aggregated-list", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16259,13 +16696,13 @@ fn main() { Some(false), Some(false)), ]), - ("delete", - Some(r##"Deletes the specified managed instance group and all of the instances in that group."##), + ("delete", + Some(r##"Deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_delete", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16293,13 +16730,13 @@ fn main() { Some(false), Some(false)), ]), - ("delete-instances", + ("delete-instances", Some(r##"Schedules a group action to delete the specified instances in the managed instance group. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_delete-instances", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16333,13 +16770,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns all of the details about the specified managed instance group."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_get", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16367,13 +16804,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a managed instance group using the information that you specify in the request. After the group is created, it schedules an action to create instances in the group using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_insert", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16401,13 +16838,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of managed instance groups that are contained within the specified project and zone."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_list", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16429,13 +16866,13 @@ fn main() { Some(false), Some(false)), ]), - ("list-managed-instances", + ("list-managed-instances", Some(r##"Lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_list-managed-instances", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16463,13 +16900,13 @@ fn main() { Some(false), Some(false)), ]), - ("recreate-instances", + ("recreate-instances", Some(r##"Schedules a group action to recreate the specified instances in the managed instance group. The instances are deleted and recreated using the current instance template for the managed instance group. This operation is marked as DONE when the action is scheduled even if the instances have not yet been recreated. You must separately verify the status of the recreating action with the listmanagedinstances method."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_recreate-instances", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16503,13 +16940,13 @@ fn main() { Some(false), Some(false)), ]), - ("resize", + ("resize", Some(r##"Resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_resize", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16543,13 +16980,13 @@ fn main() { Some(false), Some(false)), ]), - ("set-instance-template", + ("set-instance-template", Some(r##"Specifies the instance template to use when creating new instances in this group. The templates for existing instances in the group do not change unless you recreate them."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_set-instance-template", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16583,13 +17020,13 @@ fn main() { Some(false), Some(false)), ]), - ("set-target-pools", + ("set-target-pools", Some(r##"Modifies the target pools to which all instances in this managed instance group are assigned. The target pools automatically apply to all of the instances in the managed instance group. This operation is marked DONE when you make the request even if the instances have not yet been added to their target pools. The change might take some time to apply to all of the instances in the group depending on the size of the group."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-group-managers_set-target-pools", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16626,13 +17063,13 @@ fn main() { ]), ("instance-groups", "methods: 'add-instances', 'aggregated-list', 'delete', 'get', 'insert', 'list', 'list-instances', 'remove-instances' and 'set-named-ports'", vec![ - ("add-instances", - Some(r##"Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. TODO: Change to comment to state "if IG is load balanced.""##), + ("add-instances", + Some(r##"Adds a list of instances to the specified instance group. Read Adding instances for more information."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-groups_add-instances", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16666,13 +17103,13 @@ fn main() { Some(false), Some(false)), ]), - ("aggregated-list", + ("aggregated-list", Some(r##"Retrieves the list of instance groups and sorts them by zone."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-groups_aggregated-list", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16688,13 +17125,13 @@ fn main() { Some(false), Some(false)), ]), - ("delete", - Some(r##"Deletes the specified instance group. The instances in the group are not deleted."##), + ("delete", + Some(r##"Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-groups_delete", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16722,13 +17159,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified instance group resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-groups_get", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16756,13 +17193,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates an instance group in the specified project using the parameters that are included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-groups_insert", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16790,13 +17227,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of instance groups that are located in the specified project and zone."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-groups_list", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16818,13 +17255,13 @@ fn main() { Some(false), Some(false)), ]), - ("list-instances", + ("list-instances", Some(r##"Lists the instances in the specified instance group."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-groups_list-instances", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16858,13 +17295,13 @@ fn main() { Some(false), Some(false)), ]), - ("remove-instances", + ("remove-instances", Some(r##"Removes one or more instances from the specified instance group, but does not delete those instances."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-groups_remove-instances", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16898,13 +17335,13 @@ fn main() { Some(false), Some(false)), ]), - ("set-named-ports", + ("set-named-ports", Some(r##"Sets the named ports for the specified instance group."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-groups_set-named-ports", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16941,13 +17378,13 @@ fn main() { ]), ("instance-templates", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified instance template."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-templates_delete", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16969,13 +17406,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified instance template resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-templates_get", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -16997,13 +17434,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", - Some(r##"Creates an instance template in the specified project using the data that is included in the request."##), + ("insert", + Some(r##"Creates an instance template in the specified project using the data that is included in the request. If you are creating a new template to update an existing instance group, your new instance template must use the same network or, if applicable, the same subnetwork as the original template."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-templates_insert", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -17025,13 +17462,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of instance templates that are contained within the specified project and zone."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instance-templates_list", vec![ (Some(r##"project"##), None, - Some(r##"The project ID for this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -17049,8 +17486,8 @@ fn main() { ]), ]), - ("instances", "methods: 'add-access-config', 'aggregated-list', 'attach-disk', 'delete', 'delete-access-config', 'detach-disk', 'get', 'get-serial-port-output', 'insert', 'list', 'reset', 'set-disk-auto-delete', 'set-metadata', 'set-scheduling', 'set-tags', 'start' and 'stop'", vec![ - ("add-access-config", + ("instances", "methods: 'add-access-config', 'aggregated-list', 'attach-disk', 'delete', 'delete-access-config', 'detach-disk', 'get', 'get-serial-port-output', 'insert', 'list', 'reset', 'set-disk-auto-delete', 'set-machine-type', 'set-metadata', 'set-scheduling', 'set-tags', 'start' and 'stop'", vec![ + ("add-access-config", Some(r##"Adds an access config to an instance's network interface."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_add-access-config", vec![ @@ -17096,7 +17533,7 @@ fn main() { Some(false), Some(false)), ]), - ("aggregated-list", + ("aggregated-list", Some(r##"Retrieves aggregated list of instance resources."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_aggregated-list", vec![ @@ -17118,7 +17555,7 @@ fn main() { Some(false), Some(false)), ]), - ("attach-disk", + ("attach-disk", Some(r##"Attaches a Disk resource to an instance."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_attach-disk", vec![ @@ -17158,8 +17595,8 @@ fn main() { Some(false), Some(false)), ]), - ("delete", - Some(r##"Deletes the specified Instance resource. For more information, see Shutting down an instance."##), + ("delete", + Some(r##"Deletes the specified Instance resource. For more information, see Stopping or Deleting an Instance."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_delete", vec![ (Some(r##"project"##), @@ -17192,7 +17629,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete-access-config", + ("delete-access-config", Some(r##"Deletes an access config from an instance's network interface."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_delete-access-config", vec![ @@ -17238,7 +17675,7 @@ fn main() { Some(false), Some(false)), ]), - ("detach-disk", + ("detach-disk", Some(r##"Detaches a disk from an instance."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_detach-disk", vec![ @@ -17278,7 +17715,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified instance resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_get", vec![ @@ -17312,7 +17749,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-serial-port-output", + ("get-serial-port-output", Some(r##"Returns the specified instance's serial port output."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_get-serial-port-output", vec![ @@ -17346,7 +17783,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates an instance resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_insert", vec![ @@ -17380,7 +17817,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of instance resources contained within the specified zone."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_list", vec![ @@ -17408,7 +17845,7 @@ fn main() { Some(false), Some(false)), ]), - ("reset", + ("reset", Some(r##"Performs a hard reset on the instance."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_reset", vec![ @@ -17442,7 +17879,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-disk-auto-delete", + ("set-disk-auto-delete", Some(r##"Sets the auto-delete flag for a disk attached to an instance."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_set-disk-auto-delete", vec![ @@ -17488,7 +17925,47 @@ fn main() { Some(false), Some(false)), ]), - ("set-metadata", + ("set-machine-type", + Some(r##"Changes the machine type for a stopped instance to the machine type specified in the request."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_set-machine-type", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"zone"##), + None, + Some(r##"The name of the zone for this request."##), + Some(true), + Some(false)), + + (Some(r##"instance"##), + None, + Some(r##"Name of the instance scoping this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("set-metadata", Some(r##"Sets metadata for the specified instance to the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_set-metadata", vec![ @@ -17528,7 +18005,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-scheduling", + ("set-scheduling", Some(r##"Sets an instance's scheduling options."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_set-scheduling", vec![ @@ -17568,7 +18045,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-tags", + ("set-tags", Some(r##"Sets tags for the specified instance to the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_set-tags", vec![ @@ -17608,8 +18085,8 @@ fn main() { Some(false), Some(false)), ]), - ("start", - Some(r##"This method starts an instance that was stopped using the using the instances().stop method. For more information, see Restart an instance."##), + ("start", + Some(r##"Starts an instance that was stopped using the using the instances().stop method. For more information, see Restart an instance."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_start", vec![ (Some(r##"project"##), @@ -17642,8 +18119,8 @@ fn main() { Some(false), Some(false)), ]), - ("stop", - Some(r##"This method stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur per-minute, virtual machine usage charges while they are stopped, but any resources that the virtual machine is using, such as persistent disks and static IP addresses,will continue to be charged until they are deleted. For more information, see Stopping an instance."##), + ("stop", + Some(r##"Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur per-minute, virtual machine usage charges while they are stopped, but any resources that the virtual machine is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/instances_stop", vec![ (Some(r##"project"##), @@ -17679,7 +18156,7 @@ fn main() { ]), ("licenses", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Returns the specified license resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/licenses_get", vec![ @@ -17710,8 +18187,8 @@ fn main() { ]), ("machine-types", "methods: 'aggregated-list', 'get' and 'list'", vec![ - ("aggregated-list", - Some(r##"Retrieves the list of machine type resources grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of machine type resources."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/machine-types_aggregated-list", vec![ (Some(r##"project"##), @@ -17732,7 +18209,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified machine type resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/machine-types_get", vec![ @@ -17766,8 +18243,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of machine type resources available to the specified project."##), + ("list", + Some(r##"Retrieves a list of machine type resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/machine-types_list", vec![ (Some(r##"project"##), @@ -17797,7 +18274,7 @@ fn main() { ]), ("networks", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified network resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/networks_delete", vec![ @@ -17825,7 +18302,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified network resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/networks_get", vec![ @@ -17853,7 +18330,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a network resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/networks_insert", vec![ @@ -17881,7 +18358,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of network resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/networks_list", vec![ @@ -17906,7 +18383,7 @@ fn main() { ]), ("projects", "methods: 'get', 'move-disk', 'move-instance', 'set-common-instance-metadata' and 'set-usage-export-bucket'", vec![ - ("get", + ("get", Some(r##"Returns the specified project resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/projects_get", vec![ @@ -17928,7 +18405,7 @@ fn main() { Some(false), Some(false)), ]), - ("move-disk", + ("move-disk", Some(r##"Moves a persistent disk from one zone to another."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/projects_move-disk", vec![ @@ -17956,7 +18433,7 @@ fn main() { Some(false), Some(false)), ]), - ("move-instance", + ("move-instance", Some(r##"Moves an instance and its attached persistent disks from one zone to another."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/projects_move-instance", vec![ @@ -17984,7 +18461,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-common-instance-metadata", + ("set-common-instance-metadata", Some(r##"Sets metadata common to all instances within the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/projects_set-common-instance-metadata", vec![ @@ -18012,7 +18489,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-usage-export-bucket", + ("set-usage-export-bucket", Some(r##"Enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/projects_set-usage-export-bucket", vec![ @@ -18043,7 +18520,7 @@ fn main() { ]), ("region-operations", "methods: 'delete', 'get' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified region-specific Operations resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/region-operations_delete", vec![ @@ -18071,7 +18548,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves the specified region-specific Operations resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/region-operations_get", vec![ @@ -18083,7 +18560,7 @@ fn main() { (Some(r##"region"##), None, - Some(r##"Name of the zone scoping this request."##), + Some(r##"Name of the region scoping this request."##), Some(true), Some(false)), @@ -18105,8 +18582,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of Operation resources contained within the specified region."##), + ("list", + Some(r##"Retrieves a list of Operation resources contained within the specified region."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/region-operations_list", vec![ (Some(r##"project"##), @@ -18136,7 +18613,7 @@ fn main() { ]), ("regions", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Returns the specified region resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/regions_get", vec![ @@ -18164,7 +18641,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of region resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/regions_list", vec![ @@ -18189,13 +18666,13 @@ fn main() { ]), ("routes", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified route resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/routes_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18217,13 +18694,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified route resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/routes_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18245,13 +18722,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a route resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/routes_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18273,13 +18750,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of route resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/routes_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18298,7 +18775,7 @@ fn main() { ]), ("snapshots", "methods: 'delete', 'get' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. For more information, see Deleting snaphots."##), @@ -18306,7 +18783,7 @@ fn main() { vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18328,13 +18805,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified Snapshot resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/snapshots_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18356,13 +18833,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of Snapshot resources contained within the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/snapshots_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18381,13 +18858,13 @@ fn main() { ]), ("ssl-certificates", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified SslCertificate resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/ssl-certificates_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18409,13 +18886,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified SslCertificate resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/ssl-certificates_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18437,13 +18914,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a SslCertificate resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/ssl-certificates_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18465,13 +18942,168 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of SslCertificate resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/ssl-certificates_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("subnetworks", "methods: 'aggregated-list', 'delete', 'get', 'insert' and 'list'", vec![ + ("aggregated-list", + Some(r##"Retrieves an aggregated list of subnetworks."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/subnetworks_aggregated-list", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes the specified subnetwork."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/subnetworks_delete", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"Name of the region scoping this request."##), + Some(true), + Some(false)), + + (Some(r##"subnetwork"##), + None, + Some(r##"Name of the Subnetwork resource to delete."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Returns the specified subnetwork."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/subnetworks_get", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"Name of the region scoping this request."##), + Some(true), + Some(false)), + + (Some(r##"subnetwork"##), + None, + Some(r##"Name of the Subnetwork resource to return."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Creates a subnetwork in the specified project using the data included in the request."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/subnetworks_insert", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"Name of the region scoping this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of subnetworks available to the specified project."##), + "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/subnetworks_list", + vec![ + (Some(r##"project"##), + None, + Some(r##"Project ID for this request."##), + Some(true), + Some(false)), + + (Some(r##"region"##), + None, + Some(r##"Name of the region scoping this request."##), Some(true), Some(false)), @@ -18490,13 +19122,13 @@ fn main() { ]), ("target-http-proxies", "methods: 'delete', 'get', 'insert', 'list' and 'set-url-map'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified TargetHttpProxy resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-http-proxies_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18518,13 +19150,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified TargetHttpProxy resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-http-proxies_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18546,13 +19178,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a TargetHttpProxy resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-http-proxies_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18574,13 +19206,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of TargetHttpProxy resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-http-proxies_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18596,13 +19228,13 @@ fn main() { Some(false), Some(false)), ]), - ("set-url-map", + ("set-url-map", Some(r##"Changes the URL map for TargetHttpProxy."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-http-proxies_set-url-map", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18633,13 +19265,13 @@ fn main() { ]), ("target-https-proxies", "methods: 'delete', 'get', 'insert', 'list', 'set-ssl-certificates' and 'set-url-map'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified TargetHttpsProxy resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-https-proxies_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18661,13 +19293,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified TargetHttpsProxy resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-https-proxies_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18689,13 +19321,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a TargetHttpsProxy resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-https-proxies_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18717,13 +19349,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of TargetHttpsProxy resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-https-proxies_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18739,19 +19371,19 @@ fn main() { Some(false), Some(false)), ]), - ("set-ssl-certificates", + ("set-ssl-certificates", Some(r##"Replaces SslCertificates for TargetHttpsProxy."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-https-proxies_set-ssl-certificates", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), (Some(r##"target-https-proxy"##), None, - Some(r##"Name of the TargetHttpsProxy resource whose URL map is to be set."##), + Some(r##"Name of the TargetHttpsProxy resource whose SSLCertificate is to be set."##), Some(true), Some(false)), @@ -18773,13 +19405,13 @@ fn main() { Some(false), Some(false)), ]), - ("set-url-map", + ("set-url-map", Some(r##"Changes the URL map for TargetHttpsProxy."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-https-proxies_set-url-map", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18810,13 +19442,13 @@ fn main() { ]), ("target-instances", "methods: 'aggregated-list', 'delete', 'get', 'insert' and 'list'", vec![ - ("aggregated-list", - Some(r##"Retrieves the list of target instances grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of target instances."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-instances_aggregated-list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18832,13 +19464,13 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified TargetInstance resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-instances_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18866,13 +19498,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified TargetInstance resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-instances_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18900,13 +19532,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a TargetInstance resource in the specified project and zone using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-instances_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18934,13 +19566,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of TargetInstance resources available to the specified project and zone."##), + ("list", + Some(r##"Retrieves a list of TargetInstance resources available to the specified project and zone."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-instances_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -18965,7 +19597,7 @@ fn main() { ]), ("target-pools", "methods: 'add-health-check', 'add-instance', 'aggregated-list', 'delete', 'get', 'get-health', 'insert', 'list', 'remove-health-check', 'remove-instance' and 'set-backup'", vec![ - ("add-health-check", + ("add-health-check", Some(r##"Adds health check URL to targetPool."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_add-health-check", vec![ @@ -19005,8 +19637,8 @@ fn main() { Some(false), Some(false)), ]), - ("add-instance", - Some(r##"Adds instance url to targetPool."##), + ("add-instance", + Some(r##"Adds instance URL to targetPool."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_add-instance", vec![ (Some(r##"project"##), @@ -19045,13 +19677,13 @@ fn main() { Some(false), Some(false)), ]), - ("aggregated-list", - Some(r##"Retrieves the list of target pools grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of target pools."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_aggregated-list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19067,13 +19699,13 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified TargetPool resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19101,13 +19733,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified TargetPool resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19135,8 +19767,8 @@ fn main() { Some(false), Some(false)), ]), - ("get-health", - Some(r##"Gets the most recent health check results for each IP for the given instance that is referenced by given TargetPool."##), + ("get-health", + Some(r##"Gets the most recent health check results for each IP for the given instance that is referenced by the given TargetPool."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_get-health", vec![ (Some(r##"project"##), @@ -19175,13 +19807,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a TargetPool resource in the specified project and region using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19209,13 +19841,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of TargetPool resources available to the specified project and region."##), + ("list", + Some(r##"Retrieves a list of TargetPool resources available to the specified project and region."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19237,7 +19869,7 @@ fn main() { Some(false), Some(false)), ]), - ("remove-health-check", + ("remove-health-check", Some(r##"Removes health check URL from targetPool."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_remove-health-check", vec![ @@ -19277,7 +19909,7 @@ fn main() { Some(false), Some(false)), ]), - ("remove-instance", + ("remove-instance", Some(r##"Removes instance URL from targetPool."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_remove-instance", vec![ @@ -19317,13 +19949,13 @@ fn main() { Some(false), Some(false)), ]), - ("set-backup", + ("set-backup", Some(r##"Changes backup pool configurations."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-pools_set-backup", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19360,8 +19992,8 @@ fn main() { ]), ("target-vpn-gateways", "methods: 'aggregated-list', 'delete', 'get', 'insert' and 'list'", vec![ - ("aggregated-list", - Some(r##"Retrieves the list of target VPN gateways grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of target VPN gateways ."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-vpn-gateways_aggregated-list", vec![ (Some(r##"project"##), @@ -19382,7 +20014,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified TargetVpnGateway resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-vpn-gateways_delete", vec![ @@ -19416,7 +20048,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified TargetVpnGateway resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-vpn-gateways_get", vec![ @@ -19450,7 +20082,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a TargetVpnGateway resource in the specified project and region using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-vpn-gateways_insert", vec![ @@ -19484,8 +20116,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of TargetVpnGateway resources available to the specified project and region."##), + ("list", + Some(r##"Retrieves a list of TargetVpnGateway resources available to the specified project and region."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/target-vpn-gateways_list", vec![ (Some(r##"project"##), @@ -19515,13 +20147,13 @@ fn main() { ]), ("url-maps", "methods: 'delete', 'get', 'insert', 'list', 'patch', 'update' and 'validate'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified UrlMap resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/url-maps_delete", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19543,13 +20175,13 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified UrlMap resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/url-maps_get", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19571,13 +20203,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a UrlMap resource in the specified project using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/url-maps_insert", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19599,13 +20231,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of UrlMap resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/url-maps_list", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19621,13 +20253,13 @@ fn main() { Some(false), Some(false)), ]), - ("patch", - Some(r##"Update the entire content of the UrlMap resource. This method supports patch semantics."##), + ("patch", + Some(r##"Updates the entire content of the UrlMap resource. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/url-maps_patch", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19655,13 +20287,13 @@ fn main() { Some(false), Some(false)), ]), - ("update", - Some(r##"Update the entire content of the UrlMap resource."##), + ("update", + Some(r##"Updates the entire content of the UrlMap resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/url-maps_update", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19689,13 +20321,13 @@ fn main() { Some(false), Some(false)), ]), - ("validate", - Some(r##"Run static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap."##), + ("validate", + Some(r##"Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/url-maps_validate", vec![ (Some(r##"project"##), None, - Some(r##"Name of the project scoping this request."##), + Some(r##"Project ID for this request."##), Some(true), Some(false)), @@ -19726,8 +20358,8 @@ fn main() { ]), ("vpn-tunnels", "methods: 'aggregated-list', 'delete', 'get', 'insert' and 'list'", vec![ - ("aggregated-list", - Some(r##"Retrieves the list of VPN tunnels grouped by scope."##), + ("aggregated-list", + Some(r##"Retrieves an aggregated list of VPN tunnels."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/vpn-tunnels_aggregated-list", vec![ (Some(r##"project"##), @@ -19748,7 +20380,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified VpnTunnel resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/vpn-tunnels_delete", vec![ @@ -19782,7 +20414,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified VpnTunnel resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/vpn-tunnels_get", vec![ @@ -19816,7 +20448,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a VpnTunnel resource in the specified project and region using the data included in the request."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/vpn-tunnels_insert", vec![ @@ -19850,8 +20482,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of VpnTunnel resources contained in the specified project and region."##), + ("list", + Some(r##"Retrieves a list of VpnTunnel resources contained in the specified project and region."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/vpn-tunnels_list", vec![ (Some(r##"project"##), @@ -19881,7 +20513,7 @@ fn main() { ]), ("zone-operations", "methods: 'delete', 'get' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified zone-specific Operations resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/zone-operations_delete", vec![ @@ -19909,7 +20541,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves the specified zone-specific Operations resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/zone-operations_get", vec![ @@ -19943,8 +20575,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Retrieves the list of Operation resources contained within the specified zone."##), + ("list", + Some(r##"Retrieves a list of Operation resources contained within the specified zone."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/zone-operations_list", vec![ (Some(r##"project"##), @@ -19974,7 +20606,7 @@ fn main() { ]), ("zones", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Returns the specified zone resource."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/zones_get", vec![ @@ -20002,7 +20634,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of zone resources available to the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_compute1_cli/zones_list", vec![ @@ -20030,7 +20662,7 @@ fn main() { let mut app = App::new("compute1") .author("Sebastian Thiel ") - .version("0.3.2+20151015") + .version("0.3.3+20160120") .about("API for the Google Compute Engine service.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_compute1_cli") .arg(Arg::with_name("url") @@ -20054,7 +20686,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -20065,7 +20697,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/compute1/Cargo.toml b/gen/compute1/Cargo.toml index e89b201377..ad7d190a17 100644 --- a/gen/compute1/Cargo.toml +++ b/gen/compute1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-compute1" -version = "0.1.10+20151015" +version = "0.1.11+20160120" authors = ["Sebastian Thiel "] description = "A complete library to interact with compute (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/compute1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/compute1/LICENSE.md b/gen/compute1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/compute1/LICENSE.md +++ b/gen/compute1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/compute1/README.md b/gen/compute1/README.md index f27e1578f7..e9fb870cd0 100644 --- a/gen/compute1/README.md +++ b/gen/compute1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-compute1` library allows access to all features of the *Google compute* service. -This documentation was generated from *compute* crate version *0.1.10+20151015*, where *20151015* is the exact revision of the *compute:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *compute* crate version *0.1.11+20160120*, where *20160120* is the exact revision of the *compute:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *compute* *v1* API can be found at the [official documentation site](https://developers.google.com/compute/docs/reference/latest/). @@ -46,7 +46,7 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [instance templates](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceTemplate.html) * [*delete*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceTemplateDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceTemplateGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceTemplateInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceTemplateListCall.html) * [instances](http://byron.github.io/google-apis-rs/google_compute1/struct.Instance.html) - * [*add access config*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceAddAccessConfigCall.html), [*aggregated list*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceAggregatedListCall.html), [*attach disk*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceAttachDiskCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceDeleteCall.html), [*delete access config*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceDeleteAccessConfigCall.html), [*detach disk*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceDetachDiskCall.html), [*get*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceGetCall.html), [*get serial port output*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceGetSerialPortOutputCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceListCall.html), [*reset*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceResetCall.html), [*set disk auto delete*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceSetDiskAutoDeleteCall.html), [*set metadata*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceSetMetadataCall.html), [*set scheduling*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceSetSchedulingCall.html), [*set tags*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceSetTagCall.html), [*start*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceStartCall.html) and [*stop*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceStopCall.html) + * [*add access config*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceAddAccessConfigCall.html), [*aggregated list*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceAggregatedListCall.html), [*attach disk*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceAttachDiskCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceDeleteCall.html), [*delete access config*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceDeleteAccessConfigCall.html), [*detach disk*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceDetachDiskCall.html), [*get*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceGetCall.html), [*get serial port output*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceGetSerialPortOutputCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceListCall.html), [*reset*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceResetCall.html), [*set disk auto delete*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceSetDiskAutoDeleteCall.html), [*set machine type*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceSetMachineTypeCall.html), [*set metadata*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceSetMetadataCall.html), [*set scheduling*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceSetSchedulingCall.html), [*set tags*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceSetTagCall.html), [*start*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceStartCall.html) and [*stop*](http://byron.github.io/google-apis-rs/google_compute1/struct.InstanceStopCall.html) * [licenses](http://byron.github.io/google-apis-rs/google_compute1/struct.License.html) * [*get*](http://byron.github.io/google-apis-rs/google_compute1/struct.LicenseGetCall.html) * [machine types](http://byron.github.io/google-apis-rs/google_compute1/struct.MachineType.html) @@ -65,6 +65,8 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [*delete*](http://byron.github.io/google-apis-rs/google_compute1/struct.SnapshotDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_compute1/struct.SnapshotGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_compute1/struct.SnapshotListCall.html) * [ssl certificates](http://byron.github.io/google-apis-rs/google_compute1/struct.SslCertificate.html) * [*delete*](http://byron.github.io/google-apis-rs/google_compute1/struct.SslCertificateDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_compute1/struct.SslCertificateGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_compute1/struct.SslCertificateInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_compute1/struct.SslCertificateListCall.html) +* [subnetworks](http://byron.github.io/google-apis-rs/google_compute1/struct.Subnetwork.html) + * [*aggregated list*](http://byron.github.io/google-apis-rs/google_compute1/struct.SubnetworkAggregatedListCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_compute1/struct.SubnetworkDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_compute1/struct.SubnetworkGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_compute1/struct.SubnetworkInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_compute1/struct.SubnetworkListCall.html) * [target http proxies](http://byron.github.io/google-apis-rs/google_compute1/struct.TargetHttpProxy.html) * [*delete*](http://byron.github.io/google-apis-rs/google_compute1/struct.TargetHttpProxyDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_compute1/struct.TargetHttpProxyGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_compute1/struct.TargetHttpProxyInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_compute1/struct.TargetHttpProxyListCall.html) and [*set url map*](http://byron.github.io/google-apis-rs/google_compute1/struct.TargetHttpProxySetUrlMapCall.html) * [target https proxies](http://byron.github.io/google-apis-rs/google_compute1/struct.TargetHttpsProxy.html) @@ -121,6 +123,7 @@ let r = hub.autoscalers().patch(...).doit() let r = hub.target_https_proxies().delete(...).doit() let r = hub.firewalls().patch(...).doit() let r = hub.vpn_tunnels().delete(...).doit() +let r = hub.backend_services().delete(...).doit() let r = hub.global_forwarding_rules().set_target(...).doit() let r = hub.instances().insert(...).doit() let r = hub.global_forwarding_rules().delete(...).doit() @@ -136,6 +139,7 @@ let r = hub.global_addresses().insert(...).doit() let r = hub.https_health_checks().delete(...).doit() let r = hub.autoscalers().insert(...).doit() let r = hub.instance_groups().insert(...).doit() +let r = hub.instances().set_tags(...).doit() let r = hub.instance_group_managers().delete_instances(...).doit() let r = hub.instance_group_managers().set_instance_template(...).doit() let r = hub.target_pools().insert(...).doit() @@ -145,7 +149,7 @@ let r = hub.disks().insert(...).doit() let r = hub.https_health_checks().insert(...).doit() let r = hub.target_pools().remove_health_check(...).doit() let r = hub.target_https_proxies().set_url_map(...).doit() -let r = hub.backend_services().delete(...).doit() +let r = hub.instances().set_machine_type(...).doit() let r = hub.url_maps().insert(...).doit() let r = hub.instances().add_access_config(...).doit() let r = hub.addresses().insert(...).doit() @@ -170,7 +174,7 @@ let r = hub.instances().delete_access_config(...).doit() let r = hub.target_https_proxies().set_ssl_certificates(...).doit() let r = hub.networks().insert(...).doit() let r = hub.instance_group_managers().abandon_instances(...).doit() -let r = hub.instances().set_tags(...).doit() +let r = hub.subnetworks().insert(...).doit() let r = hub.snapshots().delete(...).doit() let r = hub.target_https_proxies().insert(...).doit() let r = hub.instances().detach_disk(...).doit() @@ -190,6 +194,7 @@ let r = hub.projects().move_instance(...).doit() let r = hub.autoscalers().delete(...).doit() let r = hub.https_health_checks().update(...).doit() let r = hub.url_maps().patch(...).doit() +let r = hub.subnetworks().delete(...).doit() let r = hub.instances().stop(...).doit() let r = hub.target_pools().add_instance(...).doit() let r = hub.target_pools().remove_instance(...).doit() diff --git a/gen/compute1/src/cmn.rs b/gen/compute1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/compute1/src/cmn.rs +++ b/gen/compute1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/compute1/src/lib.rs b/gen/compute1/src/lib.rs index 8bac149529..85f92af259 100644 --- a/gen/compute1/src/lib.rs +++ b/gen/compute1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *compute* crate version *0.1.10+20151015*, where *20151015* is the exact revision of the *compute:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *compute* crate version *0.1.11+20160120*, where *20160120* is the exact revision of the *compute:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *compute* *v1* API can be found at the //! [official documentation site](https://developers.google.com/compute/docs/reference/latest/). @@ -44,7 +44,7 @@ //! * [instance templates](struct.InstanceTemplate.html) //! * [*delete*](struct.InstanceTemplateDeleteCall.html), [*get*](struct.InstanceTemplateGetCall.html), [*insert*](struct.InstanceTemplateInsertCall.html) and [*list*](struct.InstanceTemplateListCall.html) //! * [instances](struct.Instance.html) -//! * [*add access config*](struct.InstanceAddAccessConfigCall.html), [*aggregated list*](struct.InstanceAggregatedListCall.html), [*attach disk*](struct.InstanceAttachDiskCall.html), [*delete*](struct.InstanceDeleteCall.html), [*delete access config*](struct.InstanceDeleteAccessConfigCall.html), [*detach disk*](struct.InstanceDetachDiskCall.html), [*get*](struct.InstanceGetCall.html), [*get serial port output*](struct.InstanceGetSerialPortOutputCall.html), [*insert*](struct.InstanceInsertCall.html), [*list*](struct.InstanceListCall.html), [*reset*](struct.InstanceResetCall.html), [*set disk auto delete*](struct.InstanceSetDiskAutoDeleteCall.html), [*set metadata*](struct.InstanceSetMetadataCall.html), [*set scheduling*](struct.InstanceSetSchedulingCall.html), [*set tags*](struct.InstanceSetTagCall.html), [*start*](struct.InstanceStartCall.html) and [*stop*](struct.InstanceStopCall.html) +//! * [*add access config*](struct.InstanceAddAccessConfigCall.html), [*aggregated list*](struct.InstanceAggregatedListCall.html), [*attach disk*](struct.InstanceAttachDiskCall.html), [*delete*](struct.InstanceDeleteCall.html), [*delete access config*](struct.InstanceDeleteAccessConfigCall.html), [*detach disk*](struct.InstanceDetachDiskCall.html), [*get*](struct.InstanceGetCall.html), [*get serial port output*](struct.InstanceGetSerialPortOutputCall.html), [*insert*](struct.InstanceInsertCall.html), [*list*](struct.InstanceListCall.html), [*reset*](struct.InstanceResetCall.html), [*set disk auto delete*](struct.InstanceSetDiskAutoDeleteCall.html), [*set machine type*](struct.InstanceSetMachineTypeCall.html), [*set metadata*](struct.InstanceSetMetadataCall.html), [*set scheduling*](struct.InstanceSetSchedulingCall.html), [*set tags*](struct.InstanceSetTagCall.html), [*start*](struct.InstanceStartCall.html) and [*stop*](struct.InstanceStopCall.html) //! * [licenses](struct.License.html) //! * [*get*](struct.LicenseGetCall.html) //! * [machine types](struct.MachineType.html) @@ -63,6 +63,8 @@ //! * [*delete*](struct.SnapshotDeleteCall.html), [*get*](struct.SnapshotGetCall.html) and [*list*](struct.SnapshotListCall.html) //! * [ssl certificates](struct.SslCertificate.html) //! * [*delete*](struct.SslCertificateDeleteCall.html), [*get*](struct.SslCertificateGetCall.html), [*insert*](struct.SslCertificateInsertCall.html) and [*list*](struct.SslCertificateListCall.html) +//! * [subnetworks](struct.Subnetwork.html) +//! * [*aggregated list*](struct.SubnetworkAggregatedListCall.html), [*delete*](struct.SubnetworkDeleteCall.html), [*get*](struct.SubnetworkGetCall.html), [*insert*](struct.SubnetworkInsertCall.html) and [*list*](struct.SubnetworkListCall.html) //! * [target http proxies](struct.TargetHttpProxy.html) //! * [*delete*](struct.TargetHttpProxyDeleteCall.html), [*get*](struct.TargetHttpProxyGetCall.html), [*insert*](struct.TargetHttpProxyInsertCall.html), [*list*](struct.TargetHttpProxyListCall.html) and [*set url map*](struct.TargetHttpProxySetUrlMapCall.html) //! * [target https proxies](struct.TargetHttpsProxy.html) @@ -121,6 +123,7 @@ //! let r = hub.target_https_proxies().delete(...).doit() //! let r = hub.firewalls().patch(...).doit() //! let r = hub.vpn_tunnels().delete(...).doit() +//! let r = hub.backend_services().delete(...).doit() //! let r = hub.global_forwarding_rules().set_target(...).doit() //! let r = hub.instances().insert(...).doit() //! let r = hub.global_forwarding_rules().delete(...).doit() @@ -136,6 +139,7 @@ //! let r = hub.https_health_checks().delete(...).doit() //! let r = hub.autoscalers().insert(...).doit() //! let r = hub.instance_groups().insert(...).doit() +//! let r = hub.instances().set_tags(...).doit() //! let r = hub.instance_group_managers().delete_instances(...).doit() //! let r = hub.instance_group_managers().set_instance_template(...).doit() //! let r = hub.target_pools().insert(...).doit() @@ -145,7 +149,7 @@ //! let r = hub.https_health_checks().insert(...).doit() //! let r = hub.target_pools().remove_health_check(...).doit() //! let r = hub.target_https_proxies().set_url_map(...).doit() -//! let r = hub.backend_services().delete(...).doit() +//! let r = hub.instances().set_machine_type(...).doit() //! let r = hub.url_maps().insert(...).doit() //! let r = hub.instances().add_access_config(...).doit() //! let r = hub.addresses().insert(...).doit() @@ -170,7 +174,7 @@ //! let r = hub.target_https_proxies().set_ssl_certificates(...).doit() //! let r = hub.networks().insert(...).doit() //! let r = hub.instance_group_managers().abandon_instances(...).doit() -//! let r = hub.instances().set_tags(...).doit() +//! let r = hub.subnetworks().insert(...).doit() //! let r = hub.snapshots().delete(...).doit() //! let r = hub.target_https_proxies().insert(...).doit() //! let r = hub.instances().detach_disk(...).doit() @@ -190,6 +194,7 @@ //! let r = hub.autoscalers().delete(...).doit() //! let r = hub.https_health_checks().update(...).doit() //! let r = hub.url_maps().patch(...).doit() +//! let r = hub.subnetworks().delete(...).doit() //! let r = hub.instances().stop(...).doit() //! let r = hub.target_pools().add_instance(...).doit() //! let r = hub.target_pools().remove_instance(...).doit() @@ -262,7 +267,7 @@ //! // 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 ! -//! let result = hub.instances().set_disk_auto_delete("project", "zone", "instance", false, "deviceName") +//! let result = hub.instances().set_disk_auto_delete("project", "zone", "instance", true, "deviceName") //! .doit(); //! //! match result { diff --git a/gen/compute1/src/lib.rs.in b/gen/compute1/src/lib.rs.in index 3471e5d709..fe43ec73b5 100644 --- a/gen/compute1/src/lib.rs.in +++ b/gen/compute1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -146,7 +147,7 @@ impl<'a, C, A> Compute Compute { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -228,6 +229,9 @@ impl<'a, C, A> Compute pub fn ssl_certificates(&'a self) -> SslCertificateMethods<'a, C, A> { SslCertificateMethods { hub: &self } } + pub fn subnetworks(&'a self) -> SubnetworkMethods<'a, C, A> { + SubnetworkMethods { hub: &self } + } pub fn target_http_proxies(&'a self) -> TargetHttpProxyMethods<'a, C, A> { TargetHttpProxyMethods { hub: &self } } @@ -257,7 +261,7 @@ impl<'a, C, A> Compute } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -287,13 +291,14 @@ pub struct VpnTunnelsScopedList { impl Part for VpnTunnelsScopedList {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ForwardingRulesScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -335,7 +340,7 @@ impl RequestValue for InstanceGroupsSetNamedPortsRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UrlMapList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of UrlMap resources. @@ -386,7 +391,7 @@ impl RequestValue for InstanceGroupManagersSetInstanceTemplateRequest {} pub struct DiskType { /// [Output Only] Type of the resource. Always compute#diskType for disk types. pub kind: Option, - /// [Output Only] An optional textual description of the resource. + /// [Output Only] An optional description of this resource. pub description: Option, /// [Output Only] URL of the zone where the disk type resides. pub zone: Option, @@ -401,7 +406,7 @@ pub struct DiskType { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -441,14 +446,14 @@ impl Part for MachineTypesScopedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct VpnTunnelAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A map of scoped vpn tunnel lists. pub items: Option>, /// [Output Only] Type of resource. Always compute#vpnTunnel for VPN tunnels. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -492,14 +497,14 @@ impl RequestValue for Metadata {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetHttpsProxyList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of TargetHttpsProxy resources. pub items: Option>, /// Type of resource. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -533,11 +538,12 @@ impl RequestValue for InstanceGroupManagersRecreateInstancesRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupManagersScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -551,11 +557,12 @@ impl Part for InstanceGroupManagersScopedListWarning {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RouteWarnings { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -575,9 +582,9 @@ impl Part for RouteWarnings {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetHttpProxy { - /// [Output Only] Type of resource. Always compute#operation for Operation resources. + /// [Output Only] Type of resource. Always compute#targetHttpProxy for target HTTP proxies. pub kind: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// URL to the UrlMap resource that defines the mapping from URL to the BackendService. #[serde(rename="urlMap")] @@ -585,7 +592,7 @@ pub struct TargetHttpProxy { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -624,14 +631,14 @@ impl Part for OperationError {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AddressList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of Address resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#addressList for lists of addresses. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -652,7 +659,7 @@ impl ResponseResult for AddressList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct HttpsHealthCheckList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of HttpsHealthCheck resources. @@ -687,6 +694,25 @@ pub struct InstanceWithNamedPorts { impl Part for InstanceWithNamedPorts {} +/// [Output Only] Informational warning which replaces the list of addresses when the list is empty. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AddressesScopedListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for AddressesScopedListWarning {} +impl Part for AddressesScopedListWarning {} + + /// Message representing the validation result for a UrlMap. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -720,7 +746,7 @@ pub struct InstanceGroupManagerActionsSummary { pub none: Option, /// [Output Only] The number of instances in the managed instance group that are scheduled to be recreated or are currently being being recreated. Recreating an instance deletes the existing root persistent disk and creates a new disk from the image that is defined in the instance template. pub recreating: Option, - /// [Output Only] The number of instances in the managed instance group that are scheduled to be created or are currently being created. + /// [Output Only] The number of instances in the managed instance group that are scheduled to be created or are currently being created. If the group fails to create one of these instances, it tries again until it creates the instance successfully. pub creating: Option, /// [Output Only] The number of instances in the managed instance group that are being reconfigured with properties that do not require a restart or a recreate action. For example, setting or removing target pools for the instance. pub refreshing: Option, @@ -741,13 +767,16 @@ impl Part for InstanceGroupManagerActionsSummary {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PathMatcher { - /// The URL to the BackendService resource. This will be used if none of the 'pathRules' defined by this PathMatcher is met by the URL's path portion. + /// The full or partial URL to the BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. For example, the following are all valid URLs to a BackendService resource: + /// - https://www.googleapis.com/compute/v1/projects/project/global/backendServices/backendService + /// - compute/v1/projects/project/global/backendServices/backendService + /// - global/backendServices/backendService #[serde(rename="defaultService")] pub default_service: Option, /// The list of path rules. #[serde(rename="pathRules")] pub path_rules: Option>, - /// An optional textual description of the resource. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// The name to which this PathMatcher is referred by the HostRule. pub name: Option, @@ -796,7 +825,7 @@ pub struct Region { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server . + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -848,7 +877,7 @@ pub struct Project { pub common_instance_metadata: Option, /// [Output Only] Quotas assigned to this project. pub quotas: Option>, - /// The location in Cloud Storage and naming method of the daily usage report. + /// The naming prefix for daily usage reports and the Google Cloud Storage bucket where they are stored. #[serde(rename="usageExportLocation")] pub usage_export_location: Option, /// Restricted features enabled for use on this project. @@ -857,12 +886,12 @@ pub struct Project { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. This is not the project ID, and is just a unique ID used by Compute Engine to identify resources. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// Name of the resource. + /// The project ID. For example: my-example-project. Use the project ID to make requests to Compute Engine. pub name: Option, } @@ -870,9 +899,37 @@ impl Resource for Project {} impl ResponseResult for Project {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [aggregated list subnetworks](struct.SubnetworkAggregatedListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SubnetworkAggregatedList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output] A map of scoped Subnetwork lists. + pub items: Option>, + /// [Output Only] Type of resource. Always compute#subnetworkAggregatedList for aggregated lists of subnetworks. + pub kind: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl ResponseResult for SubnetworkAggregatedList {} + + /// InstanceGroupManagers /// -/// Next available tag: 19 +/// Next available tag: 20 /// /// # Activities /// @@ -894,21 +951,23 @@ impl ResponseResult for Project {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupManager { - /// The target number of running instances for this managed instance group. Deleting or abandoning instances reduces this number. Resizing the group changes this number. - #[serde(rename="targetSize")] - pub target_size: Option, - /// An optional text description for the managed instance group. + /// [Output Only] The list of instance actions and the number of instances in this managed instance group that are scheduled for each of those actions. + #[serde(rename="currentActions")] + pub current_actions: Option, + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// The name of the zone where the managed instance group is located. pub zone: Option, + /// The name of the managed instance group. The name must be 1-63 characters long, and comply with RFC1035. + pub name: Option, /// [Output Only] The fingerprint of the target pools information. You can use this optional field for optimistic locking when you update the target pool entries. pub fingerprint: Option, /// [Output Only] The URL of the Instance Group resource. #[serde(rename="instanceGroup")] pub instance_group: Option, - /// [Output Only] The list of instance actions and the number of instances in this managed instance group that are scheduled for each of those actions. - #[serde(rename="currentActions")] - pub current_actions: Option, + /// The target number of running instances for this managed instance group. Deleting or abandoning instances reduces this number. Resizing the group changes this number. + #[serde(rename="targetSize")] + pub target_size: Option, /// [Output Only] A unique identifier for this resource type. The server generates this identifier. pub id: Option, /// The base instance name to use for instances in this group. The value must be 1-58 characters long. Instances are named by appending a hyphen and a random four-character string to the base instance name. The base instance name must comply with RFC1035. @@ -928,8 +987,9 @@ pub struct InstanceGroupManager { /// [Output Only] The URL for this managed instance group. The server defines this URL. #[serde(rename="selfLink")] pub self_link: Option, - /// The name of the managed instance group. The name must be 1-63 characters long, and comply with RFC1035. - pub name: Option, + /// Named ports configured for the Instance Groups complementary to this Instance Group Manager. + #[serde(rename="namedPorts")] + pub named_ports: Option>, } impl RequestValue for InstanceGroupManager {} @@ -948,14 +1008,14 @@ impl ResponseResult for InstanceGroupManager {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetVpnGatewayAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A map of scoped target vpn gateway lists. pub items: Option>, /// [Output Only] Type of resource. Always compute#targetVpnGateway for target VPN gateways. pub kind: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -1013,14 +1073,14 @@ impl ResponseResult for InstanceGroupManagersListManagedInstancesResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MachineTypeList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of Machine Type resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#machineTypeList for lists of machine types. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -1041,7 +1101,7 @@ impl ResponseResult for MachineTypeList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SslCertificateList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of SslCertificate resources. @@ -1058,6 +1118,23 @@ pub struct SslCertificateList { impl ResponseResult for SslCertificateList {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DisksScopedListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for DisksScopedListWarningData {} +impl Part for DisksScopedListWarningData {} + + /// Contains a list of ForwardingRule resources. /// /// # Activities @@ -1070,7 +1147,7 @@ impl ResponseResult for SslCertificateList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ForwardingRuleList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of ForwardingRule resources. @@ -1098,14 +1175,14 @@ impl ResponseResult for ForwardingRuleList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct FirewallList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of Firewall resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#firewallList for lists of firewalls. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -1145,14 +1222,14 @@ impl Part for UrlMapTest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AutoscalerAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A map of scoped autoscaler lists. pub items: Option>, /// Type of resource. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -1168,11 +1245,12 @@ impl ResponseResult for AutoscalerAggregatedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationWarnings { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -1191,7 +1269,7 @@ impl Part for OperationWarnings {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupsListInstances { - /// [Output Only] A token that is used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of instances and any named ports that are assigned to those instances. @@ -1224,7 +1302,7 @@ impl ResponseResult for InstanceGroupsListInstances {} pub struct InstanceTemplate { /// [Output Only] The resource type, which is always compute#instanceTemplate for instance templates. pub kind: Option, - /// An optional text description for the instance template. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. pub name: Option, @@ -1293,10 +1371,10 @@ impl Part for ForwardingRulesScopedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RouteList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// A list of Route resources. + /// [Output Only] A list of Route resources. pub items: Option>, /// Type of resource. pub kind: Option, @@ -1337,7 +1415,7 @@ pub struct Disk { /// [Output Only] Last detach timestamp in RFC3339 text format. #[serde(rename="lastDetachTimestamp")] pub last_detach_timestamp: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// The ID value of the image used to create this disk. This value identifies the exact image that was used to create this persistent disk. For example, if you created the persistent disk from an image that was later deleted and recreated under the same name, the source image ID would identify the exact version of the image that was used. #[serde(rename="sourceImageId")] @@ -1365,7 +1443,7 @@ pub struct Disk { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. pub name: Option, @@ -1396,13 +1474,14 @@ impl Resource for Disk {} impl ResponseResult for Disk {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct VpnTunnelsScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -1424,11 +1503,11 @@ impl Part for VpnTunnelsScopedListWarningData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetHttpsProxy { - /// Type of the resource. + /// [Output Only] Type of the resource. Always compute#targetHttpsProxy for target HTTPS proxies. pub kind: Option, - /// An optional textual description of the resource. Provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, - /// URLs to SslCertificate resources that are used to authenticate connections to Backends. Currently exactly one SSL certificate must be specified. + /// URLs to SslCertificate resources that are used to authenticate connections between users and the load balancer. Currently exactly one SSL certificate must be specified. #[serde(rename="sslCertificates")] pub ssl_certificates: Option>, /// URL to the UrlMap resource that defines the mapping from URL to the BackendService. @@ -1437,7 +1516,7 @@ pub struct TargetHttpsProxy { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -1475,12 +1554,14 @@ pub struct InstanceGroup { pub network: Option, /// [Output Only] The URL of the zone where the instance group is located. pub zone: Option, - /// An optional text description for the instance group. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// The name of the instance group. The name must be 1-63 characters long, and comply with RFC1035. pub name: Option, /// [Output Only] The fingerprint of the named ports. The system uses this fingerprint to detect conflicts when multiple users change the named ports concurrently. pub fingerprint: Option, + /// [Output Only] The URL of the subnetwork to which all instances in the instance group belong. + pub subnetwork: Option, /// Assigns a name to a port number. For example: {name: "http", port: 80} /// /// This allows the system to reference ports by the assigned name instead of a port number. Named ports can also contain multiple ports. For example: [{name: "http", port: 80},{name: "http", port: 8080}] @@ -1521,8 +1602,12 @@ impl ResponseResult for InstanceGroup {} pub struct Network { /// [Output Only] Type of the resource. Always compute#network for networks. pub kind: Option, - /// An optional textual description of the resource. Provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, + /// [Output Only] Server-defined fully-qualified URLs for all subnetworks in this network. + pub subnetworks: Option>, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, /// The range of internal addresses that are legal on this network. This range is a CIDR specification, for example: 192.168.0.0/16. Provided by the client when the network is created. #[serde(rename="IPv4Range")] pub i_pv4_range: Option, @@ -1532,8 +1617,11 @@ pub struct Network { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. - pub id: Option, + /// When set to true, the network is created in "auto subnet mode". When set to false, the network is in "custom subnet mode". + /// + /// In "auto subnet mode", a newly created network is assigned the default CIDR of 10.128.0.0/9 and it automatically creates one subnetwork per region. + #[serde(rename="autoCreateSubnetworks")] + pub auto_create_subnetworks: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, @@ -1560,7 +1648,7 @@ impl ResponseResult for Network {} pub struct Zone { /// [Output Only] Status of the zone, either UP or DOWN. pub status: Option, - /// [Output Only] Type of the resource. Always kind#zone for zones. + /// [Output Only] Type of the resource. Always compute#zone for zones. pub kind: Option, /// [Output Only] Textual description of the resource. pub description: Option, @@ -1574,7 +1662,7 @@ pub struct Zone { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -1613,6 +1701,23 @@ pub struct AccessConfig { impl RequestValue for AccessConfig {} +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SubnetworksScopedListWarningData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for SubnetworksScopedListWarningData {} +impl Part for SubnetworksScopedListWarningData {} + + /// An HttpHealthCheck resource. This resource defines a template for how individual instances should be checked for health, via HTTP. /// /// # Activities @@ -1631,7 +1736,7 @@ impl RequestValue for AccessConfig {} pub struct HttpHealthCheck { /// Type of the resource. pub kind: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// How long (in seconds) to wait before claiming failure. The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. #[serde(rename="timeoutSec")] @@ -1649,7 +1754,7 @@ pub struct HttpHealthCheck { pub healthy_threshold: Option, /// The value of the host header in the HTTP health check request. If left empty (default value), the public IP on behalf of which this health check is performed will be used. pub host: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] @@ -1680,7 +1785,7 @@ impl ResponseResult for HttpHealthCheck {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UsageExportLocation { - /// The name of an existing bucket in Cloud Storage where the usage report object is stored. The Google Service Account is granted write access to this bucket. This is just the bucket name, with no gs:// or https://storage.googleapis.com/ in front of it. + /// The name of an existing bucket in Cloud Storage where the usage report object is stored. The Google Service Account is granted write access to this bucket. This can either be the bucket name by itself, such as example-bucket, or the bucket name with gs:// or https://storage.googleapis.com/ in front of it, such as gs://example-bucket. #[serde(rename="bucketName")] pub bucket_name: Option, /// An optional prefix for the name of the usage report object stored in bucketName. If not supplied, defaults to usage. The report is stored as a CSV file named report_name_prefix_gce_YYYYMMDD.csv where YYYYMMDD is the day of the usage according to Pacific Time. If you supply a prefix, it should conform to Cloud Storage object naming conventions. @@ -1702,14 +1807,14 @@ impl RequestValue for UsageExportLocation {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AutoscalerList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of Autoscaler resources. pub items: Option>, /// Type of resource. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -1719,6 +1824,34 @@ pub struct AutoscalerList { impl ResponseResult for AutoscalerList {} +/// Contains a list of Subnetwork resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list subnetworks](struct.SubnetworkListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SubnetworkList { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The Subnetwork resources. + pub items: Option>, + /// [Output Only] Type of resource. Always compute#subnetworkList for lists of subnetworks. + pub kind: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for this resource. + #[serde(rename="selfLink")] + pub self_link: Option, +} + +impl ResponseResult for SubnetworkList {} + + /// CPU utilization policy. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1770,7 +1903,7 @@ pub struct TargetVpnGateway { pub status: Option, /// [Output Only] Type of resource. Always compute#targetVpnGateway for target VPN gateways. pub kind: Option, - /// An optional textual description of the resource. Provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// [Output Only] URL of the region where the target VPN gateway resides. pub region: Option, @@ -1785,7 +1918,7 @@ pub struct TargetVpnGateway { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] A list of URLs to VpnTunnel resources. VpnTunnels are created using compute.vpntunnels.insert and associated to a VPN gateway. pub tunnels: Option>, @@ -1809,16 +1942,16 @@ impl ResponseResult for TargetVpnGateway {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A map of scoped instance lists. pub items: Option>, /// [Output Only] Type of resource. Always compute#instanceAggregatedList for aggregated lists of Instance resources. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, - /// [Output Only] Server defined URL for this resource. + /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] pub self_link: Option, } @@ -1832,11 +1965,12 @@ impl ResponseResult for InstanceAggregatedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationsScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -1844,13 +1978,14 @@ impl NestedType for OperationsScopedListWarning {} impl Part for OperationsScopedListWarning {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AutoscalersScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -1948,7 +2083,7 @@ impl RequestValue for DiskMoveRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupManagerAggregatedList { - /// [Output Only] A token that is used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A map of filtered managed instance group lists. @@ -1998,16 +2133,16 @@ impl Part for ZoneMaintenanceWindows {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of Instance resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#instanceList for lists of Instance resources. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, - /// [Output Only] Server defined URL for this resource. + /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] pub self_link: Option, } @@ -2033,7 +2168,7 @@ impl ResponseResult for InstanceList {} pub struct HttpsHealthCheck { /// Type of the resource. pub kind: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// How long (in seconds) to wait before claiming failure. The default value is 5 seconds. It is invalid for timeoutSec to have a greater value than checkIntervalSec. #[serde(rename="timeoutSec")] @@ -2051,7 +2186,7 @@ pub struct HttpsHealthCheck { pub healthy_threshold: Option, /// The value of the host header in the HTTPS health check request. If left empty (default value), the public IP on behalf of which this health check is performed will be used. pub host: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] @@ -2071,7 +2206,7 @@ impl Resource for HttpsHealthCheck {} impl ResponseResult for HttpsHealthCheck {} -/// An SslCertificate resource. This resource provides a mechanism to upload an SSL key and certificate to global HTTPS loadbalancer to serve secure connections. +/// An SslCertificate resource. This resource provides a mechanism to upload an SSL key and certificate to the load balancer to serve secure connections from the user. /// /// # Activities /// @@ -2097,12 +2232,12 @@ pub struct SslCertificate { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// An optional textual description of the resource. Provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, } @@ -2138,11 +2273,12 @@ impl RequestValue for InstanceGroupManagersSetTargetPoolsRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AutoscalersScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -2199,14 +2335,14 @@ impl RequestValue for TargetPoolsAddHealthCheckRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct NetworkList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of Network resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#networkList for lists of networks. pub kind: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource . #[serde(rename="selfLink")] @@ -2227,7 +2363,7 @@ impl ResponseResult for NetworkList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ZoneList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of Zone resources. @@ -2292,7 +2428,7 @@ impl RequestValue for InstanceReference {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceTemplateList { - /// [Output Only] A token that is used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] list of InstanceTemplate resources. @@ -2320,14 +2456,14 @@ impl ResponseResult for InstanceTemplateList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetInstanceList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of TargetInstance resources. pub items: Option>, /// Type of resource. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -2348,7 +2484,7 @@ impl ResponseResult for TargetInstanceList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct HttpHealthCheckList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of HttpHealthCheck resources. @@ -2419,7 +2555,8 @@ impl RequestValue for AttachedDisk {} pub struct ManagedInstance { /// [Output Only] The current action that the managed instance group has scheduled for the instance. Possible values: /// - NONE The instance is running, and the managed instance group does not have any scheduled actions for this instance. - /// - CREATING The managed instance group is creating this instance. + /// - CREATING The managed instance group is creating this instance. If the group fails to create this instance, it will try again until it is successful. + /// - CREATING_WITHOUT_RETRIES The managed instance group is attempting to create this instance only once. If the group fails to create this instance, it does not try again and the group's target_size value is decreased. /// - RECREATING The managed instance group is recreating this instance. /// - DELETING The managed instance group is permanently deleting this instance. /// - ABANDONING The managed instance group is abandoning this instance. The instance will be removed from the instance group and from any target pools that are associated with this group. @@ -2453,14 +2590,14 @@ impl Part for ManagedInstance {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ForwardingRuleAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A map of scoped forwarding rule lists. pub items: Option>, /// Type of resource. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -2502,7 +2639,7 @@ impl Part for TestFailure {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetPoolAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A map of scoped target pool lists. @@ -2519,6 +2656,52 @@ pub struct TargetPoolAggregatedList { impl ResponseResult for TargetPoolAggregatedList {} +/// A Subnetwork resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert subnetworks](struct.SubnetworkInsertCall.html) (request) +/// * [get subnetworks](struct.SubnetworkGetCall.html) (response) +/// * [list subnetworks](struct.SubnetworkListCall.html) (none) +/// * [aggregated list subnetworks](struct.SubnetworkAggregatedListCall.html) (none) +/// * [delete subnetworks](struct.SubnetworkDeleteCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Subnetwork { + /// [Output Only] Type of the resource. Always compute#subnetwork for Subnetwork resources. + pub kind: Option, + /// An optional description of this resource. Provide this property when you create the resource. + pub description: Option, + /// [Output Only] The gateway address for default routes to reach destination addresses outside this subnetwork. + #[serde(rename="gatewayAddress")] + pub gateway_address: Option, + /// [Output Only] URL of the region where the Subnetwork resides. + pub region: Option, + /// The name of the resource, provided by the client when initially creating the resource. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, + /// The range of internal addresses that are owned by this subnetwork. Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or 192.168.0.0/16. Ranges must be unique and non-overlapping within a network. + #[serde(rename="ipCidrRange")] + pub ip_cidr_range: Option, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// [Output Only] Server-defined URL for the resource. + #[serde(rename="selfLink")] + pub self_link: Option, + /// The URL of the network to which this subnetwork belongs, provided by the client when initially creating the subnetwork. Only networks that are in the distributed mode can have subnetworks. + pub network: Option, +} + +impl RequestValue for Subnetwork {} +impl Resource for Subnetwork {} +impl ResponseResult for Subnetwork {} + + /// An Operation resource, used to manage asynchronous API requests. /// /// # Activities @@ -2532,6 +2715,7 @@ impl ResponseResult for TargetPoolAggregatedList {} /// * [delete target https proxies](struct.TargetHttpsProxyDeleteCall.html) (response) /// * [patch firewalls](struct.FirewallPatchCall.html) (response) /// * [delete vpn tunnels](struct.VpnTunnelDeleteCall.html) (response) +/// * [delete backend services](struct.BackendServiceDeleteCall.html) (response) /// * [set target global forwarding rules](struct.GlobalForwardingRuleSetTargetCall.html) (response) /// * [insert instances](struct.InstanceInsertCall.html) (response) /// * [delete global forwarding rules](struct.GlobalForwardingRuleDeleteCall.html) (response) @@ -2547,6 +2731,7 @@ impl ResponseResult for TargetPoolAggregatedList {} /// * [delete https health checks](struct.HttpsHealthCheckDeleteCall.html) (response) /// * [insert autoscalers](struct.AutoscalerInsertCall.html) (response) /// * [insert instance groups](struct.InstanceGroupInsertCall.html) (response) +/// * [set tags instances](struct.InstanceSetTagCall.html) (response) /// * [delete instances instance group managers](struct.InstanceGroupManagerDeleteInstanceCall.html) (response) /// * [set instance template instance group managers](struct.InstanceGroupManagerSetInstanceTemplateCall.html) (response) /// * [insert target pools](struct.TargetPoolInsertCall.html) (response) @@ -2556,7 +2741,7 @@ impl ResponseResult for TargetPoolAggregatedList {} /// * [insert https health checks](struct.HttpsHealthCheckInsertCall.html) (response) /// * [remove health check target pools](struct.TargetPoolRemoveHealthCheckCall.html) (response) /// * [set url map target https proxies](struct.TargetHttpsProxySetUrlMapCall.html) (response) -/// * [delete backend services](struct.BackendServiceDeleteCall.html) (response) +/// * [set machine type instances](struct.InstanceSetMachineTypeCall.html) (response) /// * [insert url maps](struct.UrlMapInsertCall.html) (response) /// * [add access config instances](struct.InstanceAddAccessConfigCall.html) (response) /// * [insert addresses](struct.AddresseInsertCall.html) (response) @@ -2581,7 +2766,7 @@ impl ResponseResult for TargetPoolAggregatedList {} /// * [set ssl certificates target https proxies](struct.TargetHttpsProxySetSslCertificateCall.html) (response) /// * [insert networks](struct.NetworkInsertCall.html) (response) /// * [abandon instances instance group managers](struct.InstanceGroupManagerAbandonInstanceCall.html) (response) -/// * [set tags instances](struct.InstanceSetTagCall.html) (response) +/// * [insert subnetworks](struct.SubnetworkInsertCall.html) (response) /// * [delete snapshots](struct.SnapshotDeleteCall.html) (response) /// * [insert target https proxies](struct.TargetHttpsProxyInsertCall.html) (response) /// * [detach disk instances](struct.InstanceDetachDiskCall.html) (response) @@ -2601,6 +2786,7 @@ impl ResponseResult for TargetPoolAggregatedList {} /// * [delete autoscalers](struct.AutoscalerDeleteCall.html) (response) /// * [update https health checks](struct.HttpsHealthCheckUpdateCall.html) (response) /// * [patch url maps](struct.UrlMapPatchCall.html) (response) +/// * [delete subnetworks](struct.SubnetworkDeleteCall.html) (response) /// * [stop instances](struct.InstanceStopCall.html) (response) /// * [add instance target pools](struct.TargetPoolAddInstanceCall.html) (response) /// * [remove instance target pools](struct.TargetPoolRemoveInstanceCall.html) (response) @@ -2631,62 +2817,64 @@ impl ResponseResult for TargetPoolAggregatedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Operation { - /// [Output Only] Status of the operation. Can be one of the following: PENDING, RUNNING, or DONE. + /// [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. pub status: Option, - /// [Output Only] The time that this operation was requested. This is in RFC3339 text format. - #[serde(rename="insertTime")] - pub insert_time: Option, + /// [Output Only] A textual description of the operation, which is set when the operation is created. + pub description: Option, /// [Output Only] If warning messages are generated during processing of the operation, this field will be populated. pub warnings: Option>, /// [Output Only] If errors are generated during processing of the operation, this field will be populated. pub error: Option, - /// [Output Only] Unique target ID which identifies a particular incarnation of the target. + /// [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. #[serde(rename="targetId")] pub target_id: Option, - /// [Output Only] URL of the resource the operation is mutating. - #[serde(rename="targetLink")] - pub target_link: Option, - /// [Output Only] The time that this operation was started by the server. This is in RFC3339 text format. + /// [Output Only] User who requested the operation, for example: user@example.com. + pub user: Option, + /// [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. #[serde(rename="startTime")] pub start_time: Option, - /// [Output Only] An optional identifier specified by the client when the mutation was initiated. Must be unique for all Operation resources in the project. + /// [Output Only] A unique client ID generated by the server. #[serde(rename="clientOperationId")] pub client_operation_id: Option, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Type of the resource. Always compute#operation for Operation resources. pub kind: Option, /// [Output Only] Name of the resource. pub name: Option, - /// [Output Only] URL of the zone where the operation resides. + /// [Output Only] URL of the zone where the operation resides. Only available when performing per-zone operations. pub zone: Option, - /// [Output Only] URL of the region where the operation resides. Only applicable for regional resources. + /// [Output Only] URL of the region where the operation resides. Only available when performing regional operations. pub region: Option, + /// [Output Only] The type of operation, which can be insert, update, or delete. + #[serde(rename="operationType")] + pub operation_type: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// [Output Only] Type of the operation, such as insert, compute.instanceGroups.update, or compute.instanceGroups.delete. - #[serde(rename="operationType")] - pub operation_type: Option, + /// [Output Only] The time that this operation was requested. This value is in RFC3339 text format. + #[serde(rename="insertTime")] + pub insert_time: Option, /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. #[serde(rename="httpErrorMessage")] pub http_error_message: Option, - /// [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess at when the operation will be complete. This number should monotonically increase as the operation progresses. + /// [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. pub progress: Option, - /// [Output Only] The time that this operation was completed. This is in RFC3339 text format. + /// [Output Only] The time that this operation was completed. This value is in RFC3339 text format. #[serde(rename="endTime")] pub end_time: Option, - /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as 404. + /// [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. #[serde(rename="httpErrorStatusCode")] pub http_error_status_code: Option, /// [Output Only] An optional textual description of the current status of the operation. #[serde(rename="statusMessage")] pub status_message: Option, - /// [Output Only] User who requested the operation, for example: user@example.com. - pub user: Option, + /// [Output Only] The URL of the resource that the operation is modifying. + #[serde(rename="targetLink")] + pub target_link: Option, } impl ResponseResult for Operation {} @@ -2729,7 +2917,7 @@ pub struct Image { pub status: Option, /// [Output Only] Type of the resource. Always compute#image for images. pub kind: Option, - /// Textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// The parameters of the raw disk image. #[serde(rename="rawDisk")] @@ -2758,7 +2946,7 @@ pub struct Image { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -2784,14 +2972,14 @@ impl ResponseResult for Image {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DiskList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of persistent disks. pub items: Option>, /// [Output Only] Type of resource. Always compute#diskList for lists of disks. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -2850,13 +3038,14 @@ pub struct AutoscalingPolicy { impl Part for AutoscalingPolicy {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationsScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -2877,14 +3066,14 @@ impl Part for OperationsScopedListWarningData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct BackendServiceList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of BackendService resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#backendServiceList for lists of backend services. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -2905,14 +3094,14 @@ impl ResponseResult for BackendServiceList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetHttpProxyList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of TargetHttpProxy resources. pub items: Option>, /// Type of resource. Always compute#targetHttpProxyList for lists of Target HTTP proxies. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -2947,14 +3136,14 @@ impl Part for AutoscalingPolicyLoadBalancingUtilization {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RegionList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of Region resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#regionList for lists of regions. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -2973,19 +3162,19 @@ pub struct Backend { /// A multiplier applied to the group's maximum servicing capacity (either UTILIZATION or RATE). Default value is 1, which means the group will serve up to 100% of its configured CPU or RPS (depending on balancingMode). A setting of 0 means the group is completely drained, offering 0% of its available CPU or RPS. Valid range is [0.0,1.0]. #[serde(rename="capacityScaler")] pub capacity_scaler: Option, - /// The max RPS of the group. Can be used with either balancing mode, but required if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be set. + /// The max requests per second (RPS) of the group. Can be used with either balancing mode, but required if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be set. #[serde(rename="maxRate")] pub max_rate: Option, /// The fully-qualified URL of a zonal Instance Group resource. This instance group defines the list of instances that serve traffic. Member virtual machine instances from each instance group must live in the same zone as the instance group itself. No two backends in a backend service are allowed to use same Instance Group resource. /// /// Note that you must specify an Instance Group resource using the fully-qualified URL, rather than a partial URL. pub group: Option, - /// An optional textual description of the resource. Provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target for the group. The default is 0.8. Valid range is [0.0, 1.0]. #[serde(rename="maxUtilization")] pub max_utilization: Option, - /// The max RPS that a single backed instance can handle. This is used to calculate the capacity of the group. Can be used in either balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be set. + /// The max requests per second (RPS) that a single backed instance can handle. This is used to calculate the capacity of the group. Can be used in either balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be set. #[serde(rename="maxRatePerInstance")] pub max_rate_per_instance: Option, /// Specifies the balancing mode for this backend. The default is UTILIZATION but available values are UTILIZATION and RATE. @@ -3011,7 +3200,7 @@ pub struct SerialPortOutput { pub kind: Option, /// [Output Only] The contents of the console output. pub contents: Option, - /// [Output Only] Server defined URL for the resource. + /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, } @@ -3034,17 +3223,37 @@ pub struct OperationsScopedList { impl Part for OperationsScopedList {} +/// An informational warning that appears when the list of addresses is empty. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SubnetworksScopedListWarning { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for SubnetworksScopedListWarning {} +impl Part for SubnetworksScopedListWarning {} + + /// [Output Only] Informational warning which replaces the list of instances when the list is empty. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstancesScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -3067,9 +3276,10 @@ impl Part for InstancesScopedListWarning {} /// * [start instances](struct.InstanceStartCall.html) (none) /// * [detach disk instances](struct.InstanceDetachDiskCall.html) (none) /// * [delete access config instances](struct.InstanceDeleteAccessConfigCall.html) (none) +/// * [set scheduling instances](struct.InstanceSetSchedulingCall.html) (none) /// * [get instances](struct.InstanceGetCall.html) (response) /// * [set tags instances](struct.InstanceSetTagCall.html) (none) -/// * [set scheduling instances](struct.InstanceSetSchedulingCall.html) (none) +/// * [set machine type instances](struct.InstanceSetMachineTypeCall.html) (none) /// * [list instances](struct.InstanceListCall.html) (none) /// * [delete instances](struct.InstanceDeleteCall.html) (none) /// * [reset instances](struct.InstanceResetCall.html) (none) @@ -3087,15 +3297,23 @@ pub struct Instance { /// Allows this instance to send and receive packets with non-matching destination or source IPs. This is required if you plan to use this instance to forward routes. For more information, see Enabling IP Forwarding. #[serde(rename="canIpForward")] pub can_ip_forward: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// A list of tags to appy to this instance. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during instance creation. The tags can be later modified by the setTags method. Each tag within the list must comply with RFC1035. pub tags: Option, /// Scheduling options for this instance. pub scheduling: Option, - /// Full or partial URL of the machine type resource to use for this instance. This is provided by the client when the instance is created. For example, the following is a valid partial url: + /// Full or partial URL of the machine type resource to use for this instance, in the format: zones/zone/machineTypes/ machine-type. This is provided by the client when the instance is created. For example, the following is a valid partial url to a predefined machine type: /// - /// zones/zone/machineTypes/machine-type + /// zones/us-central1-f/machineTypes/n1-standard-1 + /// + /// To create a custom machine type, provide a URL to a machine type in the following format, where CPUS is 1 or an even number up to 32 (2, 4, 6, ... 24, etc), and MEMORY is the total memory for this instance. Memory must be a multiple of 256 MB and must be supplied in MB (e.g. 5 GB of memory is 5120 MB): + /// + /// zones/zone/machineTypes/custom-CPUS-MEMORY + /// + /// For example: zones/us-central1-f/machineTypes/custom-4-5120 + /// + /// For a full list of restrictions, read the Specifications for custom machine types. #[serde(rename="machineType")] pub machine_type: Option, /// A list of service accounts, with their specified scopes, authorized for this instance. Service accounts generate access tokens that can be accessed through the metadata server and used to authenticate applications on the instance. See Authenticating from Google Compute Engine for more information. @@ -3104,20 +3322,20 @@ pub struct Instance { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// An array of configurations for this interface. This specifies how this interface is configured to interact with other network services, such as connecting to the internet. #[serde(rename="networkInterfaces")] pub network_interfaces: Option>, /// [Output Only] Type of the resource. Always compute#instance for instances. pub kind: Option, - /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + /// The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. pub name: Option, /// [Output Only] URL of the zone where the instance resides. pub zone: Option, /// Array of disks associated with this instance. Persistent disks must be created before you can assign them. pub disks: Option>, - /// [Output Only] Server defined URL for this resource. + /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] pub self_link: Option, /// [Output Only] An optional, human-readable explanation of the status. @@ -3191,14 +3409,14 @@ impl Part for AddressesScopedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetVpnGatewayList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of TargetVpnGateway resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#targetVpnGateway for target VPN gateways. pub kind: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -3214,11 +3432,12 @@ impl ResponseResult for TargetVpnGatewayList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DiskTypesScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -3237,7 +3456,7 @@ impl Part for DiskTypesScopedListWarning {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupAggregatedList { - /// [Output Only] A token that is used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A map of scoped instance group lists. @@ -3324,14 +3543,14 @@ impl Part for AutoscalingPolicyCustomMetricUtilization {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DiskAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A map of scoped disk lists. pub items: Option>, /// [Output Only] Type of resource. Always compute#diskAggregatedList for aggregated lists of persistent disks. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -3352,14 +3571,14 @@ impl ResponseResult for DiskAggregatedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A map of scoped operation lists. pub items: Option>, /// [Output Only] Type of resource. Always compute#operationAggregatedList for aggregated lists of operations. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -3369,29 +3588,30 @@ pub struct OperationAggregatedList { impl ResponseResult for OperationAggregatedList {} -/// [Output Only] Metadata for this warning in key: value format. +/// Array of key/value pairs. The total size of all keys and values must be less than 512 KB. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DisksScopedListWarningData { - /// [Output Only] A key for the warning data. +pub struct MetadataItems { + /// Key for the metadata entry. Keys must conform to the following regexp: [a-zA-Z0-9-_]+, and be less than 128 bytes in length. This is reflected as part of a URL in the metadata server. Additionally, to avoid ambiguity, keys must not conflict with any other metadata keys for the project. pub key: Option, - /// [Output Only] A warning data value corresponding to the key. + /// Value for the metadata entry. These are free-form strings, and only have meaning as interpreted by the image running in the instance. The only restriction placed on values is that their size must be less than or equal to 32768 bytes. pub value: Option, } -impl NestedType for DisksScopedListWarningData {} -impl Part for DisksScopedListWarningData {} +impl NestedType for MetadataItems {} +impl Part for MetadataItems {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstancesScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -3412,7 +3632,7 @@ impl Part for InstancesScopedListWarningData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AddressAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A map of scoped address lists. @@ -3454,11 +3674,12 @@ impl RequestValue for InstanceGroupsListInstancesRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetPoolsScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -3477,14 +3698,14 @@ impl Part for TargetPoolsScopedListWarning {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SnapshotList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, - /// A list of Snapshot resources. + /// [Output Only] A list of Snapshot resources. pub items: Option>, /// Type of resource. pub kind: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -3527,13 +3748,14 @@ pub struct TargetPoolsRemoveInstanceRequest { impl RequestValue for TargetPoolsRemoveInstanceRequest {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MachineTypesScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -3564,9 +3786,9 @@ pub struct Snapshot { /// [Output Only] A size of the the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion. #[serde(rename="storageBytes")] pub storage_bytes: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, - /// The source disk used to create this snapshot. + /// [Output Only] The source disk used to create this snapshot. #[serde(rename="sourceDisk")] pub source_disk: Option, /// [Output Only] Creation timestamp in RFC3339 text format. @@ -3583,7 +3805,7 @@ pub struct Snapshot { /// [Output Only] An indicator whether storageBytes is in a stable state or it is being adjusted as a result of shared storage reallocation. #[serde(rename="storageBytesStatus")] pub storage_bytes_status: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -3613,7 +3835,7 @@ pub struct DiskTypesScopedList { impl Part for DiskTypesScopedList {} -/// A BackendService resource. This resource defines a group of backend virtual machines together with their serving capacity. +/// A BackendService resource. This resource defines a group of backend virtual machines and their serving capacity. /// /// # Activities /// @@ -3634,12 +3856,12 @@ pub struct BackendService { pub kind: Option, /// no description provided pub protocol: Option, - /// An optional textual description of the resource. Provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, - /// How many seconds to wait for the backend before considering it a failed request. Default is 30 seconds. + /// How many seconds to wait for the backend before considering it a failed request. Default is 30 seconds. Valid range is [1, 86400]. #[serde(rename="timeoutSec")] pub timeout_sec: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// The list of backends that serve this BackendService. pub backends: Option>, @@ -3648,13 +3870,13 @@ pub struct BackendService { /// Name of backend port. The same name should appear in the resource views referenced by this service. Required. #[serde(rename="portName")] pub port_name: Option, - /// The list of URLs to the HttpHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified, and a health check is required. + /// The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified, and a health check is required. #[serde(rename="healthChecks")] pub health_checks: Option>, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// Deprecated in favor of port name. The TCP port to connect on the backend. The default value is 80. + /// Deprecated in favor of portName. The TCP port to connect on the backend. The default value is 80. pub port: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -3681,13 +3903,13 @@ impl ResponseResult for BackendService {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MachineType { - /// [Output Only] The tumber of CPUs exposed to the instance. + /// [Output Only] The number of virtual CPUs that are available to the instance. #[serde(rename="guestCpus")] pub guest_cpus: Option, /// [Deprecated] This property is deprecated and will never be populated with any relevant values. #[serde(rename="imageSpaceGb")] pub image_space_gb: Option, - /// Type of the resource. + /// [Output Only] The type of the resource. Always compute#machineType for machine types. pub kind: Option, /// [Output Only] An optional textual description of the resource. pub description: Option, @@ -3710,7 +3932,7 @@ pub struct MachineType { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -3734,14 +3956,14 @@ impl ResponseResult for MachineType {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ImageList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of Image resources. pub items: Option>, /// Type of resource. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -3751,13 +3973,14 @@ pub struct ImageList { impl ResponseResult for ImageList {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetVpnGatewaysScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -3767,13 +3990,14 @@ impl NestedType for TargetVpnGatewaysScopedListWarningData {} impl Part for TargetVpnGatewaysScopedListWarningData {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationWarningsData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -3789,11 +4013,12 @@ impl Part for OperationWarningsData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ForwardingRulesScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -3809,7 +4034,7 @@ impl Part for ForwardingRulesScopedListWarning {} pub struct HostRule { /// The list of host patterns to match. They must be valid hostnames, except * will match any string of ([a-z0-9-.]*). In that case, * must be the first character and must be followed in the pattern by either - or .. pub hosts: Option>, - /// An optional textual description. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// The name of the PathMatcher to use to match the path portion of the URL if the hostRule matches the URL's host portion. #[serde(rename="pathMatcher")] @@ -3837,7 +4062,7 @@ impl Part for HostRule {} pub struct Firewall { /// [Output Ony] Type of the resource. Always compute#firewall for firewall rules. pub kind: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// A list of instance tags which this rule applies to. One or both of sourceRanges and sourceTags may be set. /// @@ -3859,12 +4084,12 @@ pub struct Firewall { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// URL of the network resource for this firewall rule. This field is required for creating an instance but optional when creating a firewall rule. If not specified when creating a firewall rule, the default network is used: + /// URL of the network resource for this firewall rule. If not specified when creating a firewall rule, the default network is used: /// global/networks/default /// If you choose to specify this property, you can specify the network as a full or partial URL. For example, the following are all valid URLs: /// - https://www.googleapis.com/compute/v1/projects/myproject/global/networks/my-network @@ -3891,14 +4116,14 @@ impl ResponseResult for Firewall {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationList { - /// [Output Only] A token used to continue a truncate. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] The Operation resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#operations for Operations resource. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -3941,18 +4166,18 @@ pub struct TargetInstance { /// NAT option controlling how IPs are NAT'ed to the instance. Currently only NO_NAT (default value) is supported. #[serde(rename="natPolicy")] pub nat_policy: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// [Output Only] URL of the zone where the target instance resides. pub zone: Option, - /// Type of the resource. + /// [Output Only] The type of the resource. Always compute#targetInstance for target instances. pub kind: Option, /// The URL to the instance that terminates the relevant traffic. pub instance: Option, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -3977,7 +4202,7 @@ impl ResponseResult for TargetInstance {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetInstanceAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A map of scoped target instance lists. @@ -4005,7 +4230,7 @@ impl ResponseResult for TargetInstanceAggregatedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupManagerList { - /// [Output Only] A token that is used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of managed instance groups. @@ -4022,13 +4247,14 @@ pub struct InstanceGroupManagerList { impl ResponseResult for InstanceGroupManagerList {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupsScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -4049,14 +4275,14 @@ impl Part for InstanceGroupsScopedListWarningData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DiskTypeAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A map of scoped disk type lists. pub items: Option>, /// [Output Only] Type of resource. Always compute#diskTypeAggregatedList. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -4106,14 +4332,14 @@ impl Part for ManagedInstanceLastAttemptErrors {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MachineTypeAggregatedList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A map of scoped machine type lists. pub items: Option>, /// [Output Only] Type of resource. Always compute#machineTypeAggregatedList for aggregated lists of machine types. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -4147,11 +4373,12 @@ impl ResponseResult for UrlMapsValidateResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetInstancesScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -4188,7 +4415,7 @@ impl RequestValue for InstanceGroupManagersAbandonInstancesRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupList { - /// [Output Only] A token that is used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of instance groups. @@ -4205,13 +4432,14 @@ pub struct InstanceGroupList { impl ResponseResult for InstanceGroupList {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct AddressesScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -4244,13 +4472,16 @@ pub struct VpnTunnel { pub ike_version: Option, /// [Output Only] Type of resource. Always compute#vpnTunnel for VPN tunnels. pub kind: Option, - /// An optional textual description of the resource. Provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// IP address of the peer VPN gateway. #[serde(rename="peerIp")] pub peer_ip: Option, /// [Output Only] URL of the region where the VPN tunnel resides. pub region: Option, + /// Local traffic selector to use when establishing the VPN tunnel with peer VPN gateway. The value should be a CIDR formatted string, for example: 192.168.0.0/16. The ranges should be disjoint. + #[serde(rename="localTrafficSelector")] + pub local_traffic_selector: Option>, /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. pub name: Option, /// [Output Only] The status of the VPN tunnel. @@ -4264,12 +4495,12 @@ pub struct VpnTunnel { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// Shared secret used to set the secure session between the GCE VPN gateway and the peer VPN gateway. + /// Shared secret used to set the secure session between the Cloud VPN gateway and the peer VPN gateway. #[serde(rename="sharedSecret")] pub shared_secret: Option, } @@ -4311,11 +4542,12 @@ impl RequestValue for DeprecationStatus {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DisksScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -4323,20 +4555,23 @@ impl NestedType for DisksScopedListWarning {} impl Part for DisksScopedListWarning {} -/// Array of key/value pairs. The total size of all keys and values must be less than 512 KB. +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [set machine type instances](struct.InstanceSetMachineTypeCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MetadataItems { - /// Key for the metadata entry. Keys must conform to the following regexp: [a-zA-Z0-9-_]+, and be less than 128 bytes in length. This is reflected as part of a URL in the metadata server. Additionally, to avoid ambiguity, keys must not conflict with any other metadata keys for the project. - pub key: Option, - /// Value for the metadata entry. These are free-form strings, and only have meaning as interpreted by the image running in the instance. The only restriction placed on values is that their size must be less than or equal to 32768 bytes. - pub value: Option, +pub struct InstancesSetMachineTypeRequest { + /// Full or partial URL of the machine type resource. See Machine Types for a full list of machine types. For example: zones/us-central1-f/machineTypes/n1-standard-1 + #[serde(rename="machineType")] + pub machine_type: Option, } -impl NestedType for MetadataItems {} -impl Part for MetadataItems {} +impl RequestValue for InstancesSetMachineTypeRequest {} /// There is no detailed description. @@ -4377,31 +4612,29 @@ impl NestedType for OperationErrorErrors {} impl Part for OperationErrorErrors {} -/// [Output Only] Informational warning which replaces the list of addresses when the list is empty. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AddressesScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. - pub message: Option, - /// [Output Only] The warning type identifier for this warning. - pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. - pub data: Option>, +pub struct SubnetworksScopedList { + /// List of subnetworks contained in this scope. + pub subnetworks: Option>, + /// An informational warning that appears when the list of addresses is empty. + pub warning: Option, } -impl NestedType for AddressesScopedListWarning {} -impl Part for AddressesScopedListWarning {} +impl Part for SubnetworksScopedList {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupManagersScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -4431,11 +4664,12 @@ impl Part for HealthCheckReference {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InstanceGroupsScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -4462,7 +4696,7 @@ impl Part for InstanceGroupsScopedListWarning {} pub struct Autoscaler { /// Type of the resource. pub kind: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// [Output Only] URL of the zone where the instance group resides. pub zone: Option, @@ -4474,7 +4708,7 @@ pub struct Autoscaler { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -4494,11 +4728,12 @@ impl ResponseResult for Autoscaler {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetVpnGatewaysScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -4609,11 +4844,11 @@ pub struct TargetPool { /// In case where failoverRatio is not set or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. #[serde(rename="failoverRatio")] pub failover_ratio: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// [Output Only] URL of the region where the target pool resides. pub region: Option, - /// Type of the resource. + /// [Output Only] Type of the resource. Always compute#targetPool for target pools. pub kind: Option, /// Sesssion affinity option, must be one of the following values: /// NONE: Connections from the same client IP may go to any instance in the pool. @@ -4636,7 +4871,7 @@ pub struct TargetPool { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -4650,13 +4885,14 @@ impl Resource for TargetPool {} impl ResponseResult for TargetPool {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetPoolsScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -4666,13 +4902,14 @@ impl NestedType for TargetPoolsScopedListWarningData {} impl Part for TargetPoolsScopedListWarningData {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetInstancesScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -4700,7 +4937,7 @@ pub struct Address { pub status: Option, /// [Output Only] Type of the resource. Always compute#address for addresses. pub kind: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// [Output Only] URL of the region where the regional address resides. This field is not applicable to global addresses. pub region: Option, @@ -4711,7 +4948,7 @@ pub struct Address { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -4730,11 +4967,12 @@ impl ResponseResult for Address {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct MachineTypesScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -4760,11 +4998,11 @@ impl Part for MachineTypesScopedListWarning {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ForwardingRule { - /// [Output Only] Type of the resource. Always compute#forwardingRule. + /// [Output Only] Type of the resource. Always compute#forwardingRule for Forwarding Rule resources. pub kind: Option, - /// An optional textual description of the resource; provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, - /// Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to ports in the specified range will be forwarded to target. Forwarding rules with the same `[IPAddress, IPProtocol]` pair must have disjoint port ranges. + /// Applicable only when IPProtocol is TCP, UDP, or SCTP, only packets addressed to ports in the specified range will be forwarded to target. Forwarding rules with the same [IPAddress, IPProtocol] pair must have disjoint port ranges. #[serde(rename="portRange")] pub port_range: Option, /// [Output Only] URL of the region where the regional forwarding rule resides. This field is not applicable to global forwarding rules. @@ -4780,12 +5018,12 @@ pub struct ForwardingRule { /// Value of the reserved IP address that this forwarding rule is serving on behalf of. For global forwarding rules, the address must be a global IP; for regional forwarding rules, the address must live in the same region as the forwarding rule. If left empty (default value), an ephemeral IP from the same scope (global or regional) will be assigned. #[serde(rename="IPAddress")] pub ip_address: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// The URL of the target resource to receive the matched traffic. For regional forwarding rules, this target must live in the same region as the forwarding rule. For global forwarding rules, this target must be a global TargetHttpProxy or TargetHttpsProxy resource. + /// The URL of the target resource to receive the matched traffic. For regional forwarding rules, this target must live in the same region as the forwarding rule. For global forwarding rules, this target must be a global TargetHttpProxy or TargetHttpsProxy resource. The forwarded traffic must be of a type appropriate to the target object. For example, TargetHttpProxy requires HTTP traffic, and TargetHttpsProxy requires HTTPS traffic. pub target: Option, } @@ -4794,13 +5032,14 @@ impl Resource for ForwardingRule {} impl ResponseResult for ForwardingRule {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DiskTypesScopedListWarningData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -4821,7 +5060,7 @@ impl Part for DiskTypesScopedListWarningData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct License { - /// If true, the customer will be charged license fee for running software that contains this license on an instance. + /// [Output Only] If true, the customer will be charged license fee for running software that contains this license on an instance. #[serde(rename="chargesUseFee")] pub charges_use_fee: Option, /// [Output Only] Type of resource. Always compute#license for licenses. @@ -4848,14 +5087,14 @@ impl ResponseResult for License {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DiskTypeList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of Disk Type resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#diskTypeList for disk types. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for this resource. #[serde(rename="selfLink")] @@ -4880,7 +5119,7 @@ pub struct AutoscalersScopedList { impl Part for AutoscalersScopedList {} -/// The route resource. A Route is a rule that specifies how certain packets should be handled by the virtual network. Routes are associated with instances by tag and the set of Routes for a particular instance is called its routing table. For each packet leaving a instance, the system searches that instance's routing table for a single best matching Route. Routes match packets by destination IP address, preferring smaller or more specific ranges over larger ones. If there is a tie, the system selects the Route with the smallest priority value. If there is still a tie, it uses the layer three and four packet headers to select just one of the remaining matching Routes. The packet is then forwarded as specified by the nextHop field of the winning Route -- either to another instance destination, a instance gateway or a Google Compute Engien-operated gateway. Packets that do not match any Route in the sending instance's routing table are dropped. +/// The route resource. A Route is a rule that specifies how certain packets should be handled by the virtual network. Routes are associated with instances by tags and the set of Routes for a particular instance is called its routing table. For each packet leaving a instance, the system searches that instance's routing table for a single best matching Route. Routes match packets by destination IP address, preferring smaller or more specific ranges over larger ones. If there is a tie, the system selects the Route with the smallest priority value. If there is still a tie, it uses the layer three and four packet headers to select just one of the remaining matching Routes. The packet is then forwarded as specified by the nextHop field of the winning Route -- either to another instance destination, a instance gateway or a Google Compute Engien-operated gateway. Packets that do not match any Route in the sending instance's routing table are dropped. /// /// # Activities /// @@ -4894,10 +5133,10 @@ impl Part for AutoscalersScopedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Route { - /// The URL to a gateway that should handle matching packets. Currently, this is only the internet gateway: projects//global/gateways/default-internet-gateway + /// The URL to a gateway that should handle matching packets. You can only specify the internet gateway using a full or partial valid URL: projects//global/gateways/default-internet-gateway #[serde(rename="nextHopGateway")] pub next_hop_gateway: Option, - /// An optional textual description of the resource. Provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// A list of instance tags to which this route applies. pub tags: Option>, @@ -4910,7 +5149,7 @@ pub struct Route { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource. Defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// The network IP address of an instance that should handle matching packets. #[serde(rename="nextHopIp")] @@ -4921,13 +5160,13 @@ pub struct Route { pub kind: Option, /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. pub name: Option, - /// The fully-qualified URL to an instance that should handle matching packets. For example: + /// The URL to an instance that should handle matching packets. You can specify this as a full or partial URL. For example: /// https://www.googleapis.com/compute/v1/projects/project/zones/zone/instances/ #[serde(rename="nextHopInstance")] pub next_hop_instance: Option, /// [Output Only] If potential misconfigurations are detected for this route, this field will be populated with warning messages. pub warnings: Option>, - /// Breaks ties between Routes of equal specificity. Routes with smaller values win when tied with routes with larger values. Default value is 1000. A valid range is between 0 and 65535. + /// The priority of this route. Priority is used to break ties in cases where there is more than one matching route of equal prefix length. In the case of two routes with equal prefix length, the one with the lowest-numbered priority value wins. Default value is 1000. Valid range is 0 through 65535. pub priority: Option, /// The URL to a VpnTunnel that should handle matching packets. #[serde(rename="nextHopVpnTunnel")] @@ -4992,6 +5231,10 @@ pub struct NetworkInterface { pub network_ip: Option, /// [Output Only] The name of the network interface, generated by the server. For network devices, these are eth0, eth1, etc. pub name: Option, + /// The URL of the Subnetwork resource for this instance. If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. If you specify this property, you can specify the subnetwork as a full or partial URL. For example, the following are all valid URLs: + /// - https://www.googleapis.com/compute/v1/projects/project/zones/zone/subnetworks/subnetwork + /// - zones/zone/subnetworks/subnetwork + pub subnetwork: Option, /// URL of the network resource for this instance. This is required for creating an instance but optional when creating a firewall rule. If not specified when creating a firewall rule, the default network is used: /// /// global/networks/default @@ -5032,14 +5275,14 @@ impl Part for DisksScopedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct VpnTunnelList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// [Output Only] A list of VpnTunnel resources. pub items: Option>, /// [Output Only] Type of resource. Always compute#vpnTunnel for VPN tunnels. pub kind: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -5103,9 +5346,9 @@ impl Part for TargetInstancesScopedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UrlMap { - /// Type of the resource. + /// [Output Only] Type of the resource. Always compute#urlMaps for url maps. pub kind: Option, - /// An optional textual description of the resource. Provided by the client when the resource is created. + /// An optional description of this resource. Provide this property when you create the resource. pub description: Option, /// The URL of the BackendService resource if none of the hostRules match. #[serde(rename="defaultService")] @@ -5123,7 +5366,7 @@ pub struct UrlMap { /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource. Set by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] @@ -5137,13 +5380,14 @@ impl Resource for UrlMap {} impl ResponseResult for UrlMap {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RouteWarningsData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -5180,7 +5424,7 @@ impl Part for InstanceGroupsScopedList {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TargetPoolList { - /// [Output Only] A token used to continue a truncated list request. + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. #[serde(rename="nextPageToken")] pub next_page_token: Option, /// A list of TargetPool resources. @@ -5255,11 +5499,12 @@ impl RequestValue for TargetPoolsRemoveHealthCheckRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct VpnTunnelsScopedListWarning { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -5407,7 +5652,7 @@ impl<'a, C, A> DiskMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of disks grouped by scope. + /// Retrieves an aggregated list of persistent disks. /// /// # Arguments /// @@ -5448,7 +5693,7 @@ impl<'a, C, A> DiskMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of persistent disks contained within the specified zone. + /// Retrieves a list of persistent disks contained within the specified zone. /// /// # Arguments /// @@ -5492,7 +5737,7 @@ impl<'a, C, A> DiskMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a snapshot of this disk. + /// Creates a snapshot of a specified persistent disk. /// /// # Arguments /// @@ -5556,7 +5801,7 @@ impl<'a, C, A> AddresseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of address resources contained within the specified region. + /// Retrieves a list of address resources contained within the specified region. /// /// # Arguments /// @@ -5578,7 +5823,7 @@ impl<'a, C, A> AddresseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of addresses grouped by scope. + /// Retrieves an aggregated list of addresses. /// /// # Arguments /// @@ -5707,7 +5952,7 @@ impl<'a, C, A> UrlMapMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn insert(&self, request: UrlMap, project: &str) -> UrlMapInsertCall<'a, C, A> { UrlMapInsertCall { hub: self.hub, @@ -5725,7 +5970,7 @@ impl<'a, C, A> UrlMapMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `urlMap` - Name of the UrlMap resource to return. pub fn get(&self, project: &str, url_map: &str) -> UrlMapGetCall<'a, C, A> { UrlMapGetCall { @@ -5740,12 +5985,12 @@ impl<'a, C, A> UrlMapMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Run static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap. + /// Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `urlMap` - Name of the UrlMap resource to be validated as. pub fn validate(&self, request: UrlMapsValidateRequest, project: &str, url_map: &str) -> UrlMapValidateCall<'a, C, A> { UrlMapValidateCall { @@ -5765,7 +6010,7 @@ impl<'a, C, A> UrlMapMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> UrlMapListCall<'a, C, A> { UrlMapListCall { hub: self.hub, @@ -5781,12 +6026,12 @@ impl<'a, C, A> UrlMapMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Update the entire content of the UrlMap resource. This method supports patch semantics. + /// Updates the entire content of the UrlMap resource. This method supports patch semantics. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `urlMap` - Name of the UrlMap resource to update. pub fn patch(&self, request: UrlMap, project: &str, url_map: &str) -> UrlMapPatchCall<'a, C, A> { UrlMapPatchCall { @@ -5802,12 +6047,12 @@ impl<'a, C, A> UrlMapMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Update the entire content of the UrlMap resource. + /// Updates the entire content of the UrlMap resource. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `urlMap` - Name of the UrlMap resource to update. pub fn update(&self, request: UrlMap, project: &str, url_map: &str) -> UrlMapUpdateCall<'a, C, A> { UrlMapUpdateCall { @@ -5827,7 +6072,7 @@ impl<'a, C, A> UrlMapMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `urlMap` - Name of the UrlMap resource to delete. pub fn delete(&self, project: &str, url_map: &str) -> UrlMapDeleteCall<'a, C, A> { UrlMapDeleteCall { @@ -5902,7 +6147,7 @@ impl<'a, C, A> GlobalAddresseMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of global address resources. + /// Retrieves a list of global address resources. /// /// # Arguments /// @@ -6005,7 +6250,7 @@ impl<'a, C, A> SnapshotMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `snapshot` - Name of the Snapshot resource to return. pub fn get(&self, project: &str, snapshot: &str) -> SnapshotGetCall<'a, C, A> { SnapshotGetCall { @@ -6024,7 +6269,7 @@ impl<'a, C, A> SnapshotMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> SnapshotListCall<'a, C, A> { SnapshotListCall { hub: self.hub, @@ -6046,7 +6291,7 @@ impl<'a, C, A> SnapshotMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `snapshot` - Name of the Snapshot resource to delete. pub fn delete(&self, project: &str, snapshot: &str) -> SnapshotDeleteCall<'a, C, A> { SnapshotDeleteCall { @@ -6123,7 +6368,7 @@ impl<'a, C, A> DiskTypeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of disk type resources grouped by scope. + /// Retrieves an aggregated list of disk type resources. /// /// # Arguments /// @@ -6143,7 +6388,7 @@ impl<'a, C, A> DiskTypeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of disk type resources available to the specified project. + /// Retrieves a list of disk type resources available to the specified project. /// /// # Arguments /// @@ -6269,7 +6514,7 @@ impl<'a, C, A> ZoneMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Compute::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `add_access_config(...)`, `aggregated_list(...)`, `attach_disk(...)`, `delete(...)`, `delete_access_config(...)`, `detach_disk(...)`, `get(...)`, `get_serial_port_output(...)`, `insert(...)`, `list(...)`, `reset(...)`, `set_disk_auto_delete(...)`, `set_metadata(...)`, `set_scheduling(...)`, `set_tags(...)`, `start(...)` and `stop(...)` +/// // like `add_access_config(...)`, `aggregated_list(...)`, `attach_disk(...)`, `delete(...)`, `delete_access_config(...)`, `detach_disk(...)`, `get(...)`, `get_serial_port_output(...)`, `insert(...)`, `list(...)`, `reset(...)`, `set_disk_auto_delete(...)`, `set_machine_type(...)`, `set_metadata(...)`, `set_scheduling(...)`, `set_tags(...)`, `start(...)` and `stop(...)` /// // to build up your call. /// let rb = hub.instances(); /// # } @@ -6284,6 +6529,29 @@ impl<'a, C, A> MethodsBuilder for InstanceMethods<'a, C, A> {} impl<'a, C, A> InstanceMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Changes the machine type for a stopped instance to the machine type specified in the request. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `instance` - Name of the instance scoping this request. + pub fn set_machine_type(&self, request: InstancesSetMachineTypeRequest, project: &str, zone: &str, instance: &str) -> InstanceSetMachineTypeCall<'a, C, A> { + InstanceSetMachineTypeCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _instance: instance.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Sets an instance's scheduling options. @@ -6309,7 +6577,7 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes the specified Instance resource. For more information, see Shutting down an instance. + /// Deletes the specified Instance resource. For more information, see Stopping or Deleting an Instance. /// /// # Arguments /// @@ -6375,6 +6643,29 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Sets tags for the specified instance to the data included in the request. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `instance` - Name of the instance scoping this request. + pub fn set_tags(&self, request: Tags, project: &str, zone: &str, instance: &str) -> InstanceSetTagCall<'a, C, A> { + InstanceSetTagCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _zone: zone.to_string(), + _instance: instance.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Adds an access config to an instance's network interface. @@ -6425,7 +6716,7 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// This method starts an instance that was stopped using the using the instances().stop method. For more information, see Restart an instance. + /// Starts an instance that was stopped using the using the instances().stop method. For more information, see Restart an instance. /// /// # Arguments /// @@ -6467,30 +6758,7 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets tags for the specified instance to the data included in the request. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `project` - Project ID for this request. - /// * `zone` - The name of the zone for this request. - /// * `instance` - Name of the instance scoping this request. - pub fn set_tags(&self, request: Tags, project: &str, zone: &str, instance: &str) -> InstanceSetTagCall<'a, C, A> { - InstanceSetTagCall { - hub: self.hub, - _request: request, - _project: project.to_string(), - _zone: zone.to_string(), - _instance: instance.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// This method stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur per-minute, virtual machine usage charges while they are stopped, but any resources that the virtual machine is using, such as persistent disks and static IP addresses,will continue to be charged until they are deleted. For more information, see Stopping an instance. + /// Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur per-minute, virtual machine usage charges while they are stopped, but any resources that the virtual machine is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance. /// /// # Arguments /// @@ -6555,6 +6823,31 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Deletes an access config from an instance's network interface. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `zone` - The name of the zone for this request. + /// * `instance` - The instance name for this request. + /// * `accessConfig` - The name of the access config to delete. + /// * `networkInterface` - The name of the network interface. + pub fn delete_access_config(&self, project: &str, zone: &str, instance: &str, access_config: &str, network_interface: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { + InstanceDeleteAccessConfigCall { + hub: self.hub, + _project: project.to_string(), + _zone: zone.to_string(), + _instance: instance.to_string(), + _access_config: access_config.to_string(), + _network_interface: network_interface.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Creates an instance resource in the specified project using the data included in the request. @@ -6619,31 +6912,6 @@ impl<'a, C, A> InstanceMethods<'a, C, A> { } } - /// Create a builder to help you perform the following task: - /// - /// Deletes an access config from an instance's network interface. - /// - /// # Arguments - /// - /// * `project` - Project ID for this request. - /// * `zone` - The name of the zone for this request. - /// * `instance` - The instance name for this request. - /// * `accessConfig` - The name of the access config to delete. - /// * `networkInterface` - The name of the network interface. - pub fn delete_access_config(&self, project: &str, zone: &str, instance: &str, access_config: &str, network_interface: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { - InstanceDeleteAccessConfigCall { - hub: self.hub, - _project: project.to_string(), - _zone: zone.to_string(), - _instance: instance.to_string(), - _access_config: access_config.to_string(), - _network_interface: network_interface.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - /// Create a builder to help you perform the following task: /// /// Retrieves aggregated list of instance resources. @@ -6732,7 +7000,7 @@ impl<'a, C, A> BackendServiceMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `backendService` - Name of the BackendService resource to delete. pub fn delete(&self, project: &str, backend_service: &str) -> BackendServiceDeleteCall<'a, C, A> { BackendServiceDeleteCall { @@ -6751,7 +7019,7 @@ impl<'a, C, A> BackendServiceMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `backendService` - Name of the BackendService resource to return. pub fn get(&self, project: &str, backend_service: &str) -> BackendServiceGetCall<'a, C, A> { BackendServiceGetCall { @@ -6766,12 +7034,12 @@ impl<'a, C, A> BackendServiceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Update the entire content of the BackendService resource. + /// Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `backendService` - Name of the BackendService resource to update. pub fn update(&self, request: BackendService, project: &str, backend_service: &str) -> BackendServiceUpdateCall<'a, C, A> { BackendServiceUpdateCall { @@ -6791,7 +7059,7 @@ impl<'a, C, A> BackendServiceMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> BackendServiceListCall<'a, C, A> { BackendServiceListCall { hub: self.hub, @@ -6807,12 +7075,12 @@ impl<'a, C, A> BackendServiceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Update the entire content of the BackendService resource. This method supports patch semantics. + /// Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. This method supports patch semantics. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `backendService` - Name of the BackendService resource to update. pub fn patch(&self, request: BackendService, project: &str, backend_service: &str) -> BackendServicePatchCall<'a, C, A> { BackendServicePatchCall { @@ -6828,12 +7096,12 @@ impl<'a, C, A> BackendServiceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a BackendService resource in the specified project using the data included in the request. + /// Creates a BackendService resource in the specified project using the data included in the request. There are several restrictions and guidelines to keep in mind when creating a backend service. Read Restrictions and Guidelines for more information. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn insert(&self, request: BackendService, project: &str) -> BackendServiceInsertCall<'a, C, A> { BackendServiceInsertCall { hub: self.hub, @@ -7095,7 +7363,7 @@ impl<'a, C, A> TargetHttpsProxyMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `targetHttpsProxy` - Name of the TargetHttpsProxy resource to delete. pub fn delete(&self, project: &str, target_https_proxy: &str) -> TargetHttpsProxyDeleteCall<'a, C, A> { TargetHttpsProxyDeleteCall { @@ -7114,7 +7382,7 @@ impl<'a, C, A> TargetHttpsProxyMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `targetHttpsProxy` - Name of the TargetHttpsProxy resource to return. pub fn get(&self, project: &str, target_https_proxy: &str) -> TargetHttpsProxyGetCall<'a, C, A> { TargetHttpsProxyGetCall { @@ -7134,7 +7402,7 @@ impl<'a, C, A> TargetHttpsProxyMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `targetHttpsProxy` - Name of the TargetHttpsProxy resource whose URL map is to be set. pub fn set_url_map(&self, request: UrlMapReference, project: &str, target_https_proxy: &str) -> TargetHttpsProxySetUrlMapCall<'a, C, A> { TargetHttpsProxySetUrlMapCall { @@ -7155,7 +7423,7 @@ impl<'a, C, A> TargetHttpsProxyMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn insert(&self, request: TargetHttpsProxy, project: &str) -> TargetHttpsProxyInsertCall<'a, C, A> { TargetHttpsProxyInsertCall { hub: self.hub, @@ -7174,8 +7442,8 @@ impl<'a, C, A> TargetHttpsProxyMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. - /// * `targetHttpsProxy` - Name of the TargetHttpsProxy resource whose URL map is to be set. + /// * `project` - Project ID for this request. + /// * `targetHttpsProxy` - Name of the TargetHttpsProxy resource whose SSLCertificate is to be set. pub fn set_ssl_certificates(&self, request: TargetHttpsProxiesSetSslCertificatesRequest, project: &str, target_https_proxy: &str) -> TargetHttpsProxySetSslCertificateCall<'a, C, A> { TargetHttpsProxySetSslCertificateCall { hub: self.hub, @@ -7194,7 +7462,7 @@ impl<'a, C, A> TargetHttpsProxyMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> TargetHttpsProxyListCall<'a, C, A> { TargetHttpsProxyListCall { hub: self.hub, @@ -7369,7 +7637,7 @@ impl<'a, C, A> GlobalOperationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of Operation resources contained within the specified project. + /// Retrieves a list of Operation resources contained within the specified project. /// /// # Arguments /// @@ -7389,7 +7657,7 @@ impl<'a, C, A> GlobalOperationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of all operations grouped by scope. + /// Retrieves an aggregated list of all operations. /// /// # Arguments /// @@ -7492,7 +7760,7 @@ impl<'a, C, A> AutoscalerMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `zone` - Name of the zone scoping this request. /// * `autoscaler` - Name of the persistent autoscaler resource to delete. pub fn delete(&self, project: &str, zone: &str, autoscaler: &str) -> AutoscalerDeleteCall<'a, C, A> { @@ -7513,7 +7781,7 @@ impl<'a, C, A> AutoscalerMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `zone` - Name of the zone scoping this request. /// * `autoscaler` - Name of the persistent autoscaler resource to return. pub fn get(&self, project: &str, zone: &str, autoscaler: &str) -> AutoscalerGetCall<'a, C, A> { @@ -7530,11 +7798,11 @@ impl<'a, C, A> AutoscalerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of autoscaler resources contained within the specified zone. + /// Retrieves a list of autoscaler resources contained within the specified zone. /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `zone` - Name of the zone scoping this request. pub fn list(&self, project: &str, zone: &str) -> AutoscalerListCall<'a, C, A> { AutoscalerListCall { @@ -7557,7 +7825,7 @@ impl<'a, C, A> AutoscalerMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `zone` - Name of the zone scoping this request. /// * `autoscaler` - Name of the autoscaler resource to update. pub fn patch(&self, request: Autoscaler, project: &str, zone: &str, autoscaler: &str) -> AutoscalerPatchCall<'a, C, A> { @@ -7580,7 +7848,7 @@ impl<'a, C, A> AutoscalerMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `zone` - Name of the zone scoping this request. pub fn insert(&self, request: Autoscaler, project: &str, zone: &str) -> AutoscalerInsertCall<'a, C, A> { AutoscalerInsertCall { @@ -7596,11 +7864,11 @@ impl<'a, C, A> AutoscalerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of autoscalers grouped by scope. + /// Retrieves an aggregated list of autoscalers. /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn aggregated_list(&self, project: &str) -> AutoscalerAggregatedListCall<'a, C, A> { AutoscalerAggregatedListCall { hub: self.hub, @@ -7621,7 +7889,7 @@ impl<'a, C, A> AutoscalerMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `zone` - Name of the zone scoping this request. pub fn update(&self, request: Autoscaler, project: &str, zone: &str) -> AutoscalerUpdateCall<'a, C, A> { AutoscalerUpdateCall { @@ -7639,6 +7907,152 @@ impl<'a, C, A> AutoscalerMethods<'a, C, A> { +/// A builder providing access to all methods supported on *subnetwork* resources. +/// It is not used directly, but through the `Compute` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_compute1 as compute1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use compute1::Compute; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Compute::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `aggregated_list(...)`, `delete(...)`, `get(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.subnetworks(); +/// # } +/// ``` +pub struct SubnetworkMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, +} + +impl<'a, C, A> MethodsBuilder for SubnetworkMethods<'a, C, A> {} + +impl<'a, C, A> SubnetworkMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves an aggregated list of subnetworks. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + pub fn aggregated_list(&self, project: &str) -> SubnetworkAggregatedListCall<'a, C, A> { + SubnetworkAggregatedListCall { + hub: self.hub, + _project: project.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a subnetwork in the specified project using the data included in the request. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Project ID for this request. + /// * `region` - Name of the region scoping this request. + pub fn insert(&self, request: Subnetwork, project: &str, region: &str) -> SubnetworkInsertCall<'a, C, A> { + SubnetworkInsertCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _region: region.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes the specified subnetwork. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `region` - Name of the region scoping this request. + /// * `subnetwork` - Name of the Subnetwork resource to delete. + pub fn delete(&self, project: &str, region: &str, subnetwork: &str) -> SubnetworkDeleteCall<'a, C, A> { + SubnetworkDeleteCall { + hub: self.hub, + _project: project.to_string(), + _region: region.to_string(), + _subnetwork: subnetwork.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of subnetworks available to the specified project. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `region` - Name of the region scoping this request. + pub fn list(&self, project: &str, region: &str) -> SubnetworkListCall<'a, C, A> { + SubnetworkListCall { + hub: self.hub, + _project: project.to_string(), + _region: region.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the specified subnetwork. + /// + /// # Arguments + /// + /// * `project` - Project ID for this request. + /// * `region` - Name of the region scoping this request. + /// * `subnetwork` - Name of the Subnetwork resource to return. + pub fn get(&self, project: &str, region: &str, subnetwork: &str) -> SubnetworkGetCall<'a, C, A> { + SubnetworkGetCall { + hub: self.hub, + _project: project.to_string(), + _region: region.to_string(), + _subnetwork: subnetwork.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *instanceGroup* resources. /// It is not used directly, but through the `Compute` hub. /// @@ -7679,11 +8093,11 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes the specified instance group. The instances in the group are not deleted. + /// Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information. /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the instance group is located. /// * `instanceGroup` - The name of the instance group to delete. pub fn delete(&self, project: &str, zone: &str, instance_group: &str) -> InstanceGroupDeleteCall<'a, C, A> { @@ -7705,7 +8119,7 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the instance group is located. /// * `instanceGroup` - The name of the instance group from which you want to generate a list of included instances. pub fn list_instances(&self, request: InstanceGroupsListInstancesRequest, project: &str, zone: &str, instance_group: &str) -> InstanceGroupListInstanceCall<'a, C, A> { @@ -7731,7 +8145,7 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where you want to create the instance group. pub fn insert(&self, request: InstanceGroup, project: &str, zone: &str) -> InstanceGroupInsertCall<'a, C, A> { InstanceGroupInsertCall { @@ -7751,7 +8165,7 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the instance group is located. /// * `instanceGroup` - The name of the instance group. pub fn get(&self, project: &str, zone: &str, instance_group: &str) -> InstanceGroupGetCall<'a, C, A> { @@ -7773,7 +8187,7 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the instance group is located. /// * `instanceGroup` - The name of the instance group where the specified instances will be removed. pub fn remove_instances(&self, request: InstanceGroupsRemoveInstancesRequest, project: &str, zone: &str, instance_group: &str) -> InstanceGroupRemoveInstanceCall<'a, C, A> { @@ -7791,12 +8205,12 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. TODO: Change to comment to state "if IG is load balanced." + /// Adds a list of instances to the specified instance group. Read Adding instances for more information. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the instance group is located. /// * `instanceGroup` - The name of the instance group where you are adding instances. pub fn add_instances(&self, request: InstanceGroupsAddInstancesRequest, project: &str, zone: &str, instance_group: &str) -> InstanceGroupAddInstanceCall<'a, C, A> { @@ -7819,7 +8233,7 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the instance group is located. /// * `instanceGroup` - The name of the instance group where the named ports are updated. pub fn set_named_ports(&self, request: InstanceGroupsSetNamedPortsRequest, project: &str, zone: &str, instance_group: &str) -> InstanceGroupSetNamedPortCall<'a, C, A> { @@ -7841,7 +8255,7 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. pub fn aggregated_list(&self, project: &str) -> InstanceGroupAggregatedListCall<'a, C, A> { InstanceGroupAggregatedListCall { hub: self.hub, @@ -7861,7 +8275,7 @@ impl<'a, C, A> InstanceGroupMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the instance group is located. pub fn list(&self, project: &str, zone: &str) -> InstanceGroupListCall<'a, C, A> { InstanceGroupListCall { @@ -8005,7 +8419,7 @@ impl<'a, C, A> ForwardingRuleMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `region` - Name of the region scoping this request. pub fn insert(&self, request: ForwardingRule, project: &str, region: &str) -> ForwardingRuleInsertCall<'a, C, A> { ForwardingRuleInsertCall { @@ -8021,12 +8435,12 @@ impl<'a, C, A> ForwardingRuleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Changes target url for forwarding rule. + /// Changes target URL for forwarding rule. The new target should be of the same type as the old target. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `region` - Name of the region scoping this request. /// * `forwardingRule` - Name of the ForwardingRule resource in which target is to be set. pub fn set_target(&self, request: TargetReference, project: &str, region: &str, forwarding_rule: &str) -> ForwardingRuleSetTargetCall<'a, C, A> { @@ -8044,11 +8458,11 @@ impl<'a, C, A> ForwardingRuleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of ForwardingRule resources available to the specified project and region. + /// Retrieves a list of ForwardingRule resources available to the specified project and region. /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `region` - Name of the region scoping this request. pub fn list(&self, project: &str, region: &str) -> ForwardingRuleListCall<'a, C, A> { ForwardingRuleListCall { @@ -8066,11 +8480,11 @@ impl<'a, C, A> ForwardingRuleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of forwarding rules grouped by scope. + /// Retrieves an aggregated list of forwarding rules. /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn aggregated_list(&self, project: &str) -> ForwardingRuleAggregatedListCall<'a, C, A> { ForwardingRuleAggregatedListCall { hub: self.hub, @@ -8090,7 +8504,7 @@ impl<'a, C, A> ForwardingRuleMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `region` - Name of the region scoping this request. /// * `forwardingRule` - Name of the ForwardingRule resource to return. pub fn get(&self, project: &str, region: &str, forwarding_rule: &str) -> ForwardingRuleGetCall<'a, C, A> { @@ -8111,7 +8525,7 @@ impl<'a, C, A> ForwardingRuleMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `region` - Name of the region scoping this request. /// * `forwardingRule` - Name of the ForwardingRule resource to delete. pub fn delete(&self, project: &str, region: &str, forwarding_rule: &str) -> ForwardingRuleDeleteCall<'a, C, A> { @@ -8197,7 +8611,7 @@ impl<'a, C, A> TargetPoolMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `region` - Name of the region scoping this request. pub fn insert(&self, request: TargetPool, project: &str, region: &str) -> TargetPoolInsertCall<'a, C, A> { TargetPoolInsertCall { @@ -8236,7 +8650,7 @@ impl<'a, C, A> TargetPoolMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the most recent health check results for each IP for the given instance that is referenced by given TargetPool. + /// Gets the most recent health check results for each IP for the given instance that is referenced by the given TargetPool. /// /// # Arguments /// @@ -8264,7 +8678,7 @@ impl<'a, C, A> TargetPoolMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `region` - Name of the region scoping this request. /// * `targetPool` - Name of the TargetPool resource for which the backup is to be set. pub fn set_backup(&self, request: TargetReference, project: &str, region: &str, target_pool: &str) -> TargetPoolSetBackupCall<'a, C, A> { @@ -8283,11 +8697,11 @@ impl<'a, C, A> TargetPoolMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of target pools grouped by scope. + /// Retrieves an aggregated list of target pools. /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn aggregated_list(&self, project: &str) -> TargetPoolAggregatedListCall<'a, C, A> { TargetPoolAggregatedListCall { hub: self.hub, @@ -8307,7 +8721,7 @@ impl<'a, C, A> TargetPoolMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `region` - Name of the region scoping this request. /// * `targetPool` - Name of the TargetPool resource to return. pub fn get(&self, project: &str, region: &str, target_pool: &str) -> TargetPoolGetCall<'a, C, A> { @@ -8324,7 +8738,7 @@ impl<'a, C, A> TargetPoolMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Adds instance url to targetPool. + /// Adds instance URL to targetPool. /// /// # Arguments /// @@ -8374,7 +8788,7 @@ impl<'a, C, A> TargetPoolMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `region` - Name of the region scoping this request. /// * `targetPool` - Name of the TargetPool resource to delete. pub fn delete(&self, project: &str, region: &str, target_pool: &str) -> TargetPoolDeleteCall<'a, C, A> { @@ -8391,11 +8805,11 @@ impl<'a, C, A> TargetPoolMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of TargetPool resources available to the specified project and region. + /// Retrieves a list of TargetPool resources available to the specified project and region. /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `region` - Name of the region scoping this request. pub fn list(&self, project: &str, region: &str) -> TargetPoolListCall<'a, C, A> { TargetPoolListCall { @@ -8454,11 +8868,11 @@ impl<'a, C, A> TargetInstanceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of TargetInstance resources available to the specified project and zone. + /// Retrieves a list of TargetInstance resources available to the specified project and zone. /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `zone` - Name of the zone scoping this request. pub fn list(&self, project: &str, zone: &str) -> TargetInstanceListCall<'a, C, A> { TargetInstanceListCall { @@ -8481,7 +8895,7 @@ impl<'a, C, A> TargetInstanceMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `zone` - Name of the zone scoping this request. pub fn insert(&self, request: TargetInstance, project: &str, zone: &str) -> TargetInstanceInsertCall<'a, C, A> { TargetInstanceInsertCall { @@ -8497,11 +8911,11 @@ impl<'a, C, A> TargetInstanceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of target instances grouped by scope. + /// Retrieves an aggregated list of target instances. /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn aggregated_list(&self, project: &str) -> TargetInstanceAggregatedListCall<'a, C, A> { TargetInstanceAggregatedListCall { hub: self.hub, @@ -8521,7 +8935,7 @@ impl<'a, C, A> TargetInstanceMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `zone` - Name of the zone scoping this request. /// * `targetInstance` - Name of the TargetInstance resource to delete. pub fn delete(&self, project: &str, zone: &str, target_instance: &str) -> TargetInstanceDeleteCall<'a, C, A> { @@ -8542,7 +8956,7 @@ impl<'a, C, A> TargetInstanceMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `zone` - Name of the zone scoping this request. /// * `targetInstance` - Name of the TargetInstance resource to return. pub fn get(&self, project: &str, zone: &str, target_instance: &str) -> TargetInstanceGetCall<'a, C, A> { @@ -8604,7 +9018,7 @@ impl<'a, C, A> GlobalForwardingRuleMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `forwardingRule` - Name of the ForwardingRule resource to delete. pub fn delete(&self, project: &str, forwarding_rule: &str) -> GlobalForwardingRuleDeleteCall<'a, C, A> { GlobalForwardingRuleDeleteCall { @@ -8619,12 +9033,12 @@ impl<'a, C, A> GlobalForwardingRuleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Changes target url for forwarding rule. + /// Changes target URL for forwarding rule. The new target should be of the same type as the old target. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `forwardingRule` - Name of the ForwardingRule resource in which target is to be set. pub fn set_target(&self, request: TargetReference, project: &str, forwarding_rule: &str) -> GlobalForwardingRuleSetTargetCall<'a, C, A> { GlobalForwardingRuleSetTargetCall { @@ -8645,7 +9059,7 @@ impl<'a, C, A> GlobalForwardingRuleMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn insert(&self, request: ForwardingRule, project: &str) -> GlobalForwardingRuleInsertCall<'a, C, A> { GlobalForwardingRuleInsertCall { hub: self.hub, @@ -8659,11 +9073,11 @@ impl<'a, C, A> GlobalForwardingRuleMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of ForwardingRule resources available to the specified project. + /// Retrieves a list of ForwardingRule resources available to the specified project. /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> GlobalForwardingRuleListCall<'a, C, A> { GlobalForwardingRuleListCall { hub: self.hub, @@ -8683,7 +9097,7 @@ impl<'a, C, A> GlobalForwardingRuleMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `forwardingRule` - Name of the ForwardingRule resource to return. pub fn get(&self, project: &str, forwarding_rule: &str) -> GlobalForwardingRuleGetCall<'a, C, A> { GlobalForwardingRuleGetCall { @@ -8743,7 +9157,7 @@ impl<'a, C, A> HttpsHealthCheckMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `httpsHealthCheck` - Name of the HttpsHealthCheck resource to delete. pub fn delete(&self, project: &str, https_health_check: &str) -> HttpsHealthCheckDeleteCall<'a, C, A> { HttpsHealthCheckDeleteCall { @@ -8762,7 +9176,7 @@ impl<'a, C, A> HttpsHealthCheckMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> HttpsHealthCheckListCall<'a, C, A> { HttpsHealthCheckListCall { hub: self.hub, @@ -8783,7 +9197,7 @@ impl<'a, C, A> HttpsHealthCheckMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn insert(&self, request: HttpsHealthCheck, project: &str) -> HttpsHealthCheckInsertCall<'a, C, A> { HttpsHealthCheckInsertCall { hub: self.hub, @@ -8801,7 +9215,7 @@ impl<'a, C, A> HttpsHealthCheckMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `httpsHealthCheck` - Name of the HttpsHealthCheck resource to return. pub fn get(&self, project: &str, https_health_check: &str) -> HttpsHealthCheckGetCall<'a, C, A> { HttpsHealthCheckGetCall { @@ -8821,7 +9235,7 @@ impl<'a, C, A> HttpsHealthCheckMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `httpsHealthCheck` - Name of the HttpsHealthCheck resource to update. pub fn update(&self, request: HttpsHealthCheck, project: &str, https_health_check: &str) -> HttpsHealthCheckUpdateCall<'a, C, A> { HttpsHealthCheckUpdateCall { @@ -8842,7 +9256,7 @@ impl<'a, C, A> HttpsHealthCheckMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `httpsHealthCheck` - Name of the HttpsHealthCheck resource to update. pub fn patch(&self, request: HttpsHealthCheck, project: &str, https_health_check: &str) -> HttpsHealthCheckPatchCall<'a, C, A> { HttpsHealthCheckPatchCall { @@ -8899,7 +9313,7 @@ impl<'a, C, A> MachineTypeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of machine type resources grouped by scope. + /// Retrieves an aggregated list of machine type resources. /// /// # Arguments /// @@ -8940,7 +9354,7 @@ impl<'a, C, A> MachineTypeMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of machine type resources available to the specified project. + /// Retrieves a list of machine type resources available to the specified project. /// /// # Arguments /// @@ -9003,7 +9417,7 @@ impl<'a, C, A> TargetVpnGatewayMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of target VPN gateways grouped by scope. + /// Retrieves an aggregated list of target VPN gateways . /// /// # Arguments /// @@ -9044,7 +9458,7 @@ impl<'a, C, A> TargetVpnGatewayMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of TargetVpnGateway resources available to the specified project and region. + /// Retrieves a list of TargetVpnGateway resources available to the specified project and region. /// /// # Arguments /// @@ -9153,7 +9567,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the managed instance group is located. /// * `instanceGroupManager` - The name of the managed instance group. /// * `size` - The number of running instances that the managed instance group should maintain at any given time. The group automatically adds or removes instances to maintain the number of instances specified by this parameter. @@ -9176,7 +9590,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the managed instance group is located. pub fn list(&self, project: &str, zone: &str) -> InstanceGroupManagerListCall<'a, C, A> { InstanceGroupManagerListCall { @@ -9198,7 +9612,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the managed instance group is located. /// * `instanceGroupManager` - The name of the managed instance group. pub fn list_managed_instances(&self, project: &str, zone: &str, instance_group_manager: &str) -> InstanceGroupManagerListManagedInstanceCall<'a, C, A> { @@ -9220,7 +9634,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where you want to create the managed instance group. pub fn insert(&self, request: InstanceGroupManager, project: &str, zone: &str) -> InstanceGroupManagerInsertCall<'a, C, A> { InstanceGroupManagerInsertCall { @@ -9240,7 +9654,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. pub fn aggregated_list(&self, project: &str) -> InstanceGroupManagerAggregatedListCall<'a, C, A> { InstanceGroupManagerAggregatedListCall { hub: self.hub, @@ -9261,7 +9675,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the managed instance group is located. /// * `instanceGroupManager` - The name of the managed instance group. pub fn delete_instances(&self, request: InstanceGroupManagersDeleteInstancesRequest, project: &str, zone: &str, instance_group_manager: &str) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> { @@ -9284,7 +9698,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the managed instance group is located. /// * `instanceGroupManager` - The name of the managed instance group. pub fn set_instance_template(&self, request: InstanceGroupManagersSetInstanceTemplateRequest, project: &str, zone: &str, instance_group_manager: &str) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> { @@ -9307,7 +9721,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the managed instance group is located. /// * `instanceGroupManager` - The name of the managed instance group. pub fn set_target_pools(&self, request: InstanceGroupManagersSetTargetPoolsRequest, project: &str, zone: &str, instance_group_manager: &str) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> { @@ -9325,11 +9739,11 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes the specified managed instance group and all of the instances in that group. + /// Deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information. /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the managed instance group is located. /// * `instanceGroupManager` - The name of the managed instance group to delete. pub fn delete(&self, project: &str, zone: &str, instance_group_manager: &str) -> InstanceGroupManagerDeleteCall<'a, C, A> { @@ -9350,7 +9764,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the managed instance group is located. /// * `instanceGroupManager` - The name of the managed instance group. pub fn get(&self, project: &str, zone: &str, instance_group_manager: &str) -> InstanceGroupManagerGetCall<'a, C, A> { @@ -9372,7 +9786,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the managed instance group is located. /// * `instanceGroupManager` - The name of the managed instance group. pub fn abandon_instances(&self, request: InstanceGroupManagersAbandonInstancesRequest, project: &str, zone: &str, instance_group_manager: &str) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> { @@ -9395,7 +9809,7 @@ impl<'a, C, A> InstanceGroupManagerMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `zone` - The name of the zone where the managed instance group is located. /// * `instanceGroupManager` - The name of the managed instance group. pub fn recreate_instances(&self, request: InstanceGroupManagersRecreateInstancesRequest, project: &str, zone: &str, instance_group_manager: &str) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> { @@ -9592,7 +10006,7 @@ impl<'a, C, A> HttpHealthCheckMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `httpHealthCheck` - Name of the HttpHealthCheck resource to return. pub fn get(&self, project: &str, http_health_check: &str) -> HttpHealthCheckGetCall<'a, C, A> { HttpHealthCheckGetCall { @@ -9612,7 +10026,7 @@ impl<'a, C, A> HttpHealthCheckMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `httpHealthCheck` - Name of the HttpHealthCheck resource to update. pub fn patch(&self, request: HttpHealthCheck, project: &str, http_health_check: &str) -> HttpHealthCheckPatchCall<'a, C, A> { HttpHealthCheckPatchCall { @@ -9632,7 +10046,7 @@ impl<'a, C, A> HttpHealthCheckMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> HttpHealthCheckListCall<'a, C, A> { HttpHealthCheckListCall { hub: self.hub, @@ -9652,7 +10066,7 @@ impl<'a, C, A> HttpHealthCheckMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `httpHealthCheck` - Name of the HttpHealthCheck resource to delete. pub fn delete(&self, project: &str, http_health_check: &str) -> HttpHealthCheckDeleteCall<'a, C, A> { HttpHealthCheckDeleteCall { @@ -9672,7 +10086,7 @@ impl<'a, C, A> HttpHealthCheckMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn insert(&self, request: HttpHealthCheck, project: &str) -> HttpHealthCheckInsertCall<'a, C, A> { HttpHealthCheckInsertCall { hub: self.hub, @@ -9691,7 +10105,7 @@ impl<'a, C, A> HttpHealthCheckMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `httpHealthCheck` - Name of the HttpHealthCheck resource to update. pub fn update(&self, request: HttpHealthCheck, project: &str, http_health_check: &str) -> HttpHealthCheckUpdateCall<'a, C, A> { HttpHealthCheckUpdateCall { @@ -9752,7 +10166,7 @@ impl<'a, C, A> InstanceTemplateMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `instanceTemplate` - The name of the instance template to delete. pub fn delete(&self, project: &str, instance_template: &str) -> InstanceTemplateDeleteCall<'a, C, A> { InstanceTemplateDeleteCall { @@ -9771,7 +10185,7 @@ impl<'a, C, A> InstanceTemplateMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. /// * `instanceTemplate` - The name of the instance template. pub fn get(&self, project: &str, instance_template: &str) -> InstanceTemplateGetCall<'a, C, A> { InstanceTemplateGetCall { @@ -9790,7 +10204,7 @@ impl<'a, C, A> InstanceTemplateMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> InstanceTemplateListCall<'a, C, A> { InstanceTemplateListCall { hub: self.hub, @@ -9806,12 +10220,12 @@ impl<'a, C, A> InstanceTemplateMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates an instance template in the specified project using the data that is included in the request. + /// Creates an instance template in the specified project using the data that is included in the request. If you are creating a new template to update an existing instance group, your new instance template must use the same network or, if applicable, the same subnetwork as the original template. /// /// # Arguments /// /// * `request` - No description provided. - /// * `project` - The project ID for this request. + /// * `project` - Project ID for this request. pub fn insert(&self, request: InstanceTemplate, project: &str) -> InstanceTemplateInsertCall<'a, C, A> { InstanceTemplateInsertCall { hub: self.hub, @@ -9870,7 +10284,7 @@ impl<'a, C, A> TargetHttpProxyMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `targetHttpProxy` - Name of the TargetHttpProxy resource to delete. pub fn delete(&self, project: &str, target_http_proxy: &str) -> TargetHttpProxyDeleteCall<'a, C, A> { TargetHttpProxyDeleteCall { @@ -9889,7 +10303,7 @@ impl<'a, C, A> TargetHttpProxyMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> TargetHttpProxyListCall<'a, C, A> { TargetHttpProxyListCall { hub: self.hub, @@ -9910,7 +10324,7 @@ impl<'a, C, A> TargetHttpProxyMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `targetHttpProxy` - Name of the TargetHttpProxy resource whose URL map is to be set. pub fn set_url_map(&self, request: UrlMapReference, project: &str, target_http_proxy: &str) -> TargetHttpProxySetUrlMapCall<'a, C, A> { TargetHttpProxySetUrlMapCall { @@ -9930,7 +10344,7 @@ impl<'a, C, A> TargetHttpProxyMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `targetHttpProxy` - Name of the TargetHttpProxy resource to return. pub fn get(&self, project: &str, target_http_proxy: &str) -> TargetHttpProxyGetCall<'a, C, A> { TargetHttpProxyGetCall { @@ -9950,7 +10364,7 @@ impl<'a, C, A> TargetHttpProxyMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn insert(&self, request: TargetHttpProxy, project: &str) -> TargetHttpProxyInsertCall<'a, C, A> { TargetHttpProxyInsertCall { hub: self.hub, @@ -10009,7 +10423,7 @@ impl<'a, C, A> SslCertificateMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `sslCertificate` - Name of the SslCertificate resource to delete. pub fn delete(&self, project: &str, ssl_certificate: &str) -> SslCertificateDeleteCall<'a, C, A> { SslCertificateDeleteCall { @@ -10028,7 +10442,7 @@ impl<'a, C, A> SslCertificateMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> SslCertificateListCall<'a, C, A> { SslCertificateListCall { hub: self.hub, @@ -10049,7 +10463,7 @@ impl<'a, C, A> SslCertificateMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn insert(&self, request: SslCertificate, project: &str) -> SslCertificateInsertCall<'a, C, A> { SslCertificateInsertCall { hub: self.hub, @@ -10067,7 +10481,7 @@ impl<'a, C, A> SslCertificateMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `sslCertificate` - Name of the SslCertificate resource to return. pub fn get(&self, project: &str, ssl_certificate: &str) -> SslCertificateGetCall<'a, C, A> { SslCertificateGetCall { @@ -10144,7 +10558,7 @@ impl<'a, C, A> ZoneOperationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of Operation resources contained within the specified zone. + /// Retrieves a list of Operation resources contained within the specified zone. /// /// # Arguments /// @@ -10232,7 +10646,7 @@ impl<'a, C, A> RouteMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `route` - Name of the route resource to return. pub fn get(&self, project: &str, route: &str) -> RouteGetCall<'a, C, A> { RouteGetCall { @@ -10252,7 +10666,7 @@ impl<'a, C, A> RouteMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn insert(&self, request: Route, project: &str) -> RouteInsertCall<'a, C, A> { RouteInsertCall { hub: self.hub, @@ -10270,7 +10684,7 @@ impl<'a, C, A> RouteMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. pub fn list(&self, project: &str) -> RouteListCall<'a, C, A> { RouteListCall { hub: self.hub, @@ -10290,7 +10704,7 @@ impl<'a, C, A> RouteMethods<'a, C, A> { /// /// # Arguments /// - /// * `project` - Name of the project scoping this request. + /// * `project` - Project ID for this request. /// * `route` - Name of the route resource to delete. pub fn delete(&self, project: &str, route: &str) -> RouteDeleteCall<'a, C, A> { RouteDeleteCall { @@ -10569,7 +10983,7 @@ impl<'a, C, A> VpnTunnelMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of VpnTunnel resources contained in the specified project and region. + /// Retrieves a list of VpnTunnel resources contained in the specified project and region. /// /// # Arguments /// @@ -10591,7 +11005,7 @@ impl<'a, C, A> VpnTunnelMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of VPN tunnels grouped by scope. + /// Retrieves an aggregated list of VPN tunnels. /// /// # Arguments /// @@ -10652,7 +11066,7 @@ impl<'a, C, A> RegionOperationMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Retrieves the list of Operation resources contained within the specified region. + /// Retrieves a list of Operation resources contained within the specified region. /// /// # Arguments /// @@ -10700,7 +11114,7 @@ impl<'a, C, A> RegionOperationMethods<'a, C, A> { /// # Arguments /// /// * `project` - Project ID for this request. - /// * `region` - Name of the zone scoping this request. + /// * `region` - Name of the region scoping this request. /// * `operation` - Name of the Operations resource to return. pub fn get(&self, project: &str, region: &str, operation: &str) -> RegionOperationGetCall<'a, C, A> { RegionOperationGetCall { @@ -10779,7 +11193,7 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.disks.delete", + dlg.begin(MethodInfo { id: "compute.disks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -10823,7 +11237,7 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10859,7 +11273,7 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10869,10 +11283,10 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10905,7 +11319,7 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DiskDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -10915,7 +11329,7 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> DiskDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -10925,7 +11339,7 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *disk* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn disk(mut self, new_value: &str) -> DiskDeleteCall<'a, C, A> { self._disk = new_value.to_string(); @@ -10943,12 +11357,12 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10965,17 +11379,17 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DiskDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DiskDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10983,7 +11397,7 @@ impl<'a, C, A> DiskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } -/// Retrieves the list of disks grouped by scope. +/// Retrieves an aggregated list of persistent disks. /// /// A builder for the *aggregatedList* method supported by a *disk* resource. /// It is not used directly, but through a `DiskMethods` instance. @@ -11043,7 +11457,7 @@ impl<'a, C, A> DiskAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.disks.aggregatedList", + dlg.begin(MethodInfo { id: "compute.disks.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -11094,7 +11508,7 @@ impl<'a, C, A> DiskAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11130,7 +11544,7 @@ impl<'a, C, A> DiskAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11140,10 +11554,10 @@ impl<'a, C, A> DiskAggregatedListCall<'a, C, A> where C: BorrowMut DiskAggregatedListCall<'a, C, A> where C: BorrowMut DiskAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> DiskAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> DiskAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> DiskAggregatedListCall<'a, C, A> { @@ -11219,12 +11637,12 @@ impl<'a, C, A> DiskAggregatedListCall<'a, C, A> where C: BorrowMut DiskAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DiskAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DiskAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11315,7 +11733,7 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.disks.get", + dlg.begin(MethodInfo { id: "compute.disks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -11359,7 +11777,7 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11395,7 +11813,7 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11405,10 +11823,10 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11441,7 +11859,7 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DiskGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -11451,7 +11869,7 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> DiskGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -11461,7 +11879,7 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *disk* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn disk(mut self, new_value: &str) -> DiskGetCall<'a, C, A> { self._disk = new_value.to_string(); @@ -11479,12 +11897,12 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11501,17 +11919,17 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DiskGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DiskGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11519,7 +11937,7 @@ impl<'a, C, A> DiskGetCall<'a, C, A> where C: BorrowMut, A: oauth } -/// Retrieves the list of persistent disks contained within the specified zone. +/// Retrieves a list of persistent disks contained within the specified zone. /// /// A builder for the *list* method supported by a *disk* resource. /// It is not used directly, but through a `DiskMethods` instance. @@ -11580,7 +11998,7 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.disks.list", + dlg.begin(MethodInfo { id: "compute.disks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -11632,7 +12050,7 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11668,7 +12086,7 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11678,10 +12096,10 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11714,7 +12132,7 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DiskListCall<'a, C, A> { self._project = new_value.to_string(); @@ -11724,31 +12142,35 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> DiskListCall<'a, C, A> { self._zone = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> DiskListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> DiskListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> DiskListCall<'a, C, A> { @@ -11767,12 +12189,12 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11789,17 +12211,17 @@ impl<'a, C, A> DiskListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DiskListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DiskListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11871,7 +12293,7 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.disks.insert", + dlg.begin(MethodInfo { id: "compute.disks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -11917,14 +12339,14 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11968,7 +12390,7 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11978,10 +12400,10 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12013,7 +12435,7 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Disk) -> DiskInsertCall<'a, C, A> { self._request = new_value; @@ -12023,7 +12445,7 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DiskInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -12033,7 +12455,7 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> DiskInsertCall<'a, C, A> { self._zone = new_value.to_string(); @@ -12058,12 +12480,12 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12080,17 +12502,17 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DiskInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DiskInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12098,7 +12520,7 @@ impl<'a, C, A> DiskInsertCall<'a, C, A> where C: BorrowMut, A: oa } -/// Creates a snapshot of this disk. +/// Creates a snapshot of a specified persistent disk. /// /// A builder for the *createSnapshot* method supported by a *disk* resource. /// It is not used directly, but through a `DiskMethods` instance. @@ -12161,7 +12583,7 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.disks.createSnapshot", + dlg.begin(MethodInfo { id: "compute.disks.createSnapshot", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -12205,14 +12627,14 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12256,7 +12678,7 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12266,10 +12688,10 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut DiskCreateSnapshotCall<'a, C, A> { self._request = new_value; @@ -12311,7 +12733,7 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut DiskCreateSnapshotCall<'a, C, A> { self._project = new_value.to_string(); @@ -12321,7 +12743,7 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut DiskCreateSnapshotCall<'a, C, A> { self._zone = new_value.to_string(); @@ -12331,7 +12753,7 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut DiskCreateSnapshotCall<'a, C, A> { self._disk = new_value.to_string(); @@ -12349,12 +12771,12 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DiskCreateSnapshotCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DiskCreateSnapshotCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12389,7 +12811,7 @@ impl<'a, C, A> DiskCreateSnapshotCall<'a, C, A> where C: BorrowMut AddresseListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.addresses.list", + dlg.begin(MethodInfo { id: "compute.addresses.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -12502,7 +12924,7 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12538,7 +12960,7 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12548,10 +12970,10 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12584,7 +13006,7 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AddresseListCall<'a, C, A> { self._project = new_value.to_string(); @@ -12594,31 +13016,35 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> AddresseListCall<'a, C, A> { self._region = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AddresseListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> AddresseListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> AddresseListCall<'a, C, A> { @@ -12637,12 +13063,12 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12659,17 +13085,17 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AddresseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AddresseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12677,7 +13103,7 @@ impl<'a, C, A> AddresseListCall<'a, C, A> where C: BorrowMut, A: } -/// Retrieves the list of addresses grouped by scope. +/// Retrieves an aggregated list of addresses. /// /// A builder for the *aggregatedList* method supported by a *addresse* resource. /// It is not used directly, but through a `AddresseMethods` instance. @@ -12737,7 +13163,7 @@ impl<'a, C, A> AddresseAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.addresses.aggregatedList", + dlg.begin(MethodInfo { id: "compute.addresses.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -12788,7 +13214,7 @@ impl<'a, C, A> AddresseAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12824,7 +13250,7 @@ impl<'a, C, A> AddresseAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12834,10 +13260,10 @@ impl<'a, C, A> AddresseAggregatedListCall<'a, C, A> where C: BorrowMut AddresseAggregatedListCall<'a, C, A> where C: BorrowMut AddresseAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AddresseAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> AddresseAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> AddresseAggregatedListCall<'a, C, A> { @@ -12913,12 +13343,12 @@ impl<'a, C, A> AddresseAggregatedListCall<'a, C, A> where C: BorrowMut AddresseAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AddresseAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AddresseAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13009,7 +13439,7 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.addresses.get", + dlg.begin(MethodInfo { id: "compute.addresses.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -13053,7 +13483,7 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13089,7 +13519,7 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13099,10 +13529,10 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13135,7 +13565,7 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AddresseGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -13145,7 +13575,7 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> AddresseGetCall<'a, C, A> { self._region = new_value.to_string(); @@ -13155,7 +13585,7 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *address* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn address(mut self, new_value: &str) -> AddresseGetCall<'a, C, A> { self._address = new_value.to_string(); @@ -13173,12 +13603,12 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13195,17 +13625,17 @@ impl<'a, C, A> AddresseGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AddresseGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AddresseGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13275,7 +13705,7 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.addresses.insert", + dlg.begin(MethodInfo { id: "compute.addresses.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -13318,14 +13748,14 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13369,7 +13799,7 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13379,10 +13809,10 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13414,7 +13844,7 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Address) -> AddresseInsertCall<'a, C, A> { self._request = new_value; @@ -13424,7 +13854,7 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AddresseInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -13434,7 +13864,7 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> AddresseInsertCall<'a, C, A> { self._region = new_value.to_string(); @@ -13452,12 +13882,12 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13474,17 +13904,17 @@ impl<'a, C, A> AddresseInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AddresseInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AddresseInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13548,7 +13978,7 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.addresses.delete", + dlg.begin(MethodInfo { id: "compute.addresses.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -13592,7 +14022,7 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13628,7 +14058,7 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13638,10 +14068,10 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13674,7 +14104,7 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AddresseDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -13684,7 +14114,7 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> AddresseDeleteCall<'a, C, A> { self._region = new_value.to_string(); @@ -13694,7 +14124,7 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *address* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn address(mut self, new_value: &str) -> AddresseDeleteCall<'a, C, A> { self._address = new_value.to_string(); @@ -13712,12 +14142,12 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13734,17 +14164,17 @@ impl<'a, C, A> AddresseDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AddresseDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AddresseDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13813,7 +14243,7 @@ impl<'a, C, A> UrlMapInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.urlMaps.insert", + dlg.begin(MethodInfo { id: "compute.urlMaps.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -13855,14 +14285,14 @@ impl<'a, C, A> UrlMapInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13906,7 +14336,7 @@ impl<'a, C, A> UrlMapInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13916,10 +14346,10 @@ impl<'a, C, A> UrlMapInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13951,17 +14381,17 @@ impl<'a, C, A> UrlMapInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UrlMap) -> UrlMapInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UrlMapInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -13979,12 +14409,12 @@ impl<'a, C, A> UrlMapInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14001,17 +14431,17 @@ impl<'a, C, A> UrlMapInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlMapInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlMapInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14074,7 +14504,7 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.urlMaps.get", + dlg.begin(MethodInfo { id: "compute.urlMaps.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -14117,7 +14547,7 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14153,7 +14583,7 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14163,10 +14593,10 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14195,11 +14625,11 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UrlMapGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -14209,7 +14639,7 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *url map* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn url_map(mut self, new_value: &str) -> UrlMapGetCall<'a, C, A> { self._url_map = new_value.to_string(); @@ -14227,12 +14657,12 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14249,17 +14679,17 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlMapGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlMapGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14267,7 +14697,7 @@ impl<'a, C, A> UrlMapGetCall<'a, C, A> where C: BorrowMut, A: oau } -/// Run static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap. +/// Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap. /// /// A builder for the *validate* method supported by a *urlMap* resource. /// It is not used directly, but through a `UrlMapMethods` instance. @@ -14329,7 +14759,7 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.urlMaps.validate", + dlg.begin(MethodInfo { id: "compute.urlMaps.validate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -14372,14 +14802,14 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14423,7 +14853,7 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14433,10 +14863,10 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14468,17 +14898,17 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UrlMapsValidateRequest) -> UrlMapValidateCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UrlMapValidateCall<'a, C, A> { self._project = new_value.to_string(); @@ -14488,7 +14918,7 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *url map* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn url_map(mut self, new_value: &str) -> UrlMapValidateCall<'a, C, A> { self._url_map = new_value.to_string(); @@ -14506,12 +14936,12 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14528,17 +14958,17 @@ impl<'a, C, A> UrlMapValidateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlMapValidateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlMapValidateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14606,7 +15036,7 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.urlMaps.list", + dlg.begin(MethodInfo { id: "compute.urlMaps.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -14657,7 +15087,7 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14693,7 +15123,7 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14703,10 +15133,10 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14735,35 +15165,39 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UrlMapListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> UrlMapListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> UrlMapListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> UrlMapListCall<'a, C, A> { @@ -14782,12 +15216,12 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14804,17 +15238,17 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlMapListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlMapListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14822,7 +15256,7 @@ impl<'a, C, A> UrlMapListCall<'a, C, A> where C: BorrowMut, A: oa } -/// Update the entire content of the UrlMap resource. This method supports patch semantics. +/// Updates the entire content of the UrlMap resource. This method supports patch semantics. /// /// A builder for the *patch* method supported by a *urlMap* resource. /// It is not used directly, but through a `UrlMapMethods` instance. @@ -14884,7 +15318,7 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.urlMaps.patch", + dlg.begin(MethodInfo { id: "compute.urlMaps.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -14927,14 +15361,14 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14978,7 +15412,7 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14988,10 +15422,10 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15023,17 +15457,17 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UrlMap) -> UrlMapPatchCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UrlMapPatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -15043,7 +15477,7 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *url map* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn url_map(mut self, new_value: &str) -> UrlMapPatchCall<'a, C, A> { self._url_map = new_value.to_string(); @@ -15061,12 +15495,12 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15083,17 +15517,17 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlMapPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlMapPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15101,7 +15535,7 @@ impl<'a, C, A> UrlMapPatchCall<'a, C, A> where C: BorrowMut, A: o } -/// Update the entire content of the UrlMap resource. +/// Updates the entire content of the UrlMap resource. /// /// A builder for the *update* method supported by a *urlMap* resource. /// It is not used directly, but through a `UrlMapMethods` instance. @@ -15163,7 +15597,7 @@ impl<'a, C, A> UrlMapUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.urlMaps.update", + dlg.begin(MethodInfo { id: "compute.urlMaps.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -15206,14 +15640,14 @@ impl<'a, C, A> UrlMapUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15257,7 +15691,7 @@ impl<'a, C, A> UrlMapUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15267,10 +15701,10 @@ impl<'a, C, A> UrlMapUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15302,17 +15736,17 @@ impl<'a, C, A> UrlMapUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UrlMap) -> UrlMapUpdateCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UrlMapUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -15322,7 +15756,7 @@ impl<'a, C, A> UrlMapUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *url map* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn url_map(mut self, new_value: &str) -> UrlMapUpdateCall<'a, C, A> { self._url_map = new_value.to_string(); @@ -15340,12 +15774,12 @@ impl<'a, C, A> UrlMapUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15362,17 +15796,17 @@ impl<'a, C, A> UrlMapUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlMapUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlMapUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15435,7 +15869,7 @@ impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.urlMaps.delete", + dlg.begin(MethodInfo { id: "compute.urlMaps.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -15478,7 +15912,7 @@ impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15514,7 +15948,7 @@ impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15524,10 +15958,10 @@ impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15556,11 +15990,11 @@ impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UrlMapDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -15570,7 +16004,7 @@ impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *url map* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn url_map(mut self, new_value: &str) -> UrlMapDeleteCall<'a, C, A> { self._url_map = new_value.to_string(); @@ -15588,12 +16022,12 @@ impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15610,17 +16044,17 @@ impl<'a, C, A> UrlMapDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlMapDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlMapDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15689,7 +16123,7 @@ impl<'a, C, A> GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalAddresses.insert", + dlg.begin(MethodInfo { id: "compute.globalAddresses.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -15731,14 +16165,14 @@ impl<'a, C, A> GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15782,7 +16216,7 @@ impl<'a, C, A> GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15792,10 +16226,10 @@ impl<'a, C, A> GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut GlobalAddresseInsertCall<'a, C, A> { self._request = new_value; @@ -15837,7 +16271,7 @@ impl<'a, C, A> GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut GlobalAddresseInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -15855,12 +16289,12 @@ impl<'a, C, A> GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalAddresseInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalAddresseInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15895,7 +16329,7 @@ impl<'a, C, A> GlobalAddresseInsertCall<'a, C, A> where C: BorrowMut GlobalAddresseListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalAddresses.list", + dlg.begin(MethodInfo { id: "compute.globalAddresses.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -16006,7 +16440,7 @@ impl<'a, C, A> GlobalAddresseListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16042,7 +16476,7 @@ impl<'a, C, A> GlobalAddresseListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16052,10 +16486,10 @@ impl<'a, C, A> GlobalAddresseListCall<'a, C, A> where C: BorrowMut GlobalAddresseListCall<'a, C, A> where C: BorrowMut GlobalAddresseListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> GlobalAddresseListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> GlobalAddresseListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> GlobalAddresseListCall<'a, C, A> { @@ -16131,12 +16569,12 @@ impl<'a, C, A> GlobalAddresseListCall<'a, C, A> where C: BorrowMut GlobalAddresseListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalAddresseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalAddresseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16226,7 +16664,7 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalAddresses.get", + dlg.begin(MethodInfo { id: "compute.globalAddresses.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -16269,7 +16707,7 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16305,7 +16743,7 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16315,10 +16753,10 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16351,7 +16789,7 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> GlobalAddresseGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -16361,7 +16799,7 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *address* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn address(mut self, new_value: &str) -> GlobalAddresseGetCall<'a, C, A> { self._address = new_value.to_string(); @@ -16379,12 +16817,12 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16401,17 +16839,17 @@ impl<'a, C, A> GlobalAddresseGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GlobalAddresseGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalAddresseGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16474,7 +16912,7 @@ impl<'a, C, A> GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalAddresses.delete", + dlg.begin(MethodInfo { id: "compute.globalAddresses.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -16517,7 +16955,7 @@ impl<'a, C, A> GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16553,7 +16991,7 @@ impl<'a, C, A> GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16563,10 +17001,10 @@ impl<'a, C, A> GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut GlobalAddresseDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -16609,7 +17047,7 @@ impl<'a, C, A> GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut GlobalAddresseDeleteCall<'a, C, A> { self._address = new_value.to_string(); @@ -16627,12 +17065,12 @@ impl<'a, C, A> GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut GlobalAddresseDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalAddresseDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalAddresseDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16722,7 +17160,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.snapshots.get", + dlg.begin(MethodInfo { id: "compute.snapshots.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -16765,7 +17203,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16801,7 +17239,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16811,10 +17249,10 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16843,11 +17281,11 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> SnapshotGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -16857,7 +17295,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *snapshot* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn snapshot(mut self, new_value: &str) -> SnapshotGetCall<'a, C, A> { self._snapshot = new_value.to_string(); @@ -16875,12 +17313,12 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16897,17 +17335,17 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SnapshotGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SnapshotGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16975,7 +17413,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.snapshots.list", + dlg.begin(MethodInfo { id: "compute.snapshots.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -17026,7 +17464,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17062,7 +17500,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17072,10 +17510,10 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17104,35 +17542,39 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> SnapshotListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> SnapshotListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> SnapshotListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> SnapshotListCall<'a, C, A> { @@ -17151,12 +17593,12 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17173,17 +17615,17 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SnapshotListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SnapshotListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17248,7 +17690,7 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.snapshots.delete", + dlg.begin(MethodInfo { id: "compute.snapshots.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -17291,7 +17733,7 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17327,7 +17769,7 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17337,10 +17779,10 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17369,11 +17811,11 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> SnapshotDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -17383,7 +17825,7 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *snapshot* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn snapshot(mut self, new_value: &str) -> SnapshotDeleteCall<'a, C, A> { self._snapshot = new_value.to_string(); @@ -17401,12 +17843,12 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17423,17 +17865,17 @@ impl<'a, C, A> SnapshotDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SnapshotDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SnapshotDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17497,7 +17939,7 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.diskTypes.get", + dlg.begin(MethodInfo { id: "compute.diskTypes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -17541,7 +17983,7 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17577,7 +18019,7 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17587,10 +18029,10 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17623,7 +18065,7 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DiskTypeGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -17633,7 +18075,7 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> DiskTypeGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -17643,7 +18085,7 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *disk type* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn disk_type(mut self, new_value: &str) -> DiskTypeGetCall<'a, C, A> { self._disk_type = new_value.to_string(); @@ -17661,12 +18103,12 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17683,17 +18125,17 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DiskTypeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DiskTypeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17701,7 +18143,7 @@ impl<'a, C, A> DiskTypeGetCall<'a, C, A> where C: BorrowMut, A: o } -/// Retrieves the list of disk type resources grouped by scope. +/// Retrieves an aggregated list of disk type resources. /// /// A builder for the *aggregatedList* method supported by a *diskType* resource. /// It is not used directly, but through a `DiskTypeMethods` instance. @@ -17761,7 +18203,7 @@ impl<'a, C, A> DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.diskTypes.aggregatedList", + dlg.begin(MethodInfo { id: "compute.diskTypes.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -17812,7 +18254,7 @@ impl<'a, C, A> DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17848,7 +18290,7 @@ impl<'a, C, A> DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17858,10 +18300,10 @@ impl<'a, C, A> DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut DiskTypeAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> DiskTypeAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> DiskTypeAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> DiskTypeAggregatedListCall<'a, C, A> { @@ -17937,12 +18383,12 @@ impl<'a, C, A> DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DiskTypeAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DiskTypeAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17977,7 +18423,7 @@ impl<'a, C, A> DiskTypeAggregatedListCall<'a, C, A> where C: BorrowMut DiskTypeListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.diskTypes.list", + dlg.begin(MethodInfo { id: "compute.diskTypes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -18090,7 +18536,7 @@ impl<'a, C, A> DiskTypeListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18126,7 +18572,7 @@ impl<'a, C, A> DiskTypeListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18136,10 +18582,10 @@ impl<'a, C, A> DiskTypeListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18172,7 +18618,7 @@ impl<'a, C, A> DiskTypeListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DiskTypeListCall<'a, C, A> { self._project = new_value.to_string(); @@ -18182,31 +18628,35 @@ impl<'a, C, A> DiskTypeListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> DiskTypeListCall<'a, C, A> { self._zone = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> DiskTypeListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> DiskTypeListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> DiskTypeListCall<'a, C, A> { @@ -18225,12 +18675,12 @@ impl<'a, C, A> DiskTypeListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18247,17 +18697,17 @@ impl<'a, C, A> DiskTypeListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DiskTypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DiskTypeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18320,7 +18770,7 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.zones.get", + dlg.begin(MethodInfo { id: "compute.zones.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -18363,7 +18813,7 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18399,7 +18849,7 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18409,10 +18859,10 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18445,7 +18895,7 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -18455,7 +18905,7 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -18473,12 +18923,12 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18495,17 +18945,17 @@ impl<'a, C, A> ZoneGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18573,7 +19023,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.zones.list", + dlg.begin(MethodInfo { id: "compute.zones.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -18624,7 +19074,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18660,7 +19110,7 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18670,10 +19120,10 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18706,31 +19156,35 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ZoneListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> ZoneListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ZoneListCall<'a, C, A> { @@ -18749,12 +19203,12 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18771,17 +19225,308 @@ impl<'a, C, A> ZoneListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Changes the machine type for a stopped instance to the machine type specified in the request. +/// +/// A builder for the *setMachineType* method supported by a *instance* resource. +/// It is not used directly, but through a `InstanceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::InstancesSetMachineTypeRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::new(), 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 ! +/// let mut req = InstancesSetMachineTypeRequest::default(); +/// +/// // 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 ! +/// let result = hub.instances().set_machine_type(req, "project", "zone", "instance") +/// .doit(); +/// # } +/// ``` +pub struct InstanceSetMachineTypeCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: InstancesSetMachineTypeRequest, + _project: String, + _zone: String, + _instance: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceSetMachineTypeCall<'a, C, A> {} + +impl<'a, C, A> InstanceSetMachineTypeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instances.setMachineType", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("instance", self._instance.to_string())); + for &field in ["alt", "project", "zone", "instance"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{instance}/setMachineType".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instance}", "instance")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["instance", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: InstancesSetMachineTypeRequest) -> InstanceSetMachineTypeCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceSetMachineTypeCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceSetMachineTypeCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name of the instance scoping this request. + /// + /// Sets the *instance* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance(mut self, new_value: &str) -> InstanceSetMachineTypeCall<'a, C, A> { + self._instance = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> InstanceSetMachineTypeCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceSetMachineTypeCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> InstanceSetMachineTypeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18852,7 +19597,7 @@ impl<'a, C, A> InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.setScheduling", + dlg.begin(MethodInfo { id: "compute.instances.setScheduling", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -18896,14 +19641,14 @@ impl<'a, C, A> InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -18947,7 +19692,7 @@ impl<'a, C, A> InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18957,10 +19702,10 @@ impl<'a, C, A> InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceSetSchedulingCall<'a, C, A> { self._request = new_value; @@ -19002,7 +19747,7 @@ impl<'a, C, A> InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceSetSchedulingCall<'a, C, A> { self._project = new_value.to_string(); @@ -19012,7 +19757,7 @@ impl<'a, C, A> InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceSetSchedulingCall<'a, C, A> { self._zone = new_value.to_string(); @@ -19022,7 +19767,7 @@ impl<'a, C, A> InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceSetSchedulingCall<'a, C, A> { self._instance = new_value.to_string(); @@ -19040,12 +19785,12 @@ impl<'a, C, A> InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceSetSchedulingCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceSetSchedulingCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19080,7 +19825,7 @@ impl<'a, C, A> InstanceSetSchedulingCall<'a, C, A> where C: BorrowMut InstanceDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.delete", + dlg.begin(MethodInfo { id: "compute.instances.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -19180,7 +19925,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19216,7 +19961,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19226,10 +19971,10 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19262,7 +20007,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -19272,7 +20017,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -19282,7 +20027,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceDeleteCall<'a, C, A> { self._instance = new_value.to_string(); @@ -19300,12 +20045,12 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19322,17 +20067,17 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19367,7 +20112,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instances().get_serial_port_output("project", "zone", "instance") -/// .port(-30) +/// .port(-82) /// .doit(); /// # } /// ``` @@ -19398,7 +20143,7 @@ impl<'a, C, A> InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.getSerialPortOutput", + dlg.begin(MethodInfo { id: "compute.instances.getSerialPortOutput", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -19445,7 +20190,7 @@ impl<'a, C, A> InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19481,7 +20226,7 @@ impl<'a, C, A> InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19491,10 +20236,10 @@ impl<'a, C, A> InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut InstanceGetSerialPortOutputCall<'a, C, A> { self._project = new_value.to_string(); @@ -19537,7 +20282,7 @@ impl<'a, C, A> InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut InstanceGetSerialPortOutputCall<'a, C, A> { self._zone = new_value.to_string(); @@ -19547,7 +20292,7 @@ impl<'a, C, A> InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut InstanceGetSerialPortOutputCall<'a, C, A> { self._instance = new_value.to_string(); @@ -19572,12 +20317,12 @@ impl<'a, C, A> InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGetSerialPortOutputCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGetSerialPortOutputCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19638,7 +20383,7 @@ impl<'a, C, A> InstanceGetSerialPortOutputCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.setDiskAutoDelete", + dlg.begin(MethodInfo { id: "compute.instances.setDiskAutoDelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -19716,7 +20461,7 @@ impl<'a, C, A> InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19752,7 +20497,7 @@ impl<'a, C, A> InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19762,10 +20507,10 @@ impl<'a, C, A> InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -19808,7 +20553,7 @@ impl<'a, C, A> InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -19818,7 +20563,7 @@ impl<'a, C, A> InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> { self._instance = new_value.to_string(); @@ -19828,7 +20573,7 @@ impl<'a, C, A> InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> { self._auto_delete = new_value; @@ -19838,7 +20583,7 @@ impl<'a, C, A> InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> { self._device_name = new_value.to_string(); @@ -19856,12 +20601,12 @@ impl<'a, C, A> InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut InstanceSetDiskAutoDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceSetDiskAutoDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceSetDiskAutoDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Sets tags for the specified instance to the data included in the request. +/// +/// A builder for the *setTags* method supported by a *instance* resource. +/// It is not used directly, but through a `InstanceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::Tags; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::new(), 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 ! +/// let mut req = Tags::default(); +/// +/// // 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 ! +/// let result = hub.instances().set_tags(req, "project", "zone", "instance") +/// .doit(); +/// # } +/// ``` +pub struct InstanceSetTagCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: Tags, + _project: String, + _zone: String, + _instance: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceSetTagCall<'a, C, A> {} + +impl<'a, C, A> InstanceSetTagCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instances.setTags", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("instance", self._instance.to_string())); + for &field in ["alt", "project", "zone", "instance"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{instance}/setTags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instance}", "instance")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["instance", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Tags) -> InstanceSetTagCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceSetTagCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceSetTagCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// Name of the instance scoping this request. + /// + /// Sets the *instance* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance(mut self, new_value: &str) -> InstanceSetTagCall<'a, C, A> { + self._instance = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> InstanceSetTagCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceSetTagCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> InstanceSetTagCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19960,7 +20996,7 @@ impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.addAccessConfig", + dlg.begin(MethodInfo { id: "compute.instances.addAccessConfig", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -20005,14 +21041,14 @@ impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -20056,7 +21092,7 @@ impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20066,10 +21102,10 @@ impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut InstanceAddAccessConfigCall<'a, C, A> { self._request = new_value; @@ -20111,7 +21147,7 @@ impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut InstanceAddAccessConfigCall<'a, C, A> { self._project = new_value.to_string(); @@ -20121,7 +21157,7 @@ impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut InstanceAddAccessConfigCall<'a, C, A> { self._zone = new_value.to_string(); @@ -20131,7 +21167,7 @@ impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut InstanceAddAccessConfigCall<'a, C, A> { self._instance = new_value.to_string(); @@ -20141,7 +21177,7 @@ impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut InstanceAddAccessConfigCall<'a, C, A> { self._network_interface = new_value.to_string(); @@ -20159,12 +21195,12 @@ impl<'a, C, A> InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut InstanceAddAccessConfigCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceAddAccessConfigCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceAddAccessConfigCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20262,7 +21298,7 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.setMetadata", + dlg.begin(MethodInfo { id: "compute.instances.setMetadata", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -20306,14 +21342,14 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -20357,7 +21393,7 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20367,10 +21403,10 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut InstanceSetMetadataCall<'a, C, A> where C: BorrowMut InstanceSetMetadataCall<'a, C, A> { self._request = new_value; @@ -20412,7 +21448,7 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut InstanceSetMetadataCall<'a, C, A> { self._project = new_value.to_string(); @@ -20422,7 +21458,7 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut InstanceSetMetadataCall<'a, C, A> { self._zone = new_value.to_string(); @@ -20432,7 +21468,7 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut InstanceSetMetadataCall<'a, C, A> { self._instance = new_value.to_string(); @@ -20450,12 +21486,12 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut InstanceSetMetadataCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceSetMetadataCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceSetMetadataCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20490,7 +21526,7 @@ impl<'a, C, A> InstanceSetMetadataCall<'a, C, A> where C: BorrowMut InstanceStartCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.start", + dlg.begin(MethodInfo { id: "compute.instances.start", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -20590,7 +21626,7 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -20626,7 +21662,7 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20636,10 +21672,10 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20672,7 +21708,7 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceStartCall<'a, C, A> { self._project = new_value.to_string(); @@ -20682,7 +21718,7 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceStartCall<'a, C, A> { self._zone = new_value.to_string(); @@ -20692,7 +21728,7 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceStartCall<'a, C, A> { self._instance = new_value.to_string(); @@ -20710,12 +21746,12 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20732,17 +21768,17 @@ impl<'a, C, A> InstanceStartCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceStartCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceStartCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20806,7 +21842,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.get", + dlg.begin(MethodInfo { id: "compute.instances.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -20850,7 +21886,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -20886,7 +21922,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20896,10 +21932,10 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20932,7 +21968,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -20942,7 +21978,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -20952,7 +21988,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceGetCall<'a, C, A> { self._instance = new_value.to_string(); @@ -20970,12 +22006,12 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20992,17 +22028,17 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21010,298 +22046,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o } -/// Sets tags for the specified instance to the data included in the request. -/// -/// A builder for the *setTags* method supported by a *instance* resource. -/// It is not used directly, but through a `InstanceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_compute1 as compute1; -/// use compute1::Tags; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use compute1::Compute; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Compute::new(hyper::Client::new(), 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 ! -/// let mut req = Tags::default(); -/// -/// // 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 ! -/// let result = hub.instances().set_tags(req, "project", "zone", "instance") -/// .doit(); -/// # } -/// ``` -pub struct InstanceSetTagCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _request: Tags, - _project: String, - _zone: String, - _instance: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for InstanceSetTagCall<'a, C, A> {} - -impl<'a, C, A> InstanceSetTagCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.instances.setTags", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - params.push(("zone", self._zone.to_string())); - params.push(("instance", self._instance.to_string())); - for &field in ["alt", "project", "zone", "instance"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{instance}/setTags".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instance}", "instance")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["instance", "zone", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Tags) -> InstanceSetTagCall<'a, C, A> { - self._request = new_value; - self - } - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> InstanceSetTagCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// The name of the zone for this request. - /// - /// Sets the *zone* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn zone(mut self, new_value: &str) -> InstanceSetTagCall<'a, C, A> { - self._zone = new_value.to_string(); - self - } - /// Name of the instance scoping this request. - /// - /// Sets the *instance* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn instance(mut self, new_value: &str) -> InstanceSetTagCall<'a, C, A> { - self._instance = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> InstanceSetTagCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> InstanceSetTagCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> InstanceSetTagCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// This method stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur per-minute, virtual machine usage charges while they are stopped, but any resources that the virtual machine is using, such as persistent disks and static IP addresses,will continue to be charged until they are deleted. For more information, see Stopping an instance. +/// Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur per-minute, virtual machine usage charges while they are stopped, but any resources that the virtual machine is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance. /// /// A builder for the *stop* method supported by a *instance* resource. /// It is not used directly, but through a `InstanceMethods` instance. @@ -21357,7 +22102,7 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.stop", + dlg.begin(MethodInfo { id: "compute.instances.stop", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -21401,7 +22146,7 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -21437,7 +22182,7 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21447,10 +22192,10 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21483,7 +22228,7 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceStopCall<'a, C, A> { self._project = new_value.to_string(); @@ -21493,7 +22238,7 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceStopCall<'a, C, A> { self._zone = new_value.to_string(); @@ -21503,7 +22248,7 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceStopCall<'a, C, A> { self._instance = new_value.to_string(); @@ -21521,12 +22266,12 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -21543,17 +22288,17 @@ impl<'a, C, A> InstanceStopCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceStopCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceStopCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21618,7 +22363,7 @@ impl<'a, C, A> InstanceDetachDiskCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.detachDisk", + dlg.begin(MethodInfo { id: "compute.instances.detachDisk", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -21663,7 +22408,7 @@ impl<'a, C, A> InstanceDetachDiskCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -21699,7 +22444,7 @@ impl<'a, C, A> InstanceDetachDiskCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21709,10 +22454,10 @@ impl<'a, C, A> InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> { self._project = new_value.to_string(); @@ -21755,7 +22500,7 @@ impl<'a, C, A> InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> { self._zone = new_value.to_string(); @@ -21765,7 +22510,7 @@ impl<'a, C, A> InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> { self._instance = new_value.to_string(); @@ -21775,7 +22520,7 @@ impl<'a, C, A> InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> { self._device_name = new_value.to_string(); @@ -21793,12 +22538,12 @@ impl<'a, C, A> InstanceDetachDiskCall<'a, C, A> where C: BorrowMut InstanceDetachDiskCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceDetachDiskCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceDetachDiskCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21896,7 +22641,7 @@ impl<'a, C, A> InstanceAttachDiskCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.attachDisk", + dlg.begin(MethodInfo { id: "compute.instances.attachDisk", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -21940,14 +22685,14 @@ impl<'a, C, A> InstanceAttachDiskCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -21991,7 +22736,7 @@ impl<'a, C, A> InstanceAttachDiskCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22001,10 +22746,10 @@ impl<'a, C, A> InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> { self._request = new_value; @@ -22046,7 +22791,7 @@ impl<'a, C, A> InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> { self._project = new_value.to_string(); @@ -22056,7 +22801,7 @@ impl<'a, C, A> InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> { self._zone = new_value.to_string(); @@ -22066,7 +22811,7 @@ impl<'a, C, A> InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> { self._instance = new_value.to_string(); @@ -22084,12 +22829,12 @@ impl<'a, C, A> InstanceAttachDiskCall<'a, C, A> where C: BorrowMut InstanceAttachDiskCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceAttachDiskCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceAttachDiskCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an access config from an instance's network interface. +/// +/// A builder for the *deleteAccessConfig* method supported by a *instance* resource. +/// It is not used directly, but through a `InstanceMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::new(), 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 ! +/// let result = hub.instances().delete_access_config("project", "zone", "instance", "accessConfig", "networkInterface") +/// .doit(); +/// # } +/// ``` +pub struct InstanceDeleteAccessConfigCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _zone: String, + _instance: String, + _access_config: String, + _network_interface: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InstanceDeleteAccessConfigCall<'a, C, A> {} + +impl<'a, C, A> InstanceDeleteAccessConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.instances.deleteAccessConfig", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("zone", self._zone.to_string())); + params.push(("instance", self._instance.to_string())); + params.push(("accessConfig", self._access_config.to_string())); + params.push(("networkInterface", self._network_interface.to_string())); + for &field in ["alt", "project", "zone", "instance", "accessConfig", "networkInterface"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{instance}/deleteAccessConfig".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instance}", "instance")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["instance", "zone", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the zone for this request. + /// + /// Sets the *zone* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn zone(mut self, new_value: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { + self._zone = new_value.to_string(); + self + } + /// The instance name for this request. + /// + /// Sets the *instance* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn instance(mut self, new_value: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { + self._instance = new_value.to_string(); + self + } + /// The name of the access config to delete. + /// + /// Sets the *access config* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn access_config(mut self, new_value: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { + self._access_config = new_value.to_string(); + self + } + /// The name of the network interface. + /// + /// Sets the *network interface* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn network_interface(mut self, new_value: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { + self._network_interface = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> InstanceDeleteAccessConfigCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InstanceDeleteAccessConfigCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> InstanceDeleteAccessConfigCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22186,7 +23215,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.insert", + dlg.begin(MethodInfo { id: "compute.instances.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -22229,14 +23258,14 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -22280,7 +23309,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22290,10 +23319,10 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22325,7 +23354,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Instance) -> InstanceInsertCall<'a, C, A> { self._request = new_value; @@ -22335,7 +23364,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -22345,7 +23374,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceInsertCall<'a, C, A> { self._zone = new_value.to_string(); @@ -22363,12 +23392,12 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22385,17 +23414,17 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22430,9 +23459,9 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.instances().list("project", "zone") -/// .page_token("kasd") -/// .max_results(14) -/// .filter("rebum.") +/// .page_token("consetetur") +/// .max_results(79) +/// .filter("sed") /// .doit(); /// # } /// ``` @@ -22464,7 +23493,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.list", + dlg.begin(MethodInfo { id: "compute.instances.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -22516,7 +23545,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22552,7 +23581,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22562,10 +23591,10 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22598,7 +23627,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceListCall<'a, C, A> { self._project = new_value.to_string(); @@ -22608,31 +23637,35 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceListCall<'a, C, A> { self._zone = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> InstanceListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> InstanceListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> InstanceListCall<'a, C, A> { @@ -22651,12 +23684,12 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22673,17 +23706,17 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22747,7 +23780,7 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.reset", + dlg.begin(MethodInfo { id: "compute.instances.reset", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -22791,7 +23824,7 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22827,7 +23860,7 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22837,10 +23870,10 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22873,7 +23906,7 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceResetCall<'a, C, A> { self._project = new_value.to_string(); @@ -22883,7 +23916,7 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceResetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -22893,7 +23926,7 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceResetCall<'a, C, A> { self._instance = new_value.to_string(); @@ -22911,12 +23944,12 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22933,301 +23966,17 @@ impl<'a, C, A> InstanceResetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceResetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes an access config from an instance's network interface. -/// -/// A builder for the *deleteAccessConfig* method supported by a *instance* resource. -/// It is not used directly, but through a `InstanceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_compute1 as compute1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use compute1::Compute; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Compute::new(hyper::Client::new(), 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 ! -/// let result = hub.instances().delete_access_config("project", "zone", "instance", "accessConfig", "networkInterface") -/// .doit(); -/// # } -/// ``` -pub struct InstanceDeleteAccessConfigCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Compute, - _project: String, - _zone: String, - _instance: String, - _access_config: String, - _network_interface: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for InstanceDeleteAccessConfigCall<'a, C, A> {} - -impl<'a, C, A> InstanceDeleteAccessConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "compute.instances.deleteAccessConfig", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); - params.push(("project", self._project.to_string())); - params.push(("zone", self._zone.to_string())); - params.push(("instance", self._instance.to_string())); - params.push(("accessConfig", self._access_config.to_string())); - params.push(("networkInterface", self._network_interface.to_string())); - for &field in ["alt", "project", "zone", "instance", "accessConfig", "networkInterface"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{instance}/deleteAccessConfig".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{project}", "project"), ("{zone}", "zone"), ("{instance}", "instance")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(3); - for param_name in ["instance", "zone", "project"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Project ID for this request. - /// - /// Sets the *project* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn project(mut self, new_value: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { - self._project = new_value.to_string(); - self - } - /// The name of the zone for this request. - /// - /// Sets the *zone* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn zone(mut self, new_value: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { - self._zone = new_value.to_string(); - self - } - /// The instance name for this request. - /// - /// Sets the *instance* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn instance(mut self, new_value: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { - self._instance = new_value.to_string(); - self - } - /// The name of the access config to delete. - /// - /// Sets the *access config* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn access_config(mut self, new_value: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { - self._access_config = new_value.to_string(); - self - } - /// The name of the network interface. - /// - /// Sets the *network interface* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn network_interface(mut self, new_value: &str) -> InstanceDeleteAccessConfigCall<'a, C, A> { - self._network_interface = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> InstanceDeleteAccessConfigCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> InstanceDeleteAccessConfigCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> InstanceDeleteAccessConfigCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceResetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23262,9 +24011,9 @@ impl<'a, C, A> InstanceDeleteAccessConfigCall<'a, C, A> where C: BorrowMut InstanceAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instances.aggregatedList", + dlg.begin(MethodInfo { id: "compute.instances.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -23346,7 +24095,7 @@ impl<'a, C, A> InstanceAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23382,7 +24131,7 @@ impl<'a, C, A> InstanceAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23392,10 +24141,10 @@ impl<'a, C, A> InstanceAggregatedListCall<'a, C, A> where C: BorrowMut InstanceAggregatedListCall<'a, C, A> where C: BorrowMut InstanceAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> InstanceAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> InstanceAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> InstanceAggregatedListCall<'a, C, A> { @@ -23471,12 +24224,12 @@ impl<'a, C, A> InstanceAggregatedListCall<'a, C, A> where C: BorrowMut InstanceAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23573,7 +24326,7 @@ impl<'a, C, A> BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.backendServices.getHealth", + dlg.begin(MethodInfo { id: "compute.backendServices.getHealth", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -23616,14 +24369,14 @@ impl<'a, C, A> BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -23667,7 +24420,7 @@ impl<'a, C, A> BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23677,10 +24430,10 @@ impl<'a, C, A> BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut BackendServiceGetHealthCall<'a, C, A> { self._request = new_value; @@ -23721,7 +24474,7 @@ impl<'a, C, A> BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut BackendServiceGetHealthCall<'a, C, A> { self._project = new_value.to_string(); @@ -23731,7 +24484,7 @@ impl<'a, C, A> BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut BackendServiceGetHealthCall<'a, C, A> { self._backend_service = new_value.to_string(); @@ -23749,12 +24502,12 @@ impl<'a, C, A> BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut BackendServiceGetHealthCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BackendServiceGetHealthCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackendServiceGetHealthCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23844,7 +24597,7 @@ impl<'a, C, A> BackendServiceDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.backendServices.delete", + dlg.begin(MethodInfo { id: "compute.backendServices.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -23887,7 +24640,7 @@ impl<'a, C, A> BackendServiceDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23923,7 +24676,7 @@ impl<'a, C, A> BackendServiceDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23933,10 +24686,10 @@ impl<'a, C, A> BackendServiceDeleteCall<'a, C, A> where C: BorrowMut BackendServiceDeleteCall<'a, C, A> where C: BorrowMut BackendServiceDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -23979,7 +24732,7 @@ impl<'a, C, A> BackendServiceDeleteCall<'a, C, A> where C: BorrowMut BackendServiceDeleteCall<'a, C, A> { self._backend_service = new_value.to_string(); @@ -23997,12 +24750,12 @@ impl<'a, C, A> BackendServiceDeleteCall<'a, C, A> where C: BorrowMut BackendServiceDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BackendServiceDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackendServiceDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24092,7 +24845,7 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.backendServices.get", + dlg.begin(MethodInfo { id: "compute.backendServices.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -24135,7 +24888,7 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -24171,7 +24924,7 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24181,10 +24934,10 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24213,11 +24966,11 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> BackendServiceGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -24227,7 +24980,7 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *backend service* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn backend_service(mut self, new_value: &str) -> BackendServiceGetCall<'a, C, A> { self._backend_service = new_value.to_string(); @@ -24245,12 +24998,12 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -24267,17 +25020,17 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BackendServiceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackendServiceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24285,7 +25038,7 @@ impl<'a, C, A> BackendServiceGetCall<'a, C, A> where C: BorrowMut } -/// Update the entire content of the BackendService resource. +/// Updates the entire content of the BackendService resource. There are several restrictions and guidelines to keep in mind when updating a backend service. Read Restrictions and Guidelines for more information. /// /// A builder for the *update* method supported by a *backendService* resource. /// It is not used directly, but through a `BackendServiceMethods` instance. @@ -24347,7 +25100,7 @@ impl<'a, C, A> BackendServiceUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.backendServices.update", + dlg.begin(MethodInfo { id: "compute.backendServices.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -24390,14 +25143,14 @@ impl<'a, C, A> BackendServiceUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -24441,7 +25194,7 @@ impl<'a, C, A> BackendServiceUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24451,10 +25204,10 @@ impl<'a, C, A> BackendServiceUpdateCall<'a, C, A> where C: BorrowMut BackendServiceUpdateCall<'a, C, A> where C: BorrowMut BackendServiceUpdateCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> BackendServiceUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -24506,7 +25259,7 @@ impl<'a, C, A> BackendServiceUpdateCall<'a, C, A> where C: BorrowMut BackendServiceUpdateCall<'a, C, A> { self._backend_service = new_value.to_string(); @@ -24524,12 +25277,12 @@ impl<'a, C, A> BackendServiceUpdateCall<'a, C, A> where C: BorrowMut BackendServiceUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BackendServiceUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackendServiceUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24591,9 +25344,9 @@ impl<'a, C, A> BackendServiceUpdateCall<'a, C, A> where C: BorrowMut BackendServiceListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.backendServices.list", + dlg.begin(MethodInfo { id: "compute.backendServices.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -24675,7 +25428,7 @@ impl<'a, C, A> BackendServiceListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -24711,7 +25464,7 @@ impl<'a, C, A> BackendServiceListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24721,10 +25474,10 @@ impl<'a, C, A> BackendServiceListCall<'a, C, A> where C: BorrowMut BackendServiceListCall<'a, C, A> where C: BorrowMut BackendServiceListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> BackendServiceListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> BackendServiceListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> BackendServiceListCall<'a, C, A> { @@ -24800,12 +25557,12 @@ impl<'a, C, A> BackendServiceListCall<'a, C, A> where C: BorrowMut BackendServiceListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BackendServiceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackendServiceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24840,7 +25597,7 @@ impl<'a, C, A> BackendServiceListCall<'a, C, A> where C: BorrowMut BackendServicePatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.backendServices.patch", + dlg.begin(MethodInfo { id: "compute.backendServices.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -24945,14 +25702,14 @@ impl<'a, C, A> BackendServicePatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -24996,7 +25753,7 @@ impl<'a, C, A> BackendServicePatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25006,10 +25763,10 @@ impl<'a, C, A> BackendServicePatchCall<'a, C, A> where C: BorrowMut BackendServicePatchCall<'a, C, A> where C: BorrowMut BackendServicePatchCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> BackendServicePatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -25061,7 +25818,7 @@ impl<'a, C, A> BackendServicePatchCall<'a, C, A> where C: BorrowMut BackendServicePatchCall<'a, C, A> { self._backend_service = new_value.to_string(); @@ -25079,12 +25836,12 @@ impl<'a, C, A> BackendServicePatchCall<'a, C, A> where C: BorrowMut BackendServicePatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BackendServicePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackendServicePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25119,7 +25876,7 @@ impl<'a, C, A> BackendServicePatchCall<'a, C, A> where C: BorrowMut BackendServiceInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.backendServices.insert", + dlg.begin(MethodInfo { id: "compute.backendServices.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -25222,14 +25979,14 @@ impl<'a, C, A> BackendServiceInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -25273,7 +26030,7 @@ impl<'a, C, A> BackendServiceInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25283,10 +26040,10 @@ impl<'a, C, A> BackendServiceInsertCall<'a, C, A> where C: BorrowMut BackendServiceInsertCall<'a, C, A> where C: BorrowMut BackendServiceInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> BackendServiceInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -25346,12 +26103,12 @@ impl<'a, C, A> BackendServiceInsertCall<'a, C, A> where C: BorrowMut BackendServiceInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BackendServiceInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackendServiceInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25415,9 +26172,9 @@ impl<'a, C, A> BackendServiceInsertCall<'a, C, A> where C: BorrowMut ImageListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.images.list", + dlg.begin(MethodInfo { id: "compute.images.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -25499,7 +26256,7 @@ impl<'a, C, A> ImageListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25535,7 +26292,7 @@ impl<'a, C, A> ImageListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25545,10 +26302,10 @@ impl<'a, C, A> ImageListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25581,31 +26338,35 @@ impl<'a, C, A> ImageListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ImageListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ImageListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> ImageListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ImageListCall<'a, C, A> { @@ -25624,12 +26385,12 @@ impl<'a, C, A> ImageListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25646,17 +26407,17 @@ impl<'a, C, A> ImageListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ImageListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ImageListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25728,7 +26489,7 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.images.deprecate", + dlg.begin(MethodInfo { id: "compute.images.deprecate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -25771,14 +26532,14 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -25822,7 +26583,7 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25832,10 +26593,10 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25867,7 +26628,7 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: DeprecationStatus) -> ImageDeprecateCall<'a, C, A> { self._request = new_value; @@ -25877,7 +26638,7 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ImageDeprecateCall<'a, C, A> { self._project = new_value.to_string(); @@ -25887,7 +26648,7 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *image* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn image(mut self, new_value: &str) -> ImageDeprecateCall<'a, C, A> { self._image = new_value.to_string(); @@ -25905,12 +26666,12 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25927,17 +26688,17 @@ impl<'a, C, A> ImageDeprecateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ImageDeprecateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ImageDeprecateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26006,7 +26767,7 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.images.insert", + dlg.begin(MethodInfo { id: "compute.images.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -26048,14 +26809,14 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -26099,7 +26860,7 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26109,10 +26870,10 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26144,7 +26905,7 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Image) -> ImageInsertCall<'a, C, A> { self._request = new_value; @@ -26154,7 +26915,7 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ImageInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -26172,12 +26933,12 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26194,17 +26955,17 @@ impl<'a, C, A> ImageInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ImageInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ImageInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26267,7 +27028,7 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.images.get", + dlg.begin(MethodInfo { id: "compute.images.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -26310,7 +27071,7 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -26346,7 +27107,7 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26356,10 +27117,10 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26392,7 +27153,7 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ImageGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -26402,7 +27163,7 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *image* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn image(mut self, new_value: &str) -> ImageGetCall<'a, C, A> { self._image = new_value.to_string(); @@ -26420,12 +27181,12 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26442,17 +27203,17 @@ impl<'a, C, A> ImageGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ImageGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ImageGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26515,7 +27276,7 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.images.delete", + dlg.begin(MethodInfo { id: "compute.images.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -26558,7 +27319,7 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -26594,7 +27355,7 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26604,10 +27365,10 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26640,7 +27401,7 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ImageDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -26650,7 +27411,7 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *image* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn image(mut self, new_value: &str) -> ImageDeleteCall<'a, C, A> { self._image = new_value.to_string(); @@ -26668,12 +27429,12 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26690,17 +27451,17 @@ impl<'a, C, A> ImageDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ImageDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ImageDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26763,7 +27524,7 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.licenses.get", + dlg.begin(MethodInfo { id: "compute.licenses.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -26806,7 +27567,7 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -26842,7 +27603,7 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26852,10 +27613,10 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26888,7 +27649,7 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> LicenseGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -26898,7 +27659,7 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *license* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn license(mut self, new_value: &str) -> LicenseGetCall<'a, C, A> { self._license = new_value.to_string(); @@ -26916,12 +27677,12 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26938,17 +27699,17 @@ impl<'a, C, A> LicenseGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LicenseGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LicenseGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27011,7 +27772,7 @@ impl<'a, C, A> TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.delete", + dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -27054,7 +27815,7 @@ impl<'a, C, A> TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -27090,7 +27851,7 @@ impl<'a, C, A> TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27100,10 +27861,10 @@ impl<'a, C, A> TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpsProxyDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -27146,7 +27907,7 @@ impl<'a, C, A> TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpsProxyDeleteCall<'a, C, A> { self._target_https_proxy = new_value.to_string(); @@ -27164,12 +27925,12 @@ impl<'a, C, A> TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpsProxyDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetHttpsProxyDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpsProxyDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27259,7 +28020,7 @@ impl<'a, C, A> TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.get", + dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -27302,7 +28063,7 @@ impl<'a, C, A> TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -27338,7 +28099,7 @@ impl<'a, C, A> TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27348,10 +28109,10 @@ impl<'a, C, A> TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpsProxyGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -27394,7 +28155,7 @@ impl<'a, C, A> TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpsProxyGetCall<'a, C, A> { self._target_https_proxy = new_value.to_string(); @@ -27412,12 +28173,12 @@ impl<'a, C, A> TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpsProxyGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetHttpsProxyGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpsProxyGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27514,7 +28275,7 @@ impl<'a, C, A> TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.setUrlMap", + dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.setUrlMap", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -27557,14 +28318,14 @@ impl<'a, C, A> TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -27608,7 +28369,7 @@ impl<'a, C, A> TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27618,10 +28379,10 @@ impl<'a, C, A> TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetUrlMapCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetHttpsProxySetUrlMapCall<'a, C, A> { self._project = new_value.to_string(); @@ -27673,7 +28434,7 @@ impl<'a, C, A> TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetUrlMapCall<'a, C, A> { self._target_https_proxy = new_value.to_string(); @@ -27691,12 +28452,12 @@ impl<'a, C, A> TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpsProxySetUrlMapCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetHttpsProxySetUrlMapCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpsProxySetUrlMapCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27792,7 +28553,7 @@ impl<'a, C, A> TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.insert", + dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -27834,14 +28595,14 @@ impl<'a, C, A> TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -27885,7 +28646,7 @@ impl<'a, C, A> TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27895,10 +28656,10 @@ impl<'a, C, A> TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpsProxyInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetHttpsProxyInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -27958,12 +28719,12 @@ impl<'a, C, A> TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpsProxyInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetHttpsProxyInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpsProxyInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -28060,7 +28821,7 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.setSslCertificates", + dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.setSslCertificates", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -28103,14 +28864,14 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -28154,7 +28915,7 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28164,10 +28925,10 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28199,27 +28960,27 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TargetHttpsProxiesSetSslCertificatesRequest) -> TargetHttpsProxySetSslCertificateCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetHttpsProxySetSslCertificateCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Name of the TargetHttpsProxy resource whose URL map is to be set. + /// Name of the TargetHttpsProxy resource whose SSLCertificate is to be set. /// /// Sets the *target https proxy* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn target_https_proxy(mut self, new_value: &str) -> TargetHttpsProxySetSslCertificateCall<'a, C, A> { self._target_https_proxy = new_value.to_string(); @@ -28237,12 +28998,12 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -28259,17 +29020,17 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TargetHttpsProxySetSslCertificateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpsProxySetSslCertificateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -28304,9 +29065,9 @@ impl<'a, C, A> TargetHttpsProxySetSslCertificateCall<'a, C, A> where C: BorrowMu /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.target_https_proxies().list("project") -/// .page_token("consetetur") +/// .page_token("At") /// .max_results(92) -/// .filter("elitr") +/// .filter("consetetur") /// .doit(); /// # } /// ``` @@ -28337,7 +29098,7 @@ impl<'a, C, A> TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.list", + dlg.begin(MethodInfo { id: "compute.targetHttpsProxies.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -28388,7 +29149,7 @@ impl<'a, C, A> TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -28424,7 +29185,7 @@ impl<'a, C, A> TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28434,10 +29195,10 @@ impl<'a, C, A> TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut TargetHttpsProxyListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> TargetHttpsProxyListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> TargetHttpsProxyListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TargetHttpsProxyListCall<'a, C, A> { @@ -28513,12 +29278,12 @@ impl<'a, C, A> TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut TargetHttpsProxyListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetHttpsProxyListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpsProxyListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -28614,7 +29379,7 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.networks.insert", + dlg.begin(MethodInfo { id: "compute.networks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -28656,14 +29421,14 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -28707,7 +29472,7 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28717,10 +29482,10 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28752,7 +29517,7 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Network) -> NetworkInsertCall<'a, C, A> { self._request = new_value; @@ -28762,7 +29527,7 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> NetworkInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -28780,12 +29545,12 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -28802,17 +29567,17 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> NetworkInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> NetworkInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -28847,9 +29612,9 @@ impl<'a, C, A> NetworkInsertCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.networks().list("project") -/// .page_token("consetetur") -/// .max_results(22) -/// .filter("accusam") +/// .page_token("dolores") +/// .max_results(55) +/// .filter("dolor") /// .doit(); /// # } /// ``` @@ -28880,7 +29645,7 @@ impl<'a, C, A> NetworkListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.networks.list", + dlg.begin(MethodInfo { id: "compute.networks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -28931,7 +29696,7 @@ impl<'a, C, A> NetworkListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -28967,7 +29732,7 @@ impl<'a, C, A> NetworkListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28977,10 +29742,10 @@ impl<'a, C, A> NetworkListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29013,31 +29778,35 @@ impl<'a, C, A> NetworkListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> NetworkListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> NetworkListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> NetworkListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> NetworkListCall<'a, C, A> { @@ -29056,12 +29825,12 @@ impl<'a, C, A> NetworkListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -29078,17 +29847,17 @@ impl<'a, C, A> NetworkListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> NetworkListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> NetworkListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29151,7 +29920,7 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.networks.delete", + dlg.begin(MethodInfo { id: "compute.networks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -29194,7 +29963,7 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -29230,7 +29999,7 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29240,10 +30009,10 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29276,7 +30045,7 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> NetworkDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -29286,7 +30055,7 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *network* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn network(mut self, new_value: &str) -> NetworkDeleteCall<'a, C, A> { self._network = new_value.to_string(); @@ -29304,12 +30073,12 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -29326,17 +30095,17 @@ impl<'a, C, A> NetworkDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> NetworkDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> NetworkDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29399,7 +30168,7 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.networks.get", + dlg.begin(MethodInfo { id: "compute.networks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -29442,7 +30211,7 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -29478,7 +30247,7 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29488,10 +30257,10 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29524,7 +30293,7 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> NetworkGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -29534,7 +30303,7 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *network* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn network(mut self, new_value: &str) -> NetworkGetCall<'a, C, A> { self._network = new_value.to_string(); @@ -29552,12 +30321,12 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -29574,17 +30343,17 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> NetworkGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> NetworkGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29592,7 +30361,7 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Retrieves the list of Operation resources contained within the specified project. +/// Retrieves a list of Operation resources contained within the specified project. /// /// A builder for the *list* method supported by a *globalOperation* resource. /// It is not used directly, but through a `GlobalOperationMethods` instance. @@ -29619,9 +30388,9 @@ impl<'a, C, A> NetworkGetCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.global_operations().list("project") -/// .page_token("ea") -/// .max_results(66) -/// .filter("Stet") +/// .page_token("sed") +/// .max_results(2) +/// .filter("sanctus") /// .doit(); /// # } /// ``` @@ -29652,7 +30421,7 @@ impl<'a, C, A> GlobalOperationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalOperations.list", + dlg.begin(MethodInfo { id: "compute.globalOperations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -29703,7 +30472,7 @@ impl<'a, C, A> GlobalOperationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -29739,7 +30508,7 @@ impl<'a, C, A> GlobalOperationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29749,10 +30518,10 @@ impl<'a, C, A> GlobalOperationListCall<'a, C, A> where C: BorrowMut GlobalOperationListCall<'a, C, A> where C: BorrowMut GlobalOperationListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> GlobalOperationListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> GlobalOperationListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> GlobalOperationListCall<'a, C, A> { @@ -29828,12 +30601,12 @@ impl<'a, C, A> GlobalOperationListCall<'a, C, A> where C: BorrowMut GlobalOperationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29868,7 +30641,7 @@ impl<'a, C, A> GlobalOperationListCall<'a, C, A> where C: BorrowMut GlobalOperationListCall<'a, C, A> where C: BorrowMut GlobalOperationAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalOperations.aggregatedList", + dlg.begin(MethodInfo { id: "compute.globalOperations.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -29979,7 +30752,7 @@ impl<'a, C, A> GlobalOperationAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30015,7 +30788,7 @@ impl<'a, C, A> GlobalOperationAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30025,10 +30798,10 @@ impl<'a, C, A> GlobalOperationAggregatedListCall<'a, C, A> where C: BorrowMut GlobalOperationAggregatedListCall<'a, C, A> where C: BorrowMut GlobalOperationAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> GlobalOperationAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> GlobalOperationAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> GlobalOperationAggregatedListCall<'a, C, A> { @@ -30104,12 +30881,12 @@ impl<'a, C, A> GlobalOperationAggregatedListCall<'a, C, A> where C: BorrowMut GlobalOperationAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalOperationAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalOperationAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30199,7 +30976,7 @@ impl<'a, C, A> GlobalOperationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalOperations.get", + dlg.begin(MethodInfo { id: "compute.globalOperations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -30242,7 +31019,7 @@ impl<'a, C, A> GlobalOperationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30278,7 +31055,7 @@ impl<'a, C, A> GlobalOperationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30288,10 +31065,10 @@ impl<'a, C, A> GlobalOperationGetCall<'a, C, A> where C: BorrowMut GlobalOperationGetCall<'a, C, A> where C: BorrowMut GlobalOperationGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -30334,7 +31111,7 @@ impl<'a, C, A> GlobalOperationGetCall<'a, C, A> where C: BorrowMut GlobalOperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -30352,12 +31129,12 @@ impl<'a, C, A> GlobalOperationGetCall<'a, C, A> where C: BorrowMut GlobalOperationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30447,7 +31224,7 @@ impl<'a, C, A> GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalOperations.delete", + dlg.begin(MethodInfo { id: "compute.globalOperations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -30489,7 +31266,7 @@ impl<'a, C, A> GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30525,7 +31302,7 @@ impl<'a, C, A> GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30535,10 +31312,10 @@ impl<'a, C, A> GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalOperationDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -30571,7 +31348,7 @@ impl<'a, C, A> GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalOperationDeleteCall<'a, C, A> { self._operation = new_value.to_string(); @@ -30589,12 +31366,12 @@ impl<'a, C, A> GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut GlobalOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalOperationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalOperationDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30685,7 +31462,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.autoscalers.delete", + dlg.begin(MethodInfo { id: "compute.autoscalers.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -30729,7 +31506,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30765,7 +31542,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30775,10 +31552,10 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30807,11 +31584,11 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -30821,7 +31598,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -30831,7 +31608,7 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *autoscaler* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn autoscaler(mut self, new_value: &str) -> AutoscalerDeleteCall<'a, C, A> { self._autoscaler = new_value.to_string(); @@ -30849,12 +31626,12 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -30871,17 +31648,17 @@ impl<'a, C, A> AutoscalerDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30945,7 +31722,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.autoscalers.get", + dlg.begin(MethodInfo { id: "compute.autoscalers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -30989,7 +31766,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -31025,7 +31802,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31035,10 +31812,10 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31067,11 +31844,11 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -31081,7 +31858,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -31091,7 +31868,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *autoscaler* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn autoscaler(mut self, new_value: &str) -> AutoscalerGetCall<'a, C, A> { self._autoscaler = new_value.to_string(); @@ -31109,12 +31886,12 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -31131,17 +31908,17 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -31149,7 +31926,7 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: } -/// Retrieves the list of autoscaler resources contained within the specified zone. +/// Retrieves a list of autoscaler resources contained within the specified zone. /// /// A builder for the *list* method supported by a *autoscaler* resource. /// It is not used directly, but through a `AutoscalerMethods` instance. @@ -31176,9 +31953,9 @@ impl<'a, C, A> AutoscalerGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.autoscalers().list("project", "zone") -/// .page_token("et") -/// .max_results(37) -/// .filter("eos") +/// .page_token("dolores") +/// .max_results(76) +/// .filter("consetetur") /// .doit(); /// # } /// ``` @@ -31210,7 +31987,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.autoscalers.list", + dlg.begin(MethodInfo { id: "compute.autoscalers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -31262,7 +32039,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -31298,7 +32075,7 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31308,10 +32085,10 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31340,11 +32117,11 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerListCall<'a, C, A> { self._project = new_value.to_string(); @@ -31354,31 +32131,35 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerListCall<'a, C, A> { self._zone = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AutoscalerListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> AutoscalerListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> AutoscalerListCall<'a, C, A> { @@ -31397,12 +32178,12 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -31419,17 +32200,17 @@ impl<'a, C, A> AutoscalerListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -31500,7 +32281,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.autoscalers.patch", + dlg.begin(MethodInfo { id: "compute.autoscalers.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -31544,14 +32325,14 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -31595,7 +32376,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31605,10 +32386,10 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31640,17 +32421,17 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Autoscaler) -> AutoscalerPatchCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerPatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -31660,7 +32441,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerPatchCall<'a, C, A> { self._zone = new_value.to_string(); @@ -31670,7 +32451,7 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *autoscaler* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn autoscaler(mut self, new_value: &str) -> AutoscalerPatchCall<'a, C, A> { self._autoscaler = new_value.to_string(); @@ -31688,12 +32469,12 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -31710,17 +32491,17 @@ impl<'a, C, A> AutoscalerPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -31790,7 +32571,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.autoscalers.insert", + dlg.begin(MethodInfo { id: "compute.autoscalers.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -31833,14 +32614,14 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -31884,7 +32665,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31894,10 +32675,10 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31929,17 +32710,17 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Autoscaler) -> AutoscalerInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -31949,7 +32730,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerInsertCall<'a, C, A> { self._zone = new_value.to_string(); @@ -31967,12 +32748,12 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -31989,17 +32770,17 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -32007,7 +32788,7 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, } -/// Retrieves the list of autoscalers grouped by scope. +/// Retrieves an aggregated list of autoscalers. /// /// A builder for the *aggregatedList* method supported by a *autoscaler* resource. /// It is not used directly, but through a `AutoscalerMethods` instance. @@ -32034,9 +32815,9 @@ impl<'a, C, A> AutoscalerInsertCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.autoscalers().aggregated_list("project") -/// .page_token("justo") -/// .max_results(62) -/// .filter("gubergren") +/// .page_token("dolore") +/// .max_results(50) +/// .filter("dolore") /// .doit(); /// # } /// ``` @@ -32067,7 +32848,7 @@ impl<'a, C, A> AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.autoscalers.aggregatedList", + dlg.begin(MethodInfo { id: "compute.autoscalers.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -32118,7 +32899,7 @@ impl<'a, C, A> AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -32154,7 +32935,7 @@ impl<'a, C, A> AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32164,10 +32945,10 @@ impl<'a, C, A> AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut AutoscalerAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> AutoscalerAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> AutoscalerAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> AutoscalerAggregatedListCall<'a, C, A> { @@ -32243,12 +33028,12 @@ impl<'a, C, A> AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AutoscalerAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -32316,7 +33101,7 @@ impl<'a, C, A> AutoscalerAggregatedListCall<'a, C, A> where C: BorrowMut AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.autoscalers.update", + dlg.begin(MethodInfo { id: "compute.autoscalers.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -32393,14 +33178,14 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -32444,7 +33229,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32454,10 +33239,10 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32489,17 +33274,17 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Autoscaler) -> AutoscalerUpdateCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> AutoscalerUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -32509,7 +33294,7 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> AutoscalerUpdateCall<'a, C, A> { self._zone = new_value.to_string(); @@ -32534,12 +33319,12 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -32556,17 +33341,17 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AutoscalerUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AutoscalerUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -32574,7 +33359,1378 @@ impl<'a, C, A> AutoscalerUpdateCall<'a, C, A> where C: BorrowMut, } -/// Deletes the specified instance group. The instances in the group are not deleted. +/// Retrieves an aggregated list of subnetworks. +/// +/// A builder for the *aggregatedList* method supported by a *subnetwork* resource. +/// It is not used directly, but through a `SubnetworkMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::new(), 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 ! +/// let result = hub.subnetworks().aggregated_list("project") +/// .page_token("invidunt") +/// .max_results(79) +/// .filter("labore") +/// .doit(); +/// # } +/// ``` +pub struct SubnetworkAggregatedListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _page_token: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubnetworkAggregatedListCall<'a, C, A> {} + +impl<'a, C, A> SubnetworkAggregatedListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SubnetworkAggregatedList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.subnetworks.aggregatedList", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "pageToken", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/compute/v1/projects/{project}/aggregated/subnetworks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SubnetworkAggregatedListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SubnetworkAggregatedListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> SubnetworkAggregatedListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. + /// + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// + /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> SubnetworkAggregatedListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubnetworkAggregatedListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubnetworkAggregatedListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubnetworkAggregatedListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a subnetwork in the specified project using the data included in the request. +/// +/// A builder for the *insert* method supported by a *subnetwork* resource. +/// It is not used directly, but through a `SubnetworkMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// use compute1::Subnetwork; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::new(), 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 ! +/// let mut req = Subnetwork::default(); +/// +/// // 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 ! +/// let result = hub.subnetworks().insert(req, "project", "region") +/// .doit(); +/// # } +/// ``` +pub struct SubnetworkInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _request: Subnetwork, + _project: String, + _region: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubnetworkInsertCall<'a, C, A> {} + +impl<'a, C, A> SubnetworkInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.subnetworks.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + for &field in ["alt", "project", "region"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Subnetwork) -> SubnetworkInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SubnetworkInsertCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the region scoping this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> SubnetworkInsertCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubnetworkInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubnetworkInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubnetworkInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes the specified subnetwork. +/// +/// A builder for the *delete* method supported by a *subnetwork* resource. +/// It is not used directly, but through a `SubnetworkMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::new(), 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 ! +/// let result = hub.subnetworks().delete("project", "region", "subnetwork") +/// .doit(); +/// # } +/// ``` +pub struct SubnetworkDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _region: String, + _subnetwork: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubnetworkDeleteCall<'a, C, A> {} + +impl<'a, C, A> SubnetworkDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.subnetworks.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("subnetwork", self._subnetwork.to_string())); + for &field in ["alt", "project", "region", "subnetwork"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetwork}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{subnetwork}", "subnetwork")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["subnetwork", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SubnetworkDeleteCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the region scoping this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> SubnetworkDeleteCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name of the Subnetwork resource to delete. + /// + /// Sets the *subnetwork* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn subnetwork(mut self, new_value: &str) -> SubnetworkDeleteCall<'a, C, A> { + self._subnetwork = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubnetworkDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubnetworkDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubnetworkDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of subnetworks available to the specified project. +/// +/// A builder for the *list* method supported by a *subnetwork* resource. +/// It is not used directly, but through a `SubnetworkMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::new(), 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 ! +/// let result = hub.subnetworks().list("project", "region") +/// .page_token("dolor") +/// .max_results(76) +/// .filter("nonumy") +/// .doit(); +/// # } +/// ``` +pub struct SubnetworkListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _region: String, + _page_token: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubnetworkListCall<'a, C, A> {} + +impl<'a, C, A> SubnetworkListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SubnetworkList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.subnetworks.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "region", "pageToken", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SubnetworkListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the region scoping this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> SubnetworkListCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SubnetworkListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> SubnetworkListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. + /// + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// + /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> SubnetworkListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubnetworkListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubnetworkListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubnetworkListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns the specified subnetwork. +/// +/// A builder for the *get* method supported by a *subnetwork* resource. +/// It is not used directly, but through a `SubnetworkMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_compute1 as compute1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use compute1::Compute; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Compute::new(hyper::Client::new(), 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 ! +/// let result = hub.subnetworks().get("project", "region", "subnetwork") +/// .doit(); +/// # } +/// ``` +pub struct SubnetworkGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Compute, + _project: String, + _region: String, + _subnetwork: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubnetworkGetCall<'a, C, A> {} + +impl<'a, C, A> SubnetworkGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subnetwork)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "compute.subnetworks.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("region", self._region.to_string())); + params.push(("subnetwork", self._subnetwork.to_string())); + for &field in ["alt", "project", "region", "subnetwork"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetwork}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{region}", "region"), ("{subnetwork}", "subnetwork")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["subnetwork", "region", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> SubnetworkGetCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Name of the region scoping this request. + /// + /// Sets the *region* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn region(mut self, new_value: &str) -> SubnetworkGetCall<'a, C, A> { + self._region = new_value.to_string(); + self + } + /// Name of the Subnetwork resource to return. + /// + /// Sets the *subnetwork* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn subnetwork(mut self, new_value: &str) -> SubnetworkGetCall<'a, C, A> { + self._subnetwork = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubnetworkGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubnetworkGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubnetworkGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information. /// /// A builder for the *delete* method supported by a *instanceGroup* resource. /// It is not used directly, but through a `InstanceGroupMethods` instance. @@ -32630,7 +34786,7 @@ impl<'a, C, A> InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroups.delete", + dlg.begin(MethodInfo { id: "compute.instanceGroups.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -32674,7 +34830,7 @@ impl<'a, C, A> InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -32710,7 +34866,7 @@ impl<'a, C, A> InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32720,10 +34876,10 @@ impl<'a, C, A> InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -32766,7 +34922,7 @@ impl<'a, C, A> InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -32776,7 +34932,7 @@ impl<'a, C, A> InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupDeleteCall<'a, C, A> { self._instance_group = new_value.to_string(); @@ -32794,12 +34950,12 @@ impl<'a, C, A> InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -32867,8 +35023,8 @@ impl<'a, C, A> InstanceGroupDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroups.listInstances", + dlg.begin(MethodInfo { id: "compute.instanceGroups.listInstances", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -32956,14 +35112,14 @@ impl<'a, C, A> InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -33007,7 +35163,7 @@ impl<'a, C, A> InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33017,10 +35173,10 @@ impl<'a, C, A> InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupListInstanceCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupListInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -33072,7 +35228,7 @@ impl<'a, C, A> InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupListInstanceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -33082,31 +35238,35 @@ impl<'a, C, A> InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupListInstanceCall<'a, C, A> { self._instance_group = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> InstanceGroupListInstanceCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> InstanceGroupListInstanceCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> InstanceGroupListInstanceCall<'a, C, A> { @@ -33125,12 +35285,12 @@ impl<'a, C, A> InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupListInstanceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupListInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupListInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33227,7 +35387,7 @@ impl<'a, C, A> InstanceGroupInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroups.insert", + dlg.begin(MethodInfo { id: "compute.instanceGroups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -33270,14 +35430,14 @@ impl<'a, C, A> InstanceGroupInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -33321,7 +35481,7 @@ impl<'a, C, A> InstanceGroupInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33331,10 +35491,10 @@ impl<'a, C, A> InstanceGroupInsertCall<'a, C, A> where C: BorrowMut InstanceGroupInsertCall<'a, C, A> where C: BorrowMut InstanceGroupInsertCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -33386,7 +35546,7 @@ impl<'a, C, A> InstanceGroupInsertCall<'a, C, A> where C: BorrowMut InstanceGroupInsertCall<'a, C, A> { self._zone = new_value.to_string(); @@ -33404,12 +35564,12 @@ impl<'a, C, A> InstanceGroupInsertCall<'a, C, A> where C: BorrowMut InstanceGroupInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33500,7 +35660,7 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroups.get", + dlg.begin(MethodInfo { id: "compute.instanceGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -33544,7 +35704,7 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -33580,7 +35740,7 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33590,10 +35750,10 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33622,11 +35782,11 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -33636,7 +35796,7 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -33646,7 +35806,7 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *instance group* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group(mut self, new_value: &str) -> InstanceGroupGetCall<'a, C, A> { self._instance_group = new_value.to_string(); @@ -33664,12 +35824,12 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -33686,17 +35846,17 @@ impl<'a, C, A> InstanceGroupGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33767,7 +35927,7 @@ impl<'a, C, A> InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroups.removeInstances", + dlg.begin(MethodInfo { id: "compute.instanceGroups.removeInstances", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -33811,14 +35971,14 @@ impl<'a, C, A> InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -33862,7 +36022,7 @@ impl<'a, C, A> InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33872,10 +36032,10 @@ impl<'a, C, A> InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupRemoveInstanceCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupRemoveInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -33927,7 +36087,7 @@ impl<'a, C, A> InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupRemoveInstanceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -33937,7 +36097,7 @@ impl<'a, C, A> InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupRemoveInstanceCall<'a, C, A> { self._instance_group = new_value.to_string(); @@ -33955,12 +36115,12 @@ impl<'a, C, A> InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupRemoveInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupRemoveInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33995,7 +36155,7 @@ impl<'a, C, A> InstanceGroupRemoveInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroups.addInstances", + dlg.begin(MethodInfo { id: "compute.instanceGroups.addInstances", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -34102,14 +36262,14 @@ impl<'a, C, A> InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -34153,7 +36313,7 @@ impl<'a, C, A> InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -34163,10 +36323,10 @@ impl<'a, C, A> InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupAddInstanceCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupAddInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -34218,7 +36378,7 @@ impl<'a, C, A> InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupAddInstanceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -34228,7 +36388,7 @@ impl<'a, C, A> InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupAddInstanceCall<'a, C, A> { self._instance_group = new_value.to_string(); @@ -34246,12 +36406,12 @@ impl<'a, C, A> InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut InstanceGroupAddInstanceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupAddInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupAddInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34349,7 +36509,7 @@ impl<'a, C, A> InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroups.setNamedPorts", + dlg.begin(MethodInfo { id: "compute.instanceGroups.setNamedPorts", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -34393,14 +36553,14 @@ impl<'a, C, A> InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -34444,7 +36604,7 @@ impl<'a, C, A> InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -34454,10 +36614,10 @@ impl<'a, C, A> InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut InstanceGroupSetNamedPortCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupSetNamedPortCall<'a, C, A> { self._project = new_value.to_string(); @@ -34509,7 +36669,7 @@ impl<'a, C, A> InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut InstanceGroupSetNamedPortCall<'a, C, A> { self._zone = new_value.to_string(); @@ -34519,7 +36679,7 @@ impl<'a, C, A> InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut InstanceGroupSetNamedPortCall<'a, C, A> { self._instance_group = new_value.to_string(); @@ -34537,12 +36697,12 @@ impl<'a, C, A> InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupSetNamedPortCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupSetNamedPortCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34604,9 +36764,9 @@ impl<'a, C, A> InstanceGroupSetNamedPortCall<'a, C, A> where C: BorrowMut InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroups.aggregatedList", + dlg.begin(MethodInfo { id: "compute.instanceGroups.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -34688,7 +36848,7 @@ impl<'a, C, A> InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -34724,7 +36884,7 @@ impl<'a, C, A> InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -34734,10 +36894,10 @@ impl<'a, C, A> InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut InstanceGroupAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> InstanceGroupAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> InstanceGroupAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> InstanceGroupAggregatedListCall<'a, C, A> { @@ -34813,12 +36977,12 @@ impl<'a, C, A> InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34880,9 +37044,9 @@ impl<'a, C, A> InstanceGroupAggregatedListCall<'a, C, A> where C: BorrowMut InstanceGroupListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroups.list", + dlg.begin(MethodInfo { id: "compute.instanceGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -34966,7 +37130,7 @@ impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -35002,7 +37166,7 @@ impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35012,10 +37176,10 @@ impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35044,11 +37208,11 @@ impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { self._project = new_value.to_string(); @@ -35058,31 +37222,35 @@ impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { self._zone = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> InstanceGroupListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> InstanceGroupListCall<'a, C, A> { @@ -35101,12 +37269,12 @@ impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -35123,17 +37291,17 @@ impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35168,9 +37336,9 @@ impl<'a, C, A> InstanceGroupListCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.regions().list("project") -/// .page_token("gubergren") -/// .max_results(3) -/// .filter("gubergren") +/// .page_token("diam") +/// .max_results(62) +/// .filter("et") /// .doit(); /// # } /// ``` @@ -35201,7 +37369,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.regions.list", + dlg.begin(MethodInfo { id: "compute.regions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -35252,7 +37420,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -35288,7 +37456,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35298,10 +37466,10 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35334,31 +37502,35 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> RegionListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> RegionListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> RegionListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> RegionListCall<'a, C, A> { @@ -35377,12 +37549,12 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -35399,17 +37571,17 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RegionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RegionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35472,7 +37644,7 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.regions.get", + dlg.begin(MethodInfo { id: "compute.regions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -35515,7 +37687,7 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -35551,7 +37723,7 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35561,10 +37733,10 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35597,7 +37769,7 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> RegionGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -35607,7 +37779,7 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> RegionGetCall<'a, C, A> { self._region = new_value.to_string(); @@ -35625,12 +37797,12 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -35647,17 +37819,17 @@ impl<'a, C, A> RegionGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RegionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RegionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35727,7 +37899,7 @@ impl<'a, C, A> ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.forwardingRules.insert", + dlg.begin(MethodInfo { id: "compute.forwardingRules.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -35770,14 +37942,14 @@ impl<'a, C, A> ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -35821,7 +37993,7 @@ impl<'a, C, A> ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35831,10 +38003,10 @@ impl<'a, C, A> ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut ForwardingRuleInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ForwardingRuleInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -35886,7 +38058,7 @@ impl<'a, C, A> ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut ForwardingRuleInsertCall<'a, C, A> { self._region = new_value.to_string(); @@ -35904,12 +38076,12 @@ impl<'a, C, A> ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ForwardingRuleInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ForwardingRuleInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35944,7 +38116,7 @@ impl<'a, C, A> ForwardingRuleInsertCall<'a, C, A> where C: BorrowMut ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.forwardingRules.setTarget", + dlg.begin(MethodInfo { id: "compute.forwardingRules.setTarget", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -36051,14 +38223,14 @@ impl<'a, C, A> ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -36102,7 +38274,7 @@ impl<'a, C, A> ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36112,10 +38284,10 @@ impl<'a, C, A> ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut ForwardingRuleSetTargetCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ForwardingRuleSetTargetCall<'a, C, A> { self._project = new_value.to_string(); @@ -36167,7 +38339,7 @@ impl<'a, C, A> ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut ForwardingRuleSetTargetCall<'a, C, A> { self._region = new_value.to_string(); @@ -36177,7 +38349,7 @@ impl<'a, C, A> ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut ForwardingRuleSetTargetCall<'a, C, A> { self._forwarding_rule = new_value.to_string(); @@ -36195,12 +38367,12 @@ impl<'a, C, A> ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ForwardingRuleSetTargetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ForwardingRuleSetTargetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -36235,7 +38407,7 @@ impl<'a, C, A> ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut ForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut ForwardingRuleListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.forwardingRules.list", + dlg.begin(MethodInfo { id: "compute.forwardingRules.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -36348,7 +38520,7 @@ impl<'a, C, A> ForwardingRuleListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -36384,7 +38556,7 @@ impl<'a, C, A> ForwardingRuleListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36394,10 +38566,10 @@ impl<'a, C, A> ForwardingRuleListCall<'a, C, A> where C: BorrowMut ForwardingRuleListCall<'a, C, A> where C: BorrowMut ForwardingRuleListCall<'a, C, A> { self._project = new_value.to_string(); @@ -36440,31 +38612,35 @@ impl<'a, C, A> ForwardingRuleListCall<'a, C, A> where C: BorrowMut ForwardingRuleListCall<'a, C, A> { self._region = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ForwardingRuleListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> ForwardingRuleListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ForwardingRuleListCall<'a, C, A> { @@ -36483,12 +38659,12 @@ impl<'a, C, A> ForwardingRuleListCall<'a, C, A> where C: BorrowMut ForwardingRuleListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ForwardingRuleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ForwardingRuleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -36523,7 +38699,7 @@ impl<'a, C, A> ForwardingRuleListCall<'a, C, A> where C: BorrowMut ForwardingRuleListCall<'a, C, A> where C: BorrowMut ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.forwardingRules.aggregatedList", + dlg.begin(MethodInfo { id: "compute.forwardingRules.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -36634,7 +38810,7 @@ impl<'a, C, A> ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -36670,7 +38846,7 @@ impl<'a, C, A> ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36680,10 +38856,10 @@ impl<'a, C, A> ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut ForwardingRuleAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ForwardingRuleAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> ForwardingRuleAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ForwardingRuleAggregatedListCall<'a, C, A> { @@ -36759,12 +38939,12 @@ impl<'a, C, A> ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut ForwardingRuleAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ForwardingRuleAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ForwardingRuleAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -36855,7 +39035,7 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.forwardingRules.get", + dlg.begin(MethodInfo { id: "compute.forwardingRules.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -36899,7 +39079,7 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -36935,7 +39115,7 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36945,10 +39125,10 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36977,11 +39157,11 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ForwardingRuleGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -36991,7 +39171,7 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> ForwardingRuleGetCall<'a, C, A> { self._region = new_value.to_string(); @@ -37001,7 +39181,7 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *forwarding rule* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn forwarding_rule(mut self, new_value: &str) -> ForwardingRuleGetCall<'a, C, A> { self._forwarding_rule = new_value.to_string(); @@ -37019,12 +39199,12 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -37041,17 +39221,17 @@ impl<'a, C, A> ForwardingRuleGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ForwardingRuleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ForwardingRuleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -37115,7 +39295,7 @@ impl<'a, C, A> ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.forwardingRules.delete", + dlg.begin(MethodInfo { id: "compute.forwardingRules.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -37159,7 +39339,7 @@ impl<'a, C, A> ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -37195,7 +39375,7 @@ impl<'a, C, A> ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37205,10 +39385,10 @@ impl<'a, C, A> ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut ForwardingRuleDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -37251,7 +39431,7 @@ impl<'a, C, A> ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut ForwardingRuleDeleteCall<'a, C, A> { self._region = new_value.to_string(); @@ -37261,7 +39441,7 @@ impl<'a, C, A> ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut ForwardingRuleDeleteCall<'a, C, A> { self._forwarding_rule = new_value.to_string(); @@ -37279,12 +39459,12 @@ impl<'a, C, A> ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut ForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ForwardingRuleDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ForwardingRuleDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -37382,7 +39562,7 @@ impl<'a, C, A> TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.addHealthCheck", + dlg.begin(MethodInfo { id: "compute.targetPools.addHealthCheck", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -37426,14 +39606,14 @@ impl<'a, C, A> TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -37477,7 +39657,7 @@ impl<'a, C, A> TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37487,10 +39667,10 @@ impl<'a, C, A> TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolAddHealthCheckCall<'a, C, A> { self._request = new_value; @@ -37531,7 +39711,7 @@ impl<'a, C, A> TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolAddHealthCheckCall<'a, C, A> { self._project = new_value.to_string(); @@ -37541,7 +39721,7 @@ impl<'a, C, A> TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolAddHealthCheckCall<'a, C, A> { self._region = new_value.to_string(); @@ -37551,7 +39731,7 @@ impl<'a, C, A> TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolAddHealthCheckCall<'a, C, A> { self._target_pool = new_value.to_string(); @@ -37569,12 +39749,12 @@ impl<'a, C, A> TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolAddHealthCheckCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetPoolAddHealthCheckCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolAddHealthCheckCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -37671,7 +39851,7 @@ impl<'a, C, A> TargetPoolInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.insert", + dlg.begin(MethodInfo { id: "compute.targetPools.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -37714,14 +39894,14 @@ impl<'a, C, A> TargetPoolInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -37765,7 +39945,7 @@ impl<'a, C, A> TargetPoolInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37775,10 +39955,10 @@ impl<'a, C, A> TargetPoolInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37810,17 +39990,17 @@ impl<'a, C, A> TargetPoolInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TargetPool) -> TargetPoolInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetPoolInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -37830,7 +40010,7 @@ impl<'a, C, A> TargetPoolInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> TargetPoolInsertCall<'a, C, A> { self._region = new_value.to_string(); @@ -37848,12 +40028,12 @@ impl<'a, C, A> TargetPoolInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -37870,17 +40050,17 @@ impl<'a, C, A> TargetPoolInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TargetPoolInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -37951,7 +40131,7 @@ impl<'a, C, A> TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.removeHealthCheck", + dlg.begin(MethodInfo { id: "compute.targetPools.removeHealthCheck", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -37995,14 +40175,14 @@ impl<'a, C, A> TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -38046,7 +40226,7 @@ impl<'a, C, A> TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38056,10 +40236,10 @@ impl<'a, C, A> TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolRemoveHealthCheckCall<'a, C, A> { self._request = new_value; @@ -38100,7 +40280,7 @@ impl<'a, C, A> TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolRemoveHealthCheckCall<'a, C, A> { self._project = new_value.to_string(); @@ -38110,7 +40290,7 @@ impl<'a, C, A> TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolRemoveHealthCheckCall<'a, C, A> { self._region = new_value.to_string(); @@ -38120,7 +40300,7 @@ impl<'a, C, A> TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolRemoveHealthCheckCall<'a, C, A> { self._target_pool = new_value.to_string(); @@ -38138,12 +40318,12 @@ impl<'a, C, A> TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetPoolRemoveHealthCheckCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolRemoveHealthCheckCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38178,7 +40358,7 @@ impl<'a, C, A> TargetPoolRemoveHealthCheckCall<'a, C, A> where C: BorrowMut TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.getHealth", + dlg.begin(MethodInfo { id: "compute.targetPools.getHealth", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -38285,14 +40465,14 @@ impl<'a, C, A> TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -38336,7 +40516,7 @@ impl<'a, C, A> TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38346,10 +40526,10 @@ impl<'a, C, A> TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut TargetPoolGetHealthCall<'a, C, A> { self._request = new_value; @@ -38390,7 +40570,7 @@ impl<'a, C, A> TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut TargetPoolGetHealthCall<'a, C, A> { self._project = new_value.to_string(); @@ -38400,7 +40580,7 @@ impl<'a, C, A> TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut TargetPoolGetHealthCall<'a, C, A> { self._region = new_value.to_string(); @@ -38410,7 +40590,7 @@ impl<'a, C, A> TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut TargetPoolGetHealthCall<'a, C, A> { self._target_pool = new_value.to_string(); @@ -38428,12 +40608,12 @@ impl<'a, C, A> TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetPoolGetHealthCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolGetHealthCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38501,7 +40681,7 @@ impl<'a, C, A> TargetPoolGetHealthCall<'a, C, A> where C: BorrowMut TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.setBackup", + dlg.begin(MethodInfo { id: "compute.targetPools.setBackup", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -38580,14 +40760,14 @@ impl<'a, C, A> TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -38631,7 +40811,7 @@ impl<'a, C, A> TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38641,10 +40821,10 @@ impl<'a, C, A> TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut TargetPoolSetBackupCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetPoolSetBackupCall<'a, C, A> { self._project = new_value.to_string(); @@ -38696,7 +40876,7 @@ impl<'a, C, A> TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut TargetPoolSetBackupCall<'a, C, A> { self._region = new_value.to_string(); @@ -38706,7 +40886,7 @@ impl<'a, C, A> TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut TargetPoolSetBackupCall<'a, C, A> { self._target_pool = new_value.to_string(); @@ -38731,12 +40911,12 @@ impl<'a, C, A> TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetPoolSetBackupCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolSetBackupCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38771,7 +40951,7 @@ impl<'a, C, A> TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut TargetPoolSetBackupCall<'a, C, A> where C: BorrowMut TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.aggregatedList", + dlg.begin(MethodInfo { id: "compute.targetPools.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -38882,7 +41062,7 @@ impl<'a, C, A> TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -38918,7 +41098,7 @@ impl<'a, C, A> TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38928,10 +41108,10 @@ impl<'a, C, A> TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut TargetPoolAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> TargetPoolAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> TargetPoolAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TargetPoolAggregatedListCall<'a, C, A> { @@ -39007,12 +41191,12 @@ impl<'a, C, A> TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut TargetPoolAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetPoolAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39103,7 +41287,7 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.get", + dlg.begin(MethodInfo { id: "compute.targetPools.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -39147,7 +41331,7 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -39183,7 +41367,7 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39193,10 +41377,10 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39225,11 +41409,11 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetPoolGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -39239,7 +41423,7 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> TargetPoolGetCall<'a, C, A> { self._region = new_value.to_string(); @@ -39249,7 +41433,7 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *target pool* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn target_pool(mut self, new_value: &str) -> TargetPoolGetCall<'a, C, A> { self._target_pool = new_value.to_string(); @@ -39267,12 +41451,12 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -39289,17 +41473,17 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TargetPoolGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39307,7 +41491,7 @@ impl<'a, C, A> TargetPoolGetCall<'a, C, A> where C: BorrowMut, A: } -/// Adds instance url to targetPool. +/// Adds instance URL to targetPool. /// /// A builder for the *addInstance* method supported by a *targetPool* resource. /// It is not used directly, but through a `TargetPoolMethods` instance. @@ -39370,7 +41554,7 @@ impl<'a, C, A> TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.addInstance", + dlg.begin(MethodInfo { id: "compute.targetPools.addInstance", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -39414,14 +41598,14 @@ impl<'a, C, A> TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -39465,7 +41649,7 @@ impl<'a, C, A> TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39475,10 +41659,10 @@ impl<'a, C, A> TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut TargetPoolAddInstanceCall<'a, C, A> { self._request = new_value; @@ -39519,7 +41703,7 @@ impl<'a, C, A> TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut TargetPoolAddInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -39529,7 +41713,7 @@ impl<'a, C, A> TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut TargetPoolAddInstanceCall<'a, C, A> { self._region = new_value.to_string(); @@ -39539,7 +41723,7 @@ impl<'a, C, A> TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut TargetPoolAddInstanceCall<'a, C, A> { self._target_pool = new_value.to_string(); @@ -39557,12 +41741,12 @@ impl<'a, C, A> TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut TargetPoolAddInstanceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetPoolAddInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolAddInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39660,7 +41844,7 @@ impl<'a, C, A> TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.removeInstance", + dlg.begin(MethodInfo { id: "compute.targetPools.removeInstance", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -39704,14 +41888,14 @@ impl<'a, C, A> TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -39755,7 +41939,7 @@ impl<'a, C, A> TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39765,10 +41949,10 @@ impl<'a, C, A> TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut TargetPoolRemoveInstanceCall<'a, C, A> { self._request = new_value; @@ -39809,7 +41993,7 @@ impl<'a, C, A> TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut TargetPoolRemoveInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -39819,7 +42003,7 @@ impl<'a, C, A> TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut TargetPoolRemoveInstanceCall<'a, C, A> { self._region = new_value.to_string(); @@ -39829,7 +42013,7 @@ impl<'a, C, A> TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut TargetPoolRemoveInstanceCall<'a, C, A> { self._target_pool = new_value.to_string(); @@ -39847,12 +42031,12 @@ impl<'a, C, A> TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut TargetPoolRemoveInstanceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetPoolRemoveInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolRemoveInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39943,7 +42127,7 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.delete", + dlg.begin(MethodInfo { id: "compute.targetPools.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -39987,7 +42171,7 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -40023,7 +42207,7 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40033,10 +42217,10 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40065,11 +42249,11 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetPoolDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -40079,7 +42263,7 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> TargetPoolDeleteCall<'a, C, A> { self._region = new_value.to_string(); @@ -40089,7 +42273,7 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *target pool* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn target_pool(mut self, new_value: &str) -> TargetPoolDeleteCall<'a, C, A> { self._target_pool = new_value.to_string(); @@ -40107,12 +42291,12 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -40129,17 +42313,17 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TargetPoolDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -40147,7 +42331,7 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, } -/// Retrieves the list of TargetPool resources available to the specified project and region. +/// Retrieves a list of TargetPool resources available to the specified project and region. /// /// A builder for the *list* method supported by a *targetPool* resource. /// It is not used directly, but through a `TargetPoolMethods` instance. @@ -40174,9 +42358,9 @@ impl<'a, C, A> TargetPoolDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.target_pools().list("project", "region") -/// .page_token("est") -/// .max_results(53) -/// .filter("et") +/// .page_token("sanctus") +/// .max_results(43) +/// .filter("kasd") /// .doit(); /// # } /// ``` @@ -40208,7 +42392,7 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetPools.list", + dlg.begin(MethodInfo { id: "compute.targetPools.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -40260,7 +42444,7 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -40296,7 +42480,7 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40306,10 +42490,10 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40338,11 +42522,11 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetPoolListCall<'a, C, A> { self._project = new_value.to_string(); @@ -40352,31 +42536,35 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> TargetPoolListCall<'a, C, A> { self._region = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> TargetPoolListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> TargetPoolListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TargetPoolListCall<'a, C, A> { @@ -40395,12 +42583,12 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -40417,17 +42605,17 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TargetPoolListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetPoolListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -40435,7 +42623,7 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A } -/// Retrieves the list of TargetInstance resources available to the specified project and zone. +/// Retrieves a list of TargetInstance resources available to the specified project and zone. /// /// A builder for the *list* method supported by a *targetInstance* resource. /// It is not used directly, but through a `TargetInstanceMethods` instance. @@ -40462,9 +42650,9 @@ impl<'a, C, A> TargetPoolListCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.target_instances().list("project", "zone") -/// .page_token("nonumy") -/// .max_results(56) -/// .filter("accusam") +/// .page_token("et") +/// .max_results(37) +/// .filter("ipsum") /// .doit(); /// # } /// ``` @@ -40496,7 +42684,7 @@ impl<'a, C, A> TargetInstanceListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetInstances.list", + dlg.begin(MethodInfo { id: "compute.targetInstances.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -40548,7 +42736,7 @@ impl<'a, C, A> TargetInstanceListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -40584,7 +42772,7 @@ impl<'a, C, A> TargetInstanceListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40594,10 +42782,10 @@ impl<'a, C, A> TargetInstanceListCall<'a, C, A> where C: BorrowMut TargetInstanceListCall<'a, C, A> where C: BorrowMut TargetInstanceListCall<'a, C, A> { self._project = new_value.to_string(); @@ -40640,31 +42828,35 @@ impl<'a, C, A> TargetInstanceListCall<'a, C, A> where C: BorrowMut TargetInstanceListCall<'a, C, A> { self._zone = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> TargetInstanceListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> TargetInstanceListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TargetInstanceListCall<'a, C, A> { @@ -40683,12 +42875,12 @@ impl<'a, C, A> TargetInstanceListCall<'a, C, A> where C: BorrowMut TargetInstanceListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetInstanceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetInstanceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -40785,7 +42977,7 @@ impl<'a, C, A> TargetInstanceInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetInstances.insert", + dlg.begin(MethodInfo { id: "compute.targetInstances.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -40828,14 +43020,14 @@ impl<'a, C, A> TargetInstanceInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -40879,7 +43071,7 @@ impl<'a, C, A> TargetInstanceInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40889,10 +43081,10 @@ impl<'a, C, A> TargetInstanceInsertCall<'a, C, A> where C: BorrowMut TargetInstanceInsertCall<'a, C, A> where C: BorrowMut TargetInstanceInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetInstanceInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -40944,7 +43136,7 @@ impl<'a, C, A> TargetInstanceInsertCall<'a, C, A> where C: BorrowMut TargetInstanceInsertCall<'a, C, A> { self._zone = new_value.to_string(); @@ -40962,12 +43154,12 @@ impl<'a, C, A> TargetInstanceInsertCall<'a, C, A> where C: BorrowMut TargetInstanceInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetInstanceInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetInstanceInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41002,7 +43194,7 @@ impl<'a, C, A> TargetInstanceInsertCall<'a, C, A> where C: BorrowMut TargetInstanceInsertCall<'a, C, A> where C: BorrowMut TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetInstances.aggregatedList", + dlg.begin(MethodInfo { id: "compute.targetInstances.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -41113,7 +43305,7 @@ impl<'a, C, A> TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -41149,7 +43341,7 @@ impl<'a, C, A> TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41159,10 +43351,10 @@ impl<'a, C, A> TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut TargetInstanceAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> TargetInstanceAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> TargetInstanceAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TargetInstanceAggregatedListCall<'a, C, A> { @@ -41238,12 +43434,12 @@ impl<'a, C, A> TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut TargetInstanceAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetInstanceAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetInstanceAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41334,7 +43530,7 @@ impl<'a, C, A> TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetInstances.delete", + dlg.begin(MethodInfo { id: "compute.targetInstances.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -41378,7 +43574,7 @@ impl<'a, C, A> TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -41414,7 +43610,7 @@ impl<'a, C, A> TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41424,10 +43620,10 @@ impl<'a, C, A> TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut TargetInstanceDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -41470,7 +43666,7 @@ impl<'a, C, A> TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut TargetInstanceDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -41480,7 +43676,7 @@ impl<'a, C, A> TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut TargetInstanceDeleteCall<'a, C, A> { self._target_instance = new_value.to_string(); @@ -41498,12 +43694,12 @@ impl<'a, C, A> TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut TargetInstanceDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetInstanceDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetInstanceDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41594,7 +43790,7 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetInstances.get", + dlg.begin(MethodInfo { id: "compute.targetInstances.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -41638,7 +43834,7 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -41674,7 +43870,7 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41684,10 +43880,10 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41716,11 +43912,11 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetInstanceGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -41730,7 +43926,7 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> TargetInstanceGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -41740,7 +43936,7 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *target instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn target_instance(mut self, new_value: &str) -> TargetInstanceGetCall<'a, C, A> { self._target_instance = new_value.to_string(); @@ -41758,12 +43954,12 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -41780,17 +43976,17 @@ impl<'a, C, A> TargetInstanceGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TargetInstanceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetInstanceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41853,7 +44049,7 @@ impl<'a, C, A> GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalForwardingRules.delete", + dlg.begin(MethodInfo { id: "compute.globalForwardingRules.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -41896,7 +44092,7 @@ impl<'a, C, A> GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -41932,7 +44128,7 @@ impl<'a, C, A> GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41942,10 +44138,10 @@ impl<'a, C, A> GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -41988,7 +44184,7 @@ impl<'a, C, A> GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleDeleteCall<'a, C, A> { self._forwarding_rule = new_value.to_string(); @@ -42006,12 +44202,12 @@ impl<'a, C, A> GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalForwardingRuleDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalForwardingRuleDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42046,7 +44242,7 @@ impl<'a, C, A> GlobalForwardingRuleDeleteCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalForwardingRules.setTarget", + dlg.begin(MethodInfo { id: "compute.globalForwardingRules.setTarget", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -42151,14 +44347,14 @@ impl<'a, C, A> GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -42202,7 +44398,7 @@ impl<'a, C, A> GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42212,10 +44408,10 @@ impl<'a, C, A> GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleSetTargetCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> GlobalForwardingRuleSetTargetCall<'a, C, A> { self._project = new_value.to_string(); @@ -42267,7 +44463,7 @@ impl<'a, C, A> GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleSetTargetCall<'a, C, A> { self._forwarding_rule = new_value.to_string(); @@ -42285,12 +44481,12 @@ impl<'a, C, A> GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleSetTargetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalForwardingRuleSetTargetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalForwardingRuleSetTargetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42386,7 +44582,7 @@ impl<'a, C, A> GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalForwardingRules.insert", + dlg.begin(MethodInfo { id: "compute.globalForwardingRules.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -42428,14 +44624,14 @@ impl<'a, C, A> GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -42479,7 +44675,7 @@ impl<'a, C, A> GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42489,10 +44685,10 @@ impl<'a, C, A> GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> GlobalForwardingRuleInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -42552,12 +44748,12 @@ impl<'a, C, A> GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalForwardingRuleInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalForwardingRuleInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42592,7 +44788,7 @@ impl<'a, C, A> GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleInsertCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalForwardingRules.list", + dlg.begin(MethodInfo { id: "compute.globalForwardingRules.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -42703,7 +44899,7 @@ impl<'a, C, A> GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -42739,7 +44935,7 @@ impl<'a, C, A> GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42749,10 +44945,10 @@ impl<'a, C, A> GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> GlobalForwardingRuleListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> GlobalForwardingRuleListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> GlobalForwardingRuleListCall<'a, C, A> { @@ -42828,12 +45028,12 @@ impl<'a, C, A> GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalForwardingRuleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalForwardingRuleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42923,7 +45123,7 @@ impl<'a, C, A> GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.globalForwardingRules.get", + dlg.begin(MethodInfo { id: "compute.globalForwardingRules.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -42966,7 +45166,7 @@ impl<'a, C, A> GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -43002,7 +45202,7 @@ impl<'a, C, A> GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43012,10 +45212,10 @@ impl<'a, C, A> GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -43058,7 +45258,7 @@ impl<'a, C, A> GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleGetCall<'a, C, A> { self._forwarding_rule = new_value.to_string(); @@ -43076,12 +45276,12 @@ impl<'a, C, A> GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut GlobalForwardingRuleGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GlobalForwardingRuleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GlobalForwardingRuleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43171,7 +45371,7 @@ impl<'a, C, A> HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.delete", + dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -43214,7 +45414,7 @@ impl<'a, C, A> HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -43250,7 +45450,7 @@ impl<'a, C, A> HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43260,10 +45460,10 @@ impl<'a, C, A> HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpsHealthCheckDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -43306,7 +45506,7 @@ impl<'a, C, A> HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpsHealthCheckDeleteCall<'a, C, A> { self._https_health_check = new_value.to_string(); @@ -43324,12 +45524,12 @@ impl<'a, C, A> HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpsHealthCheckDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpsHealthCheckDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43391,9 +45591,9 @@ impl<'a, C, A> HttpsHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.list", + dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -43475,7 +45675,7 @@ impl<'a, C, A> HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -43511,7 +45711,7 @@ impl<'a, C, A> HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43521,10 +45721,10 @@ impl<'a, C, A> HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut HttpsHealthCheckListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> HttpsHealthCheckListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> HttpsHealthCheckListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> HttpsHealthCheckListCall<'a, C, A> { @@ -43600,12 +45804,12 @@ impl<'a, C, A> HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut HttpsHealthCheckListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpsHealthCheckListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpsHealthCheckListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43701,7 +45905,7 @@ impl<'a, C, A> HttpsHealthCheckInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.insert", + dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -43743,14 +45947,14 @@ impl<'a, C, A> HttpsHealthCheckInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -43794,7 +45998,7 @@ impl<'a, C, A> HttpsHealthCheckInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43804,10 +46008,10 @@ impl<'a, C, A> HttpsHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpsHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpsHealthCheckInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> HttpsHealthCheckInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -43867,12 +46071,12 @@ impl<'a, C, A> HttpsHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpsHealthCheckInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpsHealthCheckInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpsHealthCheckInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43962,7 +46166,7 @@ impl<'a, C, A> HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.get", + dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -44005,7 +46209,7 @@ impl<'a, C, A> HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -44041,7 +46245,7 @@ impl<'a, C, A> HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44051,10 +46255,10 @@ impl<'a, C, A> HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpsHealthCheckGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -44097,7 +46301,7 @@ impl<'a, C, A> HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpsHealthCheckGetCall<'a, C, A> { self._https_health_check = new_value.to_string(); @@ -44115,12 +46319,12 @@ impl<'a, C, A> HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpsHealthCheckGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpsHealthCheckGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpsHealthCheckGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -44217,7 +46421,7 @@ impl<'a, C, A> HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.update", + dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -44260,14 +46464,14 @@ impl<'a, C, A> HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -44311,7 +46515,7 @@ impl<'a, C, A> HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44321,10 +46525,10 @@ impl<'a, C, A> HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpsHealthCheckUpdateCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> HttpsHealthCheckUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -44376,7 +46580,7 @@ impl<'a, C, A> HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpsHealthCheckUpdateCall<'a, C, A> { self._https_health_check = new_value.to_string(); @@ -44394,12 +46598,12 @@ impl<'a, C, A> HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpsHealthCheckUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpsHealthCheckUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpsHealthCheckUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -44496,7 +46700,7 @@ impl<'a, C, A> HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.patch", + dlg.begin(MethodInfo { id: "compute.httpsHealthChecks.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -44539,14 +46743,14 @@ impl<'a, C, A> HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -44590,7 +46794,7 @@ impl<'a, C, A> HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44600,10 +46804,10 @@ impl<'a, C, A> HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpsHealthCheckPatchCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> HttpsHealthCheckPatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -44655,7 +46859,7 @@ impl<'a, C, A> HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpsHealthCheckPatchCall<'a, C, A> { self._https_health_check = new_value.to_string(); @@ -44673,12 +46877,12 @@ impl<'a, C, A> HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpsHealthCheckPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpsHealthCheckPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -44713,7 +46917,7 @@ impl<'a, C, A> HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpsHealthCheckPatchCall<'a, C, A> where C: BorrowMut MachineTypeAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.machineTypes.aggregatedList", + dlg.begin(MethodInfo { id: "compute.machineTypes.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -44824,7 +47028,7 @@ impl<'a, C, A> MachineTypeAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -44860,7 +47064,7 @@ impl<'a, C, A> MachineTypeAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44870,10 +47074,10 @@ impl<'a, C, A> MachineTypeAggregatedListCall<'a, C, A> where C: BorrowMut MachineTypeAggregatedListCall<'a, C, A> where C: BorrowMut MachineTypeAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> MachineTypeAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> MachineTypeAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> MachineTypeAggregatedListCall<'a, C, A> { @@ -44949,12 +47157,12 @@ impl<'a, C, A> MachineTypeAggregatedListCall<'a, C, A> where C: BorrowMut MachineTypeAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MachineTypeAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MachineTypeAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -45045,7 +47253,7 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.machineTypes.get", + dlg.begin(MethodInfo { id: "compute.machineTypes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -45089,7 +47297,7 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -45125,7 +47333,7 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45135,10 +47343,10 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45171,7 +47379,7 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> MachineTypeGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -45181,7 +47389,7 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> MachineTypeGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -45191,7 +47399,7 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *machine type* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn machine_type(mut self, new_value: &str) -> MachineTypeGetCall<'a, C, A> { self._machine_type = new_value.to_string(); @@ -45209,12 +47417,12 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -45231,17 +47439,17 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MachineTypeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MachineTypeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -45249,7 +47457,7 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A } -/// Retrieves the list of machine type resources available to the specified project. +/// Retrieves a list of machine type resources available to the specified project. /// /// A builder for the *list* method supported by a *machineType* resource. /// It is not used directly, but through a `MachineTypeMethods` instance. @@ -45276,9 +47484,9 @@ impl<'a, C, A> MachineTypeGetCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.machine_types().list("project", "zone") -/// .page_token("ipsum") -/// .max_results(66) -/// .filter("Lorem") +/// .page_token("est") +/// .max_results(5) +/// .filter("tempor") /// .doit(); /// # } /// ``` @@ -45310,7 +47518,7 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.machineTypes.list", + dlg.begin(MethodInfo { id: "compute.machineTypes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -45362,7 +47570,7 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -45398,7 +47606,7 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45408,10 +47616,10 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45444,7 +47652,7 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> MachineTypeListCall<'a, C, A> { self._project = new_value.to_string(); @@ -45454,31 +47662,35 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> MachineTypeListCall<'a, C, A> { self._zone = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> MachineTypeListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> MachineTypeListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> MachineTypeListCall<'a, C, A> { @@ -45497,12 +47709,12 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -45519,17 +47731,17 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MachineTypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MachineTypeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -45537,7 +47749,7 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, } -/// Retrieves the list of target VPN gateways grouped by scope. +/// Retrieves an aggregated list of target VPN gateways . /// /// A builder for the *aggregatedList* method supported by a *targetVpnGateway* resource. /// It is not used directly, but through a `TargetVpnGatewayMethods` instance. @@ -45564,9 +47776,9 @@ impl<'a, C, A> MachineTypeListCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.target_vpn_gateways().aggregated_list("project") -/// .page_token("sanctus") -/// .max_results(67) -/// .filter("consetetur") +/// .page_token("Lorem") +/// .max_results(62) +/// .filter("elitr") /// .doit(); /// # } /// ``` @@ -45597,7 +47809,7 @@ impl<'a, C, A> TargetVpnGatewayAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetVpnGateways.aggregatedList", + dlg.begin(MethodInfo { id: "compute.targetVpnGateways.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -45648,7 +47860,7 @@ impl<'a, C, A> TargetVpnGatewayAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -45684,7 +47896,7 @@ impl<'a, C, A> TargetVpnGatewayAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45694,10 +47906,10 @@ impl<'a, C, A> TargetVpnGatewayAggregatedListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayAggregatedListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> TargetVpnGatewayAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> TargetVpnGatewayAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TargetVpnGatewayAggregatedListCall<'a, C, A> { @@ -45773,12 +47989,12 @@ impl<'a, C, A> TargetVpnGatewayAggregatedListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetVpnGatewayAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetVpnGatewayAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -45869,7 +48085,7 @@ impl<'a, C, A> TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetVpnGateways.get", + dlg.begin(MethodInfo { id: "compute.targetVpnGateways.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -45913,7 +48129,7 @@ impl<'a, C, A> TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -45949,7 +48165,7 @@ impl<'a, C, A> TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45959,10 +48175,10 @@ impl<'a, C, A> TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut TargetVpnGatewayGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -46005,7 +48221,7 @@ impl<'a, C, A> TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut TargetVpnGatewayGetCall<'a, C, A> { self._region = new_value.to_string(); @@ -46015,7 +48231,7 @@ impl<'a, C, A> TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut TargetVpnGatewayGetCall<'a, C, A> { self._target_vpn_gateway = new_value.to_string(); @@ -46033,12 +48249,12 @@ impl<'a, C, A> TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetVpnGatewayGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetVpnGatewayGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46073,7 +48289,7 @@ impl<'a, C, A> TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut TargetVpnGatewayGetCall<'a, C, A> where C: BorrowMut TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetVpnGateways.list", + dlg.begin(MethodInfo { id: "compute.targetVpnGateways.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -46186,7 +48402,7 @@ impl<'a, C, A> TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -46222,7 +48438,7 @@ impl<'a, C, A> TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46232,10 +48448,10 @@ impl<'a, C, A> TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayListCall<'a, C, A> { self._project = new_value.to_string(); @@ -46278,31 +48494,35 @@ impl<'a, C, A> TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayListCall<'a, C, A> { self._region = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> TargetVpnGatewayListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> TargetVpnGatewayListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TargetVpnGatewayListCall<'a, C, A> { @@ -46321,12 +48541,12 @@ impl<'a, C, A> TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut TargetVpnGatewayListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetVpnGatewayListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetVpnGatewayListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46423,7 +48643,7 @@ impl<'a, C, A> TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetVpnGateways.insert", + dlg.begin(MethodInfo { id: "compute.targetVpnGateways.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -46466,14 +48686,14 @@ impl<'a, C, A> TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -46517,7 +48737,7 @@ impl<'a, C, A> TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46527,10 +48747,10 @@ impl<'a, C, A> TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut TargetVpnGatewayInsertCall<'a, C, A> { self._request = new_value; @@ -46572,7 +48792,7 @@ impl<'a, C, A> TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut TargetVpnGatewayInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -46582,7 +48802,7 @@ impl<'a, C, A> TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut TargetVpnGatewayInsertCall<'a, C, A> { self._region = new_value.to_string(); @@ -46600,12 +48820,12 @@ impl<'a, C, A> TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut TargetVpnGatewayInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetVpnGatewayInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetVpnGatewayInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46696,7 +48916,7 @@ impl<'a, C, A> TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetVpnGateways.delete", + dlg.begin(MethodInfo { id: "compute.targetVpnGateways.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -46740,7 +48960,7 @@ impl<'a, C, A> TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -46776,7 +48996,7 @@ impl<'a, C, A> TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46786,10 +49006,10 @@ impl<'a, C, A> TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut TargetVpnGatewayDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -46832,7 +49052,7 @@ impl<'a, C, A> TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut TargetVpnGatewayDeleteCall<'a, C, A> { self._region = new_value.to_string(); @@ -46842,7 +49062,7 @@ impl<'a, C, A> TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut TargetVpnGatewayDeleteCall<'a, C, A> { self._target_vpn_gateway = new_value.to_string(); @@ -46860,12 +49080,12 @@ impl<'a, C, A> TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetVpnGatewayDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetVpnGatewayDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46926,7 +49146,7 @@ impl<'a, C, A> TargetVpnGatewayDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.resize", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.resize", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -47002,7 +49222,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47038,7 +49258,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47048,10 +49268,10 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> { self._project = new_value.to_string(); @@ -47094,7 +49314,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> { self._zone = new_value.to_string(); @@ -47104,7 +49324,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -47114,7 +49334,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> { self._size = new_value; @@ -47132,12 +49352,12 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupManagerResizeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerResizeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47199,9 +49419,9 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.list", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -47285,7 +49505,7 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47321,7 +49541,7 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47331,10 +49551,10 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> { self._project = new_value.to_string(); @@ -47377,31 +49597,35 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> { self._zone = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> InstanceGroupManagerListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> InstanceGroupManagerListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> InstanceGroupManagerListCall<'a, C, A> { @@ -47420,12 +49644,12 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupManagerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47516,7 +49740,7 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.listManagedInstances", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.listManagedInstances", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -47560,7 +49784,7 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47596,7 +49820,7 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47606,10 +49830,10 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47638,11 +49862,11 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerListManagedInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -47652,7 +49876,7 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerListManagedInstanceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -47662,7 +49886,7 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerListManagedInstanceCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -47680,12 +49904,12 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -47702,17 +49926,17 @@ impl<'a, C, A> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where C: Bo } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerListManagedInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerListManagedInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47782,7 +50006,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.insert", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -47825,14 +50049,14 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -47876,7 +50100,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47886,10 +50110,10 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -47941,7 +50165,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> { self._zone = new_value.to_string(); @@ -47959,12 +50183,12 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupManagerInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48026,9 +50250,9 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerAggregatedListCall<'a, C, A> where C: BorrowM Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.aggregatedList", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -48110,7 +50334,7 @@ impl<'a, C, A> InstanceGroupManagerAggregatedListCall<'a, C, A> where C: BorrowM params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -48146,7 +50370,7 @@ impl<'a, C, A> InstanceGroupManagerAggregatedListCall<'a, C, A> where C: BorrowM match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48156,10 +50380,10 @@ impl<'a, C, A> InstanceGroupManagerAggregatedListCall<'a, C, A> where C: BorrowM if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48188,35 +50412,39 @@ impl<'a, C, A> InstanceGroupManagerAggregatedListCall<'a, C, A> where C: BorrowM } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> InstanceGroupManagerAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> InstanceGroupManagerAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> InstanceGroupManagerAggregatedListCall<'a, C, A> { @@ -48235,12 +50463,12 @@ impl<'a, C, A> InstanceGroupManagerAggregatedListCall<'a, C, A> where C: BorrowM } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -48257,17 +50485,17 @@ impl<'a, C, A> InstanceGroupManagerAggregatedListCall<'a, C, A> where C: BorrowM } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48338,7 +50566,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.deleteInstances", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.deleteInstances", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -48382,14 +50610,14 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -48433,7 +50661,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48443,10 +50671,10 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48478,17 +50706,17 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstanceGroupManagersDeleteInstancesRequest) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -48498,7 +50726,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -48508,7 +50736,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -48526,12 +50754,12 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -48548,17 +50776,17 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48629,7 +50857,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.setInstanceTemplate", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.setInstanceTemplate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -48673,14 +50901,14 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -48724,7 +50952,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48734,10 +50962,10 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48769,17 +50997,17 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstanceGroupManagersSetInstanceTemplateRequest) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> { self._project = new_value.to_string(); @@ -48789,7 +51017,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> { self._zone = new_value.to_string(); @@ -48799,7 +51027,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -48817,12 +51045,12 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -48839,17 +51067,17 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48920,7 +51148,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.setTargetPools", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.setTargetPools", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -48964,14 +51192,14 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -49015,7 +51243,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49025,10 +51253,10 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49060,17 +51288,17 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstanceGroupManagersSetTargetPoolsRequest) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> { self._project = new_value.to_string(); @@ -49080,7 +51308,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> { self._zone = new_value.to_string(); @@ -49090,7 +51318,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -49108,12 +51336,12 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -49130,17 +51358,17 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -49148,7 +51376,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu } -/// Deletes the specified managed instance group and all of the instances in that group. +/// Deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information. /// /// A builder for the *delete* method supported by a *instanceGroupManager* resource. /// It is not used directly, but through a `InstanceGroupManagerMethods` instance. @@ -49204,7 +51432,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.delete", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -49248,7 +51476,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -49284,7 +51512,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49294,10 +51522,10 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -49340,7 +51568,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -49350,7 +51578,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -49368,12 +51596,12 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupManagerDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -49464,7 +51692,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.get", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -49508,7 +51736,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -49544,7 +51772,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49554,10 +51782,10 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -49600,7 +51828,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -49610,7 +51838,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -49628,12 +51856,12 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupManagerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -49731,7 +51959,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.abandonInstances", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.abandonInstances", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -49775,14 +52003,14 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -49826,7 +52054,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49836,10 +52064,10 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49871,17 +52099,17 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstanceGroupManagersAbandonInstancesRequest) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -49891,7 +52119,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -49901,7 +52129,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -49919,12 +52147,12 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -49941,17 +52169,17 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -50022,7 +52250,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.recreateInstances", + dlg.begin(MethodInfo { id: "compute.instanceGroupManagers.recreateInstances", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -50066,14 +52294,14 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -50117,7 +52345,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50127,10 +52355,10 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50162,17 +52390,17 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstanceGroupManagersRecreateInstancesRequest) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -50182,7 +52410,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -50192,7 +52420,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -50210,12 +52438,12 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -50232,17 +52460,17 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -50311,7 +52539,7 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.projects.moveDisk", + dlg.begin(MethodInfo { id: "compute.projects.moveDisk", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -50353,14 +52581,14 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -50404,7 +52632,7 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50414,10 +52642,10 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50449,7 +52677,7 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: DiskMoveRequest) -> ProjectMoveDiskCall<'a, C, A> { self._request = new_value; @@ -50459,7 +52687,7 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ProjectMoveDiskCall<'a, C, A> { self._project = new_value.to_string(); @@ -50477,12 +52705,12 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -50499,17 +52727,17 @@ impl<'a, C, A> ProjectMoveDiskCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectMoveDiskCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectMoveDiskCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -50578,7 +52806,7 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.projects.setCommonInstanceMetadata", + dlg.begin(MethodInfo { id: "compute.projects.setCommonInstanceMetadata", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -50620,14 +52848,14 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -50671,7 +52899,7 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50681,10 +52909,10 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50716,7 +52944,7 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Metadata) -> ProjectSetCommonInstanceMetadataCall<'a, C, A> { self._request = new_value; @@ -50726,7 +52954,7 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ProjectSetCommonInstanceMetadataCall<'a, C, A> { self._project = new_value.to_string(); @@ -50744,12 +52972,12 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -50766,17 +52994,17 @@ impl<'a, C, A> ProjectSetCommonInstanceMetadataCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSetCommonInstanceMetadataCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSetCommonInstanceMetadataCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -50838,7 +53066,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.projects.get", + dlg.begin(MethodInfo { id: "compute.projects.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -50880,7 +53108,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -50916,7 +53144,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50926,10 +53154,10 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50962,7 +53190,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -50980,12 +53208,12 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -51002,17 +53230,17 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51081,7 +53309,7 @@ impl<'a, C, A> ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.projects.moveInstance", + dlg.begin(MethodInfo { id: "compute.projects.moveInstance", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -51123,14 +53351,14 @@ impl<'a, C, A> ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -51174,7 +53402,7 @@ impl<'a, C, A> ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51184,10 +53412,10 @@ impl<'a, C, A> ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut ProjectMoveInstanceCall<'a, C, A> { self._request = new_value; @@ -51229,7 +53457,7 @@ impl<'a, C, A> ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut ProjectMoveInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -51247,12 +53475,12 @@ impl<'a, C, A> ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut ProjectMoveInstanceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectMoveInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectMoveInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51348,7 +53576,7 @@ impl<'a, C, A> ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.projects.setUsageExportBucket", + dlg.begin(MethodInfo { id: "compute.projects.setUsageExportBucket", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -51390,14 +53618,14 @@ impl<'a, C, A> ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -51441,7 +53669,7 @@ impl<'a, C, A> ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51451,10 +53679,10 @@ impl<'a, C, A> ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut ProjectSetUsageExportBucketCall<'a, C, A> { self._request = new_value; @@ -51496,7 +53724,7 @@ impl<'a, C, A> ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut ProjectSetUsageExportBucketCall<'a, C, A> { self._project = new_value.to_string(); @@ -51514,12 +53742,12 @@ impl<'a, C, A> ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut ProjectSetUsageExportBucketCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSetUsageExportBucketCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSetUsageExportBucketCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51609,7 +53837,7 @@ impl<'a, C, A> HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpHealthChecks.get", + dlg.begin(MethodInfo { id: "compute.httpHealthChecks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -51652,7 +53880,7 @@ impl<'a, C, A> HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -51688,7 +53916,7 @@ impl<'a, C, A> HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51698,10 +53926,10 @@ impl<'a, C, A> HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpHealthCheckGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -51744,7 +53972,7 @@ impl<'a, C, A> HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpHealthCheckGetCall<'a, C, A> { self._http_health_check = new_value.to_string(); @@ -51762,12 +53990,12 @@ impl<'a, C, A> HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut HttpHealthCheckGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpHealthCheckGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpHealthCheckGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51864,7 +54092,7 @@ impl<'a, C, A> HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpHealthChecks.patch", + dlg.begin(MethodInfo { id: "compute.httpHealthChecks.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -51907,14 +54135,14 @@ impl<'a, C, A> HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -51958,7 +54186,7 @@ impl<'a, C, A> HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51968,10 +54196,10 @@ impl<'a, C, A> HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpHealthCheckPatchCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> HttpHealthCheckPatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -52023,7 +54251,7 @@ impl<'a, C, A> HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpHealthCheckPatchCall<'a, C, A> { self._http_health_check = new_value.to_string(); @@ -52041,12 +54269,12 @@ impl<'a, C, A> HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpHealthCheckPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpHealthCheckPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -52108,9 +54336,9 @@ impl<'a, C, A> HttpHealthCheckPatchCall<'a, C, A> where C: BorrowMut HttpHealthCheckListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpHealthChecks.list", + dlg.begin(MethodInfo { id: "compute.httpHealthChecks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -52192,7 +54420,7 @@ impl<'a, C, A> HttpHealthCheckListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -52228,7 +54456,7 @@ impl<'a, C, A> HttpHealthCheckListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52238,10 +54466,10 @@ impl<'a, C, A> HttpHealthCheckListCall<'a, C, A> where C: BorrowMut HttpHealthCheckListCall<'a, C, A> where C: BorrowMut HttpHealthCheckListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> HttpHealthCheckListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> HttpHealthCheckListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> HttpHealthCheckListCall<'a, C, A> { @@ -52317,12 +54549,12 @@ impl<'a, C, A> HttpHealthCheckListCall<'a, C, A> where C: BorrowMut HttpHealthCheckListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpHealthCheckListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpHealthCheckListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -52412,7 +54644,7 @@ impl<'a, C, A> HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpHealthChecks.delete", + dlg.begin(MethodInfo { id: "compute.httpHealthChecks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -52455,7 +54687,7 @@ impl<'a, C, A> HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -52491,7 +54723,7 @@ impl<'a, C, A> HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52501,10 +54733,10 @@ impl<'a, C, A> HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpHealthCheckDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -52547,7 +54779,7 @@ impl<'a, C, A> HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpHealthCheckDeleteCall<'a, C, A> { self._http_health_check = new_value.to_string(); @@ -52565,12 +54797,12 @@ impl<'a, C, A> HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut HttpHealthCheckDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpHealthCheckDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpHealthCheckDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -52666,7 +54898,7 @@ impl<'a, C, A> HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpHealthChecks.insert", + dlg.begin(MethodInfo { id: "compute.httpHealthChecks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -52708,14 +54940,14 @@ impl<'a, C, A> HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -52759,7 +54991,7 @@ impl<'a, C, A> HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52769,10 +55001,10 @@ impl<'a, C, A> HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpHealthCheckInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> HttpHealthCheckInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -52832,12 +55064,12 @@ impl<'a, C, A> HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut HttpHealthCheckInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpHealthCheckInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpHealthCheckInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -52934,7 +55166,7 @@ impl<'a, C, A> HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.httpHealthChecks.update", + dlg.begin(MethodInfo { id: "compute.httpHealthChecks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -52977,14 +55209,14 @@ impl<'a, C, A> HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -53028,7 +55260,7 @@ impl<'a, C, A> HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53038,10 +55270,10 @@ impl<'a, C, A> HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpHealthCheckUpdateCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> HttpHealthCheckUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -53093,7 +55325,7 @@ impl<'a, C, A> HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpHealthCheckUpdateCall<'a, C, A> { self._http_health_check = new_value.to_string(); @@ -53111,12 +55343,12 @@ impl<'a, C, A> HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut HttpHealthCheckUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HttpHealthCheckUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HttpHealthCheckUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53206,7 +55438,7 @@ impl<'a, C, A> InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceTemplates.delete", + dlg.begin(MethodInfo { id: "compute.instanceTemplates.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -53249,7 +55481,7 @@ impl<'a, C, A> InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -53285,7 +55517,7 @@ impl<'a, C, A> InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53295,10 +55527,10 @@ impl<'a, C, A> InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut InstanceTemplateDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -53341,7 +55573,7 @@ impl<'a, C, A> InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut InstanceTemplateDeleteCall<'a, C, A> { self._instance_template = new_value.to_string(); @@ -53359,12 +55591,12 @@ impl<'a, C, A> InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut InstanceTemplateDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceTemplateDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceTemplateDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53454,7 +55686,7 @@ impl<'a, C, A> InstanceTemplateGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceTemplates.get", + dlg.begin(MethodInfo { id: "compute.instanceTemplates.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -53497,7 +55729,7 @@ impl<'a, C, A> InstanceTemplateGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -53533,7 +55765,7 @@ impl<'a, C, A> InstanceTemplateGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53543,10 +55775,10 @@ impl<'a, C, A> InstanceTemplateGetCall<'a, C, A> where C: BorrowMut InstanceTemplateGetCall<'a, C, A> where C: BorrowMut InstanceTemplateGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -53589,7 +55821,7 @@ impl<'a, C, A> InstanceTemplateGetCall<'a, C, A> where C: BorrowMut InstanceTemplateGetCall<'a, C, A> { self._instance_template = new_value.to_string(); @@ -53607,12 +55839,12 @@ impl<'a, C, A> InstanceTemplateGetCall<'a, C, A> where C: BorrowMut InstanceTemplateGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceTemplateGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceTemplateGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53674,9 +55906,9 @@ impl<'a, C, A> InstanceTemplateGetCall<'a, C, A> where C: BorrowMut InstanceTemplateListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceTemplates.list", + dlg.begin(MethodInfo { id: "compute.instanceTemplates.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -53758,7 +55990,7 @@ impl<'a, C, A> InstanceTemplateListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -53794,7 +56026,7 @@ impl<'a, C, A> InstanceTemplateListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53804,10 +56036,10 @@ impl<'a, C, A> InstanceTemplateListCall<'a, C, A> where C: BorrowMut InstanceTemplateListCall<'a, C, A> where C: BorrowMut InstanceTemplateListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> InstanceTemplateListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> InstanceTemplateListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> InstanceTemplateListCall<'a, C, A> { @@ -53883,12 +56119,12 @@ impl<'a, C, A> InstanceTemplateListCall<'a, C, A> where C: BorrowMut InstanceTemplateListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceTemplateListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceTemplateListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53923,7 +56159,7 @@ impl<'a, C, A> InstanceTemplateListCall<'a, C, A> where C: BorrowMut InstanceTemplateInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.instanceTemplates.insert", + dlg.begin(MethodInfo { id: "compute.instanceTemplates.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -54026,14 +56262,14 @@ impl<'a, C, A> InstanceTemplateInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -54077,7 +56313,7 @@ impl<'a, C, A> InstanceTemplateInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54087,10 +56323,10 @@ impl<'a, C, A> InstanceTemplateInsertCall<'a, C, A> where C: BorrowMut InstanceTemplateInsertCall<'a, C, A> where C: BorrowMut InstanceTemplateInsertCall<'a, C, A> { self._request = new_value; self } - /// The project ID for this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceTemplateInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -54150,12 +56386,12 @@ impl<'a, C, A> InstanceTemplateInsertCall<'a, C, A> where C: BorrowMut InstanceTemplateInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceTemplateInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceTemplateInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -54245,7 +56481,7 @@ impl<'a, C, A> TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpProxies.delete", + dlg.begin(MethodInfo { id: "compute.targetHttpProxies.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -54288,7 +56524,7 @@ impl<'a, C, A> TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -54324,7 +56560,7 @@ impl<'a, C, A> TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54334,10 +56570,10 @@ impl<'a, C, A> TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpProxyDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -54380,7 +56616,7 @@ impl<'a, C, A> TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpProxyDeleteCall<'a, C, A> { self._target_http_proxy = new_value.to_string(); @@ -54398,12 +56634,12 @@ impl<'a, C, A> TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetHttpProxyDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpProxyDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -54465,9 +56701,9 @@ impl<'a, C, A> TargetHttpProxyDeleteCall<'a, C, A> where C: BorrowMut TargetHttpProxyListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpProxies.list", + dlg.begin(MethodInfo { id: "compute.targetHttpProxies.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -54549,7 +56785,7 @@ impl<'a, C, A> TargetHttpProxyListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -54585,7 +56821,7 @@ impl<'a, C, A> TargetHttpProxyListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54595,10 +56831,10 @@ impl<'a, C, A> TargetHttpProxyListCall<'a, C, A> where C: BorrowMut TargetHttpProxyListCall<'a, C, A> where C: BorrowMut TargetHttpProxyListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> TargetHttpProxyListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> TargetHttpProxyListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TargetHttpProxyListCall<'a, C, A> { @@ -54674,12 +56914,12 @@ impl<'a, C, A> TargetHttpProxyListCall<'a, C, A> where C: BorrowMut TargetHttpProxyListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetHttpProxyListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpProxyListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -54776,7 +57016,7 @@ impl<'a, C, A> TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpProxies.setUrlMap", + dlg.begin(MethodInfo { id: "compute.targetHttpProxies.setUrlMap", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -54819,14 +57059,14 @@ impl<'a, C, A> TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -54870,7 +57110,7 @@ impl<'a, C, A> TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54880,10 +57120,10 @@ impl<'a, C, A> TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpProxySetUrlMapCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetHttpProxySetUrlMapCall<'a, C, A> { self._project = new_value.to_string(); @@ -54935,7 +57175,7 @@ impl<'a, C, A> TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpProxySetUrlMapCall<'a, C, A> { self._target_http_proxy = new_value.to_string(); @@ -54953,12 +57193,12 @@ impl<'a, C, A> TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut TargetHttpProxySetUrlMapCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetHttpProxySetUrlMapCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpProxySetUrlMapCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55048,7 +57288,7 @@ impl<'a, C, A> TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpProxies.get", + dlg.begin(MethodInfo { id: "compute.targetHttpProxies.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -55091,7 +57331,7 @@ impl<'a, C, A> TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -55127,7 +57367,7 @@ impl<'a, C, A> TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55137,10 +57377,10 @@ impl<'a, C, A> TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpProxyGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -55183,7 +57423,7 @@ impl<'a, C, A> TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpProxyGetCall<'a, C, A> { self._target_http_proxy = new_value.to_string(); @@ -55201,12 +57441,12 @@ impl<'a, C, A> TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut TargetHttpProxyGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetHttpProxyGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpProxyGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55302,7 +57542,7 @@ impl<'a, C, A> TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.targetHttpProxies.insert", + dlg.begin(MethodInfo { id: "compute.targetHttpProxies.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -55344,14 +57584,14 @@ impl<'a, C, A> TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -55395,7 +57635,7 @@ impl<'a, C, A> TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55405,10 +57645,10 @@ impl<'a, C, A> TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpProxyInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TargetHttpProxyInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -55468,12 +57708,12 @@ impl<'a, C, A> TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut TargetHttpProxyInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetHttpProxyInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetHttpProxyInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55563,7 +57803,7 @@ impl<'a, C, A> SslCertificateDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.sslCertificates.delete", + dlg.begin(MethodInfo { id: "compute.sslCertificates.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -55606,7 +57846,7 @@ impl<'a, C, A> SslCertificateDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -55642,7 +57882,7 @@ impl<'a, C, A> SslCertificateDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55652,10 +57892,10 @@ impl<'a, C, A> SslCertificateDeleteCall<'a, C, A> where C: BorrowMut SslCertificateDeleteCall<'a, C, A> where C: BorrowMut SslCertificateDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -55698,7 +57938,7 @@ impl<'a, C, A> SslCertificateDeleteCall<'a, C, A> where C: BorrowMut SslCertificateDeleteCall<'a, C, A> { self._ssl_certificate = new_value.to_string(); @@ -55716,12 +57956,12 @@ impl<'a, C, A> SslCertificateDeleteCall<'a, C, A> where C: BorrowMut SslCertificateDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SslCertificateDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SslCertificateDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55783,9 +58023,9 @@ impl<'a, C, A> SslCertificateDeleteCall<'a, C, A> where C: BorrowMut SslCertificateListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.sslCertificates.list", + dlg.begin(MethodInfo { id: "compute.sslCertificates.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -55867,7 +58107,7 @@ impl<'a, C, A> SslCertificateListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -55903,7 +58143,7 @@ impl<'a, C, A> SslCertificateListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55913,10 +58153,10 @@ impl<'a, C, A> SslCertificateListCall<'a, C, A> where C: BorrowMut SslCertificateListCall<'a, C, A> where C: BorrowMut SslCertificateListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> SslCertificateListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> SslCertificateListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> SslCertificateListCall<'a, C, A> { @@ -55992,12 +58236,12 @@ impl<'a, C, A> SslCertificateListCall<'a, C, A> where C: BorrowMut SslCertificateListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SslCertificateListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SslCertificateListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56093,7 +58337,7 @@ impl<'a, C, A> SslCertificateInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.sslCertificates.insert", + dlg.begin(MethodInfo { id: "compute.sslCertificates.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -56135,14 +58379,14 @@ impl<'a, C, A> SslCertificateInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -56186,7 +58430,7 @@ impl<'a, C, A> SslCertificateInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56196,10 +58440,10 @@ impl<'a, C, A> SslCertificateInsertCall<'a, C, A> where C: BorrowMut SslCertificateInsertCall<'a, C, A> where C: BorrowMut SslCertificateInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> SslCertificateInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -56259,12 +58503,12 @@ impl<'a, C, A> SslCertificateInsertCall<'a, C, A> where C: BorrowMut SslCertificateInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SslCertificateInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SslCertificateInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56354,7 +58598,7 @@ impl<'a, C, A> SslCertificateGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.sslCertificates.get", + dlg.begin(MethodInfo { id: "compute.sslCertificates.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -56397,7 +58641,7 @@ impl<'a, C, A> SslCertificateGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -56433,7 +58677,7 @@ impl<'a, C, A> SslCertificateGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56443,10 +58687,10 @@ impl<'a, C, A> SslCertificateGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56475,11 +58719,11 @@ impl<'a, C, A> SslCertificateGetCall<'a, C, A> where C: BorrowMut } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> SslCertificateGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -56489,7 +58733,7 @@ impl<'a, C, A> SslCertificateGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *ssl certificate* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ssl_certificate(mut self, new_value: &str) -> SslCertificateGetCall<'a, C, A> { self._ssl_certificate = new_value.to_string(); @@ -56507,12 +58751,12 @@ impl<'a, C, A> SslCertificateGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -56529,17 +58773,17 @@ impl<'a, C, A> SslCertificateGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SslCertificateGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SslCertificateGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56603,7 +58847,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.zoneOperations.delete", + dlg.begin(MethodInfo { id: "compute.zoneOperations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -56646,7 +58890,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -56682,7 +58926,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56692,10 +58936,10 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -56728,7 +58972,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -56738,7 +58982,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> { self._operation = new_value.to_string(); @@ -56756,12 +59000,12 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ZoneOperationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56796,7 +59040,7 @@ impl<'a, C, A> ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationDeleteCall<'a, C, A> where C: BorrowMut ZoneOperationListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.zoneOperations.list", + dlg.begin(MethodInfo { id: "compute.zoneOperations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -56909,7 +59153,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -56945,7 +59189,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56955,10 +59199,10 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56991,7 +59235,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._project = new_value.to_string(); @@ -57001,31 +59245,35 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._zone = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> ZoneOperationListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { @@ -57044,12 +59292,12 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -57066,17 +59314,17 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57140,7 +59388,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.zoneOperations.get", + dlg.begin(MethodInfo { id: "compute.zoneOperations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -57184,7 +59432,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -57220,7 +59468,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57230,10 +59478,10 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57266,7 +59514,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -57276,7 +59524,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -57286,7 +59534,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *operation* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operation(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -57304,12 +59552,12 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -57326,17 +59574,17 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57399,7 +59647,7 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.routes.get", + dlg.begin(MethodInfo { id: "compute.routes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -57442,7 +59690,7 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -57478,7 +59726,7 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57488,10 +59736,10 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57520,11 +59768,11 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> RouteGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -57534,7 +59782,7 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *route* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn route(mut self, new_value: &str) -> RouteGetCall<'a, C, A> { self._route = new_value.to_string(); @@ -57552,12 +59800,12 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -57574,17 +59822,17 @@ impl<'a, C, A> RouteGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RouteGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RouteGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57653,7 +59901,7 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.routes.insert", + dlg.begin(MethodInfo { id: "compute.routes.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -57695,14 +59943,14 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -57746,7 +59994,7 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57756,10 +60004,10 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57791,17 +60039,17 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Route) -> RouteInsertCall<'a, C, A> { self._request = new_value; self } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> RouteInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -57819,12 +60067,12 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -57841,17 +60089,17 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RouteInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RouteInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57886,9 +60134,9 @@ impl<'a, C, A> RouteInsertCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.routes().list("project") -/// .page_token("clita") -/// .max_results(95) -/// .filter("sit") +/// .page_token("sit") +/// .max_results(25) +/// .filter("nonumy") /// .doit(); /// # } /// ``` @@ -57919,7 +60167,7 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.routes.list", + dlg.begin(MethodInfo { id: "compute.routes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -57970,7 +60218,7 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -58006,7 +60254,7 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58016,10 +60264,10 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58048,35 +60296,39 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> RouteListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> RouteListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> RouteListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> RouteListCall<'a, C, A> { @@ -58095,12 +60347,12 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -58117,17 +60369,17 @@ impl<'a, C, A> RouteListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RouteListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RouteListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58190,7 +60442,7 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.routes.delete", + dlg.begin(MethodInfo { id: "compute.routes.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -58233,7 +60485,7 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -58269,7 +60521,7 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58279,10 +60531,10 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58311,11 +60563,11 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o } - /// Name of the project scoping this request. + /// Project ID for this request. /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> RouteDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -58325,7 +60577,7 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *route* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn route(mut self, new_value: &str) -> RouteDeleteCall<'a, C, A> { self._route = new_value.to_string(); @@ -58343,12 +60595,12 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -58365,17 +60617,17 @@ impl<'a, C, A> RouteDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RouteDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RouteDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58445,7 +60697,7 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.firewalls.patch", + dlg.begin(MethodInfo { id: "compute.firewalls.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -58488,14 +60740,14 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -58539,7 +60791,7 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58549,10 +60801,10 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58584,7 +60836,7 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Firewall) -> FirewallPatchCall<'a, C, A> { self._request = new_value; @@ -58594,7 +60846,7 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> FirewallPatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -58604,7 +60856,7 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *firewall* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn firewall(mut self, new_value: &str) -> FirewallPatchCall<'a, C, A> { self._firewall = new_value.to_string(); @@ -58622,12 +60874,12 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -58644,17 +60896,17 @@ impl<'a, C, A> FirewallPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FirewallPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FirewallPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58717,7 +60969,7 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.firewalls.get", + dlg.begin(MethodInfo { id: "compute.firewalls.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -58760,7 +61012,7 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -58796,7 +61048,7 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58806,10 +61058,10 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58842,7 +61094,7 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> FirewallGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -58852,7 +61104,7 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *firewall* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn firewall(mut self, new_value: &str) -> FirewallGetCall<'a, C, A> { self._firewall = new_value.to_string(); @@ -58870,12 +61122,12 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -58892,17 +61144,17 @@ impl<'a, C, A> FirewallGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FirewallGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FirewallGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58972,7 +61224,7 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.firewalls.update", + dlg.begin(MethodInfo { id: "compute.firewalls.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -59015,14 +61267,14 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -59066,7 +61318,7 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59076,10 +61328,10 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59111,7 +61363,7 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Firewall) -> FirewallUpdateCall<'a, C, A> { self._request = new_value; @@ -59121,7 +61373,7 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> FirewallUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -59131,7 +61383,7 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *firewall* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn firewall(mut self, new_value: &str) -> FirewallUpdateCall<'a, C, A> { self._firewall = new_value.to_string(); @@ -59149,12 +61401,12 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59171,17 +61423,17 @@ impl<'a, C, A> FirewallUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FirewallUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FirewallUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -59250,7 +61502,7 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.firewalls.insert", + dlg.begin(MethodInfo { id: "compute.firewalls.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -59292,14 +61544,14 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -59343,7 +61595,7 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59353,10 +61605,10 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59388,7 +61640,7 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Firewall) -> FirewallInsertCall<'a, C, A> { self._request = new_value; @@ -59398,7 +61650,7 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> FirewallInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -59416,12 +61668,12 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59438,17 +61690,17 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FirewallInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FirewallInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -59483,9 +61735,9 @@ impl<'a, C, A> FirewallInsertCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.firewalls().list("project") -/// .page_token("et") -/// .max_results(13) -/// .filter("amet.") +/// .page_token("kasd") +/// .max_results(9) +/// .filter("ut") /// .doit(); /// # } /// ``` @@ -59516,7 +61768,7 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.firewalls.list", + dlg.begin(MethodInfo { id: "compute.firewalls.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -59567,7 +61819,7 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -59603,7 +61855,7 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59613,10 +61865,10 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59649,31 +61901,35 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> FirewallListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> FirewallListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> FirewallListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> FirewallListCall<'a, C, A> { @@ -59692,12 +61948,12 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59714,17 +61970,17 @@ impl<'a, C, A> FirewallListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FirewallListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FirewallListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -59787,7 +62043,7 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.firewalls.delete", + dlg.begin(MethodInfo { id: "compute.firewalls.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -59830,7 +62086,7 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -59866,7 +62122,7 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59876,10 +62132,10 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59912,7 +62168,7 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> FirewallDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -59922,7 +62178,7 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *firewall* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn firewall(mut self, new_value: &str) -> FirewallDeleteCall<'a, C, A> { self._firewall = new_value.to_string(); @@ -59940,12 +62196,12 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59962,17 +62218,17 @@ impl<'a, C, A> FirewallDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FirewallDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FirewallDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60042,7 +62298,7 @@ impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.vpnTunnels.insert", + dlg.begin(MethodInfo { id: "compute.vpnTunnels.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -60085,14 +62341,14 @@ impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -60136,7 +62392,7 @@ impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60146,10 +62402,10 @@ impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60181,7 +62437,7 @@ impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: VpnTunnel) -> VpnTunnelInsertCall<'a, C, A> { self._request = new_value; @@ -60191,7 +62447,7 @@ impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> VpnTunnelInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -60201,7 +62457,7 @@ impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> VpnTunnelInsertCall<'a, C, A> { self._region = new_value.to_string(); @@ -60219,12 +62475,12 @@ impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -60241,17 +62497,17 @@ impl<'a, C, A> VpnTunnelInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VpnTunnelInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VpnTunnelInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60315,7 +62571,7 @@ impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.vpnTunnels.delete", + dlg.begin(MethodInfo { id: "compute.vpnTunnels.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -60359,7 +62615,7 @@ impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -60395,7 +62651,7 @@ impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60405,10 +62661,10 @@ impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60441,7 +62697,7 @@ impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -60451,7 +62707,7 @@ impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { self._region = new_value.to_string(); @@ -60461,7 +62717,7 @@ impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *vpn tunnel* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn vpn_tunnel(mut self, new_value: &str) -> VpnTunnelDeleteCall<'a, C, A> { self._vpn_tunnel = new_value.to_string(); @@ -60479,12 +62735,12 @@ impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -60501,17 +62757,17 @@ impl<'a, C, A> VpnTunnelDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VpnTunnelDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VpnTunnelDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60575,7 +62831,7 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.vpnTunnels.get", + dlg.begin(MethodInfo { id: "compute.vpnTunnels.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -60619,7 +62875,7 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -60655,7 +62911,7 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60665,10 +62921,10 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60701,7 +62957,7 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> VpnTunnelGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -60711,7 +62967,7 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> VpnTunnelGetCall<'a, C, A> { self._region = new_value.to_string(); @@ -60721,7 +62977,7 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *vpn tunnel* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn vpn_tunnel(mut self, new_value: &str) -> VpnTunnelGetCall<'a, C, A> { self._vpn_tunnel = new_value.to_string(); @@ -60739,12 +62995,12 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -60761,17 +63017,17 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VpnTunnelGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VpnTunnelGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60779,7 +63035,7 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: } -/// Retrieves the list of VpnTunnel resources contained in the specified project and region. +/// Retrieves a list of VpnTunnel resources contained in the specified project and region. /// /// A builder for the *list* method supported by a *vpnTunnel* resource. /// It is not used directly, but through a `VpnTunnelMethods` instance. @@ -60806,9 +63062,9 @@ impl<'a, C, A> VpnTunnelGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.vpn_tunnels().list("project", "region") -/// .page_token("accusam") -/// .max_results(27) -/// .filter("clita") +/// .page_token("clita") +/// .max_results(26) +/// .filter("sea") /// .doit(); /// # } /// ``` @@ -60840,7 +63096,7 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.vpnTunnels.list", + dlg.begin(MethodInfo { id: "compute.vpnTunnels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -60892,7 +63148,7 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -60928,7 +63184,7 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60938,10 +63194,10 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60974,7 +63230,7 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> VpnTunnelListCall<'a, C, A> { self._project = new_value.to_string(); @@ -60984,31 +63240,35 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> VpnTunnelListCall<'a, C, A> { self._region = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> VpnTunnelListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> VpnTunnelListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> VpnTunnelListCall<'a, C, A> { @@ -61027,12 +63287,12 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -61049,17 +63309,17 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VpnTunnelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VpnTunnelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61067,7 +63327,7 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: } -/// Retrieves the list of VPN tunnels grouped by scope. +/// Retrieves an aggregated list of VPN tunnels. /// /// A builder for the *aggregatedList* method supported by a *vpnTunnel* resource. /// It is not used directly, but through a `VpnTunnelMethods` instance. @@ -61094,9 +63354,9 @@ impl<'a, C, A> VpnTunnelListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.vpn_tunnels().aggregated_list("project") -/// .page_token("ut") -/// .max_results(89) -/// .filter("diam") +/// .page_token("tempor") +/// .max_results(87) +/// .filter("dolor") /// .doit(); /// # } /// ``` @@ -61127,7 +63387,7 @@ impl<'a, C, A> VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.vpnTunnels.aggregatedList", + dlg.begin(MethodInfo { id: "compute.vpnTunnels.aggregatedList", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -61178,7 +63438,7 @@ impl<'a, C, A> VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -61214,7 +63474,7 @@ impl<'a, C, A> VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61224,10 +63484,10 @@ impl<'a, C, A> VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut VpnTunnelAggregatedListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> VpnTunnelAggregatedListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> VpnTunnelAggregatedListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> VpnTunnelAggregatedListCall<'a, C, A> { @@ -61303,12 +63567,12 @@ impl<'a, C, A> VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> VpnTunnelAggregatedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VpnTunnelAggregatedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61343,7 +63607,7 @@ impl<'a, C, A> VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut VpnTunnelAggregatedListCall<'a, C, A> where C: BorrowMut RegionOperationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.regionOperations.list", + dlg.begin(MethodInfo { id: "compute.regionOperations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -61456,7 +63720,7 @@ impl<'a, C, A> RegionOperationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -61492,7 +63756,7 @@ impl<'a, C, A> RegionOperationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61502,10 +63766,10 @@ impl<'a, C, A> RegionOperationListCall<'a, C, A> where C: BorrowMut RegionOperationListCall<'a, C, A> where C: BorrowMut RegionOperationListCall<'a, C, A> { self._project = new_value.to_string(); @@ -61548,31 +63812,35 @@ impl<'a, C, A> RegionOperationListCall<'a, C, A> where C: BorrowMut RegionOperationListCall<'a, C, A> { self._region = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> RegionOperationListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> RegionOperationListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> RegionOperationListCall<'a, C, A> { @@ -61591,12 +63859,12 @@ impl<'a, C, A> RegionOperationListCall<'a, C, A> where C: BorrowMut RegionOperationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RegionOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RegionOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61687,7 +63955,7 @@ impl<'a, C, A> RegionOperationDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.regionOperations.delete", + dlg.begin(MethodInfo { id: "compute.regionOperations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -61730,7 +63998,7 @@ impl<'a, C, A> RegionOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -61766,7 +64034,7 @@ impl<'a, C, A> RegionOperationDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61776,10 +64044,10 @@ impl<'a, C, A> RegionOperationDeleteCall<'a, C, A> where C: BorrowMut RegionOperationDeleteCall<'a, C, A> where C: BorrowMut RegionOperationDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -61812,7 +64080,7 @@ impl<'a, C, A> RegionOperationDeleteCall<'a, C, A> where C: BorrowMut RegionOperationDeleteCall<'a, C, A> { self._region = new_value.to_string(); @@ -61822,7 +64090,7 @@ impl<'a, C, A> RegionOperationDeleteCall<'a, C, A> where C: BorrowMut RegionOperationDeleteCall<'a, C, A> { self._operation = new_value.to_string(); @@ -61840,12 +64108,12 @@ impl<'a, C, A> RegionOperationDeleteCall<'a, C, A> where C: BorrowMut RegionOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RegionOperationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RegionOperationDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61936,7 +64204,7 @@ impl<'a, C, A> RegionOperationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "compute.regionOperations.get", + dlg.begin(MethodInfo { id: "compute.regionOperations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -61980,7 +64248,7 @@ impl<'a, C, A> RegionOperationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -62016,7 +64284,7 @@ impl<'a, C, A> RegionOperationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62026,10 +64294,10 @@ impl<'a, C, A> RegionOperationGetCall<'a, C, A> where C: BorrowMut RegionOperationGetCall<'a, C, A> where C: BorrowMut RegionOperationGetCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Name of the zone scoping this request. + /// Name of the region scoping this request. /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> RegionOperationGetCall<'a, C, A> { self._region = new_value.to_string(); @@ -62082,7 +64350,7 @@ impl<'a, C, A> RegionOperationGetCall<'a, C, A> where C: BorrowMut RegionOperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -62100,12 +64368,12 @@ impl<'a, C, A> RegionOperationGetCall<'a, C, A> where C: BorrowMut RegionOperationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RegionOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RegionOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/container1-cli/Cargo.toml b/gen/container1-cli/Cargo.toml index 8696d3a9cc..2ee95b7ff5 100644 --- a/gen/container1-cli/Cargo.toml +++ b/gen/container1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-container1-cli" -version = "0.3.2+20150603" +version = "0.3.3+20150603" authors = ["Sebastian Thiel "] description = "A complete library to interact with container (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/container1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/container1-cli/LICENSE.md b/gen/container1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/container1-cli/LICENSE.md +++ b/gen/container1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/container1-cli/README.md b/gen/container1-cli/README.md index 49681427aa..0c81dee5fd 100644 --- a/gen/container1-cli/README.md +++ b/gen/container1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *container* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/container1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/container1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/container1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/container1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/container1-cli). # Usage -This documentation was generated from the *container* API at revision *20150603*. The CLI is at version *0.3.2*. +This documentation was generated from the *container* API at revision *20150603*. The CLI is at version *0.3.3*. ```bash container1 [options] @@ -41,18 +41,18 @@ container1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/container1-cli/mkdocs.yml b/gen/container1-cli/mkdocs.yml index 3d959737c4..19f19cb87d 100644 --- a/gen/container1-cli/mkdocs.yml +++ b/gen/container1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: container v0.3.2+20150603 +site_name: container v0.3.3+20150603 site_url: http://byron.github.io/google-apis-rs/google-container1-cli site_description: Write integrating applications with bcore @@ -20,5 +20,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/container1-cli/src/main.rs b/gen/container1-cli/src/main.rs index 5045637494..fdb231b7c3 100644 --- a/gen/container1-cli/src/main.rs +++ b/gen/container1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Container>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _projects_zones_clusters_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _projects_zones_clusters_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "cluster.status" => Some(("cluster.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.node-ipv4-cidr-size" => Some(("cluster.nodeIpv4CidrSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -107,7 +107,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreateClusterRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().zones_clusters_create(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -120,7 +120,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -133,7 +133,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -156,10 +156,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_clusters_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_clusters_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_clusters_delete(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("cluster-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -172,7 +172,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -185,7 +185,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -208,10 +208,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_clusters_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_clusters_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_clusters_get(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("cluster-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -224,7 +224,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -237,7 +237,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -260,10 +260,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_clusters_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_clusters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_clusters_list(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -276,7 +276,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -289,7 +289,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -312,13 +312,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_clusters_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_clusters_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -332,8 +332,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update.desired-node-version" => Some(("update.desiredNodeVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -348,7 +348,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UpdateClusterRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().zones_clusters_update(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("cluster-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -361,7 +361,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -374,7 +374,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -397,10 +397,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_get_serverconfig(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_get_serverconfig(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_get_serverconfig(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -413,7 +413,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -426,7 +426,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -449,10 +449,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_operations_get(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("operation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -465,7 +465,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -478,7 +478,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -501,10 +501,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_operations_list(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -517,7 +517,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -530,7 +530,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -607,14 +607,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "container1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "container1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -634,7 +634,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -677,7 +677,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("projects", "methods: 'zones-clusters-create', 'zones-clusters-delete', 'zones-clusters-get', 'zones-clusters-list', 'zones-clusters-update', 'zones-get-serverconfig', 'zones-operations-get' and 'zones-operations-list'", vec![ - ("zones-clusters-create", + ("zones-clusters-create", Some(r##"Creates a cluster, consisting of the specified number and type of Google Compute Engine instances, plus a Kubernetes master endpoint. By default, the cluster is created in the project's [default network](/compute/docs/networking#networks_1). One firewall is added for the cluster. After cluster creation, the cluster creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range is being used by the cluster."##), "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_zones-clusters-create", vec![ @@ -711,7 +711,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-clusters-delete", + ("zones-clusters-delete", Some(r##"Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted."##), "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_zones-clusters-delete", vec![ @@ -745,7 +745,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-clusters-get", + ("zones-clusters-get", Some(r##"Gets a specific cluster."##), "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_zones-clusters-get", vec![ @@ -779,7 +779,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-clusters-list", + ("zones-clusters-list", Some(r##"Lists all clusters owned by a project in either the specified zone or all zones."##), "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_zones-clusters-list", vec![ @@ -807,7 +807,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-clusters-update", + ("zones-clusters-update", Some(r##"Update settings of a specific cluster."##), "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_zones-clusters-update", vec![ @@ -847,7 +847,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-get-serverconfig", + ("zones-get-serverconfig", Some(r##"Returns configuration info about the Container Engine service."##), "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_zones-get-serverconfig", vec![ @@ -875,7 +875,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-operations-get", + ("zones-operations-get", Some(r##"Gets the specified operation."##), "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_zones-operations-get", vec![ @@ -909,7 +909,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-operations-list", + ("zones-operations-list", Some(r##"Lists all operations in a project in a specific zone or all zones."##), "Details at http://byron.github.io/google-apis-rs/google_container1_cli/projects_zones-operations-list", vec![ @@ -943,7 +943,7 @@ fn main() { let mut app = App::new("container1") .author("Sebastian Thiel ") - .version("0.3.2+20150603") + .version("0.3.3+20150603") .about("The Google Container Engine API is used for building and managing container based applications, powered by the open source Kubernetes technology.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_container1_cli") .arg(Arg::with_name("url") @@ -967,7 +967,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -978,7 +978,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/container1/Cargo.toml b/gen/container1/Cargo.toml index 95c25e9062..6ac5ab197e 100644 --- a/gen/container1/Cargo.toml +++ b/gen/container1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-container1" -version = "0.1.10+20150603" +version = "0.1.11+20150603" authors = ["Sebastian Thiel "] description = "A complete library to interact with container (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/container1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/container1/LICENSE.md b/gen/container1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/container1/LICENSE.md +++ b/gen/container1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/container1/README.md b/gen/container1/README.md index acdf8c0d87..e848da1f6b 100644 --- a/gen/container1/README.md +++ b/gen/container1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-container1` library allows access to all features of the *Google container* service. -This documentation was generated from *container* crate version *0.1.10+20150603*, where *20150603* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *container* crate version *0.1.11+20150603*, where *20150603* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *container* *v1* API can be found at the [official documentation site](https://cloud.google.com/container-engine/). diff --git a/gen/container1/src/cmn.rs b/gen/container1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/container1/src/cmn.rs +++ b/gen/container1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/container1/src/lib.rs b/gen/container1/src/lib.rs index f742e70e22..9dd1173946 100644 --- a/gen/container1/src/lib.rs +++ b/gen/container1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *container* crate version *0.1.10+20150603*, where *20150603* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *container* crate version *0.1.11+20150603*, where *20150603* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *container* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/container-engine/). diff --git a/gen/container1/src/lib.rs.in b/gen/container1/src/lib.rs.in index dac3c78383..89500e7608 100644 --- a/gen/container1/src/lib.rs.in +++ b/gen/container1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -132,7 +133,7 @@ impl<'a, C, A> Container Container { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -141,7 +142,7 @@ impl<'a, C, A> Container } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -689,7 +690,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.clusters.get", + dlg.begin(MethodInfo { id: "container.projects.zones.clusters.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -733,7 +734,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -769,7 +770,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -779,10 +780,10 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -825,7 +826,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -835,7 +836,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> { self._cluster_id = new_value.to_string(); @@ -853,12 +854,12 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneClusterGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneClusterGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -954,7 +955,7 @@ impl<'a, C, A> ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.getServerconfig", + dlg.begin(MethodInfo { id: "container.projects.zones.getServerconfig", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -997,7 +998,7 @@ impl<'a, C, A> ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1033,7 +1034,7 @@ impl<'a, C, A> ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1043,10 +1044,10 @@ impl<'a, C, A> ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut ProjectZoneGetServerconfigCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1089,7 +1090,7 @@ impl<'a, C, A> ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut ProjectZoneGetServerconfigCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1107,12 +1108,12 @@ impl<'a, C, A> ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneGetServerconfigCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneGetServerconfigCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1209,7 +1210,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.clusters.delete", + dlg.begin(MethodInfo { id: "container.projects.zones.clusters.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1253,7 +1254,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1289,7 +1290,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1299,10 +1300,10 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1345,7 +1346,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1355,7 +1356,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> { self._cluster_id = new_value.to_string(); @@ -1373,12 +1374,12 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneClusterDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneClusterDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1474,7 +1475,7 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.clusters.list", + dlg.begin(MethodInfo { id: "container.projects.zones.clusters.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1517,7 +1518,7 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1553,7 +1554,7 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1563,10 +1564,10 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1609,7 +1610,7 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterListCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1627,12 +1628,12 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneClusterListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneClusterListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1728,7 +1729,7 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.operations.list", + dlg.begin(MethodInfo { id: "container.projects.zones.operations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1771,7 +1772,7 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1807,7 +1808,7 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1817,10 +1818,10 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut ProjectZoneOperationListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1863,7 +1864,7 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut ProjectZoneOperationListCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1881,12 +1882,12 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1989,7 +1990,7 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.clusters.create", + dlg.begin(MethodInfo { id: "container.projects.zones.clusters.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2032,14 +2033,14 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2083,7 +2084,7 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2093,10 +2094,10 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> { self._request = new_value; @@ -2138,7 +2139,7 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2148,7 +2149,7 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2166,12 +2167,12 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneClusterCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneClusterCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2275,7 +2276,7 @@ impl<'a, C, A> ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.clusters.update", + dlg.begin(MethodInfo { id: "container.projects.zones.clusters.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2319,14 +2320,14 @@ impl<'a, C, A> ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2370,7 +2371,7 @@ impl<'a, C, A> ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2380,10 +2381,10 @@ impl<'a, C, A> ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterUpdateCall<'a, C, A> { self._request = new_value; @@ -2425,7 +2426,7 @@ impl<'a, C, A> ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterUpdateCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2435,7 +2436,7 @@ impl<'a, C, A> ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterUpdateCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2445,7 +2446,7 @@ impl<'a, C, A> ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterUpdateCall<'a, C, A> { self._cluster_id = new_value.to_string(); @@ -2463,12 +2464,12 @@ impl<'a, C, A> ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneClusterUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneClusterUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2565,7 +2566,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.operations.get", + dlg.begin(MethodInfo { id: "container.projects.zones.operations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2609,7 +2610,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2645,7 +2646,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2655,10 +2656,10 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2701,7 +2702,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2711,7 +2712,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> { self._operation_id = new_value.to_string(); @@ -2729,12 +2730,12 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/container1_beta1-cli/Cargo.toml b/gen/container1_beta1-cli/Cargo.toml index 60ded3ea3d..70974c0ed7 100644 --- a/gen/container1_beta1-cli/Cargo.toml +++ b/gen/container1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-container1_beta1-cli" -version = "0.3.2+20151005" +version = "0.3.3+20151005" authors = ["Sebastian Thiel "] description = "A complete library to interact with container (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/container1_beta1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/container1_beta1-cli/LICENSE.md b/gen/container1_beta1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/container1_beta1-cli/LICENSE.md +++ b/gen/container1_beta1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/container1_beta1-cli/README.md b/gen/container1_beta1-cli/README.md index 2f14031339..ae71c314a6 100644 --- a/gen/container1_beta1-cli/README.md +++ b/gen/container1_beta1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *container* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/container1-beta1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/container1-beta1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/container1-beta1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/container1-beta1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/container1_beta1-cli). # Usage -This documentation was generated from the *container* API at revision *20151005*. The CLI is at version *0.3.2*. +This documentation was generated from the *container* API at revision *20151005*. The CLI is at version *0.3.3*. ```bash container1-beta1 [options] @@ -41,18 +41,18 @@ container1-beta1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/container1_beta1-cli/mkdocs.yml b/gen/container1_beta1-cli/mkdocs.yml index 5b14e25879..384bdeaf84 100644 --- a/gen/container1_beta1-cli/mkdocs.yml +++ b/gen/container1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: container v0.3.2+20151005 +site_name: container v0.3.3+20151005 site_url: http://byron.github.io/google-apis-rs/google-container1_beta1-cli site_description: Write integrating applications with bcore @@ -20,5 +20,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/container1_beta1-cli/src/main.rs b/gen/container1_beta1-cli/src/main.rs index caaee9cddf..75af1427dc 100644 --- a/gen/container1_beta1-cli/src/main.rs +++ b/gen/container1_beta1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Container>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _projects_clusters_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _projects_clusters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().clusters_list(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().operations_list(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -149,13 +149,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_clusters_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_clusters_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -169,8 +169,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "cluster.status" => Some(("cluster.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "cluster.container-ipv4-cidr" => Some(("cluster.containerIpv4Cidr", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -209,7 +209,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreateClusterRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().zones_clusters_create(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -222,7 +222,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -235,7 +235,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -258,10 +258,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_clusters_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_clusters_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_clusters_delete(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or(""), opt.value_of("cluster-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -274,7 +274,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -287,7 +287,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -310,10 +310,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_clusters_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_clusters_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_clusters_get(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or(""), opt.value_of("cluster-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -326,7 +326,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -339,7 +339,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -362,10 +362,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_clusters_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_clusters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_clusters_list(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -378,7 +378,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -391,7 +391,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -414,10 +414,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_operations_get(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or(""), opt.value_of("operation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -430,7 +430,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -443,7 +443,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -466,10 +466,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_zones_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_zones_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().zones_operations_list(opt.value_of("project-id").unwrap_or(""), opt.value_of("zone-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -482,7 +482,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -495,7 +495,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -572,14 +572,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "container1-beta1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "container1-beta1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -599,7 +599,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -638,7 +638,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("projects", "methods: 'clusters-list', 'operations-list', 'zones-clusters-create', 'zones-clusters-delete', 'zones-clusters-get', 'zones-clusters-list', 'zones-operations-get' and 'zones-operations-list'", vec![ - ("clusters-list", + ("clusters-list", Some(r##"Lists all clusters owned by a project across all zones."##), "Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_clusters-list", vec![ @@ -660,7 +660,7 @@ fn main() { Some(false), Some(false)), ]), - ("operations-list", + ("operations-list", Some(r##"Lists all operations in a project, across all zones."##), "Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_operations-list", vec![ @@ -682,7 +682,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-clusters-create", + ("zones-clusters-create", Some(r##"Creates a cluster, consisting of the specified number and type of Google Compute Engine instances, plus a Kubernetes master instance. The cluster is created in the project's default network. @@ -722,7 +722,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-clusters-delete", + ("zones-clusters-delete", Some(r##"Deletes the cluster, including the Kubernetes master and all worker nodes. Firewalls and routes that were configured at cluster creation are also deleted."##), @@ -758,7 +758,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-clusters-get", + ("zones-clusters-get", Some(r##"Gets a specific cluster."##), "Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_zones-clusters-get", vec![ @@ -792,7 +792,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-clusters-list", + ("zones-clusters-list", Some(r##"Lists all clusters owned by a project in the specified zone."##), "Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_zones-clusters-list", vec![ @@ -820,7 +820,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-operations-get", + ("zones-operations-get", Some(r##"Gets the specified operation."##), "Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_zones-operations-get", vec![ @@ -854,7 +854,7 @@ fn main() { Some(false), Some(false)), ]), - ("zones-operations-list", + ("zones-operations-list", Some(r##"Lists all operations in a project in a specific zone."##), "Details at http://byron.github.io/google-apis-rs/google_container1_beta1_cli/projects_zones-operations-list", vec![ @@ -888,7 +888,7 @@ fn main() { let mut app = App::new("container1-beta1") .author("Sebastian Thiel ") - .version("0.3.2+20151005") + .version("0.3.3+20151005") .about("The Google Container Engine API is used for building and managing container based applications, powered by the open source Kubernetes technology.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_container1_beta1_cli") .arg(Arg::with_name("url") @@ -912,7 +912,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -923,7 +923,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/container1_beta1/Cargo.toml b/gen/container1_beta1/Cargo.toml index 7a7b47e1b3..649aaba7d5 100644 --- a/gen/container1_beta1/Cargo.toml +++ b/gen/container1_beta1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-container1_beta1" -version = "0.1.10+20151005" +version = "0.1.11+20151005" authors = ["Sebastian Thiel "] description = "A complete library to interact with container (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/container1_beta1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/container1_beta1/LICENSE.md b/gen/container1_beta1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/container1_beta1/LICENSE.md +++ b/gen/container1_beta1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/container1_beta1/README.md b/gen/container1_beta1/README.md index 302d44fb87..0eece5db34 100644 --- a/gen/container1_beta1/README.md +++ b/gen/container1_beta1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-container1_beta1` library allows access to all features of the *Google container* service. -This documentation was generated from *container* crate version *0.1.10+20151005*, where *20151005* is the exact revision of the *container:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *container* crate version *0.1.11+20151005*, where *20151005* is the exact revision of the *container:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *container* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/container-engine/docs/v1beta1/). diff --git a/gen/container1_beta1/src/cmn.rs b/gen/container1_beta1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/container1_beta1/src/cmn.rs +++ b/gen/container1_beta1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/container1_beta1/src/lib.rs b/gen/container1_beta1/src/lib.rs index d45c08f611..9eb6ee3ac5 100644 --- a/gen/container1_beta1/src/lib.rs +++ b/gen/container1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *container* crate version *0.1.10+20151005*, where *20151005* is the exact revision of the *container:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *container* crate version *0.1.11+20151005*, where *20151005* is the exact revision of the *container:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *container* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/container-engine/docs/v1beta1/). diff --git a/gen/container1_beta1/src/lib.rs.in b/gen/container1_beta1/src/lib.rs.in index 79edb890fd..2075e22d6a 100644 --- a/gen/container1_beta1/src/lib.rs.in +++ b/gen/container1_beta1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -126,7 +127,7 @@ impl<'a, C, A> Container Container { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -135,7 +136,7 @@ impl<'a, C, A> Container } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -689,7 +690,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.clusters.get", + dlg.begin(MethodInfo { id: "container.projects.zones.clusters.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -733,7 +734,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -769,7 +770,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -779,10 +780,10 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -825,7 +826,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> { self._zone_id = new_value.to_string(); @@ -835,7 +836,7 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> { self._cluster_id = new_value.to_string(); @@ -853,12 +854,12 @@ impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneClusterGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneClusterGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -947,7 +948,7 @@ impl<'a, C, A> ProjectOperationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.operations.list", + dlg.begin(MethodInfo { id: "container.projects.operations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -989,7 +990,7 @@ impl<'a, C, A> ProjectOperationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1025,7 +1026,7 @@ impl<'a, C, A> ProjectOperationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1035,10 +1036,10 @@ impl<'a, C, A> ProjectOperationListCall<'a, C, A> where C: BorrowMut ProjectOperationListCall<'a, C, A> where C: BorrowMut ProjectOperationListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1089,12 +1090,12 @@ impl<'a, C, A> ProjectOperationListCall<'a, C, A> where C: BorrowMut ProjectOperationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1187,7 +1188,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.clusters.delete", + dlg.begin(MethodInfo { id: "container.projects.zones.clusters.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1231,7 +1232,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1267,7 +1268,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1277,10 +1278,10 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1323,7 +1324,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> { self._zone_id = new_value.to_string(); @@ -1333,7 +1334,7 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> { self._cluster_id = new_value.to_string(); @@ -1351,12 +1352,12 @@ impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneClusterDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneClusterDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1445,7 +1446,7 @@ impl<'a, C, A> ProjectClusterListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.clusters.list", + dlg.begin(MethodInfo { id: "container.projects.clusters.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1487,7 +1488,7 @@ impl<'a, C, A> ProjectClusterListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1523,7 +1524,7 @@ impl<'a, C, A> ProjectClusterListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1533,10 +1534,10 @@ impl<'a, C, A> ProjectClusterListCall<'a, C, A> where C: BorrowMut ProjectClusterListCall<'a, C, A> where C: BorrowMut ProjectClusterListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1587,12 +1588,12 @@ impl<'a, C, A> ProjectClusterListCall<'a, C, A> where C: BorrowMut ProjectClusterListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectClusterListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectClusterListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1683,7 +1684,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.operations.get", + dlg.begin(MethodInfo { id: "container.projects.zones.operations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1727,7 +1728,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1763,7 +1764,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1773,10 +1774,10 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1819,7 +1820,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> { self._zone_id = new_value.to_string(); @@ -1829,7 +1830,7 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> { self._operation_id = new_value.to_string(); @@ -1847,12 +1848,12 @@ impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1942,7 +1943,7 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.operations.list", + dlg.begin(MethodInfo { id: "container.projects.zones.operations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1985,7 +1986,7 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2021,7 +2022,7 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2031,10 +2032,10 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut ProjectZoneOperationListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2077,7 +2078,7 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut ProjectZoneOperationListCall<'a, C, A> { self._zone_id = new_value.to_string(); @@ -2095,12 +2096,12 @@ impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2190,7 +2191,7 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.clusters.list", + dlg.begin(MethodInfo { id: "container.projects.zones.clusters.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2233,7 +2234,7 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2269,7 +2270,7 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2279,10 +2280,10 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2325,7 +2326,7 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterListCall<'a, C, A> { self._zone_id = new_value.to_string(); @@ -2343,12 +2344,12 @@ impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneClusterListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneClusterListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2451,7 +2452,7 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "container.projects.zones.clusters.create", + dlg.begin(MethodInfo { id: "container.projects.zones.clusters.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2494,14 +2495,14 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2545,7 +2546,7 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2555,10 +2556,10 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> { self._request = new_value; @@ -2600,7 +2601,7 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2610,7 +2611,7 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> { self._zone_id = new_value.to_string(); @@ -2628,12 +2629,12 @@ impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectZoneClusterCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectZoneClusterCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/content2-cli/Cargo.toml b/gen/content2-cli/Cargo.toml index 7c1ab53601..1d1d62a349 100644 --- a/gen/content2-cli/Cargo.toml +++ b/gen/content2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-content2-cli" -version = "0.3.2+20151002" +version = "0.3.3+20160115" authors = ["Sebastian Thiel "] description = "A complete library to interact with Shopping Content (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/content2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/content2-cli/LICENSE.md b/gen/content2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/content2-cli/LICENSE.md +++ b/gen/content2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/content2-cli/README.md b/gen/content2-cli/README.md index 068e6f6b93..079021c1a6 100644 --- a/gen/content2-cli/README.md +++ b/gen/content2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Shopping Content* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/content2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/content2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/content2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/content2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/content2-cli). # Usage -This documentation was generated from the *Shopping Content* API at revision *20151002*. The CLI is at version *0.3.2*. +This documentation was generated from the *Shopping Content* API at revision *20160115*. The CLI is at version *0.3.3*. ```bash content2 [options] @@ -98,18 +98,18 @@ content2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/content2-cli/mkdocs.yml b/gen/content2-cli/mkdocs.yml index 27a480ccb5..632e7e8384 100644 --- a/gen/content2-cli/mkdocs.yml +++ b/gen/content2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Shopping Content v0.3.2+20151002 +site_name: Shopping Content v0.3.3+20160115 site_url: http://byron.github.io/google-apis-rs/google-content2-cli site_description: Write integrating applications with bcore @@ -68,5 +68,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/content2-cli/src/main.rs b/gen/content2-cli/src/main.rs index b3ac05dd53..c1680700d4 100644 --- a/gen/content2-cli/src/main.rs +++ b/gen/content2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::ShoppingContent>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _accounts_authinfo(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _accounts_authinfo(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().authinfo(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,13 +97,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -117,8 +117,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -132,7 +132,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountsCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -148,7 +148,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -162,7 +162,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -185,10 +185,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().delete(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -204,7 +204,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -218,7 +218,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -233,10 +233,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().get(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -249,7 +249,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -262,7 +262,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -285,13 +285,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -305,8 +305,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "reviews-url" => Some(("reviewsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -327,7 +327,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Account = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().insert(request, opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -343,7 +343,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -357,7 +357,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -380,10 +380,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().list(opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -402,7 +402,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -416,7 +416,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -439,13 +439,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -459,8 +459,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "reviews-url" => Some(("reviewsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -481,7 +481,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Account = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().patch(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -497,7 +497,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -511,7 +511,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -534,13 +534,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -554,8 +554,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "reviews-url" => Some(("reviewsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -576,7 +576,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Account = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().update(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -592,7 +592,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -606,7 +606,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -629,13 +629,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accountshipping_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accountshipping_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -649,8 +649,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -664,7 +664,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountshippingCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.accountshipping().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -680,7 +680,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -694,7 +694,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -717,10 +717,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accountshipping_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accountshipping_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accountshipping().get(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -733,7 +733,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -746,7 +746,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -769,10 +769,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accountshipping_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accountshipping_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accountshipping().list(opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -791,7 +791,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -805,7 +805,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -828,13 +828,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accountshipping_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accountshipping_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -848,8 +848,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -865,7 +865,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountShipping = json::value::from_value(object).unwrap(); let mut call = self.hub.accountshipping().patch(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -881,7 +881,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -895,7 +895,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -918,13 +918,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accountshipping_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accountshipping_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -938,8 +938,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -955,7 +955,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountShipping = json::value::from_value(object).unwrap(); let mut call = self.hub.accountshipping().update(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -971,7 +971,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -985,7 +985,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1008,13 +1008,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accountstatuses_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accountstatuses_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1028,8 +1028,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -1043,7 +1043,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountstatusesCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.accountstatuses().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1056,7 +1056,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1069,7 +1069,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1092,10 +1092,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accountstatuses_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accountstatuses_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accountstatuses().get(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1108,7 +1108,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1121,7 +1121,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1144,10 +1144,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accountstatuses_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accountstatuses_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accountstatuses().list(opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1166,7 +1166,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1180,7 +1180,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1203,13 +1203,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounttax_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounttax_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1223,8 +1223,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -1238,7 +1238,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccounttaxCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.accounttax().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -1254,7 +1254,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -1268,7 +1268,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1291,10 +1291,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounttax_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounttax_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounttax().get(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1307,7 +1307,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1320,7 +1320,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1343,10 +1343,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounttax_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounttax_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounttax().list(opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1365,7 +1365,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1379,7 +1379,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1402,13 +1402,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounttax_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounttax_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1422,8 +1422,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1439,7 +1439,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountTax = json::value::from_value(object).unwrap(); let mut call = self.hub.accounttax().patch(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -1455,7 +1455,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -1469,7 +1469,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1492,13 +1492,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounttax_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounttax_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1512,8 +1512,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1529,7 +1529,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountTax = json::value::from_value(object).unwrap(); let mut call = self.hub.accounttax().update(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -1545,7 +1545,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -1559,7 +1559,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1582,13 +1582,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datafeeds_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datafeeds_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1602,8 +1602,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -1617,7 +1617,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DatafeedsCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datafeeds().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -1633,7 +1633,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -1647,7 +1647,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1670,10 +1670,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datafeeds_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datafeeds_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datafeeds().delete(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("datafeed-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -1689,7 +1689,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -1703,7 +1703,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1718,10 +1718,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datafeeds_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datafeeds_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datafeeds().get(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("datafeed-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1734,7 +1734,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1747,7 +1747,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1770,13 +1770,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datafeeds_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datafeeds_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1790,8 +1790,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1824,7 +1824,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Datafeed = json::value::from_value(object).unwrap(); let mut call = self.hub.datafeeds().insert(request, opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -1840,7 +1840,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -1854,7 +1854,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1877,10 +1877,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datafeeds_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datafeeds_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datafeeds().list(opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1899,7 +1899,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1913,7 +1913,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1936,13 +1936,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datafeeds_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datafeeds_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1956,8 +1956,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1990,7 +1990,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Datafeed = json::value::from_value(object).unwrap(); let mut call = self.hub.datafeeds().patch(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("datafeed-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -2006,7 +2006,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -2020,7 +2020,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2043,13 +2043,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datafeeds_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datafeeds_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2063,8 +2063,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2097,7 +2097,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Datafeed = json::value::from_value(object).unwrap(); let mut call = self.hub.datafeeds().update(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("datafeed-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -2113,7 +2113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -2127,7 +2127,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2150,13 +2150,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datafeedstatuses_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datafeedstatuses_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2170,8 +2170,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -2185,7 +2185,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DatafeedstatusesCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datafeedstatuses().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2198,7 +2198,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2211,7 +2211,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2234,10 +2234,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datafeedstatuses_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datafeedstatuses_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datafeedstatuses().get(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("datafeed-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2250,7 +2250,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2263,7 +2263,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2286,10 +2286,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datafeedstatuses_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datafeedstatuses_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datafeedstatuses().list(opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2308,7 +2308,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -2322,7 +2322,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2345,13 +2345,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inventory_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inventory_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2365,8 +2365,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -2380,7 +2380,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InventoryCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.inventory().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -2396,7 +2396,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -2410,7 +2410,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2433,13 +2433,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inventory_set(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inventory_set(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2453,9 +2453,12 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "installment.amount.currency" => Some(("installment.amount.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "installment.amount.value" => Some(("installment.amount.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "installment.months" => Some(("installment.months", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "sale-price-effective-date" => Some(("salePriceEffectiveDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "price.currency" => Some(("price.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "price.value" => Some(("price.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2463,9 +2466,12 @@ impl<'n, 'a> Engine<'n, 'a> { "sale-price.currency" => Some(("salePrice.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "sale-price.value" => Some(("salePrice.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "availability" => Some(("availability", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "loyalty-points.ratio" => Some(("loyaltyPoints.ratio", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "loyalty-points.name" => Some(("loyaltyPoints.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "loyalty-points.points-value" => Some(("loyaltyPoints.pointsValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "quantity" => Some(("quantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["availability", "currency", "price", "quantity", "sale-price", "sale-price-effective-date", "sell-on-google-quantity", "value"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["amount", "availability", "currency", "installment", "loyalty-points", "months", "name", "points-value", "price", "quantity", "ratio", "sale-price", "sale-price-effective-date", "sell-on-google-quantity", "value"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2476,7 +2482,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InventorySetRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.inventory().set(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("store-code").unwrap_or(""), opt.value_of("product-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -2492,7 +2498,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -2506,7 +2512,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2529,13 +2535,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_acknowledge(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_acknowledge(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2549,8 +2555,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "operation-id" => Some(("operationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -2565,7 +2571,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersAcknowledgeRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().acknowledge(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2578,7 +2584,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2591,7 +2597,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2614,10 +2620,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_advancetestorder(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_advancetestorder(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().advancetestorder(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2630,7 +2636,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2643,7 +2649,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2666,13 +2672,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_cancel(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2686,8 +2692,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "reason" => Some(("reason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reason-text" => Some(("reasonText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2704,7 +2710,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersCancelRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().cancel(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2717,7 +2723,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2730,7 +2736,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2753,13 +2759,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_cancellineitem(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_cancellineitem(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2773,16 +2779,18 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "quantity" => Some(("quantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "reason" => Some(("reason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "amount.currency" => Some(("amount.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "amount.value" => Some(("amount.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reason-text" => Some(("reasonText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "line-item-id" => Some(("lineItemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation-id" => Some(("operationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "quantity" => Some(("quantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["line-item-id", "operation-id", "quantity", "reason", "reason-text"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["amount", "currency", "line-item-id", "operation-id", "quantity", "reason", "reason-text", "value"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2793,7 +2801,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersCancelLineItemRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().cancellineitem(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2806,7 +2814,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2819,7 +2827,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2842,13 +2850,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_createtestorder(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_createtestorder(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2862,8 +2870,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "test-order.customer.explicit-marketing-preference" => Some(("testOrder.customer.explicitMarketingPreference", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "test-order.customer.full-name" => Some(("testOrder.customer.fullName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2893,7 +2901,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersCreateTestOrderRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().createtestorder(request, opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2906,7 +2914,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2919,7 +2927,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2942,13 +2950,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2962,8 +2970,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -2977,7 +2985,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2990,7 +2998,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3003,7 +3011,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3026,10 +3034,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().get(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3042,7 +3050,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3055,7 +3063,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3078,10 +3086,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_getbymerchantorderid(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_getbymerchantorderid(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().getbymerchantorderid(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("merchant-order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3094,7 +3102,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3107,7 +3115,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3130,10 +3138,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_gettestordertemplate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_gettestordertemplate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().gettestordertemplate(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("template-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3146,7 +3154,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3159,7 +3167,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3182,10 +3190,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().list(opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "statuses" => { @@ -3219,7 +3227,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "placed-date-end", "acknowledged", "max-results", "page-token", "placed-date-start", "statuses"].iter().map(|v|*v)); @@ -3233,7 +3241,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3256,13 +3264,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_refund(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_refund(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3276,8 +3284,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "amount.currency" => Some(("amount.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "amount.value" => Some(("amount.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3296,7 +3304,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersRefundRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().refund(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3309,7 +3317,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3322,7 +3330,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3345,13 +3353,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_returnlineitem(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_returnlineitem(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3365,8 +3373,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "quantity" => Some(("quantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "reason" => Some(("reason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3385,7 +3393,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersReturnLineItemRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().returnlineitem(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3398,7 +3406,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3411,7 +3419,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3434,13 +3442,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_shiplineitems(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_shiplineitems(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3454,8 +3462,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "shipment-id" => Some(("shipmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "carrier" => Some(("carrier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3473,7 +3481,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersShipLineItemsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().shiplineitems(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3486,7 +3494,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3499,7 +3507,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3522,13 +3530,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_updatemerchantorderid(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_updatemerchantorderid(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3542,8 +3550,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "merchant-order-id" => Some(("merchantOrderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation-id" => Some(("operationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3559,7 +3567,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersUpdateMerchantOrderIdRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().updatemerchantorderid(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3572,7 +3580,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3585,7 +3593,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3608,13 +3616,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_updateshipment(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_updateshipment(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3628,8 +3636,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "shipment-id" => Some(("shipmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3648,7 +3656,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersUpdateShipmentRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().updateshipment(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3661,7 +3669,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3674,7 +3682,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3697,13 +3705,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3717,8 +3725,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -3732,7 +3740,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ProductsCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.products().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -3748,7 +3756,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -3762,7 +3770,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3785,10 +3793,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.products().delete(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("product-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -3804,7 +3812,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -3818,7 +3826,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3833,10 +3841,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.products().get(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("product-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3849,7 +3857,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3862,7 +3870,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3885,13 +3893,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3905,8 +3913,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "display-ads-title" => Some(("displayAdsTitle", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "color" => Some(("color", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3995,7 +4003,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Product = json::value::from_value(object).unwrap(); let mut call = self.hub.products().insert(request, opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "dry-run" => { @@ -4011,7 +4019,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dry-run"].iter().map(|v|*v)); @@ -4025,7 +4033,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4048,10 +4056,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _products_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _products_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.products().list(opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -4060,6 +4068,9 @@ impl<'n, 'a> Engine<'n, 'a> { "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, + "include-invalid-inserted-items" => { + call = call.include_invalid_inserted_items(arg_from_str(value.unwrap_or("false"), err, "include-invalid-inserted-items", "boolean")); + }, _ => { let mut found = false; for param in &self.gp { @@ -4070,10 +4081,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "max-results"].iter().map(|v|*v)); + v.extend(["include-invalid-inserted-items", "page-token", "max-results"].iter().map(|v|*v)); v } )); } } @@ -4084,7 +4095,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4107,13 +4118,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _productstatuses_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _productstatuses_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4127,8 +4138,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -4142,7 +4153,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ProductstatusesCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.productstatuses().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4155,7 +4166,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4168,7 +4179,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4191,10 +4202,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _productstatuses_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _productstatuses_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.productstatuses().get(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("product-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4207,7 +4218,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4220,7 +4231,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4243,10 +4254,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _productstatuses_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _productstatuses_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.productstatuses().list(opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -4255,6 +4266,9 @@ impl<'n, 'a> Engine<'n, 'a> { "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, + "include-invalid-inserted-items" => { + call = call.include_invalid_inserted_items(arg_from_str(value.unwrap_or("false"), err, "include-invalid-inserted-items", "boolean")); + }, _ => { let mut found = false; for param in &self.gp { @@ -4265,10 +4279,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "max-results"].iter().map(|v|*v)); + v.extend(["include-invalid-inserted-items", "page-token", "max-results"].iter().map(|v|*v)); v } )); } } @@ -4279,7 +4293,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4572,14 +4586,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "content2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "content2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -4599,7 +4613,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -4638,7 +4652,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("accounts", "methods: 'authinfo', 'custombatch', 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("authinfo", + ("authinfo", Some(r##"Returns information about the authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_authinfo", vec![ @@ -4654,7 +4668,7 @@ fn main() { Some(false), Some(false)), ]), - ("custombatch", + ("custombatch", Some(r##"Retrieves, inserts, updates, and deletes multiple Merchant Center (sub-)accounts in a single request."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_custombatch", vec![ @@ -4676,7 +4690,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a Merchant Center sub-account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_delete", vec![ @@ -4698,7 +4712,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves a Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_get", vec![ @@ -4726,7 +4740,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a Merchant Center sub-account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_insert", vec![ @@ -4754,7 +4768,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the sub-accounts in your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_list", vec![ @@ -4776,7 +4790,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a Merchant Center account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_patch", vec![ @@ -4810,7 +4824,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounts_update", vec![ @@ -4847,7 +4861,7 @@ fn main() { ]), ("accountshipping", "methods: 'custombatch', 'get', 'list', 'patch' and 'update'", vec![ - ("custombatch", + ("custombatch", Some(r##"Retrieves and updates the shipping settings of multiple accounts in a single request."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountshipping_custombatch", vec![ @@ -4869,7 +4883,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves the shipping settings of the account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountshipping_get", vec![ @@ -4897,7 +4911,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the shipping settings of the sub-accounts in your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountshipping_list", vec![ @@ -4919,7 +4933,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates the shipping settings of the account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountshipping_patch", vec![ @@ -4953,7 +4967,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates the shipping settings of the account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountshipping_update", vec![ @@ -4990,7 +5004,7 @@ fn main() { ]), ("accountstatuses", "methods: 'custombatch', 'get' and 'list'", vec![ - ("custombatch", + ("custombatch", None, "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountstatuses_custombatch", vec![ @@ -5012,7 +5026,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves the status of a Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountstatuses_get", vec![ @@ -5040,7 +5054,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the statuses of the sub-accounts in your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accountstatuses_list", vec![ @@ -5065,7 +5079,7 @@ fn main() { ]), ("accounttax", "methods: 'custombatch', 'get', 'list', 'patch' and 'update'", vec![ - ("custombatch", + ("custombatch", Some(r##"Retrieves and updates tax settings of multiple accounts in a single request."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounttax_custombatch", vec![ @@ -5087,7 +5101,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves the tax settings of the account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounttax_get", vec![ @@ -5115,7 +5129,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the tax settings of the sub-accounts in your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounttax_list", vec![ @@ -5137,7 +5151,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates the tax settings of the account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounttax_patch", vec![ @@ -5171,7 +5185,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates the tax settings of the account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/accounttax_update", vec![ @@ -5208,7 +5222,7 @@ fn main() { ]), ("datafeeds", "methods: 'custombatch', 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("custombatch", + ("custombatch", None, "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_custombatch", vec![ @@ -5230,7 +5244,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a datafeed from your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_delete", vec![ @@ -5252,7 +5266,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves a datafeed from your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_get", vec![ @@ -5280,7 +5294,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Registers a datafeed with your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_insert", vec![ @@ -5308,7 +5322,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the datafeeds in your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_list", vec![ @@ -5330,7 +5344,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a datafeed of your Merchant Center account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_patch", vec![ @@ -5364,7 +5378,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a datafeed of your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeeds_update", vec![ @@ -5401,7 +5415,7 @@ fn main() { ]), ("datafeedstatuses", "methods: 'custombatch', 'get' and 'list'", vec![ - ("custombatch", + ("custombatch", None, "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeedstatuses_custombatch", vec![ @@ -5423,7 +5437,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves the status of a datafeed from your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeedstatuses_get", vec![ @@ -5451,7 +5465,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the statuses of the datafeeds in your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/datafeedstatuses_list", vec![ @@ -5476,7 +5490,7 @@ fn main() { ]), ("inventory", "methods: 'custombatch' and 'set'", vec![ - ("custombatch", + ("custombatch", Some(r##"Updates price and availability for multiple products or stores in a single request. This operation does not update the expiration date of the products."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/inventory_custombatch", vec![ @@ -5498,7 +5512,7 @@ fn main() { Some(false), Some(false)), ]), - ("set", + ("set", Some(r##"Updates price and availability of a product in your Merchant Center account. This operation does not update the expiration date of the product."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/inventory_set", vec![ @@ -5541,7 +5555,7 @@ fn main() { ]), ("orders", "methods: 'acknowledge', 'advancetestorder', 'cancel', 'cancellineitem', 'createtestorder', 'custombatch', 'get', 'getbymerchantorderid', 'gettestordertemplate', 'list', 'refund', 'returnlineitem', 'shiplineitems', 'updatemerchantorderid' and 'updateshipment'", vec![ - ("acknowledge", + ("acknowledge", Some(r##"Marks an order as acknowledged."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_acknowledge", vec![ @@ -5575,7 +5589,7 @@ fn main() { Some(false), Some(false)), ]), - ("advancetestorder", + ("advancetestorder", Some(r##"Sandbox only. Moves a test order from state "inProgress" to state "pendingShipment"."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_advancetestorder", vec![ @@ -5603,7 +5617,7 @@ fn main() { Some(false), Some(false)), ]), - ("cancel", + ("cancel", Some(r##"Cancels all line items in an order."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_cancel", vec![ @@ -5637,7 +5651,7 @@ fn main() { Some(false), Some(false)), ]), - ("cancellineitem", + ("cancellineitem", Some(r##"Cancels a line item."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_cancellineitem", vec![ @@ -5671,7 +5685,7 @@ fn main() { Some(false), Some(false)), ]), - ("createtestorder", + ("createtestorder", Some(r##"Sandbox only. Creates a test order."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_createtestorder", vec![ @@ -5699,7 +5713,7 @@ fn main() { Some(false), Some(false)), ]), - ("custombatch", + ("custombatch", Some(r##"Retrieves or modifies multiple orders in a single request."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_custombatch", vec![ @@ -5721,7 +5735,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves an order from your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_get", vec![ @@ -5749,7 +5763,7 @@ fn main() { Some(false), Some(false)), ]), - ("getbymerchantorderid", + ("getbymerchantorderid", Some(r##"Retrieves an order using merchant order id."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_getbymerchantorderid", vec![ @@ -5777,7 +5791,7 @@ fn main() { Some(false), Some(false)), ]), - ("gettestordertemplate", + ("gettestordertemplate", Some(r##"Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_gettestordertemplate", vec![ @@ -5805,7 +5819,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the orders in your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_list", vec![ @@ -5827,7 +5841,7 @@ fn main() { Some(false), Some(false)), ]), - ("refund", + ("refund", Some(r##"Refund a portion of the order, up to the full amount paid."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_refund", vec![ @@ -5861,7 +5875,7 @@ fn main() { Some(false), Some(false)), ]), - ("returnlineitem", + ("returnlineitem", Some(r##"Returns a line item."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_returnlineitem", vec![ @@ -5895,7 +5909,7 @@ fn main() { Some(false), Some(false)), ]), - ("shiplineitems", + ("shiplineitems", Some(r##"Marks line item(s) as shipped."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_shiplineitems", vec![ @@ -5929,7 +5943,7 @@ fn main() { Some(false), Some(false)), ]), - ("updatemerchantorderid", + ("updatemerchantorderid", Some(r##"Updates the merchant order ID for a given order."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_updatemerchantorderid", vec![ @@ -5963,7 +5977,7 @@ fn main() { Some(false), Some(false)), ]), - ("updateshipment", + ("updateshipment", Some(r##"Updates a shipment's status, carrier, and/or tracking ID."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/orders_updateshipment", vec![ @@ -6000,7 +6014,7 @@ fn main() { ]), ("products", "methods: 'custombatch', 'delete', 'get', 'insert' and 'list'", vec![ - ("custombatch", + ("custombatch", Some(r##"Retrieves, inserts, and deletes multiple products in a single request."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/products_custombatch", vec![ @@ -6022,7 +6036,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a product from your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/products_delete", vec![ @@ -6044,7 +6058,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves a product from your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/products_get", vec![ @@ -6072,7 +6086,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Uploads a product to your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/products_insert", vec![ @@ -6100,7 +6114,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the products in your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/products_list", vec![ @@ -6125,7 +6139,7 @@ fn main() { ]), ("productstatuses", "methods: 'custombatch', 'get' and 'list'", vec![ - ("custombatch", + ("custombatch", Some(r##"Gets the statuses of multiple products in a single request."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/productstatuses_custombatch", vec![ @@ -6147,7 +6161,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets the status of a product from your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/productstatuses_get", vec![ @@ -6175,7 +6189,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the statuses of the products in your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_cli/productstatuses_list", vec![ @@ -6203,7 +6217,7 @@ fn main() { let mut app = App::new("content2") .author("Sebastian Thiel ") - .version("0.3.2+20151002") + .version("0.3.3+20160115") .about("Manage product items, inventory, and Merchant Center accounts for Google Shopping.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_content2_cli") .arg(Arg::with_name("url") @@ -6227,7 +6241,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -6238,7 +6252,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/content2/Cargo.toml b/gen/content2/Cargo.toml index 39e398f220..8e0830a910 100644 --- a/gen/content2/Cargo.toml +++ b/gen/content2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-content2" -version = "0.1.10+20151002" +version = "0.1.11+20160115" authors = ["Sebastian Thiel "] description = "A complete library to interact with Shopping Content (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/content2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/content2/LICENSE.md b/gen/content2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/content2/LICENSE.md +++ b/gen/content2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/content2/README.md b/gen/content2/README.md index 0ec44b3538..e9323c3b8b 100644 --- a/gen/content2/README.md +++ b/gen/content2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-content2` library allows access to all features of the *Google Shopping Content* service. -This documentation was generated from *Shopping Content* crate version *0.1.10+20151002*, where *20151002* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Shopping Content* crate version *0.1.11+20160115*, where *20160115* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Shopping Content* *v2* API can be found at the [official documentation site](https://developers.google.com/shopping-content). diff --git a/gen/content2/src/cmn.rs b/gen/content2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/content2/src/cmn.rs +++ b/gen/content2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/content2/src/lib.rs b/gen/content2/src/lib.rs index ea0e2ad8aa..18bd41897f 100644 --- a/gen/content2/src/lib.rs +++ b/gen/content2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Shopping Content* crate version *0.1.10+20151002*, where *20151002* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Shopping Content* crate version *0.1.11+20160115*, where *20160115* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Shopping Content* *v2* API can be found at the //! [official documentation site](https://developers.google.com/shopping-content). @@ -126,13 +126,13 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.orders().list("merchantId") -//! .add_statuses("ea") -//! .placed_date_start("et") -//! .placed_date_end("dolor") -//! .page_token("diam") -//! .order_by("kasd") -//! .max_results(14) -//! .acknowledged(true) +//! .add_statuses("dolor") +//! .placed_date_start("diam") +//! .placed_date_end("kasd") +//! .page_token("invidunt") +//! .order_by("rebum.") +//! .max_results(50) +//! .acknowledged(false) //! .doit(); //! //! match result { diff --git a/gen/content2/src/lib.rs.in b/gen/content2/src/lib.rs.in index b9db23321d..45049bf2a0 100644 --- a/gen/content2/src/lib.rs.in +++ b/gen/content2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -133,7 +134,7 @@ impl<'a, C, A> ShoppingContent ShoppingContent { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -169,7 +170,7 @@ impl<'a, C, A> ShoppingContent } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -932,21 +933,6 @@ pub struct AccountstatusesCustomBatchResponse { impl ResponseResult for AccountstatusesCustomBatchResponse {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ProductInstallment { - /// The amount the buyer has to pay per month. - pub amount: Option, - /// The number of installments the buyer has to pay. - pub months: Option, -} - -impl Part for ProductInstallment {} - - /// A batch entry encoding a single non-batch datafeedstatuses response. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -972,21 +958,26 @@ impl Part for DatafeedstatusesCustomBatchResponseEntry {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Inventory { - /// The quantity of the product that is reserved for sell-on-google ads. Supported only for online products. - #[serde(rename="sellOnGoogleQuantity")] - pub sell_on_google_quantity: Option, /// Identifies what kind of resource this is. Value: the fixed string "content#inventory". pub kind: Option, - /// The sale price of the product. Mandatory if sale_price_effective_date is defined. - #[serde(rename="salePrice")] - pub sale_price: Option, + /// Number and amount of installments to pay for an item. Brazil only. + pub installment: Option, /// A date range represented by a pair of ISO 8601 dates separated by a space, comma, or slash. Both dates might be specified as 'null' if undecided. #[serde(rename="salePriceEffectiveDate")] pub sale_price_effective_date: Option, /// The price of the product. pub price: Option, + /// The quantity of the product that is reserved for sell-on-google ads. Supported only for online products. + #[serde(rename="sellOnGoogleQuantity")] + pub sell_on_google_quantity: Option, + /// The sale price of the product. Mandatory if sale_price_effective_date is defined. + #[serde(rename="salePrice")] + pub sale_price: Option, /// The availability of the product. pub availability: Option, + /// Loyalty points that users receive after purchasing the item. Japan only. + #[serde(rename="loyaltyPoints")] + pub loyalty_points: Option, /// The quantity of the product. Must be equal to or greater than zero. Supported only for local products. pub quantity: Option, } @@ -1349,17 +1340,19 @@ impl RequestValue for InventoryCustomBatchRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrdersCancelLineItemRequest { - /// The ID of the operation. Unique across all operations for a given order. - #[serde(rename="operationId")] - pub operation_id: Option, - /// The reason for the cancellation. - pub reason: Option, + /// Amount to refund for the cancelation. Optional. If not set, Google will calculate the default based on the price and tax of the items involved. The amount must not be larger than the net amount left on the order. + pub amount: Option, /// The explanation of the reason. #[serde(rename="reasonText")] pub reason_text: Option, /// The ID of the line item to cancel. #[serde(rename="lineItemId")] pub line_item_id: Option, + /// The ID of the operation. Unique across all operations for a given order. + #[serde(rename="operationId")] + pub operation_id: Option, + /// The reason for the cancellation. + pub reason: Option, /// The quantity to cancel. pub quantity: Option, } @@ -1594,7 +1587,7 @@ pub struct DatafeedFetchSchedule { pub password: Option, /// The day of the week the feed file should be fetched. pub weekday: Option, - /// The hour of the day the feed file should be fetched (0-24). + /// The hour of the day the feed file should be fetched (0-23). pub hour: Option, /// Time zone used for schedule. UTC by default. E.g., "America/Los_Angeles". #[serde(rename="timeZone")] @@ -1963,6 +1956,21 @@ pub struct ProductsCustomBatchResponse { impl ResponseResult for ProductsCustomBatchResponse {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Installment { + /// The amount the buyer has to pay per month. + pub amount: Option, + /// The number of installments the buyer has to pay. + pub months: Option, +} + +impl Part for Installment {} + + /// A batch entry encoding a single non-batch inventory response. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -2148,11 +2156,13 @@ impl ResponseResult for DatafeedsListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrdersCustomBatchRequestEntryCancelLineItem { - /// The reason for the cancellation. - pub reason: Option, + /// Amount to refund for the cancelation. Optional. If not set, Google will calculate the default based on the price and tax of the items involved. The amount must not be larger than the net amount left on the order. + pub amount: Option, /// The explanation of the reason. #[serde(rename="reasonText")] pub reason_text: Option, + /// The reason for the cancellation. + pub reason: Option, /// The ID of the line item to cancel. #[serde(rename="lineItemId")] pub line_item_id: Option, @@ -2357,7 +2367,7 @@ pub struct Datafeed { pub content_type: Option, /// A descriptive name of the data feed. pub name: Option, - /// The two-letter ISO 639-1 language of the items in the feed. + /// The two-letter ISO 639-1 language of the items in the feed. Must be a valid language for targetCountry. #[serde(rename="contentLanguage")] pub content_language: Option, /// Format of the feed file. @@ -3135,7 +3145,7 @@ pub struct Product { /// Identifies what kind of resource this is. Value: the fixed string "content#product". pub kind: Option, /// Number and amount of installments to pay for an item. Brazil only. - pub installment: Option, + pub installment: Option, /// Size of the item. pub sizes: Option>, /// Target gender of the item. @@ -3282,19 +3292,24 @@ impl ResponseResult for ProductsListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct InventorySetRequest { + /// Number and amount of installments to pay for an item. Brazil only. + pub installment: Option, + /// A date range represented by a pair of ISO 8601 dates separated by a space, comma, or slash. Both dates might be specified as 'null' if undecided. + #[serde(rename="salePriceEffectiveDate")] + pub sale_price_effective_date: Option, + /// The price of the product. + pub price: Option, /// The quantity of the product that is reserved for sell-on-google ads. Supported only for online products. #[serde(rename="sellOnGoogleQuantity")] pub sell_on_google_quantity: Option, /// The sale price of the product. Mandatory if sale_price_effective_date is defined. #[serde(rename="salePrice")] pub sale_price: Option, - /// A date range represented by a pair of ISO 8601 dates separated by a space, comma, or slash. Both dates might be specified as 'null' if undecided. - #[serde(rename="salePriceEffectiveDate")] - pub sale_price_effective_date: Option, - /// The price of the product. - pub price: Option, /// The availability of the product. pub availability: Option, + /// Loyalty points that users receive after purchasing the item. Japan only. + #[serde(rename="loyaltyPoints")] + pub loyalty_points: Option, /// The quantity of the product. Must be equal to or greater than zero. Supported only for local products. pub quantity: Option, } @@ -4248,6 +4263,7 @@ impl<'a, C, A> ProductstatuseMethods<'a, C, A> { _merchant_id: merchant_id.to_string(), _page_token: Default::default(), _max_results: Default::default(), + _include_invalid_inserted_items: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -4694,6 +4710,7 @@ impl<'a, C, A> ProductMethods<'a, C, A> { _merchant_id: merchant_id.to_string(), _page_token: Default::default(), _max_results: Default::default(), + _include_invalid_inserted_items: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -5334,7 +5351,7 @@ impl<'a, C, A> AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounttax.custombatch", + dlg.begin(MethodInfo { id: "content.accounttax.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._dry_run { @@ -5357,14 +5374,14 @@ impl<'a, C, A> AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5408,7 +5425,7 @@ impl<'a, C, A> AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5418,10 +5435,10 @@ impl<'a, C, A> AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut AccounttaxCustombatchCall<'a, C, A> { self._request = new_value; @@ -5478,12 +5495,12 @@ impl<'a, C, A> AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut AccounttaxCustombatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccounttaxCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccounttaxCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5582,7 +5599,7 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounttax.patch", + dlg.begin(MethodInfo { id: "content.accounttax.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -5628,14 +5645,14 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5679,7 +5696,7 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5689,10 +5706,10 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5724,7 +5741,7 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AccountTax) -> AccounttaxPatchCall<'a, C, A> { self._request = new_value; @@ -5734,7 +5751,7 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccounttaxPatchCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -5744,7 +5761,7 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccounttaxPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5769,12 +5786,12 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5791,17 +5808,17 @@ impl<'a, C, A> AccounttaxPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccounttaxPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccounttaxPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5867,7 +5884,7 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounttax.list", + dlg.begin(MethodInfo { id: "content.accounttax.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -5915,7 +5932,7 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5951,7 +5968,7 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5961,10 +5978,10 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5997,7 +6014,7 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccounttaxListCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -6029,12 +6046,12 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6051,17 +6068,17 @@ impl<'a, C, A> AccounttaxListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccounttaxListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccounttaxListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6133,7 +6150,7 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounttax.update", + dlg.begin(MethodInfo { id: "content.accounttax.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -6179,14 +6196,14 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6230,7 +6247,7 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6240,10 +6257,10 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6275,7 +6292,7 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AccountTax) -> AccounttaxUpdateCall<'a, C, A> { self._request = new_value; @@ -6285,7 +6302,7 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccounttaxUpdateCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -6295,7 +6312,7 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccounttaxUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6320,12 +6337,12 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6342,17 +6359,17 @@ impl<'a, C, A> AccounttaxUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccounttaxUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccounttaxUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6415,7 +6432,7 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounttax.get", + dlg.begin(MethodInfo { id: "content.accounttax.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -6458,7 +6475,7 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6494,7 +6511,7 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6504,10 +6521,10 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6540,7 +6557,7 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccounttaxGetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -6550,7 +6567,7 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccounttaxGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6568,12 +6585,12 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6590,17 +6607,17 @@ impl<'a, C, A> AccounttaxGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccounttaxGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccounttaxGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6663,7 +6680,7 @@ impl<'a, C, A> DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.datafeedstatuses.get", + dlg.begin(MethodInfo { id: "content.datafeedstatuses.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -6706,7 +6723,7 @@ impl<'a, C, A> DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6742,7 +6759,7 @@ impl<'a, C, A> DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6752,10 +6769,10 @@ impl<'a, C, A> DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut DatafeedstatuseGetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -6796,7 +6813,7 @@ impl<'a, C, A> DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut DatafeedstatuseGetCall<'a, C, A> { self._datafeed_id = new_value.to_string(); @@ -6814,12 +6831,12 @@ impl<'a, C, A> DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut DatafeedstatuseGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DatafeedstatuseGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatafeedstatuseGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6912,7 +6929,7 @@ impl<'a, C, A> DatafeedstatuseListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.datafeedstatuses.list", + dlg.begin(MethodInfo { id: "content.datafeedstatuses.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -6960,7 +6977,7 @@ impl<'a, C, A> DatafeedstatuseListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6996,7 +7013,7 @@ impl<'a, C, A> DatafeedstatuseListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7006,10 +7023,10 @@ impl<'a, C, A> DatafeedstatuseListCall<'a, C, A> where C: BorrowMut DatafeedstatuseListCall<'a, C, A> where C: BorrowMut DatafeedstatuseListCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -7074,12 +7091,12 @@ impl<'a, C, A> DatafeedstatuseListCall<'a, C, A> where C: BorrowMut DatafeedstatuseListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DatafeedstatuseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatafeedstatuseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7172,7 +7189,7 @@ impl<'a, C, A> DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.datafeedstatuses.custombatch", + dlg.begin(MethodInfo { id: "content.datafeedstatuses.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -7192,14 +7209,14 @@ impl<'a, C, A> DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7243,7 +7260,7 @@ impl<'a, C, A> DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7253,10 +7270,10 @@ impl<'a, C, A> DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut DatafeedstatuseCustombatchCall<'a, C, A> { self._request = new_value; @@ -7306,12 +7323,12 @@ impl<'a, C, A> DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut DatafeedstatuseCustombatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DatafeedstatuseCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatafeedstatuseCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7406,7 +7423,7 @@ impl<'a, C, A> DatafeedCustombatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.datafeeds.custombatch", + dlg.begin(MethodInfo { id: "content.datafeeds.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._dry_run { @@ -7429,14 +7446,14 @@ impl<'a, C, A> DatafeedCustombatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7480,7 +7497,7 @@ impl<'a, C, A> DatafeedCustombatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7490,10 +7507,10 @@ impl<'a, C, A> DatafeedCustombatchCall<'a, C, A> where C: BorrowMut DatafeedCustombatchCall<'a, C, A> where C: BorrowMut DatafeedCustombatchCall<'a, C, A> { self._request = new_value; @@ -7550,12 +7567,12 @@ impl<'a, C, A> DatafeedCustombatchCall<'a, C, A> where C: BorrowMut DatafeedCustombatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DatafeedCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatafeedCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7645,7 +7662,7 @@ impl<'a, C, A> DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.datafeeds.get", + dlg.begin(MethodInfo { id: "content.datafeeds.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -7688,7 +7705,7 @@ impl<'a, C, A> DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7724,7 +7741,7 @@ impl<'a, C, A> DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7734,10 +7751,10 @@ impl<'a, C, A> DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7769,7 +7786,7 @@ impl<'a, C, A> DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> DatafeedGetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -7778,7 +7795,7 @@ impl<'a, C, A> DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *datafeed id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn datafeed_id(mut self, new_value: &str) -> DatafeedGetCall<'a, C, A> { self._datafeed_id = new_value.to_string(); @@ -7796,12 +7813,12 @@ impl<'a, C, A> DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7818,17 +7835,17 @@ impl<'a, C, A> DatafeedGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatafeedGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatafeedGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7900,7 +7917,7 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.datafeeds.patch", + dlg.begin(MethodInfo { id: "content.datafeeds.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -7946,14 +7963,14 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7997,7 +8014,7 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8007,10 +8024,10 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8042,7 +8059,7 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Datafeed) -> DatafeedPatchCall<'a, C, A> { self._request = new_value; @@ -8051,7 +8068,7 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> DatafeedPatchCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -8060,7 +8077,7 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *datafeed id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn datafeed_id(mut self, new_value: &str) -> DatafeedPatchCall<'a, C, A> { self._datafeed_id = new_value.to_string(); @@ -8085,12 +8102,12 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8107,17 +8124,17 @@ impl<'a, C, A> DatafeedPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatafeedPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatafeedPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8182,7 +8199,7 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.datafeeds.delete", + dlg.begin(MethodInfo { id: "content.datafeeds.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -8227,7 +8244,7 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8263,7 +8280,7 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8273,10 +8290,10 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8298,7 +8315,7 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> DatafeedDeleteCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -8307,7 +8324,7 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *datafeed id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn datafeed_id(mut self, new_value: &str) -> DatafeedDeleteCall<'a, C, A> { self._datafeed_id = new_value.to_string(); @@ -8332,12 +8349,12 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8354,17 +8371,17 @@ impl<'a, C, A> DatafeedDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatafeedDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatafeedDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8435,7 +8452,7 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.datafeeds.insert", + dlg.begin(MethodInfo { id: "content.datafeeds.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -8480,14 +8497,14 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8531,7 +8548,7 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8541,10 +8558,10 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8576,7 +8593,7 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Datafeed) -> DatafeedInsertCall<'a, C, A> { self._request = new_value; @@ -8585,7 +8602,7 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> DatafeedInsertCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -8610,12 +8627,12 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8632,17 +8649,17 @@ impl<'a, C, A> DatafeedInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatafeedInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatafeedInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8708,7 +8725,7 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.datafeeds.list", + dlg.begin(MethodInfo { id: "content.datafeeds.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -8756,7 +8773,7 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8792,7 +8809,7 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8802,10 +8819,10 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8838,7 +8855,7 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> DatafeedListCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -8870,12 +8887,12 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8892,17 +8909,17 @@ impl<'a, C, A> DatafeedListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatafeedListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatafeedListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8974,7 +8991,7 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.datafeeds.update", + dlg.begin(MethodInfo { id: "content.datafeeds.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -9020,14 +9037,14 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9071,7 +9088,7 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9081,10 +9098,10 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9116,7 +9133,7 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Datafeed) -> DatafeedUpdateCall<'a, C, A> { self._request = new_value; @@ -9125,7 +9142,7 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> DatafeedUpdateCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -9134,7 +9151,7 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *datafeed id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn datafeed_id(mut self, new_value: &str) -> DatafeedUpdateCall<'a, C, A> { self._datafeed_id = new_value.to_string(); @@ -9159,12 +9176,12 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9181,17 +9198,17 @@ impl<'a, C, A> DatafeedUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatafeedUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatafeedUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9254,7 +9271,7 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.productstatuses.get", + dlg.begin(MethodInfo { id: "content.productstatuses.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -9297,7 +9314,7 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9333,7 +9350,7 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9343,10 +9360,10 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9379,7 +9396,7 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> ProductstatuseGetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -9389,7 +9406,7 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *product id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn product_id(mut self, new_value: &str) -> ProductstatuseGetCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -9407,12 +9424,12 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9429,17 +9446,17 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProductstatuseGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductstatuseGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9476,6 +9493,7 @@ impl<'a, C, A> ProductstatuseGetCall<'a, C, A> where C: BorrowMut /// let result = hub.productstatuses().list("merchantId") /// .page_token("sanctus") /// .max_results(79) +/// .include_invalid_inserted_items(true) /// .doit(); /// # } /// ``` @@ -9486,6 +9504,7 @@ pub struct ProductstatuseListCall<'a, C, A> _merchant_id: String, _page_token: Option, _max_results: Option, + _include_invalid_inserted_items: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -9505,9 +9524,9 @@ impl<'a, C, A> ProductstatuseListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.productstatuses.list", + dlg.begin(MethodInfo { id: "content.productstatuses.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -9515,7 +9534,10 @@ impl<'a, C, A> ProductstatuseListCall<'a, C, A> where C: BorrowMut ProductstatuseListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9589,7 +9611,7 @@ impl<'a, C, A> ProductstatuseListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9599,10 +9621,10 @@ impl<'a, C, A> ProductstatuseListCall<'a, C, A> where C: BorrowMut ProductstatuseListCall<'a, C, A> where C: BorrowMut ProductstatuseListCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -9655,6 +9677,13 @@ impl<'a, C, A> ProductstatuseListCall<'a, C, A> where C: BorrowMut ProductstatuseListCall<'a, C, A> { + self._include_invalid_inserted_items = Some(new_value); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -9667,12 +9696,12 @@ impl<'a, C, A> ProductstatuseListCall<'a, C, A> where C: BorrowMut ProductstatuseListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProductstatuseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductstatuseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9767,7 +9796,7 @@ impl<'a, C, A> ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.productstatuses.custombatch", + dlg.begin(MethodInfo { id: "content.productstatuses.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -9787,14 +9816,14 @@ impl<'a, C, A> ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9838,7 +9867,7 @@ impl<'a, C, A> ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9848,10 +9877,10 @@ impl<'a, C, A> ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut ProductstatuseCustombatchCall<'a, C, A> { self._request = new_value; @@ -9901,12 +9930,12 @@ impl<'a, C, A> ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut ProductstatuseCustombatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProductstatuseCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductstatuseCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9994,7 +10023,7 @@ impl<'a, C, A> AccountAuthinfoCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounts.authinfo", + dlg.begin(MethodInfo { id: "content.accounts.authinfo", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -10014,7 +10043,7 @@ impl<'a, C, A> AccountAuthinfoCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10050,7 +10079,7 @@ impl<'a, C, A> AccountAuthinfoCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10060,10 +10089,10 @@ impl<'a, C, A> AccountAuthinfoCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10104,12 +10133,12 @@ impl<'a, C, A> AccountAuthinfoCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10126,17 +10155,17 @@ impl<'a, C, A> AccountAuthinfoCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountAuthinfoCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAuthinfoCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10208,7 +10237,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounts.patch", + dlg.begin(MethodInfo { id: "content.accounts.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -10254,14 +10283,14 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10305,7 +10334,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10315,10 +10344,10 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10350,7 +10379,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountPatchCall<'a, C, A> { self._request = new_value; @@ -10360,7 +10389,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -10370,7 +10399,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10395,12 +10424,12 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10417,17 +10446,17 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10490,7 +10519,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounts.get", + dlg.begin(MethodInfo { id: "content.accounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -10533,7 +10562,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10569,7 +10598,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10579,10 +10608,10 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10615,7 +10644,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -10625,7 +10654,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10643,12 +10672,12 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10665,17 +10694,17 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10747,7 +10776,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounts.update", + dlg.begin(MethodInfo { id: "content.accounts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -10793,14 +10822,14 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10844,7 +10873,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10854,10 +10883,10 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10889,7 +10918,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountUpdateCall<'a, C, A> { self._request = new_value; @@ -10899,7 +10928,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccountUpdateCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -10909,7 +10938,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10934,12 +10963,12 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10956,17 +10985,17 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11001,8 +11030,8 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().list("merchantId") -/// .page_token("et") -/// .max_results(5) +/// .page_token("consetetur") +/// .max_results(49) /// .doit(); /// # } /// ``` @@ -11032,7 +11061,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounts.list", + dlg.begin(MethodInfo { id: "content.accounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -11080,7 +11109,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11116,7 +11145,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11126,10 +11155,10 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11162,7 +11191,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccountListCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -11194,12 +11223,12 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11216,17 +11245,17 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11261,7 +11290,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().delete("merchantId", "accountId") -/// .dry_run(false) +/// .dry_run(true) /// .doit(); /// # } /// ``` @@ -11291,7 +11320,7 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounts.delete", + dlg.begin(MethodInfo { id: "content.accounts.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -11336,7 +11365,7 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11372,7 +11401,7 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11382,10 +11411,10 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11408,7 +11437,7 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccountDeleteCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -11418,7 +11447,7 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -11443,12 +11472,12 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11465,17 +11494,17 @@ impl<'a, C, A> AccountDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11545,7 +11574,7 @@ impl<'a, C, A> AccountCustombatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounts.custombatch", + dlg.begin(MethodInfo { id: "content.accounts.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._dry_run { @@ -11568,14 +11597,14 @@ impl<'a, C, A> AccountCustombatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11619,7 +11648,7 @@ impl<'a, C, A> AccountCustombatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11629,10 +11658,10 @@ impl<'a, C, A> AccountCustombatchCall<'a, C, A> where C: BorrowMut AccountCustombatchCall<'a, C, A> where C: BorrowMut AccountCustombatchCall<'a, C, A> { self._request = new_value; @@ -11689,12 +11718,12 @@ impl<'a, C, A> AccountCustombatchCall<'a, C, A> where C: BorrowMut AccountCustombatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11762,7 +11791,7 @@ impl<'a, C, A> AccountCustombatchCall<'a, C, A> where C: BorrowMut AccountInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accounts.insert", + dlg.begin(MethodInfo { id: "content.accounts.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -11837,14 +11866,14 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11888,7 +11917,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11898,10 +11927,10 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11933,7 +11962,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountInsertCall<'a, C, A> { self._request = new_value; @@ -11943,7 +11972,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccountInsertCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -11968,12 +11997,12 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11990,17 +12019,17 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12073,7 +12102,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.inventory.set", + dlg.begin(MethodInfo { id: "content.inventory.set", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -12120,14 +12149,14 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12171,7 +12200,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12181,10 +12210,10 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12216,7 +12245,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InventorySetRequest) -> InventorySetCall<'a, C, A> { self._request = new_value; @@ -12226,7 +12255,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> InventorySetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -12236,7 +12265,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *store code* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn store_code(mut self, new_value: &str) -> InventorySetCall<'a, C, A> { self._store_code = new_value.to_string(); @@ -12246,7 +12275,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *product id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn product_id(mut self, new_value: &str) -> InventorySetCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -12271,12 +12300,12 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12293,17 +12322,17 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InventorySetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InventorySetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12344,7 +12373,7 @@ impl<'a, C, A> InventorySetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.inventory().custombatch(req) -/// .dry_run(true) +/// .dry_run(false) /// .doit(); /// # } /// ``` @@ -12373,7 +12402,7 @@ impl<'a, C, A> InventoryCustombatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.inventory.custombatch", + dlg.begin(MethodInfo { id: "content.inventory.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._dry_run { @@ -12396,14 +12425,14 @@ impl<'a, C, A> InventoryCustombatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12447,7 +12476,7 @@ impl<'a, C, A> InventoryCustombatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12457,10 +12486,10 @@ impl<'a, C, A> InventoryCustombatchCall<'a, C, A> where C: BorrowMut InventoryCustombatchCall<'a, C, A> where C: BorrowMut InventoryCustombatchCall<'a, C, A> { self._request = new_value; @@ -12517,12 +12546,12 @@ impl<'a, C, A> InventoryCustombatchCall<'a, C, A> where C: BorrowMut InventoryCustombatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InventoryCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InventoryCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12612,7 +12641,7 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accountstatuses.get", + dlg.begin(MethodInfo { id: "content.accountstatuses.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -12655,7 +12684,7 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12691,7 +12720,7 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12701,10 +12730,10 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12737,7 +12766,7 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> AccountstatuseGetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -12747,7 +12776,7 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountstatuseGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12765,12 +12794,12 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12787,17 +12816,17 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountstatuseGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountstatuseGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12832,8 +12861,8 @@ impl<'a, C, A> AccountstatuseGetCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accountstatuses().list("merchantId") -/// .page_token("consetetur") -/// .max_results(17) +/// .page_token("dolore") +/// .max_results(82) /// .doit(); /// # } /// ``` @@ -12863,7 +12892,7 @@ impl<'a, C, A> AccountstatuseListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accountstatuses.list", + dlg.begin(MethodInfo { id: "content.accountstatuses.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -12911,7 +12940,7 @@ impl<'a, C, A> AccountstatuseListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12947,7 +12976,7 @@ impl<'a, C, A> AccountstatuseListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12957,10 +12986,10 @@ impl<'a, C, A> AccountstatuseListCall<'a, C, A> where C: BorrowMut AccountstatuseListCall<'a, C, A> where C: BorrowMut AccountstatuseListCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -13025,12 +13054,12 @@ impl<'a, C, A> AccountstatuseListCall<'a, C, A> where C: BorrowMut AccountstatuseListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountstatuseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountstatuseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13123,7 +13152,7 @@ impl<'a, C, A> AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accountstatuses.custombatch", + dlg.begin(MethodInfo { id: "content.accountstatuses.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -13143,14 +13172,14 @@ impl<'a, C, A> AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13194,7 +13223,7 @@ impl<'a, C, A> AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13204,10 +13233,10 @@ impl<'a, C, A> AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut AccountstatuseCustombatchCall<'a, C, A> { self._request = new_value; @@ -13257,12 +13286,12 @@ impl<'a, C, A> AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountstatuseCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountstatuseCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13324,8 +13353,9 @@ impl<'a, C, A> AccountstatuseCustombatchCall<'a, C, A> where C: BorrowMut _merchant_id: String, _page_token: Option, _max_results: Option, + _include_invalid_inserted_items: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -13355,9 +13386,9 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.products.list", + dlg.begin(MethodInfo { id: "content.products.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -13365,7 +13396,10 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o if let Some(value) = self._max_results { params.push(("maxResults", value.to_string())); } - for &field in ["alt", "merchantId", "pageToken", "maxResults"].iter() { + if let Some(value) = self._include_invalid_inserted_items { + params.push(("includeInvalidInsertedItems", value.to_string())); + } + for &field in ["alt", "merchantId", "pageToken", "maxResults", "includeInvalidInsertedItems"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -13403,7 +13437,7 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13439,7 +13473,7 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13449,10 +13483,10 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13485,7 +13519,7 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> ProductListCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -13505,6 +13539,13 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o self._max_results = Some(new_value); self } + /// Flag to include the invalid inserted items in the result of the list request. By default the invalid items are not shown (the default value is false). + /// + /// Sets the *include invalid inserted items* query property to the given value. + pub fn include_invalid_inserted_items(mut self, new_value: bool) -> ProductListCall<'a, C, A> { + self._include_invalid_inserted_items = Some(new_value); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -13517,12 +13558,12 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13539,17 +13580,17 @@ impl<'a, C, A> ProductListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProductListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13612,7 +13653,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.products.get", + dlg.begin(MethodInfo { id: "content.products.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -13655,7 +13696,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13691,7 +13732,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13701,10 +13742,10 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13737,7 +13778,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -13747,7 +13788,7 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *product id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn product_id(mut self, new_value: &str) -> ProductGetCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -13765,12 +13806,12 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13787,17 +13828,17 @@ impl<'a, C, A> ProductGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProductGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13862,7 +13903,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.products.delete", + dlg.begin(MethodInfo { id: "content.products.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -13907,7 +13948,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13943,7 +13984,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13953,10 +13994,10 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13979,7 +14020,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> ProductDeleteCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -13989,7 +14030,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *product id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn product_id(mut self, new_value: &str) -> ProductDeleteCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -14014,12 +14055,12 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14036,17 +14077,17 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProductDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14087,7 +14128,7 @@ impl<'a, C, A> ProductDeleteCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.products().custombatch(req) -/// .dry_run(true) +/// .dry_run(false) /// .doit(); /// # } /// ``` @@ -14116,7 +14157,7 @@ impl<'a, C, A> ProductCustombatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.products.custombatch", + dlg.begin(MethodInfo { id: "content.products.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._dry_run { @@ -14139,14 +14180,14 @@ impl<'a, C, A> ProductCustombatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14190,7 +14231,7 @@ impl<'a, C, A> ProductCustombatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14200,10 +14241,10 @@ impl<'a, C, A> ProductCustombatchCall<'a, C, A> where C: BorrowMut ProductCustombatchCall<'a, C, A> where C: BorrowMut ProductCustombatchCall<'a, C, A> { self._request = new_value; @@ -14260,12 +14301,12 @@ impl<'a, C, A> ProductCustombatchCall<'a, C, A> where C: BorrowMut ProductCustombatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProductCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14363,7 +14404,7 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.products.insert", + dlg.begin(MethodInfo { id: "content.products.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -14408,14 +14449,14 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14459,7 +14500,7 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14469,10 +14510,10 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14504,7 +14545,7 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Product) -> ProductInsertCall<'a, C, A> { self._request = new_value; @@ -14514,7 +14555,7 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> ProductInsertCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -14539,12 +14580,12 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14561,17 +14602,17 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProductInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProductInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14606,8 +14647,8 @@ impl<'a, C, A> ProductInsertCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accountshipping().list("merchantId") -/// .page_token("labore") -/// .max_results(64) +/// .page_token("ea") +/// .max_results(6) /// .doit(); /// # } /// ``` @@ -14637,7 +14678,7 @@ impl<'a, C, A> AccountshippingListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accountshipping.list", + dlg.begin(MethodInfo { id: "content.accountshipping.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -14685,7 +14726,7 @@ impl<'a, C, A> AccountshippingListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14721,7 +14762,7 @@ impl<'a, C, A> AccountshippingListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14731,10 +14772,10 @@ impl<'a, C, A> AccountshippingListCall<'a, C, A> where C: BorrowMut AccountshippingListCall<'a, C, A> where C: BorrowMut AccountshippingListCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -14799,12 +14840,12 @@ impl<'a, C, A> AccountshippingListCall<'a, C, A> where C: BorrowMut AccountshippingListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountshippingListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountshippingListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14872,7 +14913,7 @@ impl<'a, C, A> AccountshippingListCall<'a, C, A> where C: BorrowMut AccountshippingPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accountshipping.patch", + dlg.begin(MethodInfo { id: "content.accountshipping.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -14949,14 +14990,14 @@ impl<'a, C, A> AccountshippingPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15000,7 +15041,7 @@ impl<'a, C, A> AccountshippingPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15010,10 +15051,10 @@ impl<'a, C, A> AccountshippingPatchCall<'a, C, A> where C: BorrowMut AccountshippingPatchCall<'a, C, A> where C: BorrowMut AccountshippingPatchCall<'a, C, A> { self._request = new_value; @@ -15055,7 +15096,7 @@ impl<'a, C, A> AccountshippingPatchCall<'a, C, A> where C: BorrowMut AccountshippingPatchCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -15065,7 +15106,7 @@ impl<'a, C, A> AccountshippingPatchCall<'a, C, A> where C: BorrowMut AccountshippingPatchCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -15090,12 +15131,12 @@ impl<'a, C, A> AccountshippingPatchCall<'a, C, A> where C: BorrowMut AccountshippingPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountshippingPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountshippingPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15163,7 +15204,7 @@ impl<'a, C, A> AccountshippingPatchCall<'a, C, A> where C: BorrowMut AccountshippingUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accountshipping.update", + dlg.begin(MethodInfo { id: "content.accountshipping.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -15240,14 +15281,14 @@ impl<'a, C, A> AccountshippingUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15291,7 +15332,7 @@ impl<'a, C, A> AccountshippingUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15301,10 +15342,10 @@ impl<'a, C, A> AccountshippingUpdateCall<'a, C, A> where C: BorrowMut AccountshippingUpdateCall<'a, C, A> where C: BorrowMut AccountshippingUpdateCall<'a, C, A> { self._request = new_value; @@ -15346,7 +15387,7 @@ impl<'a, C, A> AccountshippingUpdateCall<'a, C, A> where C: BorrowMut AccountshippingUpdateCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -15356,7 +15397,7 @@ impl<'a, C, A> AccountshippingUpdateCall<'a, C, A> where C: BorrowMut AccountshippingUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -15381,12 +15422,12 @@ impl<'a, C, A> AccountshippingUpdateCall<'a, C, A> where C: BorrowMut AccountshippingUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountshippingUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountshippingUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15454,7 +15495,7 @@ impl<'a, C, A> AccountshippingUpdateCall<'a, C, A> where C: BorrowMut AccountshippingCustombatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accountshipping.custombatch", + dlg.begin(MethodInfo { id: "content.accountshipping.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._dry_run { @@ -15506,14 +15547,14 @@ impl<'a, C, A> AccountshippingCustombatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15557,7 +15598,7 @@ impl<'a, C, A> AccountshippingCustombatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15567,10 +15608,10 @@ impl<'a, C, A> AccountshippingCustombatchCall<'a, C, A> where C: BorrowMut AccountshippingCustombatchCall<'a, C, A> where C: BorrowMut AccountshippingCustombatchCall<'a, C, A> { self._request = new_value; @@ -15627,12 +15668,12 @@ impl<'a, C, A> AccountshippingCustombatchCall<'a, C, A> where C: BorrowMut AccountshippingCustombatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountshippingCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountshippingCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15722,7 +15763,7 @@ impl<'a, C, A> AccountshippingGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.accountshipping.get", + dlg.begin(MethodInfo { id: "content.accountshipping.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -15765,7 +15806,7 @@ impl<'a, C, A> AccountshippingGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15801,7 +15842,7 @@ impl<'a, C, A> AccountshippingGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15811,10 +15852,10 @@ impl<'a, C, A> AccountshippingGetCall<'a, C, A> where C: BorrowMut AccountshippingGetCall<'a, C, A> where C: BorrowMut AccountshippingGetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -15857,7 +15898,7 @@ impl<'a, C, A> AccountshippingGetCall<'a, C, A> where C: BorrowMut AccountshippingGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -15875,12 +15916,12 @@ impl<'a, C, A> AccountshippingGetCall<'a, C, A> where C: BorrowMut AccountshippingGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountshippingGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountshippingGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15942,13 +15983,13 @@ impl<'a, C, A> AccountshippingGetCall<'a, C, A> where C: BorrowMut OrderListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.list", + dlg.begin(MethodInfo { id: "content.orders.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -16050,7 +16091,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16086,7 +16127,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16096,10 +16137,10 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16132,7 +16173,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -16202,12 +16243,12 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16224,17 +16265,17 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16297,7 +16338,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.gettestordertemplate", + dlg.begin(MethodInfo { id: "content.orders.gettestordertemplate", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -16340,7 +16381,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16376,7 +16417,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16386,10 +16427,10 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -16432,7 +16473,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> { self._template_name = new_value.to_string(); @@ -16450,12 +16491,12 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderGettestordertemplateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderGettestordertemplateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16545,7 +16586,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.get", + dlg.begin(MethodInfo { id: "content.orders.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -16588,7 +16629,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16624,7 +16665,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16634,10 +16675,10 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16670,7 +16711,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -16680,7 +16721,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -16698,12 +16739,12 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16720,17 +16761,17 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16800,7 +16841,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.refund", + dlg.begin(MethodInfo { id: "content.orders.refund", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -16843,14 +16884,14 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -16894,7 +16935,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16904,10 +16945,10 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16939,7 +16980,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrdersRefundRequest) -> OrderRefundCall<'a, C, A> { self._request = new_value; @@ -16949,7 +16990,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderRefundCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -16959,7 +17000,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> OrderRefundCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -16977,12 +17018,12 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16999,17 +17040,17 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderRefundCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderRefundCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17079,7 +17120,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.acknowledge", + dlg.begin(MethodInfo { id: "content.orders.acknowledge", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -17122,14 +17163,14 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17173,7 +17214,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17183,10 +17224,10 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17218,7 +17259,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrdersAcknowledgeRequest) -> OrderAcknowledgeCall<'a, C, A> { self._request = new_value; @@ -17228,7 +17269,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderAcknowledgeCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -17238,7 +17279,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> OrderAcknowledgeCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -17256,12 +17297,12 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17278,17 +17319,17 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderAcknowledgeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderAcknowledgeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17358,7 +17399,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.updatemerchantorderid", + dlg.begin(MethodInfo { id: "content.orders.updatemerchantorderid", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -17401,14 +17442,14 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17452,7 +17493,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17462,10 +17503,10 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> { self._request = new_value; @@ -17507,7 +17548,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -17517,7 +17558,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -17535,12 +17576,12 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderUpdatemerchantorderidCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderUpdatemerchantorderidCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17630,7 +17671,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.advancetestorder", + dlg.begin(MethodInfo { id: "content.orders.advancetestorder", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -17673,7 +17714,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17709,7 +17750,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17719,10 +17760,10 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -17765,7 +17806,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -17783,12 +17824,12 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderAdvancetestorderCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderAdvancetestorderCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17884,7 +17925,7 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.createtestorder", + dlg.begin(MethodInfo { id: "content.orders.createtestorder", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -17926,14 +17967,14 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17977,7 +18018,7 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17987,10 +18028,10 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> { self._request = new_value; @@ -18032,7 +18073,7 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -18050,12 +18091,12 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderCreatetestorderCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderCreatetestorderCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18152,7 +18193,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.returnlineitem", + dlg.begin(MethodInfo { id: "content.orders.returnlineitem", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -18195,14 +18236,14 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -18246,7 +18287,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18256,10 +18297,10 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> { self._request = new_value; @@ -18301,7 +18342,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -18311,7 +18352,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -18329,12 +18370,12 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderReturnlineitemCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderReturnlineitemCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18424,7 +18465,7 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.getbymerchantorderid", + dlg.begin(MethodInfo { id: "content.orders.getbymerchantorderid", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -18467,7 +18508,7 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18503,7 +18544,7 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18513,10 +18554,10 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -18559,7 +18600,7 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> { self._merchant_order_id = new_value.to_string(); @@ -18577,12 +18618,12 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderGetbymerchantorderidCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderGetbymerchantorderidCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18677,7 +18718,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.custombatch", + dlg.begin(MethodInfo { id: "content.orders.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -18697,14 +18738,14 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -18748,7 +18789,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18758,10 +18799,10 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18793,7 +18834,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrdersCustomBatchRequest) -> OrderCustombatchCall<'a, C, A> { self._request = new_value; @@ -18811,12 +18852,12 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18833,17 +18874,17 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18913,7 +18954,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.shiplineitems", + dlg.begin(MethodInfo { id: "content.orders.shiplineitems", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -18956,14 +18997,14 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19007,7 +19048,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19017,10 +19058,10 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19052,7 +19093,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrdersShipLineItemsRequest) -> OrderShiplineitemCall<'a, C, A> { self._request = new_value; @@ -19062,7 +19103,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderShiplineitemCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -19072,7 +19113,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> OrderShiplineitemCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -19090,12 +19131,12 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19112,17 +19153,17 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderShiplineitemCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderShiplineitemCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19192,7 +19233,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.updateshipment", + dlg.begin(MethodInfo { id: "content.orders.updateshipment", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -19235,14 +19276,14 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19286,7 +19327,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19296,10 +19337,10 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> { self._request = new_value; @@ -19341,7 +19382,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -19351,7 +19392,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -19369,12 +19410,12 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderUpdateshipmentCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderUpdateshipmentCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19471,7 +19512,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.cancellineitem", + dlg.begin(MethodInfo { id: "content.orders.cancellineitem", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -19514,14 +19555,14 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19565,7 +19606,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19575,10 +19616,10 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> { self._request = new_value; @@ -19620,7 +19661,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -19630,7 +19671,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -19648,12 +19689,12 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderCancellineitemCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderCancellineitemCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19750,7 +19791,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.cancel", + dlg.begin(MethodInfo { id: "content.orders.cancel", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -19793,14 +19834,14 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19844,7 +19885,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19854,10 +19895,10 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19889,7 +19930,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrdersCancelRequest) -> OrderCancelCall<'a, C, A> { self._request = new_value; @@ -19899,7 +19940,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderCancelCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -19909,7 +19950,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> OrderCancelCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -19927,12 +19968,12 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19949,17 +19990,17 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderCancelCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderCancelCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/content2_sandbox-cli/Cargo.toml b/gen/content2_sandbox-cli/Cargo.toml index 6d7e25400f..df3bb77673 100644 --- a/gen/content2_sandbox-cli/Cargo.toml +++ b/gen/content2_sandbox-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-content2_sandbox-cli" -version = "0.3.2+20151002" +version = "0.3.3+20160115" authors = ["Sebastian Thiel "] description = "A complete library to interact with Shopping Content (protocol v2sandbox)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/content2_sandbox-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/content2_sandbox-cli/LICENSE.md b/gen/content2_sandbox-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/content2_sandbox-cli/LICENSE.md +++ b/gen/content2_sandbox-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/content2_sandbox-cli/README.md b/gen/content2_sandbox-cli/README.md index 058766372d..b5c8d9a047 100644 --- a/gen/content2_sandbox-cli/README.md +++ b/gen/content2_sandbox-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Shopping Content* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/content2-sandbox.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/content2-sandbox.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/content2-sandbox.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/content2-sandbox.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/content2_sandbox-cli). # Usage -This documentation was generated from the *Shopping Content* API at revision *20151002*. The CLI is at version *0.3.2*. +This documentation was generated from the *Shopping Content* API at revision *20160115*. The CLI is at version *0.3.3*. ```bash content2-sandbox [options] @@ -48,18 +48,18 @@ content2-sandbox [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/content2_sandbox-cli/mkdocs.yml b/gen/content2_sandbox-cli/mkdocs.yml index 467202ea28..e882340e9d 100644 --- a/gen/content2_sandbox-cli/mkdocs.yml +++ b/gen/content2_sandbox-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Shopping Content v0.3.2+20151002 +site_name: Shopping Content v0.3.3+20160115 site_url: http://byron.github.io/google-apis-rs/google-content2_sandbox-cli site_description: Write integrating applications with bcore @@ -27,5 +27,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/content2_sandbox-cli/src/main.rs b/gen/content2_sandbox-cli/src/main.rs index 1855112e5b..dfb98c3c6f 100644 --- a/gen/content2_sandbox-cli/src/main.rs +++ b/gen/content2_sandbox-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::ShoppingContent>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _orders_acknowledge(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _orders_acknowledge(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "operation-id" => Some(("operationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -81,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersAcknowledgeRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().acknowledge(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -94,7 +94,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -107,7 +107,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -130,10 +130,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_advancetestorder(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_advancetestorder(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().advancetestorder(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -146,7 +146,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -159,7 +159,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -182,13 +182,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_cancel(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -202,8 +202,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "reason" => Some(("reason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reason-text" => Some(("reasonText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -220,7 +220,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersCancelRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().cancel(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -233,7 +233,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -246,7 +246,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -269,13 +269,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_cancellineitem(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_cancellineitem(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -289,16 +289,18 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "quantity" => Some(("quantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "reason" => Some(("reason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "amount.currency" => Some(("amount.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "amount.value" => Some(("amount.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reason-text" => Some(("reasonText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "line-item-id" => Some(("lineItemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation-id" => Some(("operationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "quantity" => Some(("quantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["line-item-id", "operation-id", "quantity", "reason", "reason-text"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["amount", "currency", "line-item-id", "operation-id", "quantity", "reason", "reason-text", "value"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -309,7 +311,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersCancelLineItemRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().cancellineitem(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -322,7 +324,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -335,7 +337,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -358,13 +360,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_createtestorder(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_createtestorder(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -378,8 +380,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "test-order.customer.explicit-marketing-preference" => Some(("testOrder.customer.explicitMarketingPreference", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "test-order.customer.full-name" => Some(("testOrder.customer.fullName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -409,7 +411,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersCreateTestOrderRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().createtestorder(request, opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -422,7 +424,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -435,7 +437,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -458,13 +460,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_custombatch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_custombatch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -478,8 +480,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -493,7 +495,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersCustomBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().custombatch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -506,7 +508,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -519,7 +521,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -542,10 +544,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().get(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -558,7 +560,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -571,7 +573,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -594,10 +596,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_getbymerchantorderid(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_getbymerchantorderid(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().getbymerchantorderid(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("merchant-order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -610,7 +612,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -623,7 +625,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -646,10 +648,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_gettestordertemplate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_gettestordertemplate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().gettestordertemplate(opt.value_of("merchant-id").unwrap_or(""), opt.value_of("template-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -662,7 +664,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -675,7 +677,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -698,10 +700,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().list(opt.value_of("merchant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "statuses" => { @@ -735,7 +737,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "placed-date-end", "acknowledged", "max-results", "page-token", "placed-date-start", "statuses"].iter().map(|v|*v)); @@ -749,7 +751,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -772,13 +774,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_refund(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_refund(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -792,8 +794,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "amount.currency" => Some(("amount.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "amount.value" => Some(("amount.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -812,7 +814,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersRefundRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().refund(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -825,7 +827,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -838,7 +840,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -861,13 +863,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_returnlineitem(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_returnlineitem(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -881,8 +883,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "quantity" => Some(("quantity", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "reason" => Some(("reason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -901,7 +903,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersReturnLineItemRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().returnlineitem(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -914,7 +916,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -927,7 +929,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -950,13 +952,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_shiplineitems(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_shiplineitems(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -970,8 +972,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "shipment-id" => Some(("shipmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "carrier" => Some(("carrier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -989,7 +991,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersShipLineItemsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().shiplineitems(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1002,7 +1004,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1015,7 +1017,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1038,13 +1040,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_updatemerchantorderid(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_updatemerchantorderid(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1058,8 +1060,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "merchant-order-id" => Some(("merchantOrderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation-id" => Some(("operationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1075,7 +1077,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersUpdateMerchantOrderIdRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().updatemerchantorderid(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1088,7 +1090,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1101,7 +1103,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1124,13 +1126,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_updateshipment(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_updateshipment(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1144,8 +1146,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "shipment-id" => Some(("shipmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1164,7 +1166,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::OrdersUpdateShipmentRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.orders().updateshipment(request, opt.value_of("merchant-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1177,7 +1179,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1190,7 +1192,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1288,14 +1290,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "content2-sandbox-secret.json", + match cmn::application_secret_from_directory(&config_dir, "content2-sandbox-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1315,7 +1317,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1354,7 +1356,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("orders", "methods: 'acknowledge', 'advancetestorder', 'cancel', 'cancellineitem', 'createtestorder', 'custombatch', 'get', 'getbymerchantorderid', 'gettestordertemplate', 'list', 'refund', 'returnlineitem', 'shiplineitems', 'updatemerchantorderid' and 'updateshipment'", vec![ - ("acknowledge", + ("acknowledge", Some(r##"Marks an order as acknowledged."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_acknowledge", vec![ @@ -1388,7 +1390,7 @@ fn main() { Some(false), Some(false)), ]), - ("advancetestorder", + ("advancetestorder", Some(r##"Sandbox only. Moves a test order from state "inProgress" to state "pendingShipment"."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_advancetestorder", vec![ @@ -1416,7 +1418,7 @@ fn main() { Some(false), Some(false)), ]), - ("cancel", + ("cancel", Some(r##"Cancels all line items in an order."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_cancel", vec![ @@ -1450,7 +1452,7 @@ fn main() { Some(false), Some(false)), ]), - ("cancellineitem", + ("cancellineitem", Some(r##"Cancels a line item."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_cancellineitem", vec![ @@ -1484,7 +1486,7 @@ fn main() { Some(false), Some(false)), ]), - ("createtestorder", + ("createtestorder", Some(r##"Sandbox only. Creates a test order."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_createtestorder", vec![ @@ -1512,7 +1514,7 @@ fn main() { Some(false), Some(false)), ]), - ("custombatch", + ("custombatch", Some(r##"Retrieves or modifies multiple orders in a single request."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_custombatch", vec![ @@ -1534,7 +1536,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves an order from your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_get", vec![ @@ -1562,7 +1564,7 @@ fn main() { Some(false), Some(false)), ]), - ("getbymerchantorderid", + ("getbymerchantorderid", Some(r##"Retrieves an order using merchant order id."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_getbymerchantorderid", vec![ @@ -1590,7 +1592,7 @@ fn main() { Some(false), Some(false)), ]), - ("gettestordertemplate", + ("gettestordertemplate", Some(r##"Sandbox only. Retrieves an order template that can be used to quickly create a new order in sandbox."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_gettestordertemplate", vec![ @@ -1618,7 +1620,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the orders in your Merchant Center account."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_list", vec![ @@ -1640,7 +1642,7 @@ fn main() { Some(false), Some(false)), ]), - ("refund", + ("refund", Some(r##"Refund a portion of the order, up to the full amount paid."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_refund", vec![ @@ -1674,7 +1676,7 @@ fn main() { Some(false), Some(false)), ]), - ("returnlineitem", + ("returnlineitem", Some(r##"Returns a line item."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_returnlineitem", vec![ @@ -1708,7 +1710,7 @@ fn main() { Some(false), Some(false)), ]), - ("shiplineitems", + ("shiplineitems", Some(r##"Marks line item(s) as shipped."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_shiplineitems", vec![ @@ -1742,7 +1744,7 @@ fn main() { Some(false), Some(false)), ]), - ("updatemerchantorderid", + ("updatemerchantorderid", Some(r##"Updates the merchant order ID for a given order."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_updatemerchantorderid", vec![ @@ -1776,7 +1778,7 @@ fn main() { Some(false), Some(false)), ]), - ("updateshipment", + ("updateshipment", Some(r##"Updates a shipment's status, carrier, and/or tracking ID."##), "Details at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli/orders_updateshipment", vec![ @@ -1816,7 +1818,7 @@ fn main() { let mut app = App::new("content2-sandbox") .author("Sebastian Thiel ") - .version("0.3.2+20151002") + .version("0.3.3+20160115") .about("Manage product items, inventory, and Merchant Center accounts for Google Shopping.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_content2_sandbox_cli") .arg(Arg::with_name("url") @@ -1840,7 +1842,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1851,7 +1853,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/content2_sandbox/Cargo.toml b/gen/content2_sandbox/Cargo.toml index 1e94f996d3..e960cdf07f 100644 --- a/gen/content2_sandbox/Cargo.toml +++ b/gen/content2_sandbox/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-content2_sandbox" -version = "0.1.10+20151002" +version = "0.1.11+20160115" authors = ["Sebastian Thiel "] description = "A complete library to interact with Shopping Content (protocol v2sandbox)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/content2_sandbox" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/content2_sandbox/LICENSE.md b/gen/content2_sandbox/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/content2_sandbox/LICENSE.md +++ b/gen/content2_sandbox/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/content2_sandbox/README.md b/gen/content2_sandbox/README.md index 5df750b73e..209e55a8a6 100644 --- a/gen/content2_sandbox/README.md +++ b/gen/content2_sandbox/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-content2_sandbox` library allows access to all features of the *Google Shopping Content* service. -This documentation was generated from *Shopping Content* crate version *0.1.10+20151002*, where *20151002* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Shopping Content* crate version *0.1.11+20160115*, where *20160115* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Shopping Content* *v2_sandbox* API can be found at the [official documentation site](https://developers.google.com/shopping-content). diff --git a/gen/content2_sandbox/src/cmn.rs b/gen/content2_sandbox/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/content2_sandbox/src/cmn.rs +++ b/gen/content2_sandbox/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/content2_sandbox/src/lib.rs b/gen/content2_sandbox/src/lib.rs index 3a152f1e35..a27d7789ae 100644 --- a/gen/content2_sandbox/src/lib.rs +++ b/gen/content2_sandbox/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Shopping Content* crate version *0.1.10+20151002*, where *20151002* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Shopping Content* crate version *0.1.11+20160115*, where *20160115* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Shopping Content* *v2_sandbox* API can be found at the //! [official documentation site](https://developers.google.com/shopping-content). diff --git a/gen/content2_sandbox/src/lib.rs.in b/gen/content2_sandbox/src/lib.rs.in index 4de0fee365..bf283c9ce3 100644 --- a/gen/content2_sandbox/src/lib.rs.in +++ b/gen/content2_sandbox/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -133,7 +134,7 @@ impl<'a, C, A> ShoppingContent ShoppingContent { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -142,7 +143,7 @@ impl<'a, C, A> ShoppingContent } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -840,17 +841,19 @@ impl Part for OrderLineItemProduct {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrdersCancelLineItemRequest { - /// The ID of the operation. Unique across all operations for a given order. - #[serde(rename="operationId")] - pub operation_id: Option, - /// The reason for the cancellation. - pub reason: Option, + /// Amount to refund for the cancelation. Optional. If not set, Google will calculate the default based on the price and tax of the items involved. The amount must not be larger than the net amount left on the order. + pub amount: Option, /// The explanation of the reason. #[serde(rename="reasonText")] pub reason_text: Option, /// The ID of the line item to cancel. #[serde(rename="lineItemId")] pub line_item_id: Option, + /// The ID of the operation. Unique across all operations for a given order. + #[serde(rename="operationId")] + pub operation_id: Option, + /// The reason for the cancellation. + pub reason: Option, /// The quantity to cancel. pub quantity: Option, } @@ -1163,11 +1166,13 @@ impl Part for OrderLineItem {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OrdersCustomBatchRequestEntryCancelLineItem { - /// The reason for the cancellation. - pub reason: Option, + /// Amount to refund for the cancelation. Optional. If not set, Google will calculate the default based on the price and tax of the items involved. The amount must not be larger than the net amount left on the order. + pub amount: Option, /// The explanation of the reason. #[serde(rename="reasonText")] pub reason_text: Option, + /// The reason for the cancellation. + pub reason: Option, /// The ID of the line item to cancel. #[serde(rename="lineItemId")] pub line_item_id: Option, @@ -1949,7 +1954,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.get", + dlg.begin(MethodInfo { id: "content.orders.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -1992,7 +1997,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2028,7 +2033,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2038,10 +2043,10 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2074,7 +2079,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -2084,7 +2089,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -2102,12 +2107,12 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2124,17 +2129,17 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2210,7 +2215,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.list", + dlg.begin(MethodInfo { id: "content.orders.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -2277,7 +2282,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2313,7 +2318,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2323,10 +2328,10 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2359,7 +2364,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -2429,12 +2434,12 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2451,17 +2456,17 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2531,7 +2536,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.updateshipment", + dlg.begin(MethodInfo { id: "content.orders.updateshipment", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -2574,14 +2579,14 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2625,7 +2630,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2635,10 +2640,10 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> { self._request = new_value; @@ -2680,7 +2685,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -2690,7 +2695,7 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -2708,12 +2713,12 @@ impl<'a, C, A> OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut OrderUpdateshipmentCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderUpdateshipmentCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderUpdateshipmentCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2803,7 +2808,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.advancetestorder", + dlg.begin(MethodInfo { id: "content.orders.advancetestorder", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -2846,7 +2851,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2882,7 +2887,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2892,10 +2897,10 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -2938,7 +2943,7 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -2956,12 +2961,12 @@ impl<'a, C, A> OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut OrderAdvancetestorderCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderAdvancetestorderCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderAdvancetestorderCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3058,7 +3063,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.updatemerchantorderid", + dlg.begin(MethodInfo { id: "content.orders.updatemerchantorderid", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -3101,14 +3106,14 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3152,7 +3157,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3162,10 +3167,10 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> { self._request = new_value; @@ -3207,7 +3212,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -3217,7 +3222,7 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -3235,12 +3240,12 @@ impl<'a, C, A> OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut OrderUpdatemerchantorderidCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderUpdatemerchantorderidCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderUpdatemerchantorderidCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3337,7 +3342,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.returnlineitem", + dlg.begin(MethodInfo { id: "content.orders.returnlineitem", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -3380,14 +3385,14 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3431,7 +3436,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3441,10 +3446,10 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> { self._request = new_value; @@ -3486,7 +3491,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -3496,7 +3501,7 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -3514,12 +3519,12 @@ impl<'a, C, A> OrderReturnlineitemCall<'a, C, A> where C: BorrowMut OrderReturnlineitemCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderReturnlineitemCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderReturnlineitemCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3609,7 +3614,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.gettestordertemplate", + dlg.begin(MethodInfo { id: "content.orders.gettestordertemplate", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -3652,7 +3657,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3688,7 +3693,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3698,10 +3703,10 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -3744,7 +3749,7 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> { self._template_name = new_value.to_string(); @@ -3762,12 +3767,12 @@ impl<'a, C, A> OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut OrderGettestordertemplateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderGettestordertemplateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderGettestordertemplateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3863,7 +3868,7 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.createtestorder", + dlg.begin(MethodInfo { id: "content.orders.createtestorder", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -3905,14 +3910,14 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3956,7 +3961,7 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3966,10 +3971,10 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> { self._request = new_value; @@ -4011,7 +4016,7 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -4029,12 +4034,12 @@ impl<'a, C, A> OrderCreatetestorderCall<'a, C, A> where C: BorrowMut OrderCreatetestorderCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderCreatetestorderCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderCreatetestorderCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4131,7 +4136,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.refund", + dlg.begin(MethodInfo { id: "content.orders.refund", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -4174,14 +4179,14 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4225,7 +4230,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4235,10 +4240,10 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4270,7 +4275,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrdersRefundRequest) -> OrderRefundCall<'a, C, A> { self._request = new_value; @@ -4280,7 +4285,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderRefundCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -4290,7 +4295,7 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> OrderRefundCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -4308,12 +4313,12 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4330,17 +4335,17 @@ impl<'a, C, A> OrderRefundCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderRefundCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderRefundCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4408,7 +4413,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.custombatch", + dlg.begin(MethodInfo { id: "content.orders.custombatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -4428,14 +4433,14 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4479,7 +4484,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4489,10 +4494,10 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4524,7 +4529,7 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrdersCustomBatchRequest) -> OrderCustombatchCall<'a, C, A> { self._request = new_value; @@ -4542,12 +4547,12 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4564,17 +4569,17 @@ impl<'a, C, A> OrderCustombatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderCustombatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderCustombatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4644,7 +4649,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.cancellineitem", + dlg.begin(MethodInfo { id: "content.orders.cancellineitem", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -4687,14 +4692,14 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4738,7 +4743,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4748,10 +4753,10 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> { self._request = new_value; @@ -4793,7 +4798,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -4803,7 +4808,7 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -4821,12 +4826,12 @@ impl<'a, C, A> OrderCancellineitemCall<'a, C, A> where C: BorrowMut OrderCancellineitemCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderCancellineitemCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderCancellineitemCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4916,7 +4921,7 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.getbymerchantorderid", + dlg.begin(MethodInfo { id: "content.orders.getbymerchantorderid", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -4959,7 +4964,7 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4995,7 +5000,7 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5005,10 +5010,10 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -5051,7 +5056,7 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> { self._merchant_order_id = new_value.to_string(); @@ -5069,12 +5074,12 @@ impl<'a, C, A> OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut OrderGetbymerchantorderidCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OrderGetbymerchantorderidCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderGetbymerchantorderidCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5171,7 +5176,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.acknowledge", + dlg.begin(MethodInfo { id: "content.orders.acknowledge", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -5214,14 +5219,14 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5265,7 +5270,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5275,10 +5280,10 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5310,7 +5315,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrdersAcknowledgeRequest) -> OrderAcknowledgeCall<'a, C, A> { self._request = new_value; @@ -5320,7 +5325,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderAcknowledgeCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -5330,7 +5335,7 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> OrderAcknowledgeCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -5348,12 +5353,12 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5370,17 +5375,17 @@ impl<'a, C, A> OrderAcknowledgeCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderAcknowledgeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderAcknowledgeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5450,7 +5455,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.cancel", + dlg.begin(MethodInfo { id: "content.orders.cancel", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -5493,14 +5498,14 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5544,7 +5549,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5554,10 +5559,10 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5589,7 +5594,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrdersCancelRequest) -> OrderCancelCall<'a, C, A> { self._request = new_value; @@ -5599,7 +5604,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderCancelCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -5609,7 +5614,7 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> OrderCancelCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -5627,12 +5632,12 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5649,17 +5654,17 @@ impl<'a, C, A> OrderCancelCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderCancelCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderCancelCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5729,7 +5734,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "content.orders.shiplineitems", + dlg.begin(MethodInfo { id: "content.orders.shiplineitems", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("merchantId", self._merchant_id.to_string())); @@ -5772,14 +5777,14 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5823,7 +5828,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5833,10 +5838,10 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5868,7 +5873,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: OrdersShipLineItemsRequest) -> OrderShiplineitemCall<'a, C, A> { self._request = new_value; @@ -5878,7 +5883,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut /// /// Sets the *merchant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn merchant_id(mut self, new_value: &str) -> OrderShiplineitemCall<'a, C, A> { self._merchant_id = new_value.to_string(); @@ -5888,7 +5893,7 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> OrderShiplineitemCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -5906,12 +5911,12 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5928,17 +5933,17 @@ impl<'a, C, A> OrderShiplineitemCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderShiplineitemCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderShiplineitemCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/coordinate1-cli/Cargo.toml b/gen/coordinate1-cli/Cargo.toml index 0aff5ada8a..e604d92b95 100644 --- a/gen/coordinate1-cli/Cargo.toml +++ b/gen/coordinate1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-coordinate1-cli" -version = "0.3.2+20150811" +version = "0.3.3+20150811" authors = ["Sebastian Thiel "] description = "A complete library to interact with coordinate (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/coordinate1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/coordinate1-cli/LICENSE.md b/gen/coordinate1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/coordinate1-cli/LICENSE.md +++ b/gen/coordinate1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/coordinate1-cli/README.md b/gen/coordinate1-cli/README.md index f9300193e1..d510afb7b3 100644 --- a/gen/coordinate1-cli/README.md +++ b/gen/coordinate1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *coordinate* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/coordinate1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/coordinate1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/coordinate1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/coordinate1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/coordinate1-cli). # Usage -This documentation was generated from the *coordinate* API at revision *20150811*. The CLI is at version *0.3.2*. +This documentation was generated from the *coordinate* API at revision *20150811*. The CLI is at version *0.3.3*. ```bash coordinate1 [options] @@ -50,18 +50,18 @@ coordinate1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/coordinate1-cli/mkdocs.yml b/gen/coordinate1-cli/mkdocs.yml index 3b1399b4da..c0c5c6f777 100644 --- a/gen/coordinate1-cli/mkdocs.yml +++ b/gen/coordinate1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: coordinate v0.3.2+20150811 +site_name: coordinate v0.3.3+20150811 site_url: http://byron.github.io/google-apis-rs/google-coordinate1-cli site_description: Write integrating applications with bcore @@ -24,5 +24,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/coordinate1-cli/src/main.rs b/gen/coordinate1-cli/src/main.rs index 81b304ec55..24425e18b1 100644 --- a/gen/coordinate1-cli/src/main.rs +++ b/gen/coordinate1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Coordinate>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _custom_field_def_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _custom_field_def_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.custom_field_def().list(opt.value_of("team-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().get(opt.value_of("team-id").unwrap_or(""), opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -149,13 +149,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -169,8 +169,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -200,7 +200,7 @@ impl<'n, 'a> Engine<'n, 'a> { let lat: f64 = arg_from_str(&opt.value_of("lat").unwrap_or(""), err, "", "number"); let lng: f64 = arg_from_str(&opt.value_of("lng").unwrap_or(""), err, "", "number"); let mut call = self.hub.jobs().insert(request, opt.value_of("team-id").unwrap_or(""), opt.value_of("address").unwrap_or(""), lat, lng, opt.value_of("title").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "note" => { @@ -228,7 +228,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["note", "custom-field", "customer-phone-number", "customer-name", "assignee"].iter().map(|v|*v)); @@ -242,7 +242,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -265,10 +265,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().list(opt.value_of("team-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -293,7 +293,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "min-modified-timestamp-ms", "max-results", "omit-job-changes"].iter().map(|v|*v)); @@ -307,7 +307,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -330,13 +330,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -350,8 +350,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -379,7 +379,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Job = json::value::from_value(object).unwrap(); let mut call = self.hub.jobs().patch(request, opt.value_of("team-id").unwrap_or(""), opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "title" => { @@ -422,7 +422,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["customer-name", "title", "note", "assignee", "customer-phone-number", "address", "lat", "progress", "lng", "custom-field"].iter().map(|v|*v)); @@ -436,7 +436,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -459,13 +459,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -479,8 +479,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -508,7 +508,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Job = json::value::from_value(object).unwrap(); let mut call = self.hub.jobs().update(request, opt.value_of("team-id").unwrap_or(""), opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "title" => { @@ -551,7 +551,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["customer-name", "title", "note", "assignee", "customer-phone-number", "address", "lat", "progress", "lng", "custom-field"].iter().map(|v|*v)); @@ -565,7 +565,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -588,10 +588,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _location_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _location_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.location().list(opt.value_of("team-id").unwrap_or(""), opt.value_of("worker-email").unwrap_or(""), opt.value_of("start-timestamp-ms").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -610,7 +610,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -624,7 +624,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -647,10 +647,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _schedule_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _schedule_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.schedule().get(opt.value_of("team-id").unwrap_or(""), opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -663,7 +663,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -676,7 +676,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -699,13 +699,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _schedule_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _schedule_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -719,8 +719,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "duration" => Some(("duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -739,7 +739,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Schedule = json::value::from_value(object).unwrap(); let mut call = self.hub.schedule().patch(request, opt.value_of("team-id").unwrap_or(""), opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-time" => { @@ -764,7 +764,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["duration", "all-day", "end-time", "start-time"].iter().map(|v|*v)); @@ -778,7 +778,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -801,13 +801,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _schedule_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _schedule_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -821,8 +821,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "duration" => Some(("duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -841,7 +841,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Schedule = json::value::from_value(object).unwrap(); let mut call = self.hub.schedule().update(request, opt.value_of("team-id").unwrap_or(""), opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-time" => { @@ -866,7 +866,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["duration", "all-day", "end-time", "start-time"].iter().map(|v|*v)); @@ -880,7 +880,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -903,10 +903,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _team_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _team_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.team().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "worker" => { @@ -928,7 +928,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["admin", "worker", "dispatcher"].iter().map(|v|*v)); @@ -942,7 +942,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -965,10 +965,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _worker_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _worker_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.worker().list(opt.value_of("team-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -981,7 +981,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -994,7 +994,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1123,14 +1123,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "coordinate1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "coordinate1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1150,7 +1150,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1189,7 +1189,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("custom-field-def", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of custom field definitions for a team."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/custom-field-def_list", vec![ @@ -1214,7 +1214,7 @@ fn main() { ]), ("jobs", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Retrieves a job, including all the changes made to the job."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/jobs_get", vec![ @@ -1242,7 +1242,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new job. Only the state field of the job should be set."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/jobs_insert", vec![ @@ -1294,7 +1294,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves jobs created or modified since the given timestamp."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/jobs_list", vec![ @@ -1316,7 +1316,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a job. Fields that are set in the job state will be updated. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/jobs_patch", vec![ @@ -1350,7 +1350,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a job. Fields that are set in the job state will be updated."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/jobs_update", vec![ @@ -1387,7 +1387,7 @@ fn main() { ]), ("location", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of locations for a worker."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/location_list", vec![ @@ -1424,7 +1424,7 @@ fn main() { ]), ("schedule", "methods: 'get', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Retrieves the schedule for a job."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/schedule_get", vec![ @@ -1452,7 +1452,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Replaces the schedule of a job with the provided schedule. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/schedule_patch", vec![ @@ -1486,7 +1486,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Replaces the schedule of a job with the provided schedule."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/schedule_update", vec![ @@ -1523,7 +1523,7 @@ fn main() { ]), ("team", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of teams for a user."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/team_list", vec![ @@ -1542,7 +1542,7 @@ fn main() { ]), ("worker", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of workers in a team."##), "Details at http://byron.github.io/google-apis-rs/google_coordinate1_cli/worker_list", vec![ @@ -1570,7 +1570,7 @@ fn main() { let mut app = App::new("coordinate1") .author("Sebastian Thiel ") - .version("0.3.2+20150811") + .version("0.3.3+20150811") .about("Lets you view and manage jobs in a Coordinate team.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_coordinate1_cli") .arg(Arg::with_name("url") @@ -1594,7 +1594,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1605,7 +1605,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/coordinate1/Cargo.toml b/gen/coordinate1/Cargo.toml index f8510375e1..2527ba52ea 100644 --- a/gen/coordinate1/Cargo.toml +++ b/gen/coordinate1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-coordinate1" -version = "0.1.10+20150811" +version = "0.1.11+20150811" authors = ["Sebastian Thiel "] description = "A complete library to interact with coordinate (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/coordinate1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/coordinate1/LICENSE.md b/gen/coordinate1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/coordinate1/LICENSE.md +++ b/gen/coordinate1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/coordinate1/README.md b/gen/coordinate1/README.md index 9ce75bb1b8..83babe59d1 100644 --- a/gen/coordinate1/README.md +++ b/gen/coordinate1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-coordinate1` library allows access to all features of the *Google coordinate* service. -This documentation was generated from *coordinate* crate version *0.1.10+20150811*, where *20150811* is the exact revision of the *coordinate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *coordinate* crate version *0.1.11+20150811*, where *20150811* is the exact revision of the *coordinate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *coordinate* *v1* API can be found at the [official documentation site](https://developers.google.com/coordinate/). diff --git a/gen/coordinate1/src/cmn.rs b/gen/coordinate1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/coordinate1/src/cmn.rs +++ b/gen/coordinate1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/coordinate1/src/lib.rs b/gen/coordinate1/src/lib.rs index a578228592..1fab037357 100644 --- a/gen/coordinate1/src/lib.rs +++ b/gen/coordinate1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *coordinate* crate version *0.1.10+20150811*, where *20150811* is the exact revision of the *coordinate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *coordinate* crate version *0.1.11+20150811*, where *20150811* is the exact revision of the *coordinate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *coordinate* *v1* API can be found at the //! [official documentation site](https://developers.google.com/coordinate/). diff --git a/gen/coordinate1/src/lib.rs.in b/gen/coordinate1/src/lib.rs.in index df553e0736..a4d4a61d62 100644 --- a/gen/coordinate1/src/lib.rs.in +++ b/gen/coordinate1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -146,7 +147,7 @@ impl<'a, C, A> Coordinate Coordinate { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -170,7 +171,7 @@ impl<'a, C, A> Coordinate } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1164,7 +1165,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.jobs.get", + dlg.begin(MethodInfo { id: "coordinate.jobs.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -1207,7 +1208,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1243,7 +1244,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1253,10 +1254,10 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1289,7 +1290,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *team id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn team_id(mut self, new_value: &str) -> JobGetCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -1299,7 +1300,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> JobGetCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -1317,12 +1318,12 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1339,17 +1340,17 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1439,7 +1440,7 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.jobs.update", + dlg.begin(MethodInfo { id: "coordinate.jobs.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -1516,14 +1517,14 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1567,7 +1568,7 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1577,10 +1578,10 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1612,7 +1613,7 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Job) -> JobUpdateCall<'a, C, A> { self._request = new_value; @@ -1622,7 +1623,7 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *team id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn team_id(mut self, new_value: &str) -> JobUpdateCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -1632,7 +1633,7 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> JobUpdateCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -1721,12 +1722,12 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1743,17 +1744,17 @@ impl<'a, C, A> JobUpdateCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1843,7 +1844,7 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.jobs.patch", + dlg.begin(MethodInfo { id: "coordinate.jobs.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -1920,14 +1921,14 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1971,7 +1972,7 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1981,10 +1982,10 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2016,7 +2017,7 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Job) -> JobPatchCall<'a, C, A> { self._request = new_value; @@ -2026,7 +2027,7 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *team id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn team_id(mut self, new_value: &str) -> JobPatchCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -2036,7 +2037,7 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> JobPatchCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -2125,12 +2126,12 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2147,17 +2148,17 @@ impl<'a, C, A> JobPatchCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2227,7 +2228,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.jobs.list", + dlg.begin(MethodInfo { id: "coordinate.jobs.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -2281,7 +2282,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2317,7 +2318,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2327,10 +2328,10 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2363,7 +2364,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *team id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn team_id(mut self, new_value: &str) -> JobListCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -2409,12 +2410,12 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2431,17 +2432,17 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2524,7 +2525,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.jobs.insert", + dlg.begin(MethodInfo { id: "coordinate.jobs.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -2589,14 +2590,14 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2640,7 +2641,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2650,10 +2651,10 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2685,7 +2686,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Job) -> JobInsertCall<'a, C, A> { self._request = new_value; @@ -2695,7 +2696,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *team id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn team_id(mut self, new_value: &str) -> JobInsertCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -2705,7 +2706,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *address* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn address(mut self, new_value: &str) -> JobInsertCall<'a, C, A> { self._address = new_value.to_string(); @@ -2715,7 +2716,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *lat* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn lat(mut self, new_value: f64) -> JobInsertCall<'a, C, A> { self._lat = new_value; @@ -2725,7 +2726,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *lng* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn lng(mut self, new_value: f64) -> JobInsertCall<'a, C, A> { self._lng = new_value; @@ -2735,7 +2736,7 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *title* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn title(mut self, new_value: &str) -> JobInsertCall<'a, C, A> { self._title = new_value.to_string(); @@ -2789,12 +2790,12 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2811,17 +2812,17 @@ impl<'a, C, A> JobInsertCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2899,7 +2900,7 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.schedule.update", + dlg.begin(MethodInfo { id: "coordinate.schedule.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -2954,14 +2955,14 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3005,7 +3006,7 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3015,10 +3016,10 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3050,7 +3051,7 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Schedule) -> ScheduleUpdateCall<'a, C, A> { self._request = new_value; @@ -3060,7 +3061,7 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *team id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn team_id(mut self, new_value: &str) -> ScheduleUpdateCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -3070,7 +3071,7 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> ScheduleUpdateCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -3116,12 +3117,12 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3138,17 +3139,17 @@ impl<'a, C, A> ScheduleUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ScheduleUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScheduleUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3226,7 +3227,7 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.schedule.patch", + dlg.begin(MethodInfo { id: "coordinate.schedule.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -3281,14 +3282,14 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3332,7 +3333,7 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3342,10 +3343,10 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3377,7 +3378,7 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Schedule) -> SchedulePatchCall<'a, C, A> { self._request = new_value; @@ -3387,7 +3388,7 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *team id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn team_id(mut self, new_value: &str) -> SchedulePatchCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -3397,7 +3398,7 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> SchedulePatchCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -3443,12 +3444,12 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3465,17 +3466,17 @@ impl<'a, C, A> SchedulePatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SchedulePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SchedulePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3538,7 +3539,7 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.schedule.get", + dlg.begin(MethodInfo { id: "coordinate.schedule.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -3581,7 +3582,7 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3617,7 +3618,7 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3627,10 +3628,10 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3663,7 +3664,7 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *team id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn team_id(mut self, new_value: &str) -> ScheduleGetCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -3673,7 +3674,7 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> ScheduleGetCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -3691,12 +3692,12 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3713,17 +3714,17 @@ impl<'a, C, A> ScheduleGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ScheduleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScheduleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3785,7 +3786,7 @@ impl<'a, C, A> WorkerListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.worker.list", + dlg.begin(MethodInfo { id: "coordinate.worker.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -3827,7 +3828,7 @@ impl<'a, C, A> WorkerListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3863,7 +3864,7 @@ impl<'a, C, A> WorkerListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3873,10 +3874,10 @@ impl<'a, C, A> WorkerListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3909,7 +3910,7 @@ impl<'a, C, A> WorkerListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *team id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn team_id(mut self, new_value: &str) -> WorkerListCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -3927,12 +3928,12 @@ impl<'a, C, A> WorkerListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3949,17 +3950,17 @@ impl<'a, C, A> WorkerListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> WorkerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> WorkerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4027,7 +4028,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.location.list", + dlg.begin(MethodInfo { id: "coordinate.location.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -4077,7 +4078,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4113,7 +4114,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4123,10 +4124,10 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4159,7 +4160,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *team id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn team_id(mut self, new_value: &str) -> LocationListCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -4169,7 +4170,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *worker email* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn worker_email(mut self, new_value: &str) -> LocationListCall<'a, C, A> { self._worker_email = new_value.to_string(); @@ -4179,7 +4180,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *start timestamp ms* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn start_timestamp_ms(mut self, new_value: &str) -> LocationListCall<'a, C, A> { self._start_timestamp_ms = new_value.to_string(); @@ -4211,12 +4212,12 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4233,17 +4234,17 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LocationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LocationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4310,7 +4311,7 @@ impl<'a, C, A> TeamListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.team.list", + dlg.begin(MethodInfo { id: "coordinate.team.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._worker { @@ -4339,7 +4340,7 @@ impl<'a, C, A> TeamListCall<'a, C, A> where C: BorrowMut, A: oaut self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4375,7 +4376,7 @@ impl<'a, C, A> TeamListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4385,10 +4386,10 @@ impl<'a, C, A> TeamListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4450,12 +4451,12 @@ impl<'a, C, A> TeamListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4472,17 +4473,17 @@ impl<'a, C, A> TeamListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TeamListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TeamListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4544,7 +4545,7 @@ impl<'a, C, A> CustomFieldDefListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "coordinate.customFieldDef.list", + dlg.begin(MethodInfo { id: "coordinate.customFieldDef.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("teamId", self._team_id.to_string())); @@ -4586,7 +4587,7 @@ impl<'a, C, A> CustomFieldDefListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4622,7 +4623,7 @@ impl<'a, C, A> CustomFieldDefListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4632,10 +4633,10 @@ impl<'a, C, A> CustomFieldDefListCall<'a, C, A> where C: BorrowMut CustomFieldDefListCall<'a, C, A> where C: BorrowMut CustomFieldDefListCall<'a, C, A> { self._team_id = new_value.to_string(); @@ -4686,12 +4687,12 @@ impl<'a, C, A> CustomFieldDefListCall<'a, C, A> where C: BorrowMut CustomFieldDefListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CustomFieldDefListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomFieldDefListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/customsearch1-cli/Cargo.toml b/gen/customsearch1-cli/Cargo.toml index ed7ce6d6e7..a88f340a49 100644 --- a/gen/customsearch1-cli/Cargo.toml +++ b/gen/customsearch1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-customsearch1-cli" -version = "0.3.2+20131205" +version = "0.3.3+20151130" authors = ["Sebastian Thiel "] description = "A complete library to interact with customsearch (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/customsearch1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/customsearch1-cli/LICENSE.md b/gen/customsearch1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/customsearch1-cli/LICENSE.md +++ b/gen/customsearch1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/customsearch1-cli/README.md b/gen/customsearch1-cli/README.md index 5ff16d5937..23bd5134c3 100644 --- a/gen/customsearch1-cli/README.md +++ b/gen/customsearch1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *customsearch* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/customsearch1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/customsearch1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/customsearch1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/customsearch1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/customsearch1-cli). # Usage -This documentation was generated from the *customsearch* API at revision *20131205*. The CLI is at version *0.3.2*. +This documentation was generated from the *customsearch* API at revision *20151130*. The CLI is at version *0.3.3*. ```bash customsearch1 [options] @@ -34,14 +34,14 @@ customsearch1 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/customsearch1-cli/mkdocs.yml b/gen/customsearch1-cli/mkdocs.yml index c2e393225c..291d48fa88 100644 --- a/gen/customsearch1-cli/mkdocs.yml +++ b/gen/customsearch1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: customsearch v0.3.2+20131205 +site_name: customsearch v0.3.3+20151130 site_url: http://byron.github.io/google-apis-rs/google-customsearch1-cli site_description: Write integrating applications with bcore @@ -13,5 +13,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/customsearch1-cli/src/main.rs b/gen/customsearch1-cli/src/main.rs index 50cbd84c54..1600583f70 100644 --- a/gen/customsearch1-cli/src/main.rs +++ b/gen/customsearch1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Customsearch>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _cse_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _cse_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.cse().list(opt.value_of("q").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start" => { @@ -154,7 +154,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["date-restrict", "or-terms", "high-range", "num", "cr", "img-type", "related-site", "gl", "search-type", "file-type", "start", "img-dominant-color", "lr", "site-search", "cref", "sort", "safe", "c2coff", "googlehost", "hq", "exact-terms", "hl", "low-range", "img-size", "img-color-type", "rights", "exclude-terms", "filter", "link-site", "cx", "site-search-filter"].iter().map(|v|*v)); @@ -221,14 +221,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "customsearch1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "customsearch1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -248,7 +248,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -287,7 +287,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("cse", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Returns metadata about the search performed, metadata about the custom search engine used for the search, and the search results."##), "Details at http://byron.github.io/google-apis-rs/google_customsearch1_cli/cse_list", vec![ @@ -315,7 +315,7 @@ fn main() { let mut app = App::new("customsearch1") .author("Sebastian Thiel ") - .version("0.3.2+20131205") + .version("0.3.3+20151130") .about("Lets you search over a website or collection of websites") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_customsearch1_cli") .arg(Arg::with_name("folder") @@ -334,7 +334,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -345,7 +345,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/customsearch1/Cargo.toml b/gen/customsearch1/Cargo.toml index e0afb600f9..e5467c99ee 100644 --- a/gen/customsearch1/Cargo.toml +++ b/gen/customsearch1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-customsearch1" -version = "0.1.10+20131205" +version = "0.1.11+20151130" authors = ["Sebastian Thiel "] description = "A complete library to interact with customsearch (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/customsearch1" diff --git a/gen/customsearch1/LICENSE.md b/gen/customsearch1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/customsearch1/LICENSE.md +++ b/gen/customsearch1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/customsearch1/README.md b/gen/customsearch1/README.md index a7a76b97b4..0179b441cb 100644 --- a/gen/customsearch1/README.md +++ b/gen/customsearch1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-customsearch1` library allows access to all features of the *Google customsearch* service. -This documentation was generated from *customsearch* crate version *0.1.10+20131205*, where *20131205* is the exact revision of the *customsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *customsearch* crate version *0.1.11+20151130*, where *20151130* is the exact revision of the *customsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *customsearch* *v1* API can be found at the [official documentation site](https://developers.google.com/custom-search/v1/using_rest). diff --git a/gen/customsearch1/src/cmn.rs b/gen/customsearch1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/customsearch1/src/cmn.rs +++ b/gen/customsearch1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/customsearch1/src/lib.rs b/gen/customsearch1/src/lib.rs index 10da65a22e..3ea0cacba6 100644 --- a/gen/customsearch1/src/lib.rs +++ b/gen/customsearch1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *customsearch* crate version *0.1.10+20131205*, where *20131205* is the exact revision of the *customsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *customsearch* crate version *0.1.11+20151130*, where *20151130* is the exact revision of the *customsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *customsearch* *v1* API can be found at the //! [official documentation site](https://developers.google.com/custom-search/v1/using_rest). diff --git a/gen/customsearch1/src/lib.rs.in b/gen/customsearch1/src/lib.rs.in index 960e4cab2a..b7ee3919fa 100644 --- a/gen/customsearch1/src/lib.rs.in +++ b/gen/customsearch1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -135,7 +136,7 @@ impl<'a, C, A> Customsearch Customsearch { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -144,7 +145,7 @@ impl<'a, C, A> Customsearch } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -769,7 +770,7 @@ impl<'a, C, A> CseListCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "search.cse.list", + dlg.begin(MethodInfo { id: "search.cse.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((34 + self._additional_params.len())); params.push(("q", self._q.to_string())); @@ -892,7 +893,7 @@ impl<'a, C, A> CseListCall<'a, C, A> where C: BorrowMut, A: oauth } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -913,7 +914,7 @@ impl<'a, C, A> CseListCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -923,10 +924,10 @@ impl<'a, C, A> CseListCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -959,7 +960,7 @@ impl<'a, C, A> CseListCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *q* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn q(mut self, new_value: &str) -> CseListCall<'a, C, A> { self._q = new_value.to_string(); @@ -1194,12 +1195,12 @@ impl<'a, C, A> CseListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/dataproc1-cli/Cargo.toml b/gen/dataproc1-cli/Cargo.toml new file mode 100644 index 0000000000..9d3709756f --- /dev/null +++ b/gen/dataproc1-cli/Cargo.toml @@ -0,0 +1,35 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-dataproc1-cli" +version = "0.3.3+20151209" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with dataproc (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dataproc1-cli" +homepage = "https://cloud.google.com/dataproc/" +documentation = "http://byron.github.io/google-apis-rs/google_dataproc1_cli" +license = "MIT" +keywords = ["dataproc", "google", "cli"] + +[[bin]] +name = "dataproc1" + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +strsim = "0.4" +yup-hyper-mock = "1.0" +clap = "2.0" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + + +[dependencies.google-dataproc1] +path = "../dataproc1" diff --git a/gen/deploymentmanager2_beta1/LICENSE.md b/gen/dataproc1-cli/LICENSE.md similarity index 96% rename from gen/deploymentmanager2_beta1/LICENSE.md rename to gen/dataproc1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/deploymentmanager2_beta1/LICENSE.md +++ b/gen/dataproc1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/dataproc1-cli/README.md b/gen/dataproc1-cli/README.md new file mode 100644 index 0000000000..3239ad7052 --- /dev/null +++ b/gen/dataproc1-cli/README.md @@ -0,0 +1,114 @@ + +The `dataproc1` command-line interface *(CLI)* allows to use most features of the *Google dataproc* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *dataproc* API can be found at the +[official documentation site](https://cloud.google.com/dataproc/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/dataproc1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/dataproc1.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dataproc1-cli). + +# Usage + +This documentation was generated from the *dataproc* API at revision *20151209*. The CLI is at version *0.3.3*. + +```bash +dataproc1 [options] + media + download [-p ]... [-o ] + upload (-r )... (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] + dataproc1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `dataproc1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/dataproc1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/dataproc1-secret.json`, assuming that the required *dataproc* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `dataproc1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/dataproc1-cli/mkdocs.yml b/gen/dataproc1-cli/mkdocs.yml new file mode 100644 index 0000000000..2b58d77e29 --- /dev/null +++ b/gen/dataproc1-cli/mkdocs.yml @@ -0,0 +1,18 @@ +site_name: dataproc v0.3.3+20151209 +site_url: http://byron.github.io/google-apis-rs/google-dataproc1-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/dataproc1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['media_download.md', 'Media', 'Download'] +- ['media_upload.md', 'Media', 'Upload'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/deploymentmanager2_beta1-cli/src/cmn.rs b/gen/dataproc1-cli/src/cmn.rs similarity index 93% rename from gen/deploymentmanager2_beta1-cli/src/cmn.rs rename to gen/dataproc1-cli/src/cmn.rs index 56051cab08..ae86fdef65 100644 --- a/gen/deploymentmanager2_beta1-cli/src/cmn.rs +++ b/gen/dataproc1-cli/src/cmn.rs @@ -1,8 +1,8 @@ // COPY OF 'src/rust/cli/cmn.rs' // DO NOT EDIT use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; -use serde::json; -use serde::json::value::Value; +use serde_json as json; +use serde_json::value::Value; use mime::Mime; use clap::{App, SubCommand}; use strsim; @@ -120,7 +120,7 @@ pub struct FieldCursor(Vec); impl ToString for FieldCursor { fn to_string(&self) -> String { - self.0.connect(".") + self.0.join(".") } } @@ -237,15 +237,15 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, + pub fn set_json_value(&self, mut object: &mut Value, value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, + err: &mut InvalidOptionsError, orig_cursor: &FieldCursor) { assert!(self.0.len() > 0); for field in &self.0[..self.0.len()-1] { let tmp = object; - object = + object = match *tmp { Value::Object(ref mut mapping) => { mapping.entry(field.to_owned()).or_insert( @@ -259,19 +259,19 @@ impl FieldCursor { match *object { Value::Object(ref mut mapping) => { let field = &self.0[self.0.len()-1]; - let to_jval = - |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| -> Value { match jtype { - JsonType::Boolean => + JsonType::Boolean => Value::Bool(arg_from_str(value, err, &field, "boolean")), - JsonType::Int => + JsonType::Int => Value::I64(arg_from_str(value, err, &field, "int")), - JsonType::Uint => + JsonType::Uint => Value::U64(arg_from_str(value, err, &field, "uint")), - JsonType::Float => + JsonType::Float => Value::F64(arg_from_str(value, err, &field, "float")), - JsonType::String => + JsonType::String => Value::String(value.to_owned()), } }; @@ -338,7 +338,7 @@ pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut Inv match UploadProtocol::from_str(name) { Ok(up) => up, Err(msg) => { - err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); UploadProtocol::Simple } }) @@ -376,8 +376,8 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { } -pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, - arg_name: &'a str, +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, arg_type: &'a str) -> T where T: FromStr + Default, ::Err: fmt::Display { @@ -411,7 +411,7 @@ impl TokenStorage for JsonTokenStorage { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => + Err(err) => match err.kind() { io::ErrorKind::NotFound => Ok(()), _ => Err(json::Error::IoError(err)) @@ -424,7 +424,7 @@ impl TokenStorage for JsonTokenStorage { Ok(mut f) => { match json::to_writer_pretty(&mut f, &token) { Ok(_) => Ok(()), - Err(io_err) => Err(json::Error::IoError(io_err)), + Err(serde_err) => Err(serde_err), } }, Err(io_err) => Err(json::Error::IoError(io_err)) @@ -435,7 +435,7 @@ impl TokenStorage for JsonTokenStorage { fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { match fs::File::open(&self.path(scope_hash)) { - Ok(mut f) => { + Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), Err(err) => Err(err), @@ -455,17 +455,17 @@ impl TokenStorage for JsonTokenStorage { #[derive(Debug)] pub enum ApplicationSecretError { DecoderError((String, json::Error)), - FormatError(String), + FormatError(String), } impl fmt::Display for ApplicationSecretError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { ApplicationSecretError::DecoderError((ref path, ref err)) - => writeln!(f, "Could not decode file at '{}' with error: {}.", + => writeln!(f, "Could not decode file at '{}' with error: {}.", path, err), ApplicationSecretError::FormatError(ref path) - => writeln!(f, "'installed' field is unset in secret file at '{}'.", + => writeln!(f, "'installed' field is unset in secret file at '{}'.", path), } } @@ -485,7 +485,7 @@ impl fmt::Display for ConfigurationError { match *self { ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), - ConfigurationError::DirectoryUnset + ConfigurationError::DirectoryUnset => writeln!(f, "--config-dir was unset or empty."), ConfigurationError::HomeExpansionFailed(ref dir) => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), @@ -532,10 +532,10 @@ impl fmt::Display for FieldError { FieldError::TrailingFieldSep(ref field) => writeln!(f, "'{}': Single field separator may not be last character.", field), FieldError::Unknown(ref field, ref suggestion, ref value) => { - let suffix = + let suffix = match *suggestion { Some(ref s) => { - let kv = + let kv = match *value { Some(ref v) => format!("{}={}", s, v), None => s.clone(), @@ -546,7 +546,7 @@ impl fmt::Display for FieldError { }; writeln!(f, "Field '{}' does not exist.{}", field, suffix) }, - FieldError::Duplicate(ref cursor) + FieldError::Duplicate(ref cursor) => writeln!(f, "Value at '{}' was already set", cursor), FieldError::Empty => writeln!(f, "Field names must not be empty."), @@ -574,13 +574,13 @@ impl fmt::Display for CLIError { CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), CLIError::Input(ref err) => write!(f, "Input -> {}", err), CLIError::Field(ref err) => write!(f, "Field -> {}", err), - CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) - => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.connect(", ")), - CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", arg_name, value, type_name, err_desc), CLIError::UnknownParameter(ref param_name, ref possible_values) => { - let mut suffix = + let suffix = match did_you_mean(param_name, &possible_values) { Some(v) => format!(" Did you mean '{}' ?", v), None => String::new(), @@ -634,7 +634,7 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) } - let expanded_config_dir = + let expanded_config_dir = if trdir.as_bytes()[0] == b'~' { match env::var("HOME").ok().or(env::var("UserProfile").ok()) { None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), @@ -657,8 +657,8 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { Ok(expanded_config_dir) } -pub fn application_secret_from_directory(dir: &str, - secret_basename: &str, +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, json_console_secret: &str) -> Result { let secret_path = Path::new(dir).join(secret_basename); @@ -679,10 +679,13 @@ pub fn application_secret_from_directory(dir: &str, Err(cfe) => cfe, Ok(mut f) => { // Assure we convert 'ugly' json string into pretty one - let console_secret: ConsoleApplicationSecret + let console_secret: ConsoleApplicationSecret = json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(io_err) => io_err, + Err(serde_err) => match serde_err { + json::Error::IoError(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, Ok(_) => continue, } } @@ -691,17 +694,17 @@ pub fn application_secret_from_directory(dir: &str, } return secret_io_error(err) }, - Ok(mut f) => { + Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { - Err(json::Error::IoError(err)) => + Err(json::Error::IoError(err)) => return secret_io_error(err), - Err(json_err) => + Err(json_err) => return Err(CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => + Ok(console_secret) => match console_secret.installed { Some(secret) => return Ok(secret), None => return Err( @@ -715,4 +718,4 @@ pub fn application_secret_from_directory(dir: &str, } } unreachable!(); -} \ No newline at end of file +} diff --git a/gen/dataproc1-cli/src/main.rs b/gen/dataproc1-cli/src/main.rs new file mode 100644 index 0000000000..cc2af8fd6c --- /dev/null +++ b/gen/dataproc1-cli/src/main.rs @@ -0,0 +1,471 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_dataproc1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Dataproc>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _media_download(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut download_mode = false; + let mut call = self.hub.media().download(opt.value_of("resource-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + if !download_mode { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _media_upload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "resource-name" => Some(("resourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["resource-name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Media = json::value::from_value(object).unwrap(); + let mut call = self.hub.media().upload(request, opt.value_of("resource-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let vals = opt.values_of("mode").unwrap().collect::>(); + let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); + let mut input_file = input_file_from_opts(vals[1], err); + let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Upload(UploadProtocol::Simple) => call.upload(input_file.unwrap(), mime_type.unwrap()), + CallType::Upload(UploadProtocol::Resumable) => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), + CallType::Standard => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("media", Some(opt)) => { + match opt.subcommand() { + ("download", Some(opt)) => { + call_result = self._media_download(opt, dry_run, &mut err); + }, + ("upload", Some(opt)) => { + call_result = self._media_upload(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("media".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "dataproc1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "dataproc1", + db_dir: config_dir.clone(), + }, None); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::Dataproc::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "bearer-token", "callback", "fields", "key", "oauth-token", "pp", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("bearer-token", "bearer_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let upload_value_names = ["mode", "file"]; + let arg_data = [ + ("media", "methods: 'download' and 'upload'", vec![ + ("download", + Some(r##"Method for media download. Download is supported on the URI `/v1/media/{+name}?alt=media`."##), + "Details at http://byron.github.io/google-apis-rs/google_dataproc1_cli/media_download", + vec![ + (Some(r##"resource-name"##), + None, + Some(r##"Name of the media that is being downloaded. See [][ByteStream.ReadRequest.resource_name]."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("upload", + Some(r##"Method for media upload. Upload is supported on the URI `/upload/v1/media/{+name}`."##), + "Details at http://byron.github.io/google-apis-rs/google_dataproc1_cli/media_upload", + vec![ + (Some(r##"resource-name"##), + None, + Some(r##"Name of the media that is being downloaded. See [][ByteStream.ReadRequest.resource_name]."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"mode"##), + Some(r##"u"##), + Some(r##"Specify the upload protocol (simple|resumable) and the file to upload"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("dataproc1") + .author("Sebastian Thiel ") + .version("0.3.3+20151209") + .about("An API for managing Hadoop-based clusters and jobs on Google Cloud Platform.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dataproc1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + if arg_name_str == "mode" { + arg = arg.number_of_values(2); + arg = arg.value_names(&upload_value_names); + + scmd = scmd.arg(Arg::with_name("mime") + .short("m") + .requires("mode") + .required(false) + .help("The file's mime time, like 'application/octet-stream'") + .takes_value(true)); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/dataproc1/Cargo.toml b/gen/dataproc1/Cargo.toml new file mode 100644 index 0000000000..e5c7b153db --- /dev/null +++ b/gen/dataproc1/Cargo.toml @@ -0,0 +1,29 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-dataproc1" +version = "0.1.11+20151209" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with dataproc (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dataproc1" +homepage = "https://cloud.google.com/dataproc/" +documentation = "http://byron.github.io/google-apis-rs/google_dataproc1" +license = "MIT" +keywords = ["dataproc", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +url = ">= 0.5" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + diff --git a/gen/cloudsearch1/LICENSE.md b/gen/dataproc1/LICENSE.md similarity index 96% rename from gen/cloudsearch1/LICENSE.md rename to gen/dataproc1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/cloudsearch1/LICENSE.md +++ b/gen/dataproc1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/dataproc1/README.md b/gen/dataproc1/README.md new file mode 100644 index 0000000000..3ae6ef8746 --- /dev/null +++ b/gen/dataproc1/README.md @@ -0,0 +1,189 @@ + +The `google-dataproc1` library allows access to all features of the *Google dataproc* service. + +This documentation was generated from *dataproc* crate version *0.1.11+20151209*, where *20151209* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. + +Everything else about the *dataproc* *v1* API can be found at the +[official documentation site](https://cloud.google.com/dataproc/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_dataproc1/struct.Dataproc.html) ... + +* [media](http://byron.github.io/google-apis-rs/google_dataproc1/struct.Media.html) + * [*download*](http://byron.github.io/google-apis-rs/google_dataproc1/struct.MediaDownloadCall.html) and [*upload*](http://byron.github.io/google-apis-rs/google_dataproc1/struct.MediaUploadCall.html) + + +Upload supported by ... + +* [*upload media*](http://byron.github.io/google-apis-rs/google_dataproc1/struct.MediaUploadCall.html) + +Download supported by ... + +* [*download media*](http://byron.github.io/google-apis-rs/google_dataproc1/struct.MediaDownloadCall.html) + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_dataproc1/struct.Dataproc.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_dataproc1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_dataproc1/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_dataproc1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_dataproc1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_dataproc1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.media().upload(...).doit() +let r = hub.media().download(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-dataproc1 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_dataproc1 as dataproc1; +use dataproc1::Media; +use dataproc1::{Result, Error}; +use std::fs; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use dataproc1::Dataproc; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = Dataproc::new(hyper::Client::new(), 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 ! +let mut req = Media::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `upload(...)`. +// Values shown here are possibly random and not representative ! +let result = hub.media().upload(req, "resourceName") + .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_dataproc1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_dataproc1/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_dataproc1/../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](http://byron.github.io/google-apis-rs/google_dataproc1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_dataproc1/trait.ResponseResult.html), 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")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_dataproc1/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_dataproc1/trait.CallBuilder.html) 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](http://byron.github.io/google-apis-rs/google_dataproc1/trait.Delegate.html) 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 [enocodable](http://byron.github.io/google-apis-rs/google_dataproc1/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_dataproc1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_dataproc1/trait.Part.html) 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](http://byron.github.io/google-apis-rs/google_dataproc1/trait.CallBuilder.html), 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](http://byron.github.io/google-apis-rs/google_dataproc1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **dataproc1** 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-rs/LICENSE.md diff --git a/gen/dataproc1/src/build.rs b/gen/dataproc1/src/build.rs new file mode 100644 index 0000000000..58d881163c --- /dev/null +++ b/gen/dataproc1/src/build.rs @@ -0,0 +1,16 @@ +extern crate syntex; +extern crate serde_codegen; + +use std::env; +use std::path::Path; + +pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-dataproc1", &src, &dst).unwrap(); +} diff --git a/gen/deploymentmanager2_beta1/src/cmn.rs b/gen/dataproc1/src/cmn.rs similarity index 93% rename from gen/deploymentmanager2_beta1/src/cmn.rs rename to gen/dataproc1/src/cmn.rs index 6294f5a77b..87b91a8986 100644 --- a/gen/deploymentmanager2_beta1/src/cmn.rs +++ b/gen/dataproc1/src/cmn.rs @@ -5,18 +5,19 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; use hyper; use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, HeaderFormat}; -use hyper::http::LINE_ENDING; +use hyper::http::h1::LINE_ENDING; use hyper::method::Method; use hyper::status::StatusCode; -use serde; +use serde_json as json; /// Identifies the Hub. There is only one per library, this trait is supposed /// to make intended use more explicit. @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -114,13 +115,21 @@ impl hyper::net::NetworkStream for DummyNetworkStream { fn peer_addr(&mut self) -> io::Result { Ok("127.0.0.1:1337".parse().unwrap()) } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } } /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -128,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -142,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -171,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -183,18 +192,18 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. /// * `json_decode_error` - The decoder error - fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) { + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { let _ = json_encoded_value; let _ = json_decode_error; } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -205,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -224,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -275,7 +284,7 @@ pub enum Error { /// Shows that we failed to decode the server response. /// This can happen if the protocol changes in conjunction with strict json decoding. - JsonDecodeError(String, serde::json::Error), + JsonDecodeError(String, json::Error), /// Indicates an HTTP repsonse with a non-success status code Failure(hyper::client::Response), @@ -296,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -309,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -410,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -424,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -438,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -490,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -504,7 +513,7 @@ impl ::std::ops::DerefMut for XUploadContentType { } impl Header for XUploadContentType { fn header_name() -> &'static str { "X-Upload-Content-Type" } - fn parse_header(raw: &[Vec]) -> Option { + fn parse_header(raw: &[Vec]) -> hyper::error::Result { hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) } } @@ -569,8 +578,8 @@ impl Header for ContentRange { } /// We are not parsable, as parsing is done by the `Range` header - fn parse_header(_: &[Vec]) -> Option { - None + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) } } @@ -595,19 +604,19 @@ impl Header for RangeResponseHeader { "Range" } - fn parse_header(raw: &[Vec]) -> Option { + fn parse_header(raw: &[Vec]) -> hyper::error::Result { if raw.len() > 0 { let v = &raw[0]; if let Ok(s) = std::str::from_utf8(v) { const PREFIX: &'static str = "bytes "; if s.starts_with(PREFIX) { if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { - return Some(RangeResponseHeader(c)) + return Ok(RangeResponseHeader(c)) } } } } - None + Err(hyper::error::Error::Method) } } @@ -649,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -659,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -717,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, - serde::json::from_str(&json_err).ok(), - serde::json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); continue; } } @@ -728,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) @@ -740,9 +749,9 @@ impl<'a, A> ResumableUploadHelper<'a, A> // Copy of src/rust/cli/cmn.rs // TODO(ST): Allow sharing common code between program types -pub fn remove_json_null_values(value: &mut serde::json::value::Value) { +pub fn remove_json_null_values(value: &mut json::value::Value) { match *value { - serde::json::value::Value::Object(ref mut map) => { + json::value::Value::Object(ref mut map) => { let mut for_removal = Vec::new(); for (key, mut value) in map.iter_mut() { diff --git a/gen/dataproc1/src/lib.rs b/gen/dataproc1/src/lib.rs new file mode 100644 index 0000000000..de28d75f1a --- /dev/null +++ b/gen/dataproc1/src/lib.rs @@ -0,0 +1,193 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *dataproc* crate version *0.1.11+20151209*, where *20151209* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. +//! +//! Everything else about the *dataproc* *v1* API can be found at the +//! [official documentation site](https://cloud.google.com/dataproc/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dataproc1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Dataproc.html) ... +//! +//! * [media](struct.Media.html) +//! * [*download*](struct.MediaDownloadCall.html) and [*upload*](struct.MediaUploadCall.html) +//! +//! +//! Upload supported by ... +//! +//! * [*upload media*](struct.MediaUploadCall.html) +//! +//! Download supported by ... +//! +//! * [*download media*](struct.MediaDownloadCall.html) +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Dataproc.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.media().upload(...).doit() +//! let r = hub.media().download(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-dataproc1 = "*" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_dataproc1 as dataproc1; +//! use dataproc1::Media; +//! use dataproc1::{Result, Error}; +//! use std::fs; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use dataproc1::Dataproc; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::new(), +//! ::default(), None); +//! let mut hub = Dataproc::new(hyper::Client::new(), 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 ! +//! let mut req = Media::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `upload(...)`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.media().upload(req, "resourceName") +//! .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../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](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), 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")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) 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](trait.Delegate.html) 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 [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) 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](trait.CallBuilder.html), 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](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/dataproc1/src/lib.rs.in b/gen/dataproc1/src/lib.rs.in new file mode 100644 index 0000000000..2753f01973 --- /dev/null +++ b/gen/dataproc1/src/lib.rs.in @@ -0,0 +1,934 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +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; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// Administrate log data for your projects + LoggingAdmin, + + /// View log data for your projects + LoggingRead, + + /// Submit log data for your projects + LoggingWrite, + + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::LoggingAdmin => "https://www.googleapis.com/auth/logging.admin", + Scope::LoggingRead => "https://www.googleapis.com/auth/logging.read", + Scope::LoggingWrite => "https://www.googleapis.com/auth/logging.write", + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::LoggingRead + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Dataproc related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dataproc1 as dataproc1; +/// use dataproc1::Media; +/// use dataproc1::{Result, Error}; +/// use std::fs; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dataproc1::Dataproc; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dataproc::new(hyper::Client::new(), 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 ! +/// let mut req = Media::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.media().upload(req, "resourceName") +/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Dataproc { + client: RefCell, + auth: RefCell, + _user_agent: String, +} + +impl<'a, C, A> Hub for Dataproc {} + +impl<'a, C, A> Dataproc + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Dataproc { + Dataproc { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/0.1.11".to_string(), + } + } + + pub fn media(&'a self) -> MediaMethods<'a, C, A> { + MediaMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/0.1.11`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Media resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [upload media](struct.MediaUploadCall.html) (request|response) +/// * [download media](struct.MediaDownloadCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Media { + /// Name of the media resource. + #[serde(rename="resourceName")] + pub resource_name: Option, +} + +impl RequestValue for Media {} +impl ResponseResult for Media {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *media* resources. +/// It is not used directly, but through the `Dataproc` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dataproc1 as dataproc1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dataproc1::Dataproc; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dataproc::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `download(...)` and `upload(...)` +/// // to build up your call. +/// let rb = hub.media(); +/// # } +/// ``` +pub struct MediaMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dataproc, +} + +impl<'a, C, A> MethodsBuilder for MediaMethods<'a, C, A> {} + +impl<'a, C, A> MediaMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Method for media upload. Upload is supported on the URI `/upload/v1/media/{+name}`. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resourceName` - Name of the media that is being downloaded. See [][ByteStream.ReadRequest.resource_name]. + pub fn upload(&self, request: Media, resource_name: &str) -> MediaUploadCall<'a, C, A> { + MediaUploadCall { + hub: self.hub, + _request: request, + _resource_name: resource_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Method for media download. Download is supported on the URI `/v1/media/{+name}?alt=media`. + /// + /// # Arguments + /// + /// * `resourceName` - Name of the media that is being downloaded. See [][ByteStream.ReadRequest.resource_name]. + pub fn download(&self, resource_name: &str) -> MediaDownloadCall<'a, C, A> { + MediaDownloadCall { + hub: self.hub, + _resource_name: resource_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Method for media upload. Upload is supported on the URI `/upload/v1/media/{+name}`. +/// +/// A builder for the *upload* method supported by a *media* resource. +/// It is not used directly, but through a `MediaMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dataproc1 as dataproc1; +/// use dataproc1::Media; +/// use std::fs; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dataproc1::Dataproc; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dataproc::new(hyper::Client::new(), 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 ! +/// let mut req = Media::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.media().upload(req, "resourceName") +/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct MediaUploadCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dataproc, + _request: Media, + _resource_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MediaUploadCall<'a, C, A> {} + +impl<'a, C, A> MediaUploadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, Media)> + where RS: ReadSeek { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dataproc.media.upload", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("resourceName", self._resource_name.to_string())); + for &field in ["alt", "resourceName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let (mut url, upload_type) = + if protocol == "simple" { + ("https://dataproc.googleapis.com/upload/v1/media/{+resourceName}".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://dataproc.googleapis.com/resumable/upload/v1/media/{+resourceName}".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resourceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut mp_reader: MultiPartReader = Default::default(); + let (mut body_reader, content_type) = match protocol { + "simple" => { + mp_reader.reserve_exact(2); + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) + .add_part(&mut reader, size, reader_mime_type.clone()); + let mime_type = mp_reader.mime_type(); + (&mut mp_reader as &mut io::Read, ContentType(mime_type)) + }, + _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), + }; + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(content_type) + .body(&mut body_reader); + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 0kb + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Media)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 0kb + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Media)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Media) -> MediaUploadCall<'a, C, A> { + self._request = new_value; + self + } + /// Name of the media that is being downloaded. See [][ByteStream.ReadRequest.resource_name]. + /// + /// Sets the *resource name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource_name(mut self, new_value: &str) -> MediaUploadCall<'a, C, A> { + self._resource_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MediaUploadCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MediaUploadCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MediaUploadCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Method for media download. Download is supported on the URI `/v1/media/{+name}?alt=media`. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `Media` structure that you would usually get. The latter will be a default value. +/// +/// A builder for the *download* method supported by a *media* resource. +/// It is not used directly, but through a `MediaMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dataproc1 as dataproc1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dataproc1::Dataproc; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dataproc::new(hyper::Client::new(), 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 ! +/// let result = hub.media().download("resourceName") +/// .doit(); +/// # } +/// ``` +pub struct MediaDownloadCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dataproc, + _resource_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MediaDownloadCall<'a, C, A> {} + +impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Media)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dataproc.media.download", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + params.push(("resourceName", self._resource_name.to_string())); + for &field in ["resourceName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if >::as_ref(&value) != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + + let mut url = "https://dataproc.googleapis.com/v1/media/{+resourceName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resourceName}", "resourceName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resourceName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = if enable_resource_parsing { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + } else { (res, Default::default()) }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Name of the media that is being downloaded. See [][ByteStream.ReadRequest.resource_name]. + /// + /// Sets the *resource name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource_name(mut self, new_value: &str) -> MediaDownloadCall<'a, C, A> { + self._resource_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MediaDownloadCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MediaDownloadCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MediaDownloadCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/datastore1_beta2-cli/Cargo.toml b/gen/datastore1_beta2-cli/Cargo.toml index efd5f3cf14..bb51d8a47a 100644 --- a/gen/datastore1_beta2-cli/Cargo.toml +++ b/gen/datastore1_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-datastore1_beta2-cli" -version = "0.3.2+20151008" +version = "0.3.3+20151008" authors = ["Sebastian Thiel "] description = "A complete library to interact with datastore (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/datastore1_beta2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/datastore1_beta2-cli/LICENSE.md b/gen/datastore1_beta2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/datastore1_beta2-cli/LICENSE.md +++ b/gen/datastore1_beta2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/datastore1_beta2-cli/README.md b/gen/datastore1_beta2-cli/README.md index 10ae96b038..810a280e19 100644 --- a/gen/datastore1_beta2-cli/README.md +++ b/gen/datastore1_beta2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *datastore* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/datastore1-beta2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/datastore1-beta2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/datastore1-beta2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/datastore1-beta2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/datastore1_beta2-cli). # Usage -This documentation was generated from the *datastore* API at revision *20151008*. The CLI is at version *0.3.2*. +This documentation was generated from the *datastore* API at revision *20151008*. The CLI is at version *0.3.3*. ```bash datastore1-beta2 [options] @@ -39,18 +39,18 @@ datastore1-beta2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/datastore1_beta2-cli/mkdocs.yml b/gen/datastore1_beta2-cli/mkdocs.yml index f5e3789de4..ea42d1ff0b 100644 --- a/gen/datastore1_beta2-cli/mkdocs.yml +++ b/gen/datastore1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: datastore v0.3.2+20151008 +site_name: datastore v0.3.3+20151008 site_url: http://byron.github.io/google-apis-rs/google-datastore1_beta2-cli site_description: Write integrating applications with bcore @@ -18,5 +18,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/datastore1_beta2-cli/src/main.rs b/gen/datastore1_beta2-cli/src/main.rs index 42c8d8dd33..ff2bc17e14 100644 --- a/gen/datastore1_beta2-cli/src/main.rs +++ b/gen/datastore1_beta2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Datastore>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _datasets_allocate_ids(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _datasets_allocate_ids(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -80,7 +80,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AllocateIdsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().allocate_ids(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -93,7 +93,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -106,7 +106,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -129,13 +129,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_begin_transaction(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_begin_transaction(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -149,8 +149,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "isolation-level" => Some(("isolationLevel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -165,7 +165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::BeginTransactionRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().begin_transaction(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -178,7 +178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -191,7 +191,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -214,13 +214,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_commit(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_commit(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -234,8 +234,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ignore-read-only" => Some(("ignoreReadOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "transaction" => Some(("transaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -253,7 +253,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CommitRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().commit(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -266,7 +266,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -279,7 +279,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -302,13 +302,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_lookup(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_lookup(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -322,8 +322,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "read-options.transaction" => Some(("readOptions.transaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "read-options.read-consistency" => Some(("readOptions.readConsistency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -339,7 +339,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LookupRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().lookup(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -352,7 +352,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -365,7 +365,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -388,13 +388,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_rollback(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_rollback(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -408,8 +408,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "transaction" => Some(("transaction", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -424,7 +424,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RollbackRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().rollback(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -437,7 +437,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -450,7 +450,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -473,13 +473,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_run_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_run_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -493,8 +493,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "query.filter.composite-filter.operator" => Some(("query.filter.compositeFilter.operator", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "query.filter.property-filter.operator" => Some(("query.filter.propertyFilter.operator", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -534,7 +534,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RunQueryRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().run_query(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -547,7 +547,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -560,7 +560,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -631,14 +631,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "datastore1-beta2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "datastore1-beta2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -658,7 +658,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -697,7 +697,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("datasets", "methods: 'allocate-ids', 'begin-transaction', 'commit', 'lookup', 'rollback' and 'run-query'", vec![ - ("allocate-ids", + ("allocate-ids", Some(r##"Allocate IDs for incomplete keys (useful for referencing an entity before it is inserted)."##), "Details at http://byron.github.io/google-apis-rs/google_datastore1_beta2_cli/datasets_allocate-ids", vec![ @@ -725,7 +725,7 @@ fn main() { Some(false), Some(false)), ]), - ("begin-transaction", + ("begin-transaction", Some(r##"Begin a new transaction."##), "Details at http://byron.github.io/google-apis-rs/google_datastore1_beta2_cli/datasets_begin-transaction", vec![ @@ -753,7 +753,7 @@ fn main() { Some(false), Some(false)), ]), - ("commit", + ("commit", Some(r##"Commit a transaction, optionally creating, deleting or modifying some entities."##), "Details at http://byron.github.io/google-apis-rs/google_datastore1_beta2_cli/datasets_commit", vec![ @@ -781,7 +781,7 @@ fn main() { Some(false), Some(false)), ]), - ("lookup", + ("lookup", Some(r##"Look up some entities by key."##), "Details at http://byron.github.io/google-apis-rs/google_datastore1_beta2_cli/datasets_lookup", vec![ @@ -809,7 +809,7 @@ fn main() { Some(false), Some(false)), ]), - ("rollback", + ("rollback", Some(r##"Roll back a transaction."##), "Details at http://byron.github.io/google-apis-rs/google_datastore1_beta2_cli/datasets_rollback", vec![ @@ -837,7 +837,7 @@ fn main() { Some(false), Some(false)), ]), - ("run-query", + ("run-query", Some(r##"Query for entities."##), "Details at http://byron.github.io/google-apis-rs/google_datastore1_beta2_cli/datasets_run-query", vec![ @@ -871,7 +871,7 @@ fn main() { let mut app = App::new("datastore1-beta2") .author("Sebastian Thiel ") - .version("0.3.2+20151008") + .version("0.3.3+20151008") .about("API for accessing Google Cloud Datastore.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_datastore1_beta2_cli") .arg(Arg::with_name("url") @@ -895,7 +895,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -906,7 +906,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/datastore1_beta2/Cargo.toml b/gen/datastore1_beta2/Cargo.toml index ff87816fcf..23ec1e38d1 100644 --- a/gen/datastore1_beta2/Cargo.toml +++ b/gen/datastore1_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-datastore1_beta2" -version = "0.1.10+20151008" +version = "0.1.11+20151008" authors = ["Sebastian Thiel "] description = "A complete library to interact with datastore (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/datastore1_beta2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/datastore1_beta2/LICENSE.md b/gen/datastore1_beta2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/datastore1_beta2/LICENSE.md +++ b/gen/datastore1_beta2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/datastore1_beta2/README.md b/gen/datastore1_beta2/README.md index 1136d8fd1a..a8cdd7e257 100644 --- a/gen/datastore1_beta2/README.md +++ b/gen/datastore1_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-datastore1_beta2` library allows access to all features of the *Google datastore* service. -This documentation was generated from *datastore* crate version *0.1.10+20151008*, where *20151008* is the exact revision of the *datastore:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *datastore* crate version *0.1.11+20151008*, where *20151008* is the exact revision of the *datastore:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *datastore* *v1_beta2* API can be found at the [official documentation site](https://developers.google.com/datastore/). diff --git a/gen/datastore1_beta2/src/cmn.rs b/gen/datastore1_beta2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/datastore1_beta2/src/cmn.rs +++ b/gen/datastore1_beta2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/datastore1_beta2/src/lib.rs b/gen/datastore1_beta2/src/lib.rs index 329f7f432c..e5f1b1ea9a 100644 --- a/gen/datastore1_beta2/src/lib.rs +++ b/gen/datastore1_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *datastore* crate version *0.1.10+20151008*, where *20151008* is the exact revision of the *datastore:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *datastore* crate version *0.1.11+20151008*, where *20151008* is the exact revision of the *datastore:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *datastore* *v1_beta2* API can be found at the //! [official documentation site](https://developers.google.com/datastore/). diff --git a/gen/datastore1_beta2/src/lib.rs.in b/gen/datastore1_beta2/src/lib.rs.in index b1a21e9f68..77b48659ff 100644 --- a/gen/datastore1_beta2/src/lib.rs.in +++ b/gen/datastore1_beta2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -140,7 +141,7 @@ impl<'a, C, A> Datastore Datastore { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -149,7 +150,7 @@ impl<'a, C, A> Datastore } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1092,7 +1093,7 @@ impl<'a, C, A> DatasetCommitCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "datastore.datasets.commit", + dlg.begin(MethodInfo { id: "datastore.datasets.commit", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("datasetId", self._dataset_id.to_string())); @@ -1134,14 +1135,14 @@ impl<'a, C, A> DatasetCommitCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1185,7 +1186,7 @@ impl<'a, C, A> DatasetCommitCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1195,10 +1196,10 @@ impl<'a, C, A> DatasetCommitCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1230,7 +1231,7 @@ impl<'a, C, A> DatasetCommitCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CommitRequest) -> DatasetCommitCall<'a, C, A> { self._request = new_value; @@ -1240,7 +1241,7 @@ impl<'a, C, A> DatasetCommitCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetCommitCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -1258,12 +1259,12 @@ impl<'a, C, A> DatasetCommitCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1280,17 +1281,17 @@ impl<'a, C, A> DatasetCommitCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetCommitCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetCommitCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1359,7 +1360,7 @@ impl<'a, C, A> DatasetAllocateIdCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "datastore.datasets.allocateIds", + dlg.begin(MethodInfo { id: "datastore.datasets.allocateIds", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("datasetId", self._dataset_id.to_string())); @@ -1401,14 +1402,14 @@ impl<'a, C, A> DatasetAllocateIdCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1452,7 +1453,7 @@ impl<'a, C, A> DatasetAllocateIdCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1462,10 +1463,10 @@ impl<'a, C, A> DatasetAllocateIdCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1497,7 +1498,7 @@ impl<'a, C, A> DatasetAllocateIdCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AllocateIdsRequest) -> DatasetAllocateIdCall<'a, C, A> { self._request = new_value; @@ -1507,7 +1508,7 @@ impl<'a, C, A> DatasetAllocateIdCall<'a, C, A> where C: BorrowMut /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetAllocateIdCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -1525,12 +1526,12 @@ impl<'a, C, A> DatasetAllocateIdCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1547,17 +1548,17 @@ impl<'a, C, A> DatasetAllocateIdCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetAllocateIdCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetAllocateIdCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1626,7 +1627,7 @@ impl<'a, C, A> DatasetRollbackCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "datastore.datasets.rollback", + dlg.begin(MethodInfo { id: "datastore.datasets.rollback", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("datasetId", self._dataset_id.to_string())); @@ -1668,14 +1669,14 @@ impl<'a, C, A> DatasetRollbackCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1719,7 +1720,7 @@ impl<'a, C, A> DatasetRollbackCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1729,10 +1730,10 @@ impl<'a, C, A> DatasetRollbackCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1764,7 +1765,7 @@ impl<'a, C, A> DatasetRollbackCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: RollbackRequest) -> DatasetRollbackCall<'a, C, A> { self._request = new_value; @@ -1774,7 +1775,7 @@ impl<'a, C, A> DatasetRollbackCall<'a, C, A> where C: BorrowMut, /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetRollbackCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -1792,12 +1793,12 @@ impl<'a, C, A> DatasetRollbackCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1814,17 +1815,17 @@ impl<'a, C, A> DatasetRollbackCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetRollbackCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetRollbackCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1893,7 +1894,7 @@ impl<'a, C, A> DatasetLookupCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "datastore.datasets.lookup", + dlg.begin(MethodInfo { id: "datastore.datasets.lookup", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("datasetId", self._dataset_id.to_string())); @@ -1935,14 +1936,14 @@ impl<'a, C, A> DatasetLookupCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1986,7 +1987,7 @@ impl<'a, C, A> DatasetLookupCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1996,10 +1997,10 @@ impl<'a, C, A> DatasetLookupCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2031,7 +2032,7 @@ impl<'a, C, A> DatasetLookupCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LookupRequest) -> DatasetLookupCall<'a, C, A> { self._request = new_value; @@ -2041,7 +2042,7 @@ impl<'a, C, A> DatasetLookupCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetLookupCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -2059,12 +2060,12 @@ impl<'a, C, A> DatasetLookupCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2081,17 +2082,17 @@ impl<'a, C, A> DatasetLookupCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetLookupCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetLookupCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2160,7 +2161,7 @@ impl<'a, C, A> DatasetRunQueryCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "datastore.datasets.runQuery", + dlg.begin(MethodInfo { id: "datastore.datasets.runQuery", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("datasetId", self._dataset_id.to_string())); @@ -2202,14 +2203,14 @@ impl<'a, C, A> DatasetRunQueryCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2253,7 +2254,7 @@ impl<'a, C, A> DatasetRunQueryCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2263,10 +2264,10 @@ impl<'a, C, A> DatasetRunQueryCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2298,7 +2299,7 @@ impl<'a, C, A> DatasetRunQueryCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: RunQueryRequest) -> DatasetRunQueryCall<'a, C, A> { self._request = new_value; @@ -2308,7 +2309,7 @@ impl<'a, C, A> DatasetRunQueryCall<'a, C, A> where C: BorrowMut, /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetRunQueryCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -2326,12 +2327,12 @@ impl<'a, C, A> DatasetRunQueryCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2348,17 +2349,17 @@ impl<'a, C, A> DatasetRunQueryCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetRunQueryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetRunQueryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2427,7 +2428,7 @@ impl<'a, C, A> DatasetBeginTransactionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "datastore.datasets.beginTransaction", + dlg.begin(MethodInfo { id: "datastore.datasets.beginTransaction", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("datasetId", self._dataset_id.to_string())); @@ -2469,14 +2470,14 @@ impl<'a, C, A> DatasetBeginTransactionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2520,7 +2521,7 @@ impl<'a, C, A> DatasetBeginTransactionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2530,10 +2531,10 @@ impl<'a, C, A> DatasetBeginTransactionCall<'a, C, A> where C: BorrowMut DatasetBeginTransactionCall<'a, C, A> where C: BorrowMut DatasetBeginTransactionCall<'a, C, A> { self._request = new_value; @@ -2575,7 +2576,7 @@ impl<'a, C, A> DatasetBeginTransactionCall<'a, C, A> where C: BorrowMut DatasetBeginTransactionCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -2593,12 +2594,12 @@ impl<'a, C, A> DatasetBeginTransactionCall<'a, C, A> where C: BorrowMut DatasetBeginTransactionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DatasetBeginTransactionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetBeginTransactionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/deploymentmanager2-cli/Cargo.toml b/gen/deploymentmanager2-cli/Cargo.toml index 436e2341df..0265e1f38e 100644 --- a/gen/deploymentmanager2-cli/Cargo.toml +++ b/gen/deploymentmanager2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-deploymentmanager2-cli" -version = "0.3.2+20150831" +version = "0.3.3+20160125" authors = ["Sebastian Thiel "] description = "A complete library to interact with Deployment Manager (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/deploymentmanager2-cli/LICENSE.md b/gen/deploymentmanager2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/deploymentmanager2-cli/LICENSE.md +++ b/gen/deploymentmanager2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/deploymentmanager2-cli/README.md b/gen/deploymentmanager2-cli/README.md index f33ee03457..512b0092c4 100644 --- a/gen/deploymentmanager2-cli/README.md +++ b/gen/deploymentmanager2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Deployment Manager* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/deploymentmanager2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/deploymentmanager2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/deploymentmanager2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/deploymentmanager2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2-cli). # Usage -This documentation was generated from the *Deployment Manager* API at revision *20150831*. The CLI is at version *0.3.2*. +This documentation was generated from the *Deployment Manager* API at revision *20160125*. The CLI is at version *0.3.3*. ```bash deploymentmanager2 [options] @@ -52,18 +52,18 @@ deploymentmanager2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/deploymentmanager2-cli/mkdocs.yml b/gen/deploymentmanager2-cli/mkdocs.yml index 3ba79671e5..1510430faa 100644 --- a/gen/deploymentmanager2-cli/mkdocs.yml +++ b/gen/deploymentmanager2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Deployment Manager v0.3.2+20150831 +site_name: Deployment Manager v0.3.3+20160125 site_url: http://byron.github.io/google-apis-rs/google-deploymentmanager2-cli site_description: Write integrating applications with bcore @@ -27,5 +27,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/deploymentmanager2-cli/src/main.rs b/gen/deploymentmanager2-cli/src/main.rs index 8eb769bef5..85659b4349 100644 --- a/gen/deploymentmanager2-cli/src/main.rs +++ b/gen/deploymentmanager2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::DeploymentManager>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _deployments_cancel_preview(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _deployments_cancel_preview(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -81,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DeploymentsCancelPreviewRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.deployments().cancel_preview(request, opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -94,7 +94,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -107,7 +107,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -130,10 +130,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.deployments().delete(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -146,7 +146,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -159,7 +159,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -182,10 +182,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.deployments().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -198,7 +198,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -211,7 +211,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -234,13 +234,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -254,8 +254,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.manifest" => Some(("update.manifest", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -265,15 +265,16 @@ impl<'n, 'a> Engine<'n, 'a> { "operation.status" => Some(("operation.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.kind" => Some(("operation.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.status-message" => Some(("operation.statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "operation.user" => Some(("operation.user", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "operation.start-time" => Some(("operation.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.description" => Some(("operation.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.zone" => Some(("operation.zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.http-error-status-code" => Some(("operation.httpErrorStatusCode", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "operation.region" => Some(("operation.region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.insert-time" => Some(("operation.insertTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.target-id" => Some(("operation.targetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.operation-type" => Some(("operation.operationType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.target-link" => Some(("operation.targetLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "operation.insert-time" => Some(("operation.insertTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.user" => Some(("operation.user", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.start-time" => Some(("operation.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.http-error-message" => Some(("operation.httpErrorMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.progress" => Some(("operation.progress", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "operation.client-operation-id" => Some(("operation.clientOperationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -297,7 +298,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Deployment = json::value::from_value(object).unwrap(); let mut call = self.hub.deployments().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "preview" => { @@ -313,7 +314,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["preview"].iter().map(|v|*v)); @@ -327,7 +328,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -350,10 +351,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.deployments().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -375,7 +376,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -389,7 +390,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -412,13 +413,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -432,8 +433,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.manifest" => Some(("update.manifest", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -443,15 +444,16 @@ impl<'n, 'a> Engine<'n, 'a> { "operation.status" => Some(("operation.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.kind" => Some(("operation.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.status-message" => Some(("operation.statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "operation.user" => Some(("operation.user", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "operation.start-time" => Some(("operation.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.description" => Some(("operation.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.zone" => Some(("operation.zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.http-error-status-code" => Some(("operation.httpErrorStatusCode", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "operation.region" => Some(("operation.region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.insert-time" => Some(("operation.insertTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.target-id" => Some(("operation.targetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.operation-type" => Some(("operation.operationType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.target-link" => Some(("operation.targetLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "operation.insert-time" => Some(("operation.insertTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.user" => Some(("operation.user", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.start-time" => Some(("operation.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.http-error-message" => Some(("operation.httpErrorMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.progress" => Some(("operation.progress", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "operation.client-operation-id" => Some(("operation.clientOperationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -475,7 +477,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Deployment = json::value::from_value(object).unwrap(); let mut call = self.hub.deployments().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "preview" => { @@ -497,7 +499,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["preview", "create-policy", "delete-policy"].iter().map(|v|*v)); @@ -511,7 +513,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -534,13 +536,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_stop(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_stop(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -554,8 +556,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -570,7 +572,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DeploymentsStopRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.deployments().stop(request, opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -583,7 +585,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -596,7 +598,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -619,13 +621,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -639,8 +641,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update.manifest" => Some(("update.manifest", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -650,15 +652,16 @@ impl<'n, 'a> Engine<'n, 'a> { "operation.status" => Some(("operation.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.kind" => Some(("operation.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.status-message" => Some(("operation.statusMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "operation.user" => Some(("operation.user", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "operation.start-time" => Some(("operation.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.description" => Some(("operation.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.zone" => Some(("operation.zone", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.http-error-status-code" => Some(("operation.httpErrorStatusCode", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "operation.region" => Some(("operation.region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.insert-time" => Some(("operation.insertTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.target-id" => Some(("operation.targetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.operation-type" => Some(("operation.operationType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.target-link" => Some(("operation.targetLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "operation.insert-time" => Some(("operation.insertTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.user" => Some(("operation.user", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "operation.start-time" => Some(("operation.startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.http-error-message" => Some(("operation.httpErrorMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "operation.progress" => Some(("operation.progress", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "operation.client-operation-id" => Some(("operation.clientOperationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -682,7 +685,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Deployment = json::value::from_value(object).unwrap(); let mut call = self.hub.deployments().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "preview" => { @@ -704,7 +707,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["preview", "create-policy", "delete-policy"].iter().map(|v|*v)); @@ -718,7 +721,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -741,10 +744,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _manifests_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _manifests_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.manifests().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or(""), opt.value_of("manifest").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -757,7 +760,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -770,7 +773,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -793,10 +796,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _manifests_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _manifests_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.manifests().list(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -818,7 +821,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -832,7 +835,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -855,10 +858,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -871,7 +874,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -884,7 +887,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -907,10 +910,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operations().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -932,7 +935,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -946,7 +949,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -969,10 +972,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _resources_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _resources_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.resources().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or(""), opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -985,7 +988,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -998,7 +1001,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1021,10 +1024,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _resources_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _resources_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.resources().list(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1046,7 +1049,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -1060,7 +1063,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1083,10 +1086,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _types_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.types().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1108,7 +1111,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -1122,7 +1125,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1252,14 +1255,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "deploymentmanager2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "deploymentmanager2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1279,7 +1282,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1318,7 +1321,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("deployments", "methods: 'cancel-preview', 'delete', 'get', 'insert', 'list', 'patch', 'stop' and 'update'", vec![ - ("cancel-preview", + ("cancel-preview", Some(r##"Cancels and removes the preview currently associated with the deployment."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_cancel-preview", vec![ @@ -1352,7 +1355,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a deployment and all of the resources in the deployment."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_delete", vec![ @@ -1380,7 +1383,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets information about a specific deployment."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_get", vec![ @@ -1408,7 +1411,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a deployment and all of the resources described by the deployment manifest."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_insert", vec![ @@ -1436,7 +1439,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all deployments for a given project."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_list", vec![ @@ -1458,7 +1461,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a deployment and all of the resources described by the deployment manifest. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_patch", vec![ @@ -1492,7 +1495,7 @@ fn main() { Some(false), Some(false)), ]), - ("stop", + ("stop", Some(r##"Stops an ongoing operation. This does not roll back any work that has already been completed, but prevents any new work from being started."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_stop", vec![ @@ -1526,7 +1529,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a deployment and all of the resources described by the deployment manifest."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/deployments_update", vec![ @@ -1563,7 +1566,7 @@ fn main() { ]), ("manifests", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets information about a specific manifest."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/manifests_get", vec![ @@ -1597,7 +1600,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all manifests for a given deployment."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/manifests_list", vec![ @@ -1628,7 +1631,7 @@ fn main() { ]), ("operations", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets information about a specific operation."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/operations_get", vec![ @@ -1656,7 +1659,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all operations for a project."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/operations_list", vec![ @@ -1681,7 +1684,7 @@ fn main() { ]), ("resources", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets information about a single resource."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/resources_get", vec![ @@ -1715,7 +1718,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all resources in a given deployment."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/resources_list", vec![ @@ -1746,7 +1749,7 @@ fn main() { ]), ("types", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Lists all resource types for Deployment Manager."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli/types_list", vec![ @@ -1774,7 +1777,7 @@ fn main() { let mut app = App::new("deploymentmanager2") .author("Sebastian Thiel ") - .version("0.3.2+20150831") + .version("0.3.3+20160125") .about("The Deployment Manager API allows users to declaratively configure, deploy and run complex solutions on the Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_deploymentmanager2_cli") .arg(Arg::with_name("url") @@ -1798,7 +1801,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1809,7 +1812,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/deploymentmanager2/Cargo.toml b/gen/deploymentmanager2/Cargo.toml index da8a5019e0..93b49ce525 100644 --- a/gen/deploymentmanager2/Cargo.toml +++ b/gen/deploymentmanager2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-deploymentmanager2" -version = "0.1.10+20150831" +version = "0.1.11+20160125" authors = ["Sebastian Thiel "] description = "A complete library to interact with Deployment Manager (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/deploymentmanager2/LICENSE.md b/gen/deploymentmanager2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/deploymentmanager2/LICENSE.md +++ b/gen/deploymentmanager2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/deploymentmanager2/README.md b/gen/deploymentmanager2/README.md index cf6a1a313b..98e4742b74 100644 --- a/gen/deploymentmanager2/README.md +++ b/gen/deploymentmanager2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-deploymentmanager2` library allows access to all features of the *Google Deployment Manager* service. -This documentation was generated from *Deployment Manager* crate version *0.1.10+20150831*, where *20150831* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Deployment Manager* crate version *0.1.11+20160125*, where *20160125* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Deployment Manager* *v2* API can be found at the [official documentation site](https://cloud.google.com/deployment-manager/). diff --git a/gen/deploymentmanager2/src/cmn.rs b/gen/deploymentmanager2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/deploymentmanager2/src/cmn.rs +++ b/gen/deploymentmanager2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/deploymentmanager2/src/lib.rs b/gen/deploymentmanager2/src/lib.rs index d37bac6c8c..588e80251e 100644 --- a/gen/deploymentmanager2/src/lib.rs +++ b/gen/deploymentmanager2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Deployment Manager* crate version *0.1.10+20150831*, where *20150831* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Deployment Manager* crate version *0.1.11+20160125*, where *20160125* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Deployment Manager* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/deployment-manager/). diff --git a/gen/deploymentmanager2/src/lib.rs.in b/gen/deploymentmanager2/src/lib.rs.in index 5f4d3176e0..7d4812149d 100644 --- a/gen/deploymentmanager2/src/lib.rs.in +++ b/gen/deploymentmanager2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -147,7 +148,7 @@ impl<'a, C, A> DeploymentManager DeploymentManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -168,7 +169,7 @@ impl<'a, C, A> DeploymentManager } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -188,11 +189,12 @@ impl<'a, C, A> DeploymentManager /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceWarnings { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -257,7 +259,7 @@ impl ResponseResult for ResourceType {} pub struct DeploymentsStopRequest { /// Specifies a fingerprint for stop() requests. A fingerprint is a randomly generated value that must be provided in stop() requests to perform optimistic locking. This ensures optimistic concurrency so that the deployment does not have conflicting requests (e.g. if someone attempts to make a new update request while another user attempts to stop an ongoing update request, this would prevent a collision). /// - /// The fingerprint is initially generated by Deployment Manager and changes after every request to modify a deployment. To get the latest fingerprint value, perform a get() request to a deployment. + /// The fingerprint is initially generated by Deployment Manager and changes after every request to modify a deployment. To get the latest fingerprint value, perform a get() request on the deployment. pub fingerprint: Option, } @@ -277,7 +279,7 @@ impl RequestValue for DeploymentsStopRequest {} pub struct DeploymentsCancelPreviewRequest { /// Specifies a fingerprint for cancelPreview() requests. A fingerprint is a randomly generated value that must be provided in cancelPreview() requests to perform optimistic locking. This ensures optimistic concurrency so that the deployment does not have conflicting requests (e.g. if someone attempts to make a new update request while another user attempts to cancel a preview, this would prevent one of the requests). /// - /// The fingerprint is initially generated by Deployment Manager and changes after every request to modify a deployment. To get the latest fingerprint value, perform a get() request to a deployment. + /// The fingerprint is initially generated by Deployment Manager and changes after every request to modify a deployment. To get the latest fingerprint value, perform a get() request on the deployment. pub fingerprint: Option, } @@ -305,13 +307,14 @@ pub struct ResourcesListResponse { impl ResponseResult for ResourcesListResponse {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceUpdateWarningsData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -531,13 +534,14 @@ pub struct ImportFile { impl Part for ImportFile {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationWarningsData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -567,11 +571,12 @@ impl Part for ResourceUpdateError {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationWarnings { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -585,11 +590,12 @@ impl Part for OperationWarnings {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceUpdateWarnings { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -709,62 +715,64 @@ impl ResponseResult for Deployment {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Operation { - /// [Output Only] Status of the operation. Can be one of the following: PENDING, RUNNING, or DONE. + /// [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. pub status: Option, - /// [Output Only] The time that this operation was requested. This is in RFC3339 text format. - #[serde(rename="insertTime")] - pub insert_time: Option, + /// [Output Only] A textual description of the operation, which is set when the operation is created. + pub description: Option, /// [Output Only] If warning messages are generated during processing of the operation, this field will be populated. pub warnings: Option>, /// [Output Only] If errors are generated during processing of the operation, this field will be populated. pub error: Option, - /// [Output Only] Unique target ID which identifies a particular incarnation of the target. + /// [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. #[serde(rename="targetId")] pub target_id: Option, - /// [Output Only] URL of the resource the operation is mutating. - #[serde(rename="targetLink")] - pub target_link: Option, - /// [Output Only] The time that this operation was started by the server. This is in RFC3339 text format. + /// [Output Only] User who requested the operation, for example: user@example.com. + pub user: Option, + /// [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. #[serde(rename="startTime")] pub start_time: Option, - /// [Output Only] An optional identifier specified by the client when the mutation was initiated. Must be unique for all Operation resources in the project. + /// [Output Only] Reserved for future use. #[serde(rename="clientOperationId")] pub client_operation_id: Option, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, - /// [Output Only] Type of the resource. Always compute#Operation for Operation resources. + /// [Output Only] Type of the resource. Always compute#operation for Operation resources. pub kind: Option, /// [Output Only] Name of the resource. pub name: Option, - /// [Output Only] URL of the zone where the operation resides. + /// [Output Only] The URL of the zone where the operation resides. Only available when performing per-zone operations. pub zone: Option, - /// [Output Only] URL of the region where the operation resides. Only applicable for regional resources. + /// [Output Only] The URL of the region where the operation resides. Only available when performing regional operations. pub region: Option, + /// [Output Only] The type of operation, such as insert, update, or delete, and so on. + #[serde(rename="operationType")] + pub operation_type: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// [Output Only] Type of the operation, such as insert, update, and delete. - #[serde(rename="operationType")] - pub operation_type: Option, + /// [Output Only] The time that this operation was requested. This value is in RFC3339 text format. + #[serde(rename="insertTime")] + pub insert_time: Option, /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. #[serde(rename="httpErrorMessage")] pub http_error_message: Option, - /// [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess at when the operation will be complete. This number should monotonically increase as the operation progresses. + /// [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. pub progress: Option, - /// [Output Only] The time that this operation was completed. This is in RFC3339 text format. + /// [Output Only] The time that this operation was completed. This value is in RFC3339 text format. #[serde(rename="endTime")] pub end_time: Option, - /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as 404. + /// [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. #[serde(rename="httpErrorStatusCode")] pub http_error_status_code: Option, /// [Output Only] An optional textual description of the current status of the operation. #[serde(rename="statusMessage")] pub status_message: Option, - /// [Output Only] User who requested the operation, for example: user@example.com. - pub user: Option, + /// [Output Only] The URL of the resource that the operation modifies. + #[serde(rename="targetLink")] + pub target_link: Option, } impl Resource for Operation {} @@ -792,13 +800,14 @@ pub struct ManifestsListResponse { impl ResponseResult for ManifestsListResponse {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceWarningsData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -1392,7 +1401,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.operations.get", + dlg.begin(MethodInfo { id: "deploymentmanager.operations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1435,7 +1444,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1471,7 +1480,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1481,10 +1490,10 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1517,7 +1526,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -1527,7 +1536,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *operation* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operation(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -1545,12 +1554,12 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1567,17 +1576,17 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1645,7 +1654,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.operations.list", + dlg.begin(MethodInfo { id: "deploymentmanager.operations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1696,7 +1705,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1732,7 +1741,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1742,10 +1751,10 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1778,31 +1787,35 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> OperationListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> OperationListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// - /// For example, filter=name ne example-instance. + /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C, A> { @@ -1821,12 +1834,12 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1843,17 +1856,17 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1922,7 +1935,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.manifests.list", + dlg.begin(MethodInfo { id: "deploymentmanager.manifests.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1974,7 +1987,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2010,7 +2023,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2020,10 +2033,10 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2056,7 +2069,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2066,31 +2079,35 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { self._deployment = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> ManifestListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// - /// For example, filter=name ne example-instance. + /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { @@ -2109,12 +2126,12 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2131,17 +2148,17 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManifestListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManifestListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2205,7 +2222,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.manifests.get", + dlg.begin(MethodInfo { id: "deploymentmanager.manifests.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2249,7 +2266,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2285,7 +2302,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2295,10 +2312,10 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2331,7 +2348,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ManifestGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -2341,7 +2358,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> ManifestGetCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -2351,7 +2368,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *manifest* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn manifest(mut self, new_value: &str) -> ManifestGetCall<'a, C, A> { self._manifest = new_value.to_string(); @@ -2369,12 +2386,12 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2391,17 +2408,17 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManifestGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManifestGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2469,7 +2486,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.types.list", + dlg.begin(MethodInfo { id: "deploymentmanager.types.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2520,7 +2537,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2556,7 +2573,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2566,10 +2583,10 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2602,31 +2619,35 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TypeListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> TypeListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> TypeListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// - /// For example, filter=name ne example-instance. + /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TypeListCall<'a, C, A> { @@ -2645,12 +2666,12 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2667,17 +2688,17 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TypeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2741,7 +2762,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.resources.get", + dlg.begin(MethodInfo { id: "deploymentmanager.resources.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2785,7 +2806,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2821,7 +2842,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2831,10 +2852,10 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2867,7 +2888,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ResourceGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -2877,7 +2898,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> ResourceGetCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -2887,7 +2908,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ResourceGetCall<'a, C, A> { self._resource = new_value.to_string(); @@ -2905,12 +2926,12 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2927,17 +2948,17 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ResourceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ResourceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3006,7 +3027,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.resources.list", + dlg.begin(MethodInfo { id: "deploymentmanager.resources.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3058,7 +3079,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3094,7 +3115,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3104,10 +3125,10 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3140,7 +3161,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { self._project = new_value.to_string(); @@ -3150,31 +3171,35 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { self._deployment = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> ResourceListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// - /// For example, filter=name ne example-instance. + /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { @@ -3193,12 +3218,12 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3215,17 +3240,17 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ResourceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ResourceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3301,7 +3326,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.update", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3353,14 +3378,14 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3404,7 +3429,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3414,10 +3439,10 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3449,7 +3474,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Deployment) -> DeploymentUpdateCall<'a, C, A> { self._request = new_value; @@ -3459,7 +3484,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -3469,13 +3494,13 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C, A> { self._deployment = new_value.to_string(); self } - /// If set to true, updates the deployment and creates and updates the "shell" resources but does not actually alter or instantiate these resources. This allows you to preview what your deployment looks like. You can use this intent to preview how an update would affect your deployment. You must provide a target.config with a configuration if this is set to true. After previewing a deployment, you can deploy your resources by making a request with the update() or you can cancelPreview() to remove the preview altogether. Note that the deployment will still exist after you cancel the preview and you must separately delete this deployment if you want to remove it. + /// If set to true, updates the deployment and creates and updates the "shell" resources but does not actually alter or instantiate these resources. This allows you to preview what your deployment will look like. You can use this intent to preview how an update would affect your deployment. You must provide a target.config with a configuration if this is set to true. After previewing a deployment, you can deploy your resources by making a request with the update() or you can cancelPreview() to remove the preview altogether. Note that the deployment will still exist after you cancel the preview and you must separately delete this deployment if you want to remove it. /// /// Sets the *preview* query property to the given value. pub fn preview(mut self, new_value: bool) -> DeploymentUpdateCall<'a, C, A> { @@ -3508,12 +3533,12 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3530,17 +3555,17 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3603,7 +3628,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.get", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3646,7 +3671,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3682,7 +3707,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3692,10 +3717,10 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3728,7 +3753,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -3738,7 +3763,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> DeploymentGetCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -3756,12 +3781,12 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3778,17 +3803,17 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3859,7 +3884,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.insert", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3904,14 +3929,14 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3955,7 +3980,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3965,10 +3990,10 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4000,7 +4025,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Deployment) -> DeploymentInsertCall<'a, C, A> { self._request = new_value; @@ -4010,7 +4035,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -4035,12 +4060,12 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4057,17 +4082,17 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4137,7 +4162,7 @@ impl<'a, C, A> DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.cancelPreview", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.cancelPreview", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4180,14 +4205,14 @@ impl<'a, C, A> DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4231,7 +4256,7 @@ impl<'a, C, A> DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4241,10 +4266,10 @@ impl<'a, C, A> DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut DeploymentCancelPreviewCall<'a, C, A> { self._request = new_value; @@ -4286,7 +4311,7 @@ impl<'a, C, A> DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut DeploymentCancelPreviewCall<'a, C, A> { self._project = new_value.to_string(); @@ -4296,7 +4321,7 @@ impl<'a, C, A> DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut DeploymentCancelPreviewCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -4314,12 +4339,12 @@ impl<'a, C, A> DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut DeploymentCancelPreviewCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DeploymentCancelPreviewCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentCancelPreviewCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4414,7 +4439,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.list", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4465,7 +4490,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4501,7 +4526,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4511,10 +4536,10 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4547,31 +4572,35 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> DeploymentListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// - /// For example, filter=name ne example-instance. + /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { @@ -4590,12 +4619,12 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4612,17 +4641,17 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4698,7 +4727,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.patch", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4750,14 +4779,14 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4801,7 +4830,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4811,10 +4840,10 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4846,7 +4875,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Deployment) -> DeploymentPatchCall<'a, C, A> { self._request = new_value; @@ -4856,7 +4885,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentPatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -4866,13 +4895,13 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> DeploymentPatchCall<'a, C, A> { self._deployment = new_value.to_string(); self } - /// If set to true, updates the deployment and creates and updates the "shell" resources but does not actually alter or instantiate these resources. This allows you to preview what your deployment looks like. You can use this intent to preview how an update would affect your deployment. You must provide a target.config with a configuration if this is set to true. After previewing a deployment, you can deploy your resources by making a request with the update() or you can cancelPreview() to remove the preview altogether. Note that the deployment will still exist after you cancel the preview and you must separately delete this deployment if you want to remove it. + /// If set to true, updates the deployment and creates and updates the "shell" resources but does not actually alter or instantiate these resources. This allows you to preview what your deployment will look like. You can use this intent to preview how an update would affect your deployment. You must provide a target.config with a configuration if this is set to true. After previewing a deployment, you can deploy your resources by making a request with the update() or you can cancelPreview() to remove the preview altogether. Note that the deployment will still exist after you cancel the preview and you must separately delete this deployment if you want to remove it. /// /// Sets the *preview* query property to the given value. pub fn preview(mut self, new_value: bool) -> DeploymentPatchCall<'a, C, A> { @@ -4905,12 +4934,12 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4927,17 +4956,17 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5007,7 +5036,7 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.stop", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.stop", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -5050,14 +5079,14 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5101,7 +5130,7 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5111,10 +5140,10 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5146,7 +5175,7 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: DeploymentsStopRequest) -> DeploymentStopCall<'a, C, A> { self._request = new_value; @@ -5156,7 +5185,7 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentStopCall<'a, C, A> { self._project = new_value.to_string(); @@ -5166,7 +5195,7 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> DeploymentStopCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -5184,12 +5213,12 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5206,17 +5235,17 @@ impl<'a, C, A> DeploymentStopCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentStopCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentStopCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5279,7 +5308,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.delete", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -5322,7 +5351,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5358,7 +5387,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5368,10 +5397,10 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5404,7 +5433,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -5414,7 +5443,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -5432,12 +5461,12 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5454,17 +5483,17 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/deploymentmanager2_beta1-cli/Cargo.toml b/gen/deploymentmanager2_beta1-cli/Cargo.toml deleted file mode 100644 index 455bcdc946..0000000000 --- a/gen/deploymentmanager2_beta1-cli/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -# DO NOT EDIT ! -# This file was generated automatically from 'src/mako/Cargo.toml.mako' -# DO NOT EDIT ! -[package] - -name = "google-deploymentmanager2_beta1-cli" -version = "0.3.0+20150415" -authors = ["Sebastian Thiel "] -description = "A complete library to interact with deploymentmanager (protocol v2beta1)" -repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2_beta1-cli" -homepage = "https://developers.google.com/deployment-manager/" -documentation = "http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli" -license = "MIT" -keywords = ["deploymentmanager", "google", "cli"] - -[[bin]] -name = "deploymentmanager2-beta1" - -[dependencies] -hyper = ">= 0.5.2" -mime = "0.0.11" -serde = ">= 0.4.1" -yup-oauth2 = "*" -strsim = "*" -yup-hyper-mock = ">=1.0.0" -clap = ">= 0.9.1" - -[build-dependencies] -syntex = { version = "*" } -serde_codegen = { version = "*" } - - -[dependencies.google-deploymentmanager2_beta1] -path = "../deploymentmanager2_beta1" diff --git a/gen/deploymentmanager2_beta1-cli/mkdocs.yml b/gen/deploymentmanager2_beta1-cli/mkdocs.yml deleted file mode 100644 index 4ce4e34cee..0000000000 --- a/gen/deploymentmanager2_beta1-cli/mkdocs.yml +++ /dev/null @@ -1,27 +0,0 @@ -site_name: deploymentmanager v0.3.0+20150415 -site_url: http://byron.github.io/google-apis-rs/google-deploymentmanager2_beta1-cli -site_description: Write integrating applications with bcore - -repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2_beta1-cli - -docs_dir: docs -site_dir: build_html - -pages: -- ['index.md', 'Home'] -- ['deployments_delete.md', 'Deployments', 'Delete'] -- ['deployments_get.md', 'Deployments', 'Get'] -- ['deployments_insert.md', 'Deployments', 'Insert'] -- ['deployments_list.md', 'Deployments', 'List'] -- ['manifests_get.md', 'Manifests', 'Get'] -- ['manifests_list.md', 'Manifests', 'List'] -- ['operations_get.md', 'Operations', 'Get'] -- ['operations_list.md', 'Operations', 'List'] -- ['resources_get.md', 'Resources', 'Get'] -- ['resources_list.md', 'Resources', 'List'] -- ['types_list.md', 'Types', 'List'] - -theme: readthedocs - -copyright: Copyright © 2015, `Sebastian Thiel` - diff --git a/gen/deploymentmanager2_beta1/Cargo.toml b/gen/deploymentmanager2_beta1/Cargo.toml deleted file mode 100644 index 6a20fe4d23..0000000000 --- a/gen/deploymentmanager2_beta1/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -# DO NOT EDIT ! -# This file was generated automatically from 'src/mako/Cargo.toml.mako' -# DO NOT EDIT ! -[package] - -name = "google-deploymentmanager2_beta1" -version = "0.1.8+20150415" -authors = ["Sebastian Thiel "] -description = "A complete library to interact with deploymentmanager (protocol v2beta1)" -repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2_beta1" -homepage = "https://developers.google.com/deployment-manager/" -documentation = "http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1" -license = "MIT" -keywords = ["deploymentmanager", "google", "protocol", "web", "api"] -build = "src/build.rs" - - -[dependencies] -hyper = ">= 0.5.2" -mime = "0.0.11" -serde = ">= 0.4.1" -yup-oauth2 = "*" -url = "*" - -[build-dependencies] -syntex = { version = "*" } -serde_codegen = { version = "*" } - diff --git a/gen/deploymentmanager2_beta2-cli/Cargo.toml b/gen/deploymentmanager2_beta2-cli/Cargo.toml index 98cd595b2b..d4f549c25c 100644 --- a/gen/deploymentmanager2_beta2-cli/Cargo.toml +++ b/gen/deploymentmanager2_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-deploymentmanager2_beta2-cli" -version = "0.3.2+20150831" +version = "0.3.3+20160125" authors = ["Sebastian Thiel "] description = "A complete library to interact with Deployment Manager (protocol v2beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2_beta2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/deploymentmanager2_beta2-cli/LICENSE.md b/gen/deploymentmanager2_beta2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/deploymentmanager2_beta2-cli/LICENSE.md +++ b/gen/deploymentmanager2_beta2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/deploymentmanager2_beta2-cli/README.md b/gen/deploymentmanager2_beta2-cli/README.md index 00eae34916..061fb73296 100644 --- a/gen/deploymentmanager2_beta2-cli/README.md +++ b/gen/deploymentmanager2_beta2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Deployment Manager* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/deploymentmanager2-beta2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/deploymentmanager2-beta2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/deploymentmanager2-beta2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/deploymentmanager2-beta2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2_beta2-cli). # Usage -This documentation was generated from the *Deployment Manager* API at revision *20150831*. The CLI is at version *0.3.2*. +This documentation was generated from the *Deployment Manager* API at revision *20160125*. The CLI is at version *0.3.3*. ```bash deploymentmanager2-beta2 [options] @@ -50,18 +50,18 @@ deploymentmanager2-beta2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/deploymentmanager2_beta2-cli/mkdocs.yml b/gen/deploymentmanager2_beta2-cli/mkdocs.yml index f3d1db932f..256f0642d3 100644 --- a/gen/deploymentmanager2_beta2-cli/mkdocs.yml +++ b/gen/deploymentmanager2_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Deployment Manager v0.3.2+20150831 +site_name: Deployment Manager v0.3.3+20160125 site_url: http://byron.github.io/google-apis-rs/google-deploymentmanager2_beta2-cli site_description: Write integrating applications with bcore @@ -25,5 +25,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/deploymentmanager2_beta2-cli/src/main.rs b/gen/deploymentmanager2_beta2-cli/src/main.rs index fa7d429e6d..c7d49f29fd 100644 --- a/gen/deploymentmanager2_beta2-cli/src/main.rs +++ b/gen/deploymentmanager2_beta2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::DeploymentManager>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _deployments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _deployments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.deployments().delete(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.deployments().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -149,13 +149,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -169,8 +169,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -196,7 +196,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Deployment = json::value::from_value(object).unwrap(); let mut call = self.hub.deployments().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -209,7 +209,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -222,7 +222,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -245,10 +245,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.deployments().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -270,7 +270,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -284,7 +284,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -307,13 +307,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -327,8 +327,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -354,7 +354,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Deployment = json::value::from_value(object).unwrap(); let mut call = self.hub.deployments().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "update-policy" => { @@ -376,7 +376,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["delete-policy", "update-policy", "create-policy"].iter().map(|v|*v)); @@ -390,7 +390,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -413,13 +413,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -433,8 +433,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "update-time" => Some(("updateTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -460,7 +460,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Deployment = json::value::from_value(object).unwrap(); let mut call = self.hub.deployments().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "update-policy" => { @@ -482,7 +482,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["delete-policy", "update-policy", "create-policy"].iter().map(|v|*v)); @@ -496,7 +496,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -519,10 +519,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _manifests_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _manifests_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.manifests().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or(""), opt.value_of("manifest").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -535,7 +535,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -548,7 +548,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -571,10 +571,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _manifests_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _manifests_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.manifests().list(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -596,7 +596,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -610,7 +610,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -633,10 +633,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -649,7 +649,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -662,7 +662,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -685,10 +685,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operations().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -710,7 +710,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -724,7 +724,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -747,10 +747,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _resources_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _resources_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.resources().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or(""), opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -763,7 +763,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -776,7 +776,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -799,10 +799,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _resources_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _resources_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.resources().list(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -824,7 +824,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -838,7 +838,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -861,10 +861,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _types_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.types().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -886,7 +886,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -900,7 +900,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1024,14 +1024,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "deploymentmanager2-beta2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "deploymentmanager2-beta2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1051,7 +1051,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1090,7 +1090,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("deployments", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a deployment and all of the resources in the deployment."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/deployments_delete", vec![ @@ -1118,7 +1118,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets information about a specific deployment."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/deployments_get", vec![ @@ -1146,7 +1146,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a deployment and all of the resources described by the deployment manifest."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/deployments_insert", vec![ @@ -1174,7 +1174,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all deployments for a given project."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/deployments_list", vec![ @@ -1196,7 +1196,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a deployment and all of the resources described by the deployment manifest. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/deployments_patch", vec![ @@ -1230,7 +1230,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a deployment and all of the resources described by the deployment manifest."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/deployments_update", vec![ @@ -1267,7 +1267,7 @@ fn main() { ]), ("manifests", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets information about a specific manifest."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/manifests_get", vec![ @@ -1301,7 +1301,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all manifests for a given deployment."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/manifests_list", vec![ @@ -1332,7 +1332,7 @@ fn main() { ]), ("operations", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets information about a specific operation."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/operations_get", vec![ @@ -1360,7 +1360,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all operations for a project."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/operations_list", vec![ @@ -1385,7 +1385,7 @@ fn main() { ]), ("resources", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets information about a single resource."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/resources_get", vec![ @@ -1419,7 +1419,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all resources in a given deployment."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/resources_list", vec![ @@ -1450,7 +1450,7 @@ fn main() { ]), ("types", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Lists all resource types for Deployment Manager."##), "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli/types_list", vec![ @@ -1478,7 +1478,7 @@ fn main() { let mut app = App::new("deploymentmanager2-beta2") .author("Sebastian Thiel ") - .version("0.3.2+20150831") + .version("0.3.3+20160125") .about("The Deployment Manager API allows users to declaratively configure, deploy and run complex solutions on the Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta2_cli") .arg(Arg::with_name("url") @@ -1502,7 +1502,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1513,7 +1513,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/deploymentmanager2_beta2/Cargo.toml b/gen/deploymentmanager2_beta2/Cargo.toml index 9137016ef4..e40420cc18 100644 --- a/gen/deploymentmanager2_beta2/Cargo.toml +++ b/gen/deploymentmanager2_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-deploymentmanager2_beta2" -version = "0.1.10+20150831" +version = "0.1.11+20160125" authors = ["Sebastian Thiel "] description = "A complete library to interact with Deployment Manager (protocol v2beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2_beta2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/deploymentmanager2_beta2/LICENSE.md b/gen/deploymentmanager2_beta2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/deploymentmanager2_beta2/LICENSE.md +++ b/gen/deploymentmanager2_beta2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/deploymentmanager2_beta2/README.md b/gen/deploymentmanager2_beta2/README.md index f3413fc5db..d371d58858 100644 --- a/gen/deploymentmanager2_beta2/README.md +++ b/gen/deploymentmanager2_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-deploymentmanager2_beta2` library allows access to all features of the *Google Deployment Manager* service. -This documentation was generated from *Deployment Manager* crate version *0.1.10+20150831*, where *20150831* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Deployment Manager* crate version *0.1.11+20160125*, where *20160125* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Deployment Manager* *v2_beta2* API can be found at the [official documentation site](https://developers.google.com/deployment-manager/). diff --git a/gen/deploymentmanager2_beta2/src/cmn.rs b/gen/deploymentmanager2_beta2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/deploymentmanager2_beta2/src/cmn.rs +++ b/gen/deploymentmanager2_beta2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/deploymentmanager2_beta2/src/lib.rs b/gen/deploymentmanager2_beta2/src/lib.rs index b7c362e894..6cdeb81e08 100644 --- a/gen/deploymentmanager2_beta2/src/lib.rs +++ b/gen/deploymentmanager2_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Deployment Manager* crate version *0.1.10+20150831*, where *20150831* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Deployment Manager* crate version *0.1.11+20160125*, where *20160125* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Deployment Manager* *v2_beta2* API can be found at the //! [official documentation site](https://developers.google.com/deployment-manager/). diff --git a/gen/deploymentmanager2_beta2/src/lib.rs.in b/gen/deploymentmanager2_beta2/src/lib.rs.in index 4f9709be46..54bc178c30 100644 --- a/gen/deploymentmanager2_beta2/src/lib.rs.in +++ b/gen/deploymentmanager2_beta2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -147,7 +148,7 @@ impl<'a, C, A> DeploymentManager DeploymentManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -168,7 +169,7 @@ impl<'a, C, A> DeploymentManager } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -239,13 +240,14 @@ impl Resource for ResourceType {} impl ResponseResult for ResourceType {} -/// [Output Only] Metadata for this warning in key: value format. +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationWarningsData { - /// [Output Only] A key for the warning data. + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). pub key: Option, /// [Output Only] A warning data value corresponding to the key. pub value: Option, @@ -261,11 +263,12 @@ impl Part for OperationWarningsData {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct OperationWarnings { - /// [Output Only] Optional human-readable details for this warning. + /// [Output Only] A human-readable description of the warning code. pub message: Option, - /// [Output Only] The warning type identifier for this warning. + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. pub code: Option, - /// [Output Only] Metadata for this warning in key: value format. + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } pub data: Option>, } @@ -551,62 +554,64 @@ impl ResponseResult for OperationsListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Operation { - /// [Output Only] Status of the operation. Can be one of the following: PENDING, RUNNING, or DONE. + /// [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. pub status: Option, - /// [Output Only] The time that this operation was requested. This is in RFC3339 text format. - #[serde(rename="insertTime")] - pub insert_time: Option, + /// [Output Only] A textual description of the operation, which is set when the operation is created. + pub description: Option, /// [Output Only] If warning messages are generated during processing of the operation, this field will be populated. pub warnings: Option>, /// [Output Only] If errors are generated during processing of the operation, this field will be populated. pub error: Option, - /// [Output Only] Unique target ID which identifies a particular incarnation of the target. + /// [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. #[serde(rename="targetId")] pub target_id: Option, - /// [Output Only] URL of the resource the operation is mutating. - #[serde(rename="targetLink")] - pub target_link: Option, - /// [Output Only] The time that this operation was started by the server. This is in RFC3339 text format. + /// [Output Only] User who requested the operation, for example: user@example.com. + pub user: Option, + /// [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. #[serde(rename="startTime")] pub start_time: Option, - /// [Output Only] An optional identifier specified by the client when the mutation was initiated. Must be unique for all Operation resources in the project. + /// [Output Only] Reserved for future use. #[serde(rename="clientOperationId")] pub client_operation_id: Option, /// [Output Only] Creation timestamp in RFC3339 text format. #[serde(rename="creationTimestamp")] pub creation_timestamp: Option, - /// [Output Only] Unique identifier for the resource; defined by the server. + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. pub id: Option, - /// [Output Only] Type of the resource. Always compute#Operation for Operation resources. + /// [Output Only] Type of the resource. Always compute#operation for Operation resources. pub kind: Option, /// [Output Only] Name of the resource. pub name: Option, - /// [Output Only] URL of the zone where the operation resides. + /// [Output Only] The URL of the zone where the operation resides. Only available when performing per-zone operations. pub zone: Option, - /// [Output Only] URL of the region where the operation resides. Only applicable for regional resources. + /// [Output Only] The URL of the region where the operation resides. Only available when performing regional operations. pub region: Option, + /// [Output Only] The type of operation, such as insert, update, or delete, and so on. + #[serde(rename="operationType")] + pub operation_type: Option, /// [Output Only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, - /// [Output Only] Type of the operation, such as insert, update, and delete. - #[serde(rename="operationType")] - pub operation_type: Option, + /// [Output Only] The time that this operation was requested. This value is in RFC3339 text format. + #[serde(rename="insertTime")] + pub insert_time: Option, /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. #[serde(rename="httpErrorMessage")] pub http_error_message: Option, - /// [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess at when the operation will be complete. This number should monotonically increase as the operation progresses. + /// [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. pub progress: Option, - /// [Output Only] The time that this operation was completed. This is in RFC3339 text format. + /// [Output Only] The time that this operation was completed. This value is in RFC3339 text format. #[serde(rename="endTime")] pub end_time: Option, - /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as 404. + /// [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. #[serde(rename="httpErrorStatusCode")] pub http_error_status_code: Option, /// [Output Only] An optional textual description of the current status of the operation. #[serde(rename="statusMessage")] pub status_message: Option, - /// [Output Only] User who requested the operation, for example: user@example.com. - pub user: Option, + /// [Output Only] The URL of the resource that the operation modifies. + #[serde(rename="targetLink")] + pub target_link: Option, } impl Resource for Operation {} @@ -1199,7 +1204,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.operations.get", + dlg.begin(MethodInfo { id: "deploymentmanager.operations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1242,7 +1247,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1278,7 +1283,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1288,10 +1293,10 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1324,7 +1329,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -1334,7 +1339,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *operation* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operation(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -1352,12 +1357,12 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1374,17 +1379,17 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1452,7 +1457,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.operations.list", + dlg.begin(MethodInfo { id: "deploymentmanager.operations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1503,7 +1508,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1539,7 +1544,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1549,10 +1554,10 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1585,31 +1590,35 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> OperationListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> OperationListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// - /// For example, filter=name ne example-instance. + /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C, A> { @@ -1628,12 +1637,12 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1650,17 +1659,17 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1729,7 +1738,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.manifests.list", + dlg.begin(MethodInfo { id: "deploymentmanager.manifests.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1781,7 +1790,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1817,7 +1826,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1827,10 +1836,10 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1863,7 +1872,7 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1873,31 +1882,35 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { self._deployment = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> ManifestListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// - /// For example, filter=name ne example-instance. + /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ManifestListCall<'a, C, A> { @@ -1916,12 +1929,12 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1938,17 +1951,17 @@ impl<'a, C, A> ManifestListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManifestListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManifestListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2012,7 +2025,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.manifests.get", + dlg.begin(MethodInfo { id: "deploymentmanager.manifests.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2056,7 +2069,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2092,7 +2105,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2102,10 +2115,10 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2138,7 +2151,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ManifestGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -2148,7 +2161,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> ManifestGetCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -2158,7 +2171,7 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *manifest* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn manifest(mut self, new_value: &str) -> ManifestGetCall<'a, C, A> { self._manifest = new_value.to_string(); @@ -2176,12 +2189,12 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2198,17 +2211,17 @@ impl<'a, C, A> ManifestGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManifestGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManifestGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2272,7 +2285,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.resources.get", + dlg.begin(MethodInfo { id: "deploymentmanager.resources.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2316,7 +2329,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2352,7 +2365,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2362,10 +2375,10 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2398,7 +2411,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ResourceGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -2408,7 +2421,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> ResourceGetCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -2418,7 +2431,7 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ResourceGetCall<'a, C, A> { self._resource = new_value.to_string(); @@ -2436,12 +2449,12 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2458,17 +2471,17 @@ impl<'a, C, A> ResourceGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ResourceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ResourceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2537,7 +2550,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.resources.list", + dlg.begin(MethodInfo { id: "deploymentmanager.resources.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2589,7 +2602,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2625,7 +2638,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2635,10 +2648,10 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2671,7 +2684,7 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2681,31 +2694,35 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { self._deployment = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> ResourceListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// - /// For example, filter=name ne example-instance. + /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ResourceListCall<'a, C, A> { @@ -2724,12 +2741,12 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2746,17 +2763,17 @@ impl<'a, C, A> ResourceListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ResourceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ResourceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2824,7 +2841,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.types.list", + dlg.begin(MethodInfo { id: "deploymentmanager.types.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2875,7 +2892,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2911,7 +2928,7 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2921,10 +2938,10 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2957,31 +2974,35 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TypeListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> TypeListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> TypeListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// - /// For example, filter=name ne example-instance. + /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> TypeListCall<'a, C, A> { @@ -3000,12 +3021,12 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3022,17 +3043,17 @@ impl<'a, C, A> TypeListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TypeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3108,7 +3129,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.update", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3160,14 +3181,14 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3211,7 +3232,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3221,10 +3242,10 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3256,7 +3277,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Deployment) -> DeploymentUpdateCall<'a, C, A> { self._request = new_value; @@ -3266,7 +3287,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -3276,7 +3297,7 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -3315,12 +3336,12 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3337,17 +3358,17 @@ impl<'a, C, A> DeploymentUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3410,7 +3431,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.get", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3453,7 +3474,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3489,7 +3510,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3499,10 +3520,10 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3535,7 +3556,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -3545,7 +3566,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> DeploymentGetCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -3563,12 +3584,12 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3585,17 +3606,17 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3664,7 +3685,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.insert", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3706,14 +3727,14 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3757,7 +3778,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3767,10 +3788,10 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3802,7 +3823,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Deployment) -> DeploymentInsertCall<'a, C, A> { self._request = new_value; @@ -3812,7 +3833,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -3830,12 +3851,12 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3852,17 +3873,17 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3930,7 +3951,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.list", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3981,7 +4002,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4017,7 +4038,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4027,10 +4048,10 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4063,31 +4084,35 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { self._project = new_value.to_string(); self } - /// Specifies a page token to use. Use this parameter if you want to list the next page of results. Set pageToken to the nextPageToken returned by a previous list request. + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. /// /// Sets the *page token* query property to the given value. pub fn page_token(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { self._page_token = Some(new_value.to_string()); self } - /// Maximum count of results to be returned. + /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. /// /// Sets the *max results* query property to the given value. pub fn max_results(mut self, new_value: u32) -> DeploymentListCall<'a, C, A> { self._max_results = Some(new_value); self } - /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: FIELD_NAME COMPARISON_STRING LITERAL_STRING. + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. /// - /// The FIELD_NAME is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The COMPARISON_STRING must be either eq (equals) or ne (not equals). The LITERAL_STRING is the string value to filter to. The literal value must be valid for the type of field (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. /// - /// For example, filter=name ne example-instance. + /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { @@ -4106,12 +4131,12 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4128,17 +4153,17 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4214,7 +4239,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.patch", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4266,14 +4291,14 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4317,7 +4342,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4327,10 +4352,10 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4362,7 +4387,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Deployment) -> DeploymentPatchCall<'a, C, A> { self._request = new_value; @@ -4372,7 +4397,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentPatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -4382,7 +4407,7 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> DeploymentPatchCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -4421,12 +4446,12 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4443,17 +4468,17 @@ impl<'a, C, A> DeploymentPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4516,7 +4541,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "deploymentmanager.deployments.delete", + dlg.begin(MethodInfo { id: "deploymentmanager.deployments.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4559,7 +4584,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4595,7 +4620,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4605,10 +4630,10 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4641,7 +4666,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -4651,7 +4676,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *deployment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C, A> { self._deployment = new_value.to_string(); @@ -4669,12 +4694,12 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4691,17 +4716,17 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/dfareporting2d1-cli/Cargo.toml b/gen/dfareporting2d1-cli/Cargo.toml index d0735546da..5df5d2191b 100644 --- a/gen/dfareporting2d1-cli/Cargo.toml +++ b/gen/dfareporting2d1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d1-cli" -version = "0.3.2+20150717" +version = "0.3.3+20151109" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/dfareporting2d1-cli/LICENSE.md b/gen/dfareporting2d1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/dfareporting2d1-cli/LICENSE.md +++ b/gen/dfareporting2d1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/dfareporting2d1-cli/README.md b/gen/dfareporting2d1-cli/README.md index 49d2b15f3f..9d57696b3c 100644 --- a/gen/dfareporting2d1-cli/README.md +++ b/gen/dfareporting2d1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *dfareporting* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/dfareporting2d1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/dfareporting2d1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/dfareporting2d1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/dfareporting2d1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d1-cli). # Usage -This documentation was generated from the *dfareporting* API at revision *20150717*. The CLI is at version *0.3.2*. +This documentation was generated from the *dfareporting* API at revision *20151109*. The CLI is at version *0.3.3*. ```bash dfareporting2d1 [options] @@ -280,18 +280,18 @@ dfareporting2d1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/dfareporting2d1-cli/mkdocs.yml b/gen/dfareporting2d1-cli/mkdocs.yml index 7a5956e509..28e0803277 100644 --- a/gen/dfareporting2d1-cli/mkdocs.yml +++ b/gen/dfareporting2d1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v0.3.2+20150717 +site_name: dfareporting v0.3.3+20151109 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d1-cli site_description: Write integrating applications with bcore @@ -205,5 +205,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/dfareporting2d1-cli/src/main.rs b/gen/dfareporting2d1-cli/src/main.rs index ea4b749fb9..8141c70716 100644 --- a/gen/dfareporting2d1-cli/src/main.rs +++ b/gen/dfareporting2d1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Dfareporting>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _account_active_ad_summaries_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _account_active_ad_summaries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_active_ad_summaries().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("summary-account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_permission_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_permission_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_permission_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -149,10 +149,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_permission_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_permission_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_permission_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -165,7 +165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -178,7 +178,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -201,10 +201,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_permissions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_permissions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -217,7 +217,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -230,7 +230,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -253,10 +253,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_permissions().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -269,7 +269,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -282,7 +282,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -305,10 +305,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_user_profiles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_user_profiles().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -321,7 +321,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -334,7 +334,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -357,13 +357,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_user_profiles_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_user_profiles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -377,8 +377,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -416,7 +416,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); let mut call = self.hub.account_user_profiles().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -429,7 +429,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -442,7 +442,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -465,10 +465,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_user_profiles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_user_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_user_profiles().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-role-id" => { @@ -508,7 +508,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "subaccount-id", "sort-field", "ids", "max-results", "page-token", "user-role-id", "sort-order", "active"].iter().map(|v|*v)); @@ -522,7 +522,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -545,13 +545,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_user_profiles_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_user_profiles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -565,8 +565,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -604,7 +604,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); let mut call = self.hub.account_user_profiles().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -617,7 +617,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -630,7 +630,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -653,13 +653,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_user_profiles_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_user_profiles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -673,8 +673,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -712,7 +712,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); let mut call = self.hub.account_user_profiles().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -725,7 +725,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -738,7 +738,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -761,10 +761,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -777,7 +777,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -790,7 +790,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -813,10 +813,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -850,7 +850,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order", "active"].iter().map(|v|*v)); @@ -864,7 +864,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -887,13 +887,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -907,8 +907,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "teaser-size-limit" => Some(("teaserSizeLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -944,7 +944,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Account = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -957,7 +957,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -970,7 +970,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -993,13 +993,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1013,8 +1013,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "teaser-size-limit" => Some(("teaserSizeLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1050,7 +1050,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Account = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1063,7 +1063,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1076,7 +1076,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1099,10 +1099,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ads_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ads_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ads().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1115,7 +1115,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1128,7 +1128,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1151,13 +1151,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ads_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ads_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1171,8 +1171,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1250,7 +1250,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Ad = json::value::from_value(object).unwrap(); let mut call = self.hub.ads().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1263,7 +1263,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1276,7 +1276,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1299,10 +1299,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ads_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ads_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ads().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "type" => { @@ -1387,7 +1387,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["landing-page-ids", "overridden-event-tag-id", "campaign-ids", "archived", "creative-optimization-configuration-ids", "ssl-compliant", "size-ids", "page-token", "sort-order", "type", "ssl-required", "creative-ids", "max-results", "creative-type", "placement-ids", "active", "compatibility", "advertiser-id", "search-string", "sort-field", "audience-segment-ids", "ids", "remarketing-list-ids", "dynamic-click-tracker"].iter().map(|v|*v)); @@ -1401,7 +1401,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1424,13 +1424,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ads_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ads_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1444,8 +1444,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1523,7 +1523,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Ad = json::value::from_value(object).unwrap(); let mut call = self.hub.ads().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1536,7 +1536,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1549,7 +1549,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1572,13 +1572,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ads_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ads_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1592,8 +1592,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1671,7 +1671,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Ad = json::value::from_value(object).unwrap(); let mut call = self.hub.ads().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1684,7 +1684,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1697,7 +1697,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1720,10 +1720,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertiser_groups().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1736,7 +1736,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1749,7 +1749,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1764,10 +1764,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertiser_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1780,7 +1780,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1793,7 +1793,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1816,13 +1816,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1836,8 +1836,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1855,7 +1855,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.advertiser_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1868,7 +1868,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1881,7 +1881,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1904,10 +1904,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertiser_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -1938,7 +1938,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -1952,7 +1952,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1975,13 +1975,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1995,8 +1995,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2014,7 +2014,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.advertiser_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2027,7 +2027,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2040,7 +2040,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2063,13 +2063,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2083,8 +2083,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2102,7 +2102,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.advertiser_groups().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2115,7 +2115,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2128,7 +2128,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2151,10 +2151,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertisers().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2167,7 +2167,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2180,7 +2180,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2203,13 +2203,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2223,8 +2223,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2262,7 +2262,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Advertiser = json::value::from_value(object).unwrap(); let mut call = self.hub.advertisers().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2275,7 +2275,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2288,7 +2288,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2311,10 +2311,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertisers().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "subaccount-id" => { @@ -2363,7 +2363,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "search-string", "subaccount-id", "include-advertisers-without-groups-only", "sort-field", "ids", "max-results", "page-token", "only-parent", "sort-order", "floodlight-configuration-ids", "advertiser-group-ids"].iter().map(|v|*v)); @@ -2377,7 +2377,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2400,13 +2400,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2420,8 +2420,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2459,7 +2459,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Advertiser = json::value::from_value(object).unwrap(); let mut call = self.hub.advertisers().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2472,7 +2472,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2485,7 +2485,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2508,13 +2508,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2528,8 +2528,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2567,7 +2567,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Advertiser = json::value::from_value(object).unwrap(); let mut call = self.hub.advertisers().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2580,7 +2580,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2593,7 +2593,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2616,10 +2616,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _browsers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _browsers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.browsers().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2632,7 +2632,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2645,7 +2645,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2668,13 +2668,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaign_creative_associations_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaign_creative_associations_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2688,8 +2688,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "creative-id" => Some(("creativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2705,7 +2705,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CampaignCreativeAssociation = json::value::from_value(object).unwrap(); let mut call = self.hub.campaign_creative_associations().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2718,7 +2718,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2731,7 +2731,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2754,10 +2754,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaign_creative_associations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaign_creative_associations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.campaign_creative_associations().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -2779,7 +2779,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "sort-order", "max-results"].iter().map(|v|*v)); @@ -2793,7 +2793,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2816,10 +2816,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaigns_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaigns_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.campaigns().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2832,7 +2832,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2845,7 +2845,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2868,13 +2868,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaigns_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaigns_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2888,8 +2888,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2943,7 +2943,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Campaign = json::value::from_value(object).unwrap(); let mut call = self.hub.campaigns().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("default-landing-page-name").unwrap_or(""), opt.value_of("default-landing-page-url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2956,7 +2956,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2969,7 +2969,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2992,10 +2992,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaigns_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaigns_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.campaigns().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "subaccount-id" => { @@ -3047,7 +3047,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["archived", "search-string", "subaccount-id", "sort-field", "advertiser-ids", "ids", "max-results", "excluded-ids", "page-token", "advertiser-group-ids", "sort-order", "overridden-event-tag-id", "at-least-one-optimization-activity"].iter().map(|v|*v)); @@ -3061,7 +3061,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3084,13 +3084,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaigns_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaigns_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3104,8 +3104,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3159,7 +3159,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Campaign = json::value::from_value(object).unwrap(); let mut call = self.hub.campaigns().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3172,7 +3172,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3185,7 +3185,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3208,13 +3208,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaigns_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaigns_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3228,8 +3228,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3283,7 +3283,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Campaign = json::value::from_value(object).unwrap(); let mut call = self.hub.campaigns().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3296,7 +3296,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3309,7 +3309,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3332,10 +3332,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _change_logs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _change_logs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.change_logs().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3348,7 +3348,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3361,7 +3361,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3384,10 +3384,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _change_logs_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _change_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.change_logs().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-profile-ids" => { @@ -3430,7 +3430,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["min-change-time", "search-string", "max-change-time", "user-profile-ids", "ids", "max-results", "object-ids", "page-token", "action", "object-type"].iter().map(|v|*v)); @@ -3444,7 +3444,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3467,10 +3467,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _cities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _cities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.cities().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "region-dart-ids" => { @@ -3495,7 +3495,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dart-ids", "country-dart-ids", "region-dart-ids", "name-prefix"].iter().map(|v|*v)); @@ -3509,7 +3509,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3532,10 +3532,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _connection_types_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _connection_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.connection_types().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3548,7 +3548,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3561,7 +3561,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3584,10 +3584,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _connection_types_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _connection_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.connection_types().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3600,7 +3600,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3613,7 +3613,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3636,10 +3636,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.content_categories().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3652,7 +3652,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3665,7 +3665,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3680,10 +3680,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.content_categories().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3696,7 +3696,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3709,7 +3709,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3732,13 +3732,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3752,8 +3752,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3771,7 +3771,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); let mut call = self.hub.content_categories().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3784,7 +3784,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3797,7 +3797,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3820,10 +3820,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.content_categories().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -3854,7 +3854,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -3868,7 +3868,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3891,13 +3891,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3911,8 +3911,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3930,7 +3930,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); let mut call = self.hub.content_categories().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3943,7 +3943,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3956,7 +3956,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3979,13 +3979,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3999,8 +3999,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4018,7 +4018,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); let mut call = self.hub.content_categories().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4031,7 +4031,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4044,7 +4044,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4067,10 +4067,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _countries_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _countries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.countries().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("dart-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4083,7 +4083,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4096,7 +4096,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4119,10 +4119,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _countries_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _countries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.countries().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4135,7 +4135,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4148,7 +4148,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4171,13 +4171,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_assets_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_assets_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4191,8 +4191,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "warned-validation-rules" => Some(("warnedValidationRules", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "detected-features" => Some(("detectedFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -4211,7 +4211,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeAssetMetadata = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_assets().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4224,7 +4224,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4232,7 +4232,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -4240,7 +4240,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4264,10 +4264,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_field_values().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4280,7 +4280,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4293,7 +4293,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4308,10 +4308,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_field_values().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4324,7 +4324,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4337,7 +4337,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4360,13 +4360,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4380,8 +4380,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4398,7 +4398,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_field_values().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4411,7 +4411,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4424,7 +4424,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4447,10 +4447,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_field_values().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -4481,7 +4481,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -4495,7 +4495,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4518,13 +4518,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4538,8 +4538,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4556,7 +4556,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_field_values().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4569,7 +4569,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4582,7 +4582,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4605,13 +4605,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4625,8 +4625,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4643,7 +4643,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_field_values().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4656,7 +4656,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4669,7 +4669,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4692,10 +4692,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_fields().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4708,7 +4708,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4721,7 +4721,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4736,10 +4736,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_fields().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4752,7 +4752,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4765,7 +4765,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4788,13 +4788,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4808,8 +4808,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4835,7 +4835,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeField = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_fields().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4848,7 +4848,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4861,7 +4861,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4884,10 +4884,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_fields().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -4921,7 +4921,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -4935,7 +4935,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4958,13 +4958,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4978,8 +4978,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5005,7 +5005,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeField = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_fields().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5018,7 +5018,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5031,7 +5031,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5054,13 +5054,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5074,8 +5074,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5101,7 +5101,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeField = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_fields().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5114,7 +5114,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5127,7 +5127,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5150,10 +5150,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5166,7 +5166,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5179,7 +5179,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5202,13 +5202,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5222,8 +5222,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5250,7 +5250,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5263,7 +5263,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5276,7 +5276,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5299,10 +5299,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -5339,7 +5339,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "group-number", "page-token", "sort-order"].iter().map(|v|*v)); @@ -5353,7 +5353,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5376,13 +5376,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_groups_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5396,8 +5396,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5424,7 +5424,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5437,7 +5437,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5450,7 +5450,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5473,13 +5473,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5493,8 +5493,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5521,7 +5521,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_groups().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5534,7 +5534,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5547,7 +5547,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5570,10 +5570,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creatives().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5586,7 +5586,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5599,7 +5599,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5622,13 +5622,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5642,8 +5642,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5725,7 +5725,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Creative = json::value::from_value(object).unwrap(); let mut call = self.hub.creatives().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5738,7 +5738,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5751,7 +5751,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5774,10 +5774,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creatives().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "types" => { @@ -5838,7 +5838,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["advertiser-id", "archived", "search-string", "max-results", "campaign-id", "sort-field", "rendering-ids", "ids", "studio-creative-id", "size-ids", "page-token", "sort-order", "companion-creative-ids", "active", "creative-field-ids", "types"].iter().map(|v|*v)); @@ -5852,7 +5852,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5875,13 +5875,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5895,8 +5895,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5978,7 +5978,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Creative = json::value::from_value(object).unwrap(); let mut call = self.hub.creatives().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5991,7 +5991,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6004,7 +6004,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6027,13 +6027,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6047,8 +6047,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6130,7 +6130,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Creative = json::value::from_value(object).unwrap(); let mut call = self.hub.creatives().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6143,7 +6143,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6156,7 +6156,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6179,13 +6179,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _dimension_values_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _dimension_values_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6199,8 +6199,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "dimension-name" => Some(("dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6218,7 +6218,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DimensionValueRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.dimension_values().query(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -6237,7 +6237,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -6251,7 +6251,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6274,10 +6274,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _directory_site_contacts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _directory_site_contacts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.directory_site_contacts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6290,7 +6290,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6303,7 +6303,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6326,10 +6326,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _directory_site_contacts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _directory_site_contacts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.directory_site_contacts().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -6363,7 +6363,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "directory-site-ids", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -6377,7 +6377,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6400,10 +6400,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _directory_sites_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _directory_sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.directory_sites().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6416,7 +6416,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6429,7 +6429,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6452,13 +6452,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _directory_sites_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _directory_sites_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6472,8 +6472,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "country-id" => Some(("countryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6515,7 +6515,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DirectorySite = json::value::from_value(object).unwrap(); let mut call = self.hub.directory_sites().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6528,7 +6528,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6541,7 +6541,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6564,10 +6564,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _directory_sites_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _directory_sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.directory_sites().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -6619,7 +6619,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["accepts-interstitial-placements", "accepts-publisher-paid-placements", "search-string", "country-id", "accepts-in-stream-video-placements", "sort-field", "ids", "max-results", "page-token", "sort-order", "parent-id", "active", "dfp-network-code"].iter().map(|v|*v)); @@ -6633,7 +6633,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6656,10 +6656,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.event_tags().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6672,7 +6672,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6685,7 +6685,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -6700,10 +6700,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.event_tags().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6716,7 +6716,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6729,7 +6729,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6752,13 +6752,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6772,8 +6772,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -6814,7 +6814,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EventTag = json::value::from_value(object).unwrap(); let mut call = self.hub.event_tags().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6827,7 +6827,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6840,7 +6840,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6863,10 +6863,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.event_tags().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -6909,7 +6909,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "campaign-id", "sort-field", "enabled", "ids", "advertiser-id", "ad-id", "sort-order", "event-tag-types", "definitions-only"].iter().map(|v|*v)); @@ -6923,7 +6923,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6946,13 +6946,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6966,8 +6966,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -7008,7 +7008,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EventTag = json::value::from_value(object).unwrap(); let mut call = self.hub.event_tags().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7021,7 +7021,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7034,7 +7034,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7057,13 +7057,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7077,8 +7077,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -7119,7 +7119,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EventTag = json::value::from_value(object).unwrap(); let mut call = self.hub.event_tags().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7132,7 +7132,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7145,7 +7145,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7168,11 +7168,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.files().get(opt.value_of("report-id").unwrap_or(""), opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7188,7 +7188,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7201,7 +7201,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7229,10 +7229,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.files().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -7260,7 +7260,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort-field", "max-results", "sort-order", "page-token", "scope"].iter().map(|v|*v)); @@ -7274,7 +7274,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7297,10 +7297,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activities().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7313,7 +7313,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7326,7 +7326,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -7341,10 +7341,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_generatetag(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_generatetag(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activities().generatetag(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "floodlight-activity-id" => { @@ -7360,7 +7360,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["floodlight-activity-id"].iter().map(|v|*v)); @@ -7374,7 +7374,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7397,10 +7397,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activities().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7413,7 +7413,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7426,7 +7426,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7449,13 +7449,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7469,8 +7469,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -7525,7 +7525,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activities().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7538,7 +7538,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7551,7 +7551,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7574,10 +7574,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activities().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tag-string" => { @@ -7629,7 +7629,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["floodlight-activity-group-ids", "search-string", "floodlight-activity-group-name", "sort-field", "floodlight-configuration-id", "ids", "max-results", "advertiser-id", "page-token", "sort-order", "tag-string", "floodlight-activity-group-tag-string", "floodlight-activity-group-type"].iter().map(|v|*v)); @@ -7643,7 +7643,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7666,13 +7666,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7686,8 +7686,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -7742,7 +7742,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activities().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7755,7 +7755,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7768,7 +7768,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7791,13 +7791,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7811,8 +7811,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -7867,7 +7867,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activities().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7880,7 +7880,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7893,7 +7893,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7916,10 +7916,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activity_groups().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7932,7 +7932,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7945,7 +7945,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -7960,10 +7960,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activity_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7976,7 +7976,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7989,7 +7989,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8012,13 +8012,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8032,8 +8032,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8074,7 +8074,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activity_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8087,7 +8087,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8100,7 +8100,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8123,10 +8123,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activity_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "type" => { @@ -8166,7 +8166,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "floodlight-configuration-id", "ids", "max-results", "advertiser-id", "page-token", "sort-order", "type"].iter().map(|v|*v)); @@ -8180,7 +8180,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8203,13 +8203,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8223,8 +8223,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8265,7 +8265,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activity_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8278,7 +8278,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8291,7 +8291,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8314,13 +8314,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8334,8 +8334,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8376,7 +8376,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activity_groups().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8389,7 +8389,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8402,7 +8402,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8425,10 +8425,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_configurations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_configurations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_configurations().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8441,7 +8441,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8454,7 +8454,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8477,10 +8477,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_configurations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_configurations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_configurations().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "ids" => { @@ -8496,7 +8496,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ids"].iter().map(|v|*v)); @@ -8510,7 +8510,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8533,13 +8533,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_configurations_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_configurations_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8553,8 +8553,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "natural-search-conversion-attribution-option" => Some(("naturalSearchConversionAttributionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8597,7 +8597,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightConfiguration = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_configurations().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8610,7 +8610,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8623,7 +8623,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8646,13 +8646,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_configurations_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_configurations_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8666,8 +8666,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "natural-search-conversion-attribution-option" => Some(("naturalSearchConversionAttributionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8710,7 +8710,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightConfiguration = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_configurations().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8723,7 +8723,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8736,7 +8736,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8759,10 +8759,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inventory_items_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inventory_items_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.inventory_items().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8775,7 +8775,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8788,7 +8788,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8811,10 +8811,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inventory_items_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inventory_items_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.inventory_items().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -8851,7 +8851,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-id", "sort-field", "ids", "max-results", "page-token", "in-plan", "site-id", "sort-order"].iter().map(|v|*v)); @@ -8865,7 +8865,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8888,10 +8888,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.landing_pages().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8904,7 +8904,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8917,7 +8917,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -8932,10 +8932,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.landing_pages().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8948,7 +8948,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8961,7 +8961,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8984,13 +8984,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -9004,8 +9004,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -9024,7 +9024,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LandingPage = json::value::from_value(object).unwrap(); let mut call = self.hub.landing_pages().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9037,7 +9037,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9050,7 +9050,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9073,10 +9073,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.landing_pages().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9089,7 +9089,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9102,7 +9102,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9125,13 +9125,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -9145,8 +9145,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -9165,7 +9165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LandingPage = json::value::from_value(object).unwrap(); let mut call = self.hub.landing_pages().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9178,7 +9178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9191,7 +9191,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9214,13 +9214,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -9234,8 +9234,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -9254,7 +9254,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LandingPage = json::value::from_value(object).unwrap(); let mut call = self.hub.landing_pages().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9267,7 +9267,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9280,7 +9280,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9303,10 +9303,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _metros_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _metros_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.metros().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9319,7 +9319,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9332,7 +9332,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9355,10 +9355,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mobile_carriers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mobile_carriers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mobile_carriers().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9371,7 +9371,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9384,7 +9384,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9407,10 +9407,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mobile_carriers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mobile_carriers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mobile_carriers().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9423,7 +9423,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9436,7 +9436,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9459,10 +9459,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operating_system_versions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operating_system_versions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operating_system_versions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9475,7 +9475,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9488,7 +9488,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9511,10 +9511,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operating_system_versions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operating_system_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operating_system_versions().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9527,7 +9527,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9540,7 +9540,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9563,10 +9563,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operating_systems_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operating_systems_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operating_systems().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("dart-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9579,7 +9579,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9592,7 +9592,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9615,10 +9615,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operating_systems_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operating_systems_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operating_systems().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9631,7 +9631,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9644,7 +9644,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9667,10 +9667,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _order_documents_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _order_documents_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.order_documents().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9683,7 +9683,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9696,7 +9696,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9719,10 +9719,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _order_documents_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _order_documents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.order_documents().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -9762,7 +9762,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-id", "search-string", "sort-field", "ids", "max-results", "page-token", "site-id", "sort-order", "approved"].iter().map(|v|*v)); @@ -9776,7 +9776,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9799,10 +9799,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9815,7 +9815,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9828,7 +9828,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9851,10 +9851,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -9888,7 +9888,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "site-id", "sort-order"].iter().map(|v|*v)); @@ -9902,7 +9902,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9925,10 +9925,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placement_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9941,7 +9941,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9954,7 +9954,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9977,13 +9977,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -9997,8 +9997,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10081,7 +10081,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10094,7 +10094,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10107,7 +10107,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10130,10 +10130,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placement_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -10191,7 +10191,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["placement-strategy-ids", "site-ids", "search-string", "content-category-ids", "directory-site-ids", "sort-field", "advertiser-ids", "archived", "ids", "max-results", "page-token", "sort-order", "placement-group-type", "pricing-types", "campaign-ids"].iter().map(|v|*v)); @@ -10205,7 +10205,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10228,13 +10228,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_groups_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10248,8 +10248,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10332,7 +10332,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10345,7 +10345,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10358,7 +10358,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10381,13 +10381,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10401,8 +10401,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10485,7 +10485,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_groups().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10498,7 +10498,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10511,7 +10511,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10534,10 +10534,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placement_strategies().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10550,7 +10550,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10563,7 +10563,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -10578,10 +10578,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placement_strategies().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10594,7 +10594,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10607,7 +10607,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10630,13 +10630,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10650,8 +10650,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10669,7 +10669,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_strategies().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10682,7 +10682,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10695,7 +10695,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10718,10 +10718,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placement_strategies().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -10752,7 +10752,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -10766,7 +10766,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10789,13 +10789,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10809,8 +10809,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10828,7 +10828,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_strategies().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10841,7 +10841,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10854,7 +10854,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10877,13 +10877,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10897,8 +10897,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10916,7 +10916,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_strategies().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10929,7 +10929,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10942,7 +10942,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10965,10 +10965,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_generatetags(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_generatetags(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placements().generatetags(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tag-formats" => { @@ -10990,7 +10990,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["tag-formats", "placement-ids", "campaign-id"].iter().map(|v|*v)); @@ -11004,7 +11004,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11027,10 +11027,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placements().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11043,7 +11043,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11056,7 +11056,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11079,13 +11079,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11099,8 +11099,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -11195,7 +11195,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Placement = json::value::from_value(object).unwrap(); let mut call = self.hub.placements().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11208,7 +11208,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11221,7 +11221,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11244,10 +11244,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placements().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -11314,7 +11314,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["placement-strategy-ids", "site-ids", "search-string", "content-category-ids", "directory-site-ids", "sort-field", "advertiser-ids", "archived", "payment-source", "ids", "max-results", "size-ids", "page-token", "compatibilities", "sort-order", "pricing-types", "campaign-ids", "group-ids"].iter().map(|v|*v)); @@ -11328,7 +11328,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11351,13 +11351,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11371,8 +11371,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -11467,7 +11467,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Placement = json::value::from_value(object).unwrap(); let mut call = self.hub.placements().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11480,7 +11480,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11493,7 +11493,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11516,13 +11516,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11536,8 +11536,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -11632,7 +11632,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Placement = json::value::from_value(object).unwrap(); let mut call = self.hub.placements().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11645,7 +11645,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11658,7 +11658,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11681,10 +11681,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _platform_types_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _platform_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.platform_types().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11697,7 +11697,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11710,7 +11710,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11733,10 +11733,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _platform_types_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _platform_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.platform_types().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11749,7 +11749,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11762,7 +11762,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11785,10 +11785,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _postal_codes_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _postal_codes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.postal_codes().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("code").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11801,7 +11801,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11814,7 +11814,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11837,10 +11837,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _postal_codes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _postal_codes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.postal_codes().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11853,7 +11853,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11866,7 +11866,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11889,10 +11889,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11905,7 +11905,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11918,7 +11918,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11941,10 +11941,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -11978,7 +11978,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -11992,7 +11992,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12015,10 +12015,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _regions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _regions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.regions().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12031,7 +12031,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12044,7 +12044,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12067,10 +12067,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_list_shares_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_list_shares_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.remarketing_list_shares().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("remarketing-list-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12083,7 +12083,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12096,7 +12096,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12119,13 +12119,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_list_shares_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_list_shares_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12139,8 +12139,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "shared-advertiser-ids" => Some(("sharedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12158,7 +12158,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RemarketingListShare = json::value::from_value(object).unwrap(); let mut call = self.hub.remarketing_list_shares().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("remarketing-list-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12171,7 +12171,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12184,7 +12184,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12207,13 +12207,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_list_shares_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_list_shares_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12227,8 +12227,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "shared-advertiser-ids" => Some(("sharedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12246,7 +12246,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RemarketingListShare = json::value::from_value(object).unwrap(); let mut call = self.hub.remarketing_list_shares().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12259,7 +12259,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12272,7 +12272,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12295,10 +12295,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_lists_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_lists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.remarketing_lists().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12311,7 +12311,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12324,7 +12324,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12347,13 +12347,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_lists_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_lists_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12367,8 +12367,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12401,7 +12401,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); let mut call = self.hub.remarketing_lists().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12414,7 +12414,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12427,7 +12427,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12450,10 +12450,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_lists_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_lists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.remarketing_lists().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -12487,7 +12487,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["name", "sort-field", "max-results", "page-token", "sort-order", "active", "floodlight-activity-id"].iter().map(|v|*v)); @@ -12501,7 +12501,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12524,13 +12524,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_lists_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_lists_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12544,8 +12544,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12578,7 +12578,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); let mut call = self.hub.remarketing_lists().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12591,7 +12591,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12604,7 +12604,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12627,13 +12627,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_lists_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_lists_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12647,8 +12647,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12681,7 +12681,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); let mut call = self.hub.remarketing_lists().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12694,7 +12694,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12707,7 +12707,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12730,13 +12730,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_compatible_fields_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_compatible_fields_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12750,8 +12750,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -12846,7 +12846,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Report = json::value::from_value(object).unwrap(); let mut call = self.hub.reports().compatible_fields_query(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12859,7 +12859,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12872,7 +12872,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12895,10 +12895,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12911,7 +12911,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12924,7 +12924,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -12939,11 +12939,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_files_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.reports().files_get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or(""), opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12959,7 +12959,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12972,7 +12972,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13000,10 +13000,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_files_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().files_list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -13028,7 +13028,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort-field", "sort-order", "max-results", "page-token"].iter().map(|v|*v)); @@ -13042,7 +13042,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13065,10 +13065,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13081,7 +13081,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13094,7 +13094,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13117,13 +13117,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -13137,8 +13137,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -13233,7 +13233,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Report = json::value::from_value(object).unwrap(); let mut call = self.hub.reports().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13246,7 +13246,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13259,7 +13259,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13282,10 +13282,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -13313,7 +13313,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort-field", "max-results", "sort-order", "page-token", "scope"].iter().map(|v|*v)); @@ -13327,7 +13327,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13350,13 +13350,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -13370,8 +13370,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -13466,7 +13466,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Report = json::value::from_value(object).unwrap(); let mut call = self.hub.reports().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13479,7 +13479,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13492,7 +13492,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13515,10 +13515,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_run(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_run(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().run(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "synchronous" => { @@ -13534,7 +13534,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["synchronous"].iter().map(|v|*v)); @@ -13548,7 +13548,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13571,13 +13571,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -13591,8 +13591,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -13687,7 +13687,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Report = json::value::from_value(object).unwrap(); let mut call = self.hub.reports().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13700,7 +13700,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13713,7 +13713,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13736,10 +13736,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sites().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13752,7 +13752,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13765,7 +13765,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13788,13 +13788,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -13808,8 +13808,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -13854,7 +13854,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Site = json::value::from_value(object).unwrap(); let mut call = self.hub.sites().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13867,7 +13867,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13880,7 +13880,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13903,10 +13903,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sites().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "unmapped-site" => { @@ -13964,7 +13964,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["accepts-interstitial-placements", "accepts-publisher-paid-placements", "search-string", "subaccount-id", "directory-site-ids", "sort-field", "ids", "max-results", "page-token", "unmapped-site", "accepts-in-stream-video-placements", "ad-words-site", "campaign-ids", "approved", "sort-order"].iter().map(|v|*v)); @@ -13978,7 +13978,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14001,13 +14001,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14021,8 +14021,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -14067,7 +14067,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Site = json::value::from_value(object).unwrap(); let mut call = self.hub.sites().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14080,7 +14080,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14093,7 +14093,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14116,13 +14116,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14136,8 +14136,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -14182,7 +14182,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Site = json::value::from_value(object).unwrap(); let mut call = self.hub.sites().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14195,7 +14195,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14208,7 +14208,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14231,10 +14231,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sizes_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sizes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sizes().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14247,7 +14247,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14260,7 +14260,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14283,13 +14283,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sizes_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sizes_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14303,8 +14303,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "width" => Some(("width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -14323,7 +14323,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Size = json::value::from_value(object).unwrap(); let mut call = self.hub.sizes().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14336,7 +14336,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14349,7 +14349,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14372,10 +14372,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sizes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sizes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sizes().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "width" => { @@ -14400,7 +14400,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["iab-standard", "width", "ids", "height"].iter().map(|v|*v)); @@ -14414,7 +14414,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14437,10 +14437,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subaccounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subaccounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subaccounts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14453,7 +14453,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14466,7 +14466,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14489,13 +14489,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subaccounts_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subaccounts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14509,8 +14509,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -14529,7 +14529,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subaccount = json::value::from_value(object).unwrap(); let mut call = self.hub.subaccounts().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14542,7 +14542,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14555,7 +14555,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14578,10 +14578,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subaccounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subaccounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subaccounts().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -14612,7 +14612,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -14626,7 +14626,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14649,13 +14649,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subaccounts_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subaccounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14669,8 +14669,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -14689,7 +14689,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subaccount = json::value::from_value(object).unwrap(); let mut call = self.hub.subaccounts().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14702,7 +14702,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14715,7 +14715,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14738,13 +14738,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subaccounts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subaccounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14758,8 +14758,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -14778,7 +14778,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subaccount = json::value::from_value(object).unwrap(); let mut call = self.hub.subaccounts().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14791,7 +14791,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14804,7 +14804,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14827,10 +14827,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _targetable_remarketing_lists_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _targetable_remarketing_lists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.targetable_remarketing_lists().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14843,7 +14843,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14856,7 +14856,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14879,10 +14879,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _targetable_remarketing_lists_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _targetable_remarketing_lists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.targetable_remarketing_lists().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -14913,7 +14913,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["name", "sort-field", "max-results", "page-token", "sort-order", "active"].iter().map(|v|*v)); @@ -14927,7 +14927,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14950,10 +14950,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_profiles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_profiles().get(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14966,7 +14966,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14979,7 +14979,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15002,10 +15002,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_profiles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_profiles().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15018,7 +15018,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15031,7 +15031,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15054,10 +15054,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_role_permission_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_role_permission_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_role_permission_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15070,7 +15070,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15083,7 +15083,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15106,10 +15106,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_role_permission_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_role_permission_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_role_permission_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15122,7 +15122,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15135,7 +15135,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15158,10 +15158,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_role_permissions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_role_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_role_permissions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15174,7 +15174,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15187,7 +15187,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15210,10 +15210,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_role_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_role_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_role_permissions().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "ids" => { @@ -15229,7 +15229,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ids"].iter().map(|v|*v)); @@ -15243,7 +15243,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15266,10 +15266,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_roles().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15282,7 +15282,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15295,7 +15295,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -15310,10 +15310,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_roles().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15326,7 +15326,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15339,7 +15339,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15362,13 +15362,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -15382,8 +15382,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -15404,7 +15404,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserRole = json::value::from_value(object).unwrap(); let mut call = self.hub.user_roles().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15417,7 +15417,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15430,7 +15430,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15453,10 +15453,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_roles().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "subaccount-id" => { @@ -15493,7 +15493,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "subaccount-id", "sort-field", "ids", "max-results", "page-token", "sort-order", "account-user-role-only"].iter().map(|v|*v)); @@ -15507,7 +15507,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15530,13 +15530,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -15550,8 +15550,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -15572,7 +15572,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserRole = json::value::from_value(object).unwrap(); let mut call = self.hub.user_roles().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15585,7 +15585,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15598,7 +15598,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15621,13 +15621,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -15641,8 +15641,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -15663,7 +15663,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserRole = json::value::from_value(object).unwrap(); let mut call = self.hub.user_roles().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15676,7 +15676,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15689,7 +15689,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -16753,14 +16753,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "dfareporting2d1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "dfareporting2d1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -16780,7 +16780,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -16820,7 +16820,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("account-active-ad-summaries", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Gets the account's active ad summary by account ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/account-active-ad-summaries_get", vec![ @@ -16851,7 +16851,7 @@ fn main() { ]), ("account-permission-groups", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one account permission group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/account-permission-groups_get", vec![ @@ -16879,7 +16879,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of account permission groups."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/account-permission-groups_list", vec![ @@ -16904,7 +16904,7 @@ fn main() { ]), ("account-permissions", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one account permission by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/account-permissions_get", vec![ @@ -16932,7 +16932,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of account permissions."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/account-permissions_list", vec![ @@ -16957,7 +16957,7 @@ fn main() { ]), ("account-user-profiles", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one account user profile by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/account-user-profiles_get", vec![ @@ -16985,7 +16985,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new account user profile."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/account-user-profiles_insert", vec![ @@ -17013,7 +17013,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of account user profiles, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/account-user-profiles_list", vec![ @@ -17035,7 +17035,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing account user profile. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/account-user-profiles_patch", vec![ @@ -17069,7 +17069,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing account user profile."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/account-user-profiles_update", vec![ @@ -17100,7 +17100,7 @@ fn main() { ]), ("accounts", "methods: 'get', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one account by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/accounts_get", vec![ @@ -17128,7 +17128,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of accounts, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/accounts_list", vec![ @@ -17150,7 +17150,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/accounts_patch", vec![ @@ -17184,7 +17184,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing account."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/accounts_update", vec![ @@ -17215,7 +17215,7 @@ fn main() { ]), ("ads", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one ad by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/ads_get", vec![ @@ -17243,7 +17243,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new ad."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/ads_insert", vec![ @@ -17271,7 +17271,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of ads, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/ads_list", vec![ @@ -17293,7 +17293,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing ad. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/ads_patch", vec![ @@ -17327,7 +17327,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing ad."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/ads_update", vec![ @@ -17358,7 +17358,7 @@ fn main() { ]), ("advertiser-groups", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing advertiser group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertiser-groups_delete", vec![ @@ -17380,7 +17380,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one advertiser group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertiser-groups_get", vec![ @@ -17408,7 +17408,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new advertiser group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertiser-groups_insert", vec![ @@ -17436,7 +17436,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of advertiser groups, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertiser-groups_list", vec![ @@ -17458,7 +17458,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing advertiser group. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertiser-groups_patch", vec![ @@ -17492,7 +17492,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing advertiser group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertiser-groups_update", vec![ @@ -17523,7 +17523,7 @@ fn main() { ]), ("advertisers", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one advertiser by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertisers_get", vec![ @@ -17551,7 +17551,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new advertiser."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertisers_insert", vec![ @@ -17579,7 +17579,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of advertisers, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertisers_list", vec![ @@ -17601,7 +17601,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing advertiser. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertisers_patch", vec![ @@ -17635,7 +17635,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing advertiser."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/advertisers_update", vec![ @@ -17666,7 +17666,7 @@ fn main() { ]), ("browsers", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of browsers."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/browsers_list", vec![ @@ -17691,7 +17691,7 @@ fn main() { ]), ("campaign-creative-associations", "methods: 'insert' and 'list'", vec![ - ("insert", + ("insert", Some(r##"Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/campaign-creative-associations_insert", vec![ @@ -17725,7 +17725,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of creative IDs associated with the specified campaign."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/campaign-creative-associations_list", vec![ @@ -17756,7 +17756,7 @@ fn main() { ]), ("campaigns", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one campaign by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/campaigns_get", vec![ @@ -17784,7 +17784,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new campaign."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/campaigns_insert", vec![ @@ -17824,7 +17824,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of campaigns, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/campaigns_list", vec![ @@ -17846,7 +17846,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing campaign. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/campaigns_patch", vec![ @@ -17880,7 +17880,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing campaign."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/campaigns_update", vec![ @@ -17911,7 +17911,7 @@ fn main() { ]), ("change-logs", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one change log by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/change-logs_get", vec![ @@ -17939,7 +17939,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of change logs."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/change-logs_list", vec![ @@ -17964,7 +17964,7 @@ fn main() { ]), ("cities", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of cities, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/cities_list", vec![ @@ -17989,7 +17989,7 @@ fn main() { ]), ("connection-types", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one connection type by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/connection-types_get", vec![ @@ -18017,7 +18017,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of connection types."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/connection-types_list", vec![ @@ -18042,7 +18042,7 @@ fn main() { ]), ("content-categories", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing content category."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/content-categories_delete", vec![ @@ -18064,7 +18064,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one content category by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/content-categories_get", vec![ @@ -18092,7 +18092,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new content category."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/content-categories_insert", vec![ @@ -18120,7 +18120,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of content categories, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/content-categories_list", vec![ @@ -18142,7 +18142,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing content category. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/content-categories_patch", vec![ @@ -18176,7 +18176,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing content category."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/content-categories_update", vec![ @@ -18207,7 +18207,7 @@ fn main() { ]), ("countries", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one country by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/countries_get", vec![ @@ -18235,7 +18235,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of countries."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/countries_list", vec![ @@ -18260,7 +18260,7 @@ fn main() { ]), ("creative-assets", "methods: 'insert'", vec![ - ("insert", + ("insert", Some(r##"Inserts a new creative asset."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-assets_insert", vec![ @@ -18303,7 +18303,7 @@ fn main() { ]), ("creative-field-values", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing creative field value."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-field-values_delete", vec![ @@ -18331,7 +18331,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one creative field value by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-field-values_get", vec![ @@ -18365,7 +18365,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new creative field value."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-field-values_insert", vec![ @@ -18399,7 +18399,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of creative field values, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-field-values_list", vec![ @@ -18427,7 +18427,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing creative field value. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-field-values_patch", vec![ @@ -18467,7 +18467,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing creative field value."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-field-values_update", vec![ @@ -18504,7 +18504,7 @@ fn main() { ]), ("creative-fields", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing creative field."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-fields_delete", vec![ @@ -18526,7 +18526,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one creative field by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-fields_get", vec![ @@ -18554,7 +18554,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new creative field."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-fields_insert", vec![ @@ -18582,7 +18582,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of creative fields, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-fields_list", vec![ @@ -18604,7 +18604,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing creative field. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-fields_patch", vec![ @@ -18638,7 +18638,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing creative field."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-fields_update", vec![ @@ -18669,7 +18669,7 @@ fn main() { ]), ("creative-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one creative group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-groups_get", vec![ @@ -18697,7 +18697,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new creative group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-groups_insert", vec![ @@ -18725,7 +18725,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of creative groups, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-groups_list", vec![ @@ -18747,7 +18747,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing creative group. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-groups_patch", vec![ @@ -18781,7 +18781,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing creative group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creative-groups_update", vec![ @@ -18812,7 +18812,7 @@ fn main() { ]), ("creatives", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one creative by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creatives_get", vec![ @@ -18840,7 +18840,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new creative."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creatives_insert", vec![ @@ -18868,7 +18868,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of creatives, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creatives_list", vec![ @@ -18890,7 +18890,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing creative. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creatives_patch", vec![ @@ -18924,7 +18924,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing creative."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/creatives_update", vec![ @@ -18955,7 +18955,7 @@ fn main() { ]), ("dimension-values", "methods: 'query'", vec![ - ("query", + ("query", Some(r##"Retrieves list of report dimension values for a list of filters."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/dimension-values_query", vec![ @@ -18986,7 +18986,7 @@ fn main() { ]), ("directory-site-contacts", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one directory site contact by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/directory-site-contacts_get", vec![ @@ -19014,7 +19014,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of directory site contacts, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/directory-site-contacts_list", vec![ @@ -19039,7 +19039,7 @@ fn main() { ]), ("directory-sites", "methods: 'get', 'insert' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one directory site by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/directory-sites_get", vec![ @@ -19067,7 +19067,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new directory site."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/directory-sites_insert", vec![ @@ -19095,7 +19095,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of directory sites, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/directory-sites_list", vec![ @@ -19120,7 +19120,7 @@ fn main() { ]), ("event-tags", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing event tag."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/event-tags_delete", vec![ @@ -19142,7 +19142,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one event tag by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/event-tags_get", vec![ @@ -19170,7 +19170,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new event tag."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/event-tags_insert", vec![ @@ -19198,7 +19198,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of event tags, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/event-tags_list", vec![ @@ -19220,7 +19220,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing event tag. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/event-tags_patch", vec![ @@ -19254,7 +19254,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing event tag."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/event-tags_update", vec![ @@ -19285,7 +19285,7 @@ fn main() { ]), ("files", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves a report file by its report ID and file ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/files_get", vec![ @@ -19313,7 +19313,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists files for a user profile."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/files_list", vec![ @@ -19338,7 +19338,7 @@ fn main() { ]), ("floodlight-activities", "methods: 'delete', 'generatetag', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing floodlight activity."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activities_delete", vec![ @@ -19360,7 +19360,7 @@ fn main() { Some(false), Some(true)), ]), - ("generatetag", + ("generatetag", Some(r##"Generates a tag for a floodlight activity."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activities_generatetag", vec![ @@ -19382,7 +19382,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets one floodlight activity by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activities_get", vec![ @@ -19410,7 +19410,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new floodlight activity."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activities_insert", vec![ @@ -19438,7 +19438,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of floodlight activities, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activities_list", vec![ @@ -19460,7 +19460,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing floodlight activity. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activities_patch", vec![ @@ -19494,7 +19494,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing floodlight activity."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activities_update", vec![ @@ -19525,7 +19525,7 @@ fn main() { ]), ("floodlight-activity-groups", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing floodlight activity group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activity-groups_delete", vec![ @@ -19547,7 +19547,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one floodlight activity group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activity-groups_get", vec![ @@ -19575,7 +19575,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new floodlight activity group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activity-groups_insert", vec![ @@ -19603,7 +19603,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of floodlight activity groups, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activity-groups_list", vec![ @@ -19625,7 +19625,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing floodlight activity group. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activity-groups_patch", vec![ @@ -19659,7 +19659,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing floodlight activity group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-activity-groups_update", vec![ @@ -19690,7 +19690,7 @@ fn main() { ]), ("floodlight-configurations", "methods: 'get', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one floodlight configuration by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-configurations_get", vec![ @@ -19718,7 +19718,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of floodlight configurations, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-configurations_list", vec![ @@ -19740,7 +19740,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing floodlight configuration. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-configurations_patch", vec![ @@ -19774,7 +19774,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing floodlight configuration."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/floodlight-configurations_update", vec![ @@ -19805,7 +19805,7 @@ fn main() { ]), ("inventory-items", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one inventory item by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/inventory-items_get", vec![ @@ -19839,7 +19839,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of inventory items, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/inventory-items_list", vec![ @@ -19870,7 +19870,7 @@ fn main() { ]), ("landing-pages", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing campaign landing page."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/landing-pages_delete", vec![ @@ -19898,7 +19898,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one campaign landing page by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/landing-pages_get", vec![ @@ -19932,7 +19932,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new landing page for the specified campaign."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/landing-pages_insert", vec![ @@ -19966,7 +19966,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of landing pages for the specified campaign."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/landing-pages_list", vec![ @@ -19994,7 +19994,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing campaign landing page. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/landing-pages_patch", vec![ @@ -20034,7 +20034,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing campaign landing page."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/landing-pages_update", vec![ @@ -20071,7 +20071,7 @@ fn main() { ]), ("metros", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of metros."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/metros_list", vec![ @@ -20096,7 +20096,7 @@ fn main() { ]), ("mobile-carriers", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one mobile carrier by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/mobile-carriers_get", vec![ @@ -20124,7 +20124,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of mobile carriers."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/mobile-carriers_list", vec![ @@ -20149,7 +20149,7 @@ fn main() { ]), ("operating-system-versions", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one operating system version by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/operating-system-versions_get", vec![ @@ -20177,7 +20177,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of operating system versions."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/operating-system-versions_list", vec![ @@ -20202,7 +20202,7 @@ fn main() { ]), ("operating-systems", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one operating system by DART ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/operating-systems_get", vec![ @@ -20230,7 +20230,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of operating systems."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/operating-systems_list", vec![ @@ -20255,7 +20255,7 @@ fn main() { ]), ("order-documents", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one order document by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/order-documents_get", vec![ @@ -20289,7 +20289,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of order documents, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/order-documents_list", vec![ @@ -20320,7 +20320,7 @@ fn main() { ]), ("orders", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one order by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/orders_get", vec![ @@ -20354,7 +20354,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of orders, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/orders_list", vec![ @@ -20385,7 +20385,7 @@ fn main() { ]), ("placement-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one placement group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-groups_get", vec![ @@ -20413,7 +20413,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new placement group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-groups_insert", vec![ @@ -20441,7 +20441,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of placement groups, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-groups_list", vec![ @@ -20463,7 +20463,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing placement group. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-groups_patch", vec![ @@ -20497,7 +20497,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing placement group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-groups_update", vec![ @@ -20528,7 +20528,7 @@ fn main() { ]), ("placement-strategies", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing placement strategy."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-strategies_delete", vec![ @@ -20550,7 +20550,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one placement strategy by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-strategies_get", vec![ @@ -20578,7 +20578,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new placement strategy."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-strategies_insert", vec![ @@ -20606,7 +20606,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of placement strategies, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-strategies_list", vec![ @@ -20628,7 +20628,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing placement strategy. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-strategies_patch", vec![ @@ -20662,7 +20662,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing placement strategy."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placement-strategies_update", vec![ @@ -20693,7 +20693,7 @@ fn main() { ]), ("placements", "methods: 'generatetags', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("generatetags", + ("generatetags", Some(r##"Generates tags for a placement."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placements_generatetags", vec![ @@ -20715,7 +20715,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets one placement by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placements_get", vec![ @@ -20743,7 +20743,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new placement."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placements_insert", vec![ @@ -20771,7 +20771,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of placements, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placements_list", vec![ @@ -20793,7 +20793,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing placement. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placements_patch", vec![ @@ -20827,7 +20827,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing placement."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/placements_update", vec![ @@ -20858,7 +20858,7 @@ fn main() { ]), ("platform-types", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one platform type by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/platform-types_get", vec![ @@ -20886,7 +20886,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of platform types."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/platform-types_list", vec![ @@ -20911,7 +20911,7 @@ fn main() { ]), ("postal-codes", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one postal code by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/postal-codes_get", vec![ @@ -20939,7 +20939,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of postal codes."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/postal-codes_list", vec![ @@ -20964,7 +20964,7 @@ fn main() { ]), ("projects", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one project by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/projects_get", vec![ @@ -20992,7 +20992,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of projects, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/projects_list", vec![ @@ -21017,7 +21017,7 @@ fn main() { ]), ("regions", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of regions."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/regions_list", vec![ @@ -21042,7 +21042,7 @@ fn main() { ]), ("remarketing-list-shares", "methods: 'get', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one remarketing list share by remarketing list ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/remarketing-list-shares_get", vec![ @@ -21070,7 +21070,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing remarketing list share. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/remarketing-list-shares_patch", vec![ @@ -21104,7 +21104,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing remarketing list share."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/remarketing-list-shares_update", vec![ @@ -21135,7 +21135,7 @@ fn main() { ]), ("remarketing-lists", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one remarketing list by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/remarketing-lists_get", vec![ @@ -21163,7 +21163,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new remarketing list."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/remarketing-lists_insert", vec![ @@ -21191,7 +21191,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of remarketing lists, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/remarketing-lists_list", vec![ @@ -21219,7 +21219,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing remarketing list. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/remarketing-lists_patch", vec![ @@ -21253,7 +21253,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing remarketing list."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/remarketing-lists_update", vec![ @@ -21284,7 +21284,7 @@ fn main() { ]), ("reports", "methods: 'compatible-fields-query', 'delete', 'files-get', 'files-list', 'get', 'insert', 'list', 'patch', 'run' and 'update'", vec![ - ("compatible-fields-query", + ("compatible-fields-query", Some(r##"Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/reports_compatible-fields-query", vec![ @@ -21312,7 +21312,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a report by its ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/reports_delete", vec![ @@ -21334,7 +21334,7 @@ fn main() { Some(false), Some(true)), ]), - ("files-get", + ("files-get", Some(r##"Retrieves a report file."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/reports_files-get", vec![ @@ -21368,7 +21368,7 @@ fn main() { Some(false), Some(false)), ]), - ("files-list", + ("files-list", Some(r##"Lists files for a report."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/reports_files-list", vec![ @@ -21396,7 +21396,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves a report by its ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/reports_get", vec![ @@ -21424,7 +21424,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a report."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/reports_insert", vec![ @@ -21452,7 +21452,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves list of reports."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/reports_list", vec![ @@ -21474,7 +21474,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a report. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/reports_patch", vec![ @@ -21508,7 +21508,7 @@ fn main() { Some(false), Some(false)), ]), - ("run", + ("run", Some(r##"Runs a report."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/reports_run", vec![ @@ -21536,7 +21536,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a report."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/reports_update", vec![ @@ -21573,7 +21573,7 @@ fn main() { ]), ("sites", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one site by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/sites_get", vec![ @@ -21601,7 +21601,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new site."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/sites_insert", vec![ @@ -21629,7 +21629,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of sites, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/sites_list", vec![ @@ -21651,7 +21651,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing site. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/sites_patch", vec![ @@ -21685,7 +21685,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing site."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/sites_update", vec![ @@ -21716,7 +21716,7 @@ fn main() { ]), ("sizes", "methods: 'get', 'insert' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one size by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/sizes_get", vec![ @@ -21744,7 +21744,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new size."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/sizes_insert", vec![ @@ -21772,7 +21772,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of sizes, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/sizes_list", vec![ @@ -21797,7 +21797,7 @@ fn main() { ]), ("subaccounts", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one subaccount by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/subaccounts_get", vec![ @@ -21825,7 +21825,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new subaccount."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/subaccounts_insert", vec![ @@ -21853,7 +21853,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Gets a list of subaccounts, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/subaccounts_list", vec![ @@ -21875,7 +21875,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing subaccount. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/subaccounts_patch", vec![ @@ -21909,7 +21909,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing subaccount."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/subaccounts_update", vec![ @@ -21940,7 +21940,7 @@ fn main() { ]), ("targetable-remarketing-lists", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one remarketing list by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/targetable-remarketing-lists_get", vec![ @@ -21968,7 +21968,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of targetable remarketing lists, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/targetable-remarketing-lists_list", vec![ @@ -21999,7 +21999,7 @@ fn main() { ]), ("user-profiles", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one user profile by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-profiles_get", vec![ @@ -22021,7 +22021,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves list of user profiles for a user."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-profiles_list", vec![ @@ -22040,7 +22040,7 @@ fn main() { ]), ("user-role-permission-groups", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one user role permission group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-role-permission-groups_get", vec![ @@ -22068,7 +22068,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Gets a list of all supported user role permission groups."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-role-permission-groups_list", vec![ @@ -22093,7 +22093,7 @@ fn main() { ]), ("user-role-permissions", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one user role permission by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-role-permissions_get", vec![ @@ -22121,7 +22121,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Gets a list of user role permissions, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-role-permissions_list", vec![ @@ -22146,7 +22146,7 @@ fn main() { ]), ("user-roles", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing user role."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-roles_delete", vec![ @@ -22168,7 +22168,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one user role by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-roles_get", vec![ @@ -22196,7 +22196,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new user role."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-roles_insert", vec![ @@ -22224,7 +22224,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of user roles, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-roles_list", vec![ @@ -22246,7 +22246,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing user role. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-roles_patch", vec![ @@ -22280,7 +22280,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing user role."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/user-roles_update", vec![ @@ -22314,7 +22314,7 @@ fn main() { let mut app = App::new("dfareporting2d1") .author("Sebastian Thiel ") - .version("0.3.2+20150717") + .version("0.3.3+20151109") .about("Manage your DoubleClick Campaign Manager ad campaigns and reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli") .arg(Arg::with_name("url") @@ -22338,7 +22338,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -22349,7 +22349,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/dfareporting2d1/Cargo.toml b/gen/dfareporting2d1/Cargo.toml index 83a3e83251..3a835422f6 100644 --- a/gen/dfareporting2d1/Cargo.toml +++ b/gen/dfareporting2d1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d1" -version = "0.1.10+20150717" +version = "0.1.11+20151109" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d1" diff --git a/gen/dfareporting2d1/LICENSE.md b/gen/dfareporting2d1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/dfareporting2d1/LICENSE.md +++ b/gen/dfareporting2d1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/dfareporting2d1/README.md b/gen/dfareporting2d1/README.md index c3da62bb58..ee2df56c17 100644 --- a/gen/dfareporting2d1/README.md +++ b/gen/dfareporting2d1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-dfareporting2d1` library allows access to all features of the *Google dfareporting* service. -This documentation was generated from *dfareporting* crate version *0.1.10+20150717*, where *20150717* is the exact revision of the *dfareporting:v2.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *dfareporting* crate version *0.1.11+20151109*, where *20151109* is the exact revision of the *dfareporting:v2.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *dfareporting* *v2d1* API can be found at the [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). diff --git a/gen/dfareporting2d1/src/cmn.rs b/gen/dfareporting2d1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/dfareporting2d1/src/cmn.rs +++ b/gen/dfareporting2d1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/dfareporting2d1/src/lib.rs b/gen/dfareporting2d1/src/lib.rs index 1c45dc9d03..4e203a404a 100644 --- a/gen/dfareporting2d1/src/lib.rs +++ b/gen/dfareporting2d1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *dfareporting* crate version *0.1.10+20150717*, where *20150717* is the exact revision of the *dfareporting:v2.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *dfareporting* crate version *0.1.11+20151109*, where *20151109* is the exact revision of the *dfareporting:v2.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *dfareporting* *v2d1* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). diff --git a/gen/dfareporting2d1/src/lib.rs.in b/gen/dfareporting2d1/src/lib.rs.in index 0f8243af16..449a435bb4 100644 --- a/gen/dfareporting2d1/src/lib.rs.in +++ b/gen/dfareporting2d1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -135,7 +136,7 @@ impl<'a, C, A> Dfareporting Dfareporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -306,7 +307,7 @@ impl<'a, C, A> Dfareporting } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1088,7 +1089,10 @@ pub struct Account { /// - "33" for CHF /// - "34" for VEF /// - "35" for COP - /// - "36" for GTQ + /// - "36" for GTQ + /// - "37" for PLN + /// - "39" for INR + /// - "40" for THB #[serde(rename="currencyId")] pub currency_id: Option, /// Reporting configuration of this account. @@ -2978,7 +2982,10 @@ pub struct DirectorySite { /// - "33" for CHF /// - "34" for VEF /// - "35" for COP - /// - "36" for GTQ + /// - "36" for GTQ + /// - "37" for PLN + /// - "39" for INR + /// - "40" for THB #[serde(rename="currencyId")] pub currency_id: Option, /// Tag types for regular placements. @@ -3254,7 +3261,7 @@ pub struct CreativeCustomEvent { /// Artwork type used by the creative.This is a read-only field. #[serde(rename="artworkType")] pub artwork_type: Option, - /// Reporting ID, used to differentiate multiple videos in a single creative. + /// Video reporting ID, used to differentiate multiple videos in a single creative. This is a read-only field. #[serde(rename="videoReportingId")] pub video_reporting_id: Option, /// Properties for rich media popup windows. This field is used only for exit events. @@ -3404,7 +3411,7 @@ pub struct Creative { /// Latest Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. #[serde(rename="latestTraffickedCreativeId")] pub latest_trafficked_creative_id: Option, - /// List of counter events configured for the creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + /// List of counter events configured for the creative. For ENHANCED_IMAGE creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: ENHANCED_IMAGE, all RICH_MEDIA, and all VPAID. #[serde(rename="counterCustomEvents")] pub counter_custom_events: Option>, /// Advertiser ID of this creative. This is a required field. Applicable to all creative types. @@ -3412,7 +3419,7 @@ pub struct Creative { pub advertiser_id: Option, /// Whether the creative is active. Applicable to all creative types. pub active: Option, - /// List of timer events configured for the creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + /// List of timer events configured for the creative. For ENHANCED_IMAGE creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: ENHANCED_IMAGE, all RICH_MEDIA, and all VPAID. #[serde(rename="timerCustomEvents")] pub timer_custom_events: Option>, /// Dimension value for the rendering ID of this creative. This is a read-only field. Applicable to all creative types. @@ -3440,13 +3447,13 @@ pub struct Creative { /// The internal Flash version for this creative as calculated by DoubleClick Studio. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE, ENHANCED_BANNER, all RICH_MEDIA, and all VPAID. #[serde(rename="requiredFlashVersion")] pub required_flash_version: Option, - /// List of exit events configured for the creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + /// List of exit events configured for the creative. For ENHANCED_BANNER and ENHANCED_IMAGE creatives, these are read-only and auto-generated from clickTags, For ENHANCED_BANNER, an event is also created from the backupImageReportingLabel. Applicable to the following creative types: ENHANCED_BANNER, ENHANCED_IMAGE, all RICH_MEDIA, and all VPAID. #[serde(rename="exitCustomEvents")] pub exit_custom_events: Option>, /// ID of current rendering version. This is a read-only field. Applicable to all creative types. #[serde(rename="renderingId")] pub rendering_id: Option, - /// Description of the video ad. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + /// Description of the video ad. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. #[serde(rename="videoDescription")] pub video_description: Option, /// Third-party URL used to record backup image impressions. Applicable to the following creative types: all RICH_MEDIA @@ -3491,7 +3498,7 @@ pub struct Creative { /// Whether HTML code is DCM-generated or manually entered. Set to true to ignore changes to htmlCode. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER. #[serde(rename="htmlCodeLocked")] pub html_code_locked: Option, - /// URL of hosted image or another ad tag. This is a required field when applicable. Applicable to the following creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and REDIRECT + /// URL of hosted image or hosted video or another ad tag. For INSTREAM_VIDEO_REDIRECT creatives this is the in-stream video redirect URL. The standard for a VAST (Video Ad Serving Template) ad response allows for a redirect link to another VAST 2.0 or 3.0 call. This is a required field when applicable. Applicable to the following creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, REDIRECT, and INSTREAM_VIDEO_REDIRECT #[serde(rename="redirectUrl")] pub redirect_url: Option, /// Click tags of the creative. For ENHANCED_BANNER, FLASH_INPAGE, and HTML5_BANNER creatives, this is a subset of detected click tags for the assets associated with this creative. After creating a flash asset, detected click tags will be returned in the creativeAssetMetadata. When inserting the creative, populate the creative clickTags field using the creativeAssetMetadata.clickTags field. For ENHANCED_IMAGE creatives, there should be exactly one entry in this list for each image creative asset. A click tag is matched with a corresponding creative asset by matching the clickTag.name field with the creativeAsset.assetIdentifier.name field. Applicable to the following creative types: ENHANCED_BANNER, ENHANCED_IMAGE, FLASH_INPAGE, HTML5_BANNER. @@ -3546,10 +3553,10 @@ pub struct Creative { /// Authoring tool for HTML5 banner creatives. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. #[serde(rename="authoringTool")] pub authoring_tool: Option, - /// Third-party URLs for tracking in-stream video creative events. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + /// Third-party URLs for tracking in-stream video creative events. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. #[serde(rename="thirdPartyUrls")] pub third_party_urls: Option>, - /// List of companion creatives assigned to an in-Stream videocreative. Acceptable values include IDs of existing flash and image creatives. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + /// List of companion creatives assigned to an in-Stream videocreative. Acceptable values include IDs of existing flash and image creatives. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. #[serde(rename="companionCreatives")] pub companion_creatives: Option>, /// HTML code for the creative. This is a required field when applicable. This field is ignored if htmlCodeLocked is false. Applicable to the following creative types: all CUSTOM, FLASH_INPAGE, and HTML5_BANNER, and all RICH_MEDIA. @@ -3558,10 +3565,10 @@ pub struct Creative { /// Whether the creative is SSL-compliant. This is a read-only field. Applicable to all creative types. #[serde(rename="sslCompliant")] pub ssl_compliant: Option, - /// Industry standard ID assigned to creative for reach and frequency. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + /// Industry standard ID assigned to creative for reach and frequency. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. #[serde(rename="commercialId")] pub commercial_id: Option, - /// Whether the user can choose to skip the creative. Applicable to the following creative types: INSTREAM_VIDEO. + /// Whether the user can choose to skip the creative. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. pub skippable: Option, } @@ -12883,7 +12890,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -12926,7 +12933,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12962,7 +12969,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12972,10 +12979,10 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -13018,7 +13025,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -13036,12 +13043,12 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserRolePermissionGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13130,7 +13137,7 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -13172,7 +13179,7 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13208,7 +13215,7 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13218,10 +13225,10 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -13272,12 +13279,12 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserRolePermissionGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13367,7 +13374,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.platformTypes.get", + dlg.begin(MethodInfo { id: "dfareporting.platformTypes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -13410,7 +13417,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13446,7 +13453,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13456,10 +13463,10 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13492,7 +13499,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlatformTypeGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -13502,7 +13509,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> PlatformTypeGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -13520,12 +13527,12 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13542,17 +13549,17 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlatformTypeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlatformTypeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13614,7 +13621,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.platformTypes.list", + dlg.begin(MethodInfo { id: "dfareporting.platformTypes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -13656,7 +13663,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13692,7 +13699,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13702,10 +13709,10 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13738,7 +13745,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlatformTypeListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -13756,12 +13763,12 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13778,17 +13785,17 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlatformTypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlatformTypeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13859,7 +13866,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.patch", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -13903,14 +13910,14 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13954,7 +13961,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13964,10 +13971,10 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> { self._request = new_value; @@ -14009,7 +14016,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -14019,7 +14026,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -14029,7 +14036,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -14047,12 +14054,12 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValuePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValuePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14143,7 +14150,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.get", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -14187,7 +14194,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14223,7 +14230,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14233,10 +14240,10 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -14279,7 +14286,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -14289,7 +14296,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -14307,12 +14314,12 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValueGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14403,7 +14410,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.delete", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -14446,7 +14453,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14482,7 +14489,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14492,10 +14499,10 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -14528,7 +14535,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -14538,7 +14545,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -14556,12 +14563,12 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValueDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14658,7 +14665,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.insert", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -14701,14 +14708,14 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14752,7 +14759,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14762,10 +14769,10 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> { self._request = new_value; @@ -14807,7 +14814,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -14817,7 +14824,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -14835,12 +14842,12 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValueInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14937,7 +14944,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.update", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -14980,14 +14987,14 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15031,7 +15038,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15041,10 +15048,10 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> { self._request = new_value; @@ -15086,7 +15093,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -15096,7 +15103,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -15114,12 +15121,12 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValueUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15221,7 +15228,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.list", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -15286,7 +15293,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15322,7 +15329,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15332,10 +15339,10 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -15378,7 +15385,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -15439,12 +15446,12 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValueListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15540,7 +15547,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.update", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -15582,14 +15589,14 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15633,7 +15640,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15643,10 +15650,10 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> { self._request = new_value; @@ -15688,7 +15695,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -15706,12 +15713,12 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15814,7 +15821,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.list", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -15885,7 +15892,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15921,7 +15928,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15931,10 +15938,10 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15967,7 +15974,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -16036,12 +16043,12 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16058,17 +16065,17 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeFieldListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16131,7 +16138,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.delete", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -16173,7 +16180,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16209,7 +16216,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16219,10 +16226,10 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -16255,7 +16262,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -16273,12 +16280,12 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16368,7 +16375,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.get", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -16411,7 +16418,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16447,7 +16454,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16457,10 +16464,10 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16493,7 +16500,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeFieldGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -16503,7 +16510,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CreativeFieldGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -16521,12 +16528,12 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16543,17 +16550,17 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeFieldGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16622,7 +16629,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.insert", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -16664,14 +16671,14 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -16715,7 +16722,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16725,10 +16732,10 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> { self._request = new_value; @@ -16770,7 +16777,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -16788,12 +16795,12 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16890,7 +16897,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.patch", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -16933,14 +16940,14 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -16984,7 +16991,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16994,10 +17001,10 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> { self._request = new_value; @@ -17039,7 +17046,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -17049,7 +17056,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -17067,12 +17074,12 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17168,7 +17175,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.insert", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -17210,14 +17217,14 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17261,7 +17268,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17271,10 +17278,10 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17306,7 +17313,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UserRole) -> UserRoleInsertCall<'a, C, A> { self._request = new_value; @@ -17316,7 +17323,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRoleInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -17334,12 +17341,12 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17356,17 +17363,17 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRoleInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRoleInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17429,7 +17436,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.get", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -17472,7 +17479,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17508,7 +17515,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17518,10 +17525,10 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17554,7 +17561,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRoleGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -17564,7 +17571,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserRoleGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -17582,12 +17589,12 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17604,17 +17611,17 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRoleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRoleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17683,7 +17690,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.update", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -17725,14 +17732,14 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17776,7 +17783,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17786,10 +17793,10 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17821,7 +17828,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UserRole) -> UserRoleUpdateCall<'a, C, A> { self._request = new_value; @@ -17831,7 +17838,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRoleUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -17849,12 +17856,12 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17871,17 +17878,17 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRoleUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRoleUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17944,7 +17951,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.delete", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -17986,7 +17993,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18022,7 +18029,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18032,10 +18039,10 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18058,7 +18065,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRoleDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -18068,7 +18075,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserRoleDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -18086,12 +18093,12 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18108,17 +18115,17 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRoleDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRoleDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18188,7 +18195,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.patch", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -18231,14 +18238,14 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -18282,7 +18289,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18292,10 +18299,10 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18327,7 +18334,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UserRole) -> UserRolePatchCall<'a, C, A> { self._request = new_value; @@ -18337,7 +18344,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRolePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -18347,7 +18354,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserRolePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -18365,12 +18372,12 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18387,17 +18394,17 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRolePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRolePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18475,7 +18482,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.list", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -18545,7 +18552,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18581,7 +18588,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18591,10 +18598,10 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18627,7 +18634,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -18702,12 +18709,12 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18724,17 +18731,17 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRoleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRoleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18797,7 +18804,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.get", + dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -18840,7 +18847,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18876,7 +18883,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18886,10 +18893,10 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -18932,7 +18939,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -18950,12 +18957,12 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OperatingSystemVersionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperatingSystemVersionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19044,7 +19051,7 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.list", + dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -19086,7 +19093,7 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19122,7 +19129,7 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19132,10 +19139,10 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -19186,12 +19193,12 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OperatingSystemVersionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperatingSystemVersionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19282,7 +19289,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.get", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -19326,7 +19333,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19362,7 +19369,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19372,10 +19379,10 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19408,7 +19415,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -19418,7 +19425,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -19428,7 +19435,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -19446,12 +19453,12 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19468,17 +19475,17 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPageGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPageGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19548,7 +19555,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.update", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -19591,14 +19598,14 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19642,7 +19649,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19652,10 +19659,10 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19687,7 +19694,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LandingPage) -> LandingPageUpdateCall<'a, C, A> { self._request = new_value; @@ -19697,7 +19704,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPageUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -19707,7 +19714,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPageUpdateCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -19725,12 +19732,12 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19747,17 +19754,17 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPageUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPageUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19820,7 +19827,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.list", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -19863,7 +19870,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19899,7 +19906,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19909,10 +19916,10 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19945,7 +19952,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPageListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -19955,7 +19962,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPageListCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -19973,12 +19980,12 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19995,17 +20002,17 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPageListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPageListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20075,7 +20082,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.insert", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -20118,14 +20125,14 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -20169,7 +20176,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20179,10 +20186,10 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20214,7 +20221,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LandingPage) -> LandingPageInsertCall<'a, C, A> { self._request = new_value; @@ -20224,7 +20231,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPageInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -20234,7 +20241,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPageInsertCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -20252,12 +20259,12 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20274,17 +20281,17 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPageInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPageInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20355,7 +20362,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.patch", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -20399,14 +20406,14 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -20450,7 +20457,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20460,10 +20467,10 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20495,7 +20502,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LandingPage) -> LandingPagePatchCall<'a, C, A> { self._request = new_value; @@ -20505,7 +20512,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -20515,7 +20522,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -20525,7 +20532,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -20543,12 +20550,12 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20565,17 +20572,17 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPagePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPagePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20639,7 +20646,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.delete", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -20682,7 +20689,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -20718,7 +20725,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20728,10 +20735,10 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20754,7 +20761,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -20764,7 +20771,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -20774,7 +20781,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -20792,12 +20799,12 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20814,17 +20821,17 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPageDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPageDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20896,7 +20903,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeAssets.insert", + dlg.begin(MethodInfo { id: "dfareporting.creativeAssets.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -20913,13 +20920,13 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -21031,7 +21038,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21041,10 +21048,10 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> { self._request = new_value; @@ -21157,7 +21164,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -21167,7 +21174,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> { self._advertiser_id = new_value.to_string(); @@ -21185,12 +21192,12 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeAssetInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeAssetInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21287,7 +21294,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.insert", + dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -21330,14 +21337,14 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -21381,7 +21388,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21391,10 +21398,10 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21426,7 +21433,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CampaignCreativeAssociation) -> CampaignCreativeAssociationInsertCall<'a, C, A> { self._request = new_value; @@ -21436,7 +21443,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -21446,7 +21453,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -21464,12 +21471,12 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -21486,17 +21493,17 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignCreativeAssociationInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignCreativeAssociationInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21565,7 +21572,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.list", + dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -21617,7 +21624,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -21653,7 +21660,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21663,10 +21670,10 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21699,7 +21706,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -21709,7 +21716,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -21748,12 +21755,12 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -21770,17 +21777,17 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignCreativeAssociationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignCreativeAssociationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21862,7 +21869,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.changeLogs.list", + dlg.begin(MethodInfo { id: "dfareporting.changeLogs.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -21946,7 +21953,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -21982,7 +21989,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21992,10 +21999,10 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22028,7 +22035,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -22119,12 +22126,12 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22141,17 +22148,17 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChangeLogListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChangeLogListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22214,7 +22221,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.changeLogs.get", + dlg.begin(MethodInfo { id: "dfareporting.changeLogs.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -22257,7 +22264,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22293,7 +22300,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22303,10 +22310,10 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22339,7 +22346,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ChangeLogGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -22349,7 +22356,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ChangeLogGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -22367,12 +22374,12 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22389,17 +22396,17 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChangeLogGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChangeLogGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22462,7 +22469,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.get", + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -22505,7 +22512,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22541,7 +22548,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22551,10 +22558,10 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -22597,7 +22604,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> { self._remarketing_list_id = new_value.to_string(); @@ -22615,12 +22622,12 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListShareGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListShareGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22717,7 +22724,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.patch", + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -22760,14 +22767,14 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -22811,7 +22818,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22821,10 +22828,10 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> { self._request = new_value; @@ -22866,7 +22873,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -22876,7 +22883,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> { self._remarketing_list_id = new_value.to_string(); @@ -22894,12 +22901,12 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListSharePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListSharePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22995,7 +23002,7 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.update", + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -23037,14 +23044,14 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -23088,7 +23095,7 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23098,10 +23105,10 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> { self._request = new_value; @@ -23143,7 +23150,7 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -23161,12 +23168,12 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListShareUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListShareUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23258,7 +23265,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.run", + dlg.begin(MethodInfo { id: "dfareporting.reports.run", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -23304,7 +23311,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23340,7 +23347,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23350,10 +23357,10 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23386,7 +23393,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportRunCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -23396,7 +23403,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportRunCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -23421,12 +23428,12 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -23443,17 +23450,17 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportRunCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportRunCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23523,7 +23530,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.patch", + dlg.begin(MethodInfo { id: "dfareporting.reports.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -23566,14 +23573,14 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -23617,7 +23624,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23627,10 +23634,10 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23662,7 +23669,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Report) -> ReportPatchCall<'a, C, A> { self._request = new_value; @@ -23672,7 +23679,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -23682,7 +23689,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportPatchCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -23700,12 +23707,12 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -23722,17 +23729,17 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23803,7 +23810,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.files.list", + dlg.begin(MethodInfo { id: "dfareporting.reports.files.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -23858,7 +23865,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23894,7 +23901,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23904,10 +23911,10 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23940,7 +23947,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -23950,7 +23957,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -23996,12 +24003,12 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -24018,17 +24025,17 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportFileListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportFileListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24097,7 +24104,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.insert", + dlg.begin(MethodInfo { id: "dfareporting.reports.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -24139,14 +24146,14 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -24190,7 +24197,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24200,10 +24207,10 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24235,7 +24242,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Report) -> ReportInsertCall<'a, C, A> { self._request = new_value; @@ -24245,7 +24252,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -24263,12 +24270,12 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -24285,17 +24292,17 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24365,7 +24372,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.update", + dlg.begin(MethodInfo { id: "dfareporting.reports.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -24408,14 +24415,14 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -24459,7 +24466,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24469,10 +24476,10 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24504,7 +24511,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Report) -> ReportUpdateCall<'a, C, A> { self._request = new_value; @@ -24514,7 +24521,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -24524,7 +24531,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportUpdateCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -24542,12 +24549,12 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -24564,17 +24571,17 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24643,7 +24650,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.compatibleFields.query", + dlg.begin(MethodInfo { id: "dfareporting.reports.compatibleFields.query", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -24685,14 +24692,14 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -24736,7 +24743,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24746,10 +24753,10 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> { self._request = new_value; @@ -24791,7 +24798,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -24809,12 +24816,12 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ReportCompatibleFieldQueryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportCompatibleFieldQueryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24904,7 +24911,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.get", + dlg.begin(MethodInfo { id: "dfareporting.reports.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -24947,7 +24954,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -24983,7 +24990,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24993,10 +25000,10 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25029,7 +25036,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -25039,7 +25046,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -25057,12 +25064,12 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25079,17 +25086,17 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25158,7 +25165,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.files.get", + dlg.begin(MethodInfo { id: "dfareporting.reports.files.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -25218,7 +25225,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25254,7 +25261,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25264,10 +25271,10 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25300,7 +25307,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -25310,7 +25317,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -25320,7 +25327,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -25338,12 +25345,12 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25360,17 +25367,17 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportFileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportFileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25433,7 +25440,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.delete", + dlg.begin(MethodInfo { id: "dfareporting.reports.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -25475,7 +25482,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25511,7 +25518,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25521,10 +25528,10 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25547,7 +25554,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -25557,7 +25564,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportDeleteCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -25575,12 +25582,12 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25597,17 +25604,17 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25679,7 +25686,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.list", + dlg.begin(MethodInfo { id: "dfareporting.reports.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -25736,7 +25743,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25772,7 +25779,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25782,10 +25789,10 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25818,7 +25825,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -25871,12 +25878,12 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25893,17 +25900,17 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25972,7 +25979,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertisers.insert", + dlg.begin(MethodInfo { id: "dfareporting.advertisers.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -26014,14 +26021,14 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -26065,7 +26072,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26075,10 +26082,10 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26110,7 +26117,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Advertiser) -> AdvertiserInsertCall<'a, C, A> { self._request = new_value; @@ -26120,7 +26127,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdvertiserInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -26138,12 +26145,12 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26160,17 +26167,17 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdvertiserInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26240,7 +26247,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertisers.patch", + dlg.begin(MethodInfo { id: "dfareporting.advertisers.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -26283,14 +26290,14 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -26334,7 +26341,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26344,10 +26351,10 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26379,7 +26386,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Advertiser) -> AdvertiserPatchCall<'a, C, A> { self._request = new_value; @@ -26389,7 +26396,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdvertiserPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -26399,7 +26406,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AdvertiserPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -26417,12 +26424,12 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26439,17 +26446,17 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdvertiserPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26535,7 +26542,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertisers.list", + dlg.begin(MethodInfo { id: "dfareporting.advertisers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -26625,7 +26632,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -26661,7 +26668,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26671,10 +26678,10 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26707,7 +26714,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -26812,12 +26819,12 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26834,17 +26841,17 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdvertiserListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26913,7 +26920,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertisers.update", + dlg.begin(MethodInfo { id: "dfareporting.advertisers.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -26955,14 +26962,14 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -27006,7 +27013,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27016,10 +27023,10 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27051,7 +27058,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Advertiser) -> AdvertiserUpdateCall<'a, C, A> { self._request = new_value; @@ -27061,7 +27068,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdvertiserUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -27079,12 +27086,12 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -27101,17 +27108,17 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdvertiserUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27174,7 +27181,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertisers.get", + dlg.begin(MethodInfo { id: "dfareporting.advertisers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -27217,7 +27224,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -27253,7 +27260,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27263,10 +27270,10 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27299,7 +27306,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -27309,7 +27316,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -27327,12 +27334,12 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -27349,17 +27356,17 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdvertiserGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27432,7 +27439,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.dimensionValues.query", + dlg.begin(MethodInfo { id: "dfareporting.dimensionValues.query", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -27480,14 +27487,14 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -27531,7 +27538,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27541,10 +27548,10 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> { self._request = new_value; @@ -27586,7 +27593,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -27618,12 +27625,12 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DimensionValueQueryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DimensionValueQueryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27713,7 +27720,7 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.delete", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -27755,7 +27762,7 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -27791,7 +27798,7 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27801,10 +27808,10 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -27837,7 +27844,7 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -27855,12 +27862,12 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27950,7 +27957,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -27993,7 +28000,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -28029,7 +28036,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28039,10 +28046,10 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -28085,7 +28092,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -28103,12 +28110,12 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -28205,7 +28212,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.patch", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -28248,14 +28255,14 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -28299,7 +28306,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28309,10 +28316,10 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> { self._request = new_value; @@ -28354,7 +28361,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -28364,7 +28371,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -28382,12 +28389,12 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -28494,7 +28501,7 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -28567,7 +28574,7 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -28603,7 +28610,7 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28613,10 +28620,10 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -28731,12 +28738,12 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -28832,7 +28839,7 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.insert", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -28874,14 +28881,14 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -28925,7 +28932,7 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28935,10 +28942,10 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> { self._request = new_value; @@ -28980,7 +28987,7 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -28998,12 +29005,12 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29099,7 +29106,7 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.update", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -29141,14 +29148,14 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -29192,7 +29199,7 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29202,10 +29209,10 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> { self._request = new_value; @@ -29247,7 +29254,7 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -29265,12 +29272,12 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29359,7 +29366,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.metros.list", + dlg.begin(MethodInfo { id: "dfareporting.metros.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -29401,7 +29408,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -29437,7 +29444,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29447,10 +29454,10 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29483,7 +29490,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> MetroListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -29501,12 +29508,12 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -29523,17 +29530,17 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MetroListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MetroListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29610,7 +29617,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.orders.list", + dlg.begin(MethodInfo { id: "dfareporting.orders.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -29682,7 +29689,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -29718,7 +29725,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29728,10 +29735,10 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29764,7 +29771,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -29774,7 +29781,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -29843,12 +29850,12 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -29865,17 +29872,17 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29939,7 +29946,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.orders.get", + dlg.begin(MethodInfo { id: "dfareporting.orders.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -29983,7 +29990,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30019,7 +30026,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30029,10 +30036,10 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30065,7 +30072,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -30075,7 +30082,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -30085,7 +30092,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -30103,12 +30110,12 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -30125,17 +30132,17 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30198,7 +30205,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.get", + dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -30241,7 +30248,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30277,7 +30284,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30287,10 +30294,10 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -30333,7 +30340,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -30351,12 +30358,12 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DirectorySiteContactGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectorySiteContactGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30459,7 +30466,7 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.list", + dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -30530,7 +30537,7 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30566,7 +30573,7 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30576,10 +30583,10 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -30681,12 +30688,12 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DirectorySiteContactListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectorySiteContactListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30774,7 +30781,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userProfiles.list", + dlg.begin(MethodInfo { id: "dfareporting.userProfiles.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -30794,7 +30801,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30830,7 +30837,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30840,10 +30847,10 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30884,12 +30891,12 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -30906,17 +30913,17 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserProfileListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserProfileListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30978,7 +30985,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userProfiles.get", + dlg.begin(MethodInfo { id: "dfareporting.userProfiles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -31020,7 +31027,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -31056,7 +31063,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31066,10 +31073,10 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31102,7 +31109,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserProfileGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -31120,12 +31127,12 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -31142,17 +31149,17 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserProfileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserProfileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -31222,7 +31229,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.ads.patch", + dlg.begin(MethodInfo { id: "dfareporting.ads.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -31265,14 +31272,14 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -31316,7 +31323,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31326,10 +31333,10 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31361,7 +31368,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Ad) -> AdPatchCall<'a, C, A> { self._request = new_value; @@ -31371,7 +31378,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -31381,7 +31388,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AdPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -31399,12 +31406,12 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -31421,17 +31428,17 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -31500,7 +31507,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.ads.insert", + dlg.begin(MethodInfo { id: "dfareporting.ads.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -31542,14 +31549,14 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -31593,7 +31600,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31603,10 +31610,10 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31638,7 +31645,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Ad) -> AdInsertCall<'a, C, A> { self._request = new_value; @@ -31648,7 +31655,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -31666,12 +31673,12 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -31688,17 +31695,17 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -31808,7 +31815,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.ads.list", + dlg.begin(MethodInfo { id: "dfareporting.ads.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((27 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -31962,7 +31969,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -31998,7 +32005,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32008,10 +32015,10 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32044,7 +32051,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -32240,12 +32247,12 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -32262,17 +32269,17 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -32335,7 +32342,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.ads.get", + dlg.begin(MethodInfo { id: "dfareporting.ads.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -32378,7 +32385,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -32414,7 +32421,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32424,10 +32431,10 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32460,7 +32467,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -32470,7 +32477,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AdGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -32488,12 +32495,12 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -32510,17 +32517,17 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -32589,7 +32596,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.ads.update", + dlg.begin(MethodInfo { id: "dfareporting.ads.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -32631,14 +32638,14 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -32682,7 +32689,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32692,10 +32699,10 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32727,7 +32734,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Ad) -> AdUpdateCall<'a, C, A> { self._request = new_value; @@ -32737,7 +32744,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -32755,12 +32762,12 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -32777,17 +32784,17 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -32850,7 +32857,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.get", + dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -32893,7 +32900,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -32929,7 +32936,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32939,10 +32946,10 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -32985,7 +32992,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -33003,12 +33010,12 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33097,7 +33104,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.list", + dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -33139,7 +33146,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -33175,7 +33182,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33185,10 +33192,10 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -33239,12 +33246,12 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33333,7 +33340,7 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.list", + dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -33375,7 +33382,7 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -33411,7 +33418,7 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33421,10 +33428,10 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -33475,12 +33482,12 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ConnectionTypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ConnectionTypeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33570,7 +33577,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.get", + dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -33613,7 +33620,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -33649,7 +33656,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33659,10 +33666,10 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33695,7 +33702,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ConnectionTypeGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -33705,7 +33712,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ConnectionTypeGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -33723,12 +33730,12 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -33745,17 +33752,17 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ConnectionTypeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ConnectionTypeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33818,7 +33825,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -33861,7 +33868,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -33897,7 +33904,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33907,10 +33914,10 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -33953,7 +33960,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -33971,12 +33978,12 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34077,7 +34084,7 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -34141,7 +34148,7 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -34177,7 +34184,7 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -34187,10 +34194,10 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -34284,12 +34291,12 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34385,7 +34392,7 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.insert", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -34427,14 +34434,14 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -34478,7 +34485,7 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -34488,10 +34495,10 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> { self._request = new_value; @@ -34533,7 +34540,7 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -34551,12 +34558,12 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34652,7 +34659,7 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.update", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -34694,14 +34701,14 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -34745,7 +34752,7 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -34755,10 +34762,10 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> { self._request = new_value; @@ -34800,7 +34807,7 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -34818,12 +34825,12 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34920,7 +34927,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.patch", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -34963,14 +34970,14 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -35014,7 +35021,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35024,10 +35031,10 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> { self._request = new_value; @@ -35069,7 +35076,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -35079,7 +35086,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -35097,12 +35104,12 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35192,7 +35199,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.delete", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -35234,7 +35241,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -35270,7 +35277,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35280,10 +35287,10 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -35316,7 +35323,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -35334,12 +35341,12 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35435,7 +35442,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sites.insert", + dlg.begin(MethodInfo { id: "dfareporting.sites.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -35477,14 +35484,14 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -35528,7 +35535,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35538,10 +35545,10 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35573,7 +35580,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Site) -> SiteInsertCall<'a, C, A> { self._request = new_value; @@ -35583,7 +35590,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SiteInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -35601,12 +35608,12 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -35623,17 +35630,17 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35696,7 +35703,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sites.get", + dlg.begin(MethodInfo { id: "dfareporting.sites.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -35739,7 +35746,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -35775,7 +35782,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35785,10 +35792,10 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35821,7 +35828,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -35831,7 +35838,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -35849,12 +35856,12 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -35871,17 +35878,17 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35973,7 +35980,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sites.list", + dlg.begin(MethodInfo { id: "dfareporting.sites.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((18 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -36072,7 +36079,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -36108,7 +36115,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36118,10 +36125,10 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36154,7 +36161,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SiteListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -36280,12 +36287,12 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -36302,17 +36309,17 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -36381,7 +36388,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sites.update", + dlg.begin(MethodInfo { id: "dfareporting.sites.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -36423,14 +36430,14 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -36474,7 +36481,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36484,10 +36491,10 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36519,7 +36526,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Site) -> SiteUpdateCall<'a, C, A> { self._request = new_value; @@ -36529,7 +36536,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SiteUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -36547,12 +36554,12 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -36569,17 +36576,17 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -36649,7 +36656,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sites.patch", + dlg.begin(MethodInfo { id: "dfareporting.sites.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -36692,14 +36699,14 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -36743,7 +36750,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36753,10 +36760,10 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36788,7 +36795,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Site) -> SitePatchCall<'a, C, A> { self._request = new_value; @@ -36798,7 +36805,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SitePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -36808,7 +36815,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SitePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -36826,12 +36833,12 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -36848,17 +36855,17 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SitePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SitePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -36921,7 +36928,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.get", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -36964,7 +36971,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -37000,7 +37007,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37010,10 +37017,10 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -37056,7 +37063,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -37074,12 +37081,12 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -37194,7 +37201,7 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.list", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -37283,7 +37290,7 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -37319,7 +37326,7 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37329,10 +37336,10 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -37476,12 +37483,12 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -37577,7 +37584,7 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.insert", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -37619,14 +37626,14 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -37670,7 +37677,7 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37680,10 +37687,10 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> { self._request = new_value; @@ -37725,7 +37732,7 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -37743,12 +37750,12 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -37838,7 +37845,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.delete", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -37880,7 +37887,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -37916,7 +37923,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37926,10 +37933,10 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -37962,7 +37969,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -37980,12 +37987,12 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38082,7 +38089,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.patch", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -38125,14 +38132,14 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -38176,7 +38183,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38186,10 +38193,10 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> { self._request = new_value; @@ -38231,7 +38238,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -38241,7 +38248,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -38259,12 +38266,12 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38355,7 +38362,7 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.generatetag", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.generatetag", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -38400,7 +38407,7 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -38436,7 +38443,7 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38446,10 +38453,10 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -38507,12 +38514,12 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGeneratetagCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGeneratetagCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38608,7 +38615,7 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.update", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -38650,14 +38657,14 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -38701,7 +38708,7 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38711,10 +38718,10 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> { self._request = new_value; @@ -38756,7 +38763,7 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -38774,12 +38781,12 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38868,7 +38875,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.regions.list", + dlg.begin(MethodInfo { id: "dfareporting.regions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -38910,7 +38917,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -38946,7 +38953,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38956,10 +38963,10 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38992,7 +38999,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> RegionListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -39010,12 +39017,12 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -39032,17 +39039,17 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RegionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RegionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39111,7 +39118,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.insert", + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -39153,14 +39160,14 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -39204,7 +39211,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39214,10 +39221,10 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> { self._request = new_value; @@ -39259,7 +39266,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -39277,12 +39284,12 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeGroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39372,7 +39379,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -39415,7 +39422,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -39451,7 +39458,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39461,10 +39468,10 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39497,7 +39504,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -39507,7 +39514,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CreativeGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -39525,12 +39532,12 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -39547,17 +39554,17 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39626,7 +39633,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.update", + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -39668,14 +39675,14 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -39719,7 +39726,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39729,10 +39736,10 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> { self._request = new_value; @@ -39774,7 +39781,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -39792,12 +39799,12 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeGroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39902,7 +39909,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -39976,7 +39983,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -40012,7 +40019,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40022,10 +40029,10 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40058,7 +40065,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -40134,12 +40141,12 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -40156,17 +40163,17 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -40236,7 +40243,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.patch", + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -40279,14 +40286,14 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -40330,7 +40337,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40340,10 +40347,10 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> { self._request = new_value; @@ -40385,7 +40392,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -40395,7 +40402,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -40413,12 +40420,12 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeGroupPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGroupPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -40520,7 +40527,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.list", + dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -40581,7 +40588,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -40617,7 +40624,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40627,10 +40634,10 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -40673,7 +40680,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> { self._advertiser_id = new_value.to_string(); @@ -40733,12 +40740,12 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetableRemarketingListListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetableRemarketingListListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -40828,7 +40835,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.get", + dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -40871,7 +40878,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -40907,7 +40914,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40917,10 +40924,10 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -40963,7 +40970,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -40981,12 +40988,12 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetableRemarketingListGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetableRemarketingListGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41083,7 +41090,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.subaccounts.patch", + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -41126,14 +41133,14 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -41177,7 +41184,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41187,10 +41194,10 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41222,7 +41229,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Subaccount) -> SubaccountPatchCall<'a, C, A> { self._request = new_value; @@ -41232,7 +41239,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SubaccountPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -41242,7 +41249,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SubaccountPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -41260,12 +41267,12 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -41282,17 +41289,17 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubaccountPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubaccountPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41361,7 +41368,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.subaccounts.insert", + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -41403,14 +41410,14 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -41454,7 +41461,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41464,10 +41471,10 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41499,7 +41506,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Subaccount) -> SubaccountInsertCall<'a, C, A> { self._request = new_value; @@ -41509,7 +41516,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SubaccountInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -41527,12 +41534,12 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -41549,17 +41556,17 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubaccountInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubaccountInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41633,7 +41640,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.subaccounts.list", + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -41697,7 +41704,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -41733,7 +41740,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41743,10 +41750,10 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41779,7 +41786,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -41840,12 +41847,12 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -41862,17 +41869,17 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubaccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubaccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41941,7 +41948,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.subaccounts.update", + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -41983,14 +41990,14 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -42034,7 +42041,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42044,10 +42051,10 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42079,7 +42086,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Subaccount) -> SubaccountUpdateCall<'a, C, A> { self._request = new_value; @@ -42089,7 +42096,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SubaccountUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -42107,12 +42114,12 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -42129,17 +42136,17 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubaccountUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubaccountUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42202,7 +42209,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.subaccounts.get", + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -42245,7 +42252,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -42281,7 +42288,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42291,10 +42298,10 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42327,7 +42334,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SubaccountGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -42337,7 +42344,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SubaccountGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -42355,12 +42362,12 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -42377,17 +42384,17 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubaccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubaccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42450,7 +42457,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.get", + dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -42493,7 +42500,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -42529,7 +42536,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42539,10 +42546,10 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42575,7 +42582,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> MobileCarrierGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -42585,7 +42592,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> MobileCarrierGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -42603,12 +42610,12 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -42625,17 +42632,17 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MobileCarrierGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MobileCarrierGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42697,7 +42704,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.list", + dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -42739,7 +42746,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -42775,7 +42782,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42785,10 +42792,10 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42821,7 +42828,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> MobileCarrierListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -42839,12 +42846,12 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -42861,17 +42868,17 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MobileCarrierListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MobileCarrierListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42934,7 +42941,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.get", + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -42977,7 +42984,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -43013,7 +43020,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43023,10 +43030,10 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -43069,7 +43076,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -43087,12 +43094,12 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightConfigurationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43188,7 +43195,7 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.update", + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -43230,14 +43237,14 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -43281,7 +43288,7 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43291,10 +43298,10 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> { self._request = new_value; @@ -43336,7 +43343,7 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -43354,12 +43361,12 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightConfigurationUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43456,7 +43463,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.patch", + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -43499,14 +43506,14 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -43550,7 +43557,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43560,10 +43567,10 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> { self._request = new_value; @@ -43605,7 +43612,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -43615,7 +43622,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -43633,12 +43640,12 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightConfigurationPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43729,7 +43736,7 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.list", + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -43778,7 +43785,7 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -43814,7 +43821,7 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43824,10 +43831,10 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -43886,12 +43893,12 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightConfigurationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43980,7 +43987,7 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.list", + dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -44022,7 +44029,7 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -44058,7 +44065,7 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44068,10 +44075,10 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -44122,12 +44129,12 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OperatingSystemListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperatingSystemListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -44217,7 +44224,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.get", + dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -44260,7 +44267,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -44296,7 +44303,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44306,10 +44313,10 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -44352,7 +44359,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> { self._dart_id = new_value.to_string(); @@ -44370,12 +44377,12 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OperatingSystemGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperatingSystemGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -44474,7 +44481,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.files.list", + dlg.begin(MethodInfo { id: "dfareporting.files.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -44531,7 +44538,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -44567,7 +44574,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44577,10 +44584,10 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44613,7 +44620,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> FileListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -44666,12 +44673,12 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -44688,17 +44695,17 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -44766,7 +44773,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.files.get", + dlg.begin(MethodInfo { id: "dfareporting.files.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("reportId", self._report_id.to_string())); @@ -44825,7 +44832,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -44861,7 +44868,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44871,10 +44878,10 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44907,7 +44914,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -44917,7 +44924,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -44935,12 +44942,12 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -44957,17 +44964,17 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -45059,7 +45066,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((18 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -45178,7 +45185,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -45214,7 +45221,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45224,10 +45231,10 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -45391,12 +45398,12 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -45492,7 +45499,7 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementGroups.update", + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -45534,14 +45541,14 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -45585,7 +45592,7 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45595,10 +45602,10 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> { self._request = new_value; @@ -45640,7 +45647,7 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -45658,12 +45665,12 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementGroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -45759,7 +45766,7 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementGroups.insert", + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -45801,14 +45808,14 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -45852,7 +45859,7 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45862,10 +45869,10 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> { self._request = new_value; @@ -45907,7 +45914,7 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -45925,12 +45932,12 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementGroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46020,7 +46027,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -46063,7 +46070,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -46099,7 +46106,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46109,10 +46116,10 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46145,7 +46152,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -46155,7 +46162,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> PlacementGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -46173,12 +46180,12 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -46195,17 +46202,17 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46275,7 +46282,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementGroups.patch", + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -46318,14 +46325,14 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -46369,7 +46376,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46379,10 +46386,10 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> { self._request = new_value; @@ -46424,7 +46431,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -46434,7 +46441,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -46452,12 +46459,12 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementGroupPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGroupPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46563,7 +46570,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.list", + dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -46642,7 +46649,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -46678,7 +46685,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46688,10 +46695,10 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46724,7 +46731,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -46734,7 +46741,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -46811,12 +46818,12 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -46833,17 +46840,17 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InventoryItemListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InventoryItemListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46907,7 +46914,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.get", + dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -46951,7 +46958,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -46987,7 +46994,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46997,10 +47004,10 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47033,7 +47040,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -47043,7 +47050,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -47053,7 +47060,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -47071,12 +47078,12 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -47093,17 +47100,17 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InventoryItemGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InventoryItemGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47166,7 +47173,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.get", + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -47209,7 +47216,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47245,7 +47252,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47255,10 +47262,10 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -47301,7 +47308,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -47319,12 +47326,12 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserRolePermissionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47415,7 +47422,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.list", + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -47464,7 +47471,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47500,7 +47507,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47510,10 +47517,10 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -47572,12 +47579,12 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserRolePermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRolePermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47666,7 +47673,7 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -47708,7 +47715,7 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47744,7 +47751,7 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47754,10 +47761,10 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -47808,12 +47815,12 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47903,7 +47910,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -47946,7 +47953,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47982,7 +47989,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47992,10 +47999,10 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -48038,7 +48045,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -48056,12 +48063,12 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48162,7 +48169,7 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.list", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -48226,7 +48233,7 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -48262,7 +48269,7 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48272,10 +48279,10 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -48369,12 +48376,12 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48470,7 +48477,7 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.update", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -48512,14 +48519,14 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -48563,7 +48570,7 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48573,10 +48580,10 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> { self._request = new_value; @@ -48618,7 +48625,7 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -48636,12 +48643,12 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48737,7 +48744,7 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.insert", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -48779,14 +48786,14 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -48830,7 +48837,7 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48840,10 +48847,10 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> { self._request = new_value; @@ -48885,7 +48892,7 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -48903,12 +48910,12 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48998,7 +49005,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.delete", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -49040,7 +49047,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -49076,7 +49083,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49086,10 +49093,10 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -49122,7 +49129,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -49140,12 +49147,12 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -49235,7 +49242,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.get", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -49278,7 +49285,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -49314,7 +49321,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49324,10 +49331,10 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -49370,7 +49377,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -49388,12 +49395,12 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -49490,7 +49497,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.patch", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -49533,14 +49540,14 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -49584,7 +49591,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49594,10 +49601,10 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> { self._request = new_value; @@ -49639,7 +49646,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -49649,7 +49656,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -49667,12 +49674,12 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -49768,7 +49775,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creatives.update", + dlg.begin(MethodInfo { id: "dfareporting.creatives.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -49810,14 +49817,14 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -49861,7 +49868,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49871,10 +49878,10 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49906,7 +49913,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Creative) -> CreativeUpdateCall<'a, C, A> { self._request = new_value; @@ -49916,7 +49923,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -49934,12 +49941,12 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -49956,17 +49963,17 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -50035,7 +50042,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creatives.insert", + dlg.begin(MethodInfo { id: "dfareporting.creatives.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -50077,14 +50084,14 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -50128,7 +50135,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50138,10 +50145,10 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50173,7 +50180,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Creative) -> CreativeInsertCall<'a, C, A> { self._request = new_value; @@ -50183,7 +50190,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -50201,12 +50208,12 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -50223,17 +50230,17 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -50296,7 +50303,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creatives.get", + dlg.begin(MethodInfo { id: "dfareporting.creatives.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -50339,7 +50346,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -50375,7 +50382,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50385,10 +50392,10 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50421,7 +50428,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -50431,7 +50438,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -50449,12 +50456,12 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -50471,17 +50478,17 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -50575,7 +50582,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creatives.list", + dlg.begin(MethodInfo { id: "dfareporting.creatives.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((19 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -50689,7 +50696,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -50725,7 +50732,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50735,10 +50742,10 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50771,7 +50778,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -50907,12 +50914,12 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -50929,17 +50936,17 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51009,7 +51016,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creatives.patch", + dlg.begin(MethodInfo { id: "dfareporting.creatives.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -51052,14 +51059,14 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -51103,7 +51110,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51113,10 +51120,10 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51148,7 +51155,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Creative) -> CreativePatchCall<'a, C, A> { self._request = new_value; @@ -51158,7 +51165,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -51168,7 +51175,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CreativePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -51186,12 +51193,12 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -51208,17 +51215,17 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51281,7 +51288,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaigns.get", + dlg.begin(MethodInfo { id: "dfareporting.campaigns.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -51324,7 +51331,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -51360,7 +51367,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51370,10 +51377,10 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51406,7 +51413,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -51416,7 +51423,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CampaignGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -51434,12 +51441,12 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -51456,17 +51463,17 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51537,7 +51544,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaigns.insert", + dlg.begin(MethodInfo { id: "dfareporting.campaigns.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -51581,14 +51588,14 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -51632,7 +51639,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51642,10 +51649,10 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51677,7 +51684,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Campaign) -> CampaignInsertCall<'a, C, A> { self._request = new_value; @@ -51687,7 +51694,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -51697,7 +51704,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *default landing page name* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn default_landing_page_name(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { self._default_landing_page_name = new_value.to_string(); @@ -51707,7 +51714,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *default landing page url* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn default_landing_page_url(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { self._default_landing_page_url = new_value.to_string(); @@ -51725,12 +51732,12 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -51747,17 +51754,17 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51827,7 +51834,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaigns.patch", + dlg.begin(MethodInfo { id: "dfareporting.campaigns.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -51870,14 +51877,14 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -51921,7 +51928,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51931,10 +51938,10 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51966,7 +51973,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Campaign) -> CampaignPatchCall<'a, C, A> { self._request = new_value; @@ -51976,7 +51983,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -51986,7 +51993,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CampaignPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -52004,12 +52011,12 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -52026,17 +52033,17 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -52105,7 +52112,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaigns.update", + dlg.begin(MethodInfo { id: "dfareporting.campaigns.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -52147,14 +52154,14 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -52198,7 +52205,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52208,10 +52215,10 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52243,7 +52250,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Campaign) -> CampaignUpdateCall<'a, C, A> { self._request = new_value; @@ -52253,7 +52260,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -52271,12 +52278,12 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -52293,17 +52300,17 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -52391,7 +52398,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaigns.list", + dlg.begin(MethodInfo { id: "dfareporting.campaigns.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -52488,7 +52495,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -52524,7 +52531,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52534,10 +52541,10 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52570,7 +52577,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -52683,12 +52690,12 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -52705,17 +52712,17 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -52778,7 +52785,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.delete", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -52820,7 +52827,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -52856,7 +52863,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52866,10 +52873,10 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52892,7 +52899,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -52902,7 +52909,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> EventTagDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -52920,12 +52927,12 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -52942,17 +52949,17 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53034,7 +53041,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.list", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -53114,7 +53121,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -53150,7 +53157,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53160,10 +53167,10 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53196,7 +53203,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -53286,12 +53293,12 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -53308,17 +53315,17 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53387,7 +53394,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.insert", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -53429,14 +53436,14 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -53480,7 +53487,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53490,10 +53497,10 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53525,7 +53532,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EventTag) -> EventTagInsertCall<'a, C, A> { self._request = new_value; @@ -53535,7 +53542,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -53553,12 +53560,12 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -53575,17 +53582,17 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53655,7 +53662,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.patch", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -53698,14 +53705,14 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -53749,7 +53756,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53759,10 +53766,10 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53794,7 +53801,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EventTag) -> EventTagPatchCall<'a, C, A> { self._request = new_value; @@ -53804,7 +53811,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -53814,7 +53821,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> EventTagPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -53832,12 +53839,12 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -53854,17 +53861,17 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53933,7 +53940,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.update", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -53975,14 +53982,14 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -54026,7 +54033,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54036,10 +54043,10 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54071,7 +54078,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EventTag) -> EventTagUpdateCall<'a, C, A> { self._request = new_value; @@ -54081,7 +54088,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -54099,12 +54106,12 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -54121,17 +54128,17 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -54194,7 +54201,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.get", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -54237,7 +54244,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -54273,7 +54280,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54283,10 +54290,10 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54319,7 +54326,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -54329,7 +54336,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> EventTagGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -54347,12 +54354,12 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -54369,17 +54376,17 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -54442,7 +54449,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.get", + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -54485,7 +54492,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -54521,7 +54528,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54531,10 +54538,10 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -54577,7 +54584,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -54595,12 +54602,12 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -54696,7 +54703,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.update", + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -54738,14 +54745,14 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -54789,7 +54796,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54799,10 +54806,10 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> { self._request = new_value; @@ -54844,7 +54851,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -54862,12 +54869,12 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -54971,7 +54978,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.list", + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -55035,7 +55042,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -55071,7 +55078,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55081,10 +55088,10 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -55127,7 +55134,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> { self._advertiser_id = new_value.to_string(); @@ -55194,12 +55201,12 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55296,7 +55303,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.patch", + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -55339,14 +55346,14 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -55390,7 +55397,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55400,10 +55407,10 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> { self._request = new_value; @@ -55445,7 +55452,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -55455,7 +55462,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -55473,12 +55480,12 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55574,7 +55581,7 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.insert", + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -55616,14 +55623,14 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -55667,7 +55674,7 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55677,10 +55684,10 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> { self._request = new_value; @@ -55722,7 +55729,7 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -55740,12 +55747,12 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55842,7 +55849,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.cities.list", + dlg.begin(MethodInfo { id: "dfareporting.cities.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -55908,7 +55915,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -55944,7 +55951,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55954,10 +55961,10 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55990,7 +55997,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CityListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -56039,12 +56046,12 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -56061,17 +56068,17 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CityListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CityListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56140,7 +56147,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.update", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -56182,14 +56189,14 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -56233,7 +56240,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56243,10 +56250,10 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> { self._request = new_value; @@ -56288,7 +56295,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -56306,12 +56313,12 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56401,7 +56408,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.get", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -56444,7 +56451,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -56480,7 +56487,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56490,10 +56497,10 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -56536,7 +56543,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -56554,12 +56561,12 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56660,7 +56667,7 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.list", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -56724,7 +56731,7 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -56760,7 +56767,7 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56770,10 +56777,10 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -56867,12 +56874,12 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56962,7 +56969,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.delete", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -57004,7 +57011,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -57040,7 +57047,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57050,10 +57057,10 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -57086,7 +57093,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -57104,12 +57111,12 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57205,7 +57212,7 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.insert", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -57247,14 +57254,14 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -57298,7 +57305,7 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57308,10 +57315,10 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> { self._request = new_value; @@ -57353,7 +57360,7 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -57371,12 +57378,12 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57473,7 +57480,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.patch", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -57516,14 +57523,14 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -57567,7 +57574,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57577,10 +57584,10 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> { self._request = new_value; @@ -57622,7 +57629,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -57632,7 +57639,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -57650,12 +57657,12 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57758,7 +57765,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.projects.list", + dlg.begin(MethodInfo { id: "dfareporting.projects.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -57829,7 +57836,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -57865,7 +57872,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57875,10 +57882,10 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57911,7 +57918,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -57980,12 +57987,12 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -58002,17 +58009,17 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58075,7 +58082,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.projects.get", + dlg.begin(MethodInfo { id: "dfareporting.projects.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -58118,7 +58125,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -58154,7 +58161,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58164,10 +58171,10 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58200,7 +58207,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -58210,7 +58217,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -58228,12 +58235,12 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -58250,17 +58257,17 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58329,7 +58336,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.directorySites.insert", + dlg.begin(MethodInfo { id: "dfareporting.directorySites.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -58371,14 +58378,14 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -58422,7 +58429,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58432,10 +58439,10 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> { self._request = new_value; @@ -58477,7 +58484,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -58495,12 +58502,12 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DirectorySiteInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectorySiteInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58615,7 +58622,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.directorySites.list", + dlg.begin(MethodInfo { id: "dfareporting.directorySites.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -58700,7 +58707,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -58736,7 +58743,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58746,10 +58753,10 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58782,7 +58789,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -58892,12 +58899,12 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -58914,17 +58921,17 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DirectorySiteListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectorySiteListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58987,7 +58994,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.directorySites.get", + dlg.begin(MethodInfo { id: "dfareporting.directorySites.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -59030,7 +59037,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -59066,7 +59073,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59076,10 +59083,10 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59112,7 +59119,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> DirectorySiteGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -59122,7 +59129,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> DirectorySiteGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -59140,12 +59147,12 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59162,17 +59169,17 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DirectorySiteGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectorySiteGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -59241,7 +59248,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sizes.insert", + dlg.begin(MethodInfo { id: "dfareporting.sizes.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -59283,14 +59290,14 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -59334,7 +59341,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59344,10 +59351,10 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59379,7 +59386,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Size) -> SizeInsertCall<'a, C, A> { self._request = new_value; @@ -59389,7 +59396,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SizeInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -59407,12 +59414,12 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59429,17 +59436,17 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SizeInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SizeInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -59509,7 +59516,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sizes.list", + dlg.begin(MethodInfo { id: "dfareporting.sizes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -59567,7 +59574,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -59603,7 +59610,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59613,10 +59620,10 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59649,7 +59656,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SizeListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -59696,12 +59703,12 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59718,17 +59725,17 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SizeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SizeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -59791,7 +59798,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sizes.get", + dlg.begin(MethodInfo { id: "dfareporting.sizes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -59834,7 +59841,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -59870,7 +59877,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59880,10 +59887,10 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59916,7 +59923,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SizeGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -59926,7 +59933,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SizeGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -59944,12 +59951,12 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59966,17 +59973,17 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SizeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SizeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60039,7 +60046,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountActiveAdSummaries.get", + dlg.begin(MethodInfo { id: "dfareporting.accountActiveAdSummaries.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -60082,7 +60089,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -60118,7 +60125,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60128,10 +60135,10 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -60174,7 +60181,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> { self._summary_account_id = new_value.to_string(); @@ -60192,12 +60199,12 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountActiveAdSummaryGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountActiveAdSummaryGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60293,7 +60300,7 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.update", + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -60335,14 +60342,14 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -60386,7 +60393,7 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60396,10 +60403,10 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> { self._request = new_value; @@ -60441,7 +60448,7 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -60459,12 +60466,12 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUserProfileUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUserProfileUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60571,7 +60578,7 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.list", + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -60644,7 +60651,7 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -60680,7 +60687,7 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60690,10 +60697,10 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -60808,12 +60815,12 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUserProfileListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUserProfileListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60909,7 +60916,7 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.insert", + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -60951,14 +60958,14 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -61002,7 +61009,7 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61012,10 +61019,10 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> { self._request = new_value; @@ -61057,7 +61064,7 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -61075,12 +61082,12 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUserProfileInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUserProfileInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61177,7 +61184,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.patch", + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -61220,14 +61227,14 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -61271,7 +61278,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61281,10 +61288,10 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> { self._request = new_value; @@ -61326,7 +61333,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -61336,7 +61343,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -61354,12 +61361,12 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUserProfilePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUserProfilePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61449,7 +61456,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.get", + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -61492,7 +61499,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -61528,7 +61535,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61538,10 +61545,10 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -61584,7 +61591,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -61602,12 +61609,12 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUserProfileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUserProfileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61696,7 +61703,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.countries.list", + dlg.begin(MethodInfo { id: "dfareporting.countries.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -61738,7 +61745,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -61774,7 +61781,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61784,10 +61791,10 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61820,7 +61827,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CountryListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -61838,12 +61845,12 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -61860,17 +61867,17 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CountryListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CountryListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61933,7 +61940,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.countries.get", + dlg.begin(MethodInfo { id: "dfareporting.countries.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -61976,7 +61983,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -62012,7 +62019,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62022,10 +62029,10 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62058,7 +62065,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CountryGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -62068,7 +62075,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *dart id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dart_id(mut self, new_value: &str) -> CountryGetCall<'a, C, A> { self._dart_id = new_value.to_string(); @@ -62086,12 +62093,12 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -62108,17 +62115,17 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CountryGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CountryGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -62182,7 +62189,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.get", + dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -62226,7 +62233,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -62262,7 +62269,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62272,10 +62279,10 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62308,7 +62315,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -62318,7 +62325,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -62328,7 +62335,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -62346,12 +62353,12 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -62368,17 +62375,17 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderDocumentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderDocumentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -62459,7 +62466,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.list", + dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -62541,7 +62548,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -62577,7 +62584,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62587,10 +62594,10 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62623,7 +62630,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -62633,7 +62640,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -62717,12 +62724,12 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -62739,17 +62746,17 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderDocumentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderDocumentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -62812,7 +62819,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.postalCodes.get", + dlg.begin(MethodInfo { id: "dfareporting.postalCodes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -62855,7 +62862,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -62891,7 +62898,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62901,10 +62908,10 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62937,7 +62944,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PostalCodeGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -62947,7 +62954,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *code* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn code(mut self, new_value: &str) -> PostalCodeGetCall<'a, C, A> { self._code = new_value.to_string(); @@ -62965,12 +62972,12 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -62987,17 +62994,17 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostalCodeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostalCodeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -63059,7 +63066,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.postalCodes.list", + dlg.begin(MethodInfo { id: "dfareporting.postalCodes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -63101,7 +63108,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -63137,7 +63144,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63147,10 +63154,10 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63183,7 +63190,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PostalCodeListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -63201,12 +63208,12 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -63223,17 +63230,17 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostalCodeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostalCodeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -63295,7 +63302,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.browsers.list", + dlg.begin(MethodInfo { id: "dfareporting.browsers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -63337,7 +63344,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -63373,7 +63380,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63383,10 +63390,10 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63419,7 +63426,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> BrowserListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -63437,12 +63444,12 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -63459,17 +63466,17 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BrowserListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BrowserListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -63532,7 +63539,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accounts.get", + dlg.begin(MethodInfo { id: "dfareporting.accounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -63575,7 +63582,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -63611,7 +63618,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63621,10 +63628,10 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63657,7 +63664,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -63667,7 +63674,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -63685,12 +63692,12 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -63707,17 +63714,17 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -63793,7 +63800,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accounts.list", + dlg.begin(MethodInfo { id: "dfareporting.accounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -63860,7 +63867,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -63896,7 +63903,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63906,10 +63913,10 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63942,7 +63949,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AccountListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -64010,12 +64017,12 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -64032,17 +64039,17 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -64111,7 +64118,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accounts.update", + dlg.begin(MethodInfo { id: "dfareporting.accounts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -64153,14 +64160,14 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -64204,7 +64211,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64214,10 +64221,10 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64249,7 +64256,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountUpdateCall<'a, C, A> { self._request = new_value; @@ -64259,7 +64266,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AccountUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -64277,12 +64284,12 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -64299,17 +64306,17 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -64379,7 +64386,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accounts.patch", + dlg.begin(MethodInfo { id: "dfareporting.accounts.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -64422,14 +64429,14 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -64473,7 +64480,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64483,10 +64490,10 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64518,7 +64525,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountPatchCall<'a, C, A> { self._request = new_value; @@ -64528,7 +64535,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -64538,7 +64545,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -64556,12 +64563,12 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -64578,17 +64585,17 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -64658,7 +64665,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.patch", + dlg.begin(MethodInfo { id: "dfareporting.placements.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -64701,14 +64708,14 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -64752,7 +64759,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64762,10 +64769,10 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64797,7 +64804,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Placement) -> PlacementPatchCall<'a, C, A> { self._request = new_value; @@ -64807,7 +64814,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -64817,7 +64824,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> PlacementPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -64835,12 +64842,12 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -64857,17 +64864,17 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -64965,7 +64972,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.list", + dlg.begin(MethodInfo { id: "dfareporting.placements.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((21 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -65105,7 +65112,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -65141,7 +65148,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65151,10 +65158,10 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65187,7 +65194,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -65342,12 +65349,12 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -65364,17 +65371,17 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -65443,7 +65450,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.insert", + dlg.begin(MethodInfo { id: "dfareporting.placements.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -65485,14 +65492,14 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -65536,7 +65543,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65546,10 +65553,10 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65581,7 +65588,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Placement) -> PlacementInsertCall<'a, C, A> { self._request = new_value; @@ -65591,7 +65598,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -65609,12 +65616,12 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -65631,17 +65638,17 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -65710,7 +65717,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.update", + dlg.begin(MethodInfo { id: "dfareporting.placements.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -65752,14 +65759,14 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -65803,7 +65810,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65813,10 +65820,10 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65848,7 +65855,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Placement) -> PlacementUpdateCall<'a, C, A> { self._request = new_value; @@ -65858,7 +65865,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -65876,12 +65883,12 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -65898,17 +65905,17 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -65976,7 +65983,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.generatetags", + dlg.begin(MethodInfo { id: "dfareporting.placements.generatetags", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -66035,7 +66042,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -66071,7 +66078,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -66081,10 +66088,10 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut PlacementGeneratetagCall<'a, C, A> where C: BorrowMut PlacementGeneratetagCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -66158,12 +66165,12 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut PlacementGeneratetagCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementGeneratetagCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGeneratetagCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -66253,7 +66260,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.get", + dlg.begin(MethodInfo { id: "dfareporting.placements.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -66296,7 +66303,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -66332,7 +66339,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -66342,10 +66349,10 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -66378,7 +66385,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -66388,7 +66395,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> PlacementGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -66406,12 +66413,12 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -66428,17 +66435,17 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/dfareporting2d2-cli/Cargo.toml b/gen/dfareporting2d2-cli/Cargo.toml index 6dee872d1d..d0ea4a242f 100644 --- a/gen/dfareporting2d2-cli/Cargo.toml +++ b/gen/dfareporting2d2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d2-cli" -version = "0.3.2+20150717" +version = "0.3.3+20151109" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/dfareporting2d2-cli/LICENSE.md b/gen/dfareporting2d2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/dfareporting2d2-cli/LICENSE.md +++ b/gen/dfareporting2d2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/dfareporting2d2-cli/README.md b/gen/dfareporting2d2-cli/README.md index ca851ca0a9..90388c502b 100644 --- a/gen/dfareporting2d2-cli/README.md +++ b/gen/dfareporting2d2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *dfareporting* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/dfareporting2d2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/dfareporting2d2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/dfareporting2d2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/dfareporting2d2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d2-cli). # Usage -This documentation was generated from the *dfareporting* API at revision *20150717*. The CLI is at version *0.3.2*. +This documentation was generated from the *dfareporting* API at revision *20151109*. The CLI is at version *0.3.3*. ```bash dfareporting2d2 [options] @@ -280,18 +280,18 @@ dfareporting2d2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/dfareporting2d2-cli/mkdocs.yml b/gen/dfareporting2d2-cli/mkdocs.yml index 4ed6ed6506..199d876e1b 100644 --- a/gen/dfareporting2d2-cli/mkdocs.yml +++ b/gen/dfareporting2d2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v0.3.2+20150717 +site_name: dfareporting v0.3.3+20151109 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d2-cli site_description: Write integrating applications with bcore @@ -205,5 +205,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/dfareporting2d2-cli/src/main.rs b/gen/dfareporting2d2-cli/src/main.rs index 196cb4c69c..9ad98845b5 100644 --- a/gen/dfareporting2d2-cli/src/main.rs +++ b/gen/dfareporting2d2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Dfareporting>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _account_active_ad_summaries_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _account_active_ad_summaries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_active_ad_summaries().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("summary-account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_permission_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_permission_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_permission_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -149,10 +149,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_permission_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_permission_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_permission_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -165,7 +165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -178,7 +178,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -201,10 +201,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_permissions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_permissions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -217,7 +217,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -230,7 +230,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -253,10 +253,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_permissions().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -269,7 +269,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -282,7 +282,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -305,10 +305,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_user_profiles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_user_profiles().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -321,7 +321,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -334,7 +334,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -357,13 +357,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_user_profiles_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_user_profiles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -377,8 +377,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -416,7 +416,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); let mut call = self.hub.account_user_profiles().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -429,7 +429,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -442,7 +442,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -465,10 +465,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_user_profiles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_user_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.account_user_profiles().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-role-id" => { @@ -508,7 +508,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "subaccount-id", "sort-field", "ids", "max-results", "page-token", "user-role-id", "sort-order", "active"].iter().map(|v|*v)); @@ -522,7 +522,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -545,13 +545,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_user_profiles_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_user_profiles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -565,8 +565,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -604,7 +604,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); let mut call = self.hub.account_user_profiles().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -617,7 +617,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -630,7 +630,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -653,13 +653,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _account_user_profiles_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _account_user_profiles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -673,8 +673,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -712,7 +712,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); let mut call = self.hub.account_user_profiles().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -725,7 +725,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -738,7 +738,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -761,10 +761,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -777,7 +777,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -790,7 +790,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -813,10 +813,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -850,7 +850,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order", "active"].iter().map(|v|*v)); @@ -864,7 +864,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -887,13 +887,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -907,8 +907,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "teaser-size-limit" => Some(("teaserSizeLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -944,7 +944,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Account = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -957,7 +957,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -970,7 +970,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -993,13 +993,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1013,8 +1013,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "teaser-size-limit" => Some(("teaserSizeLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1050,7 +1050,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Account = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1063,7 +1063,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1076,7 +1076,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1099,10 +1099,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ads_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ads_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ads().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1115,7 +1115,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1128,7 +1128,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1151,13 +1151,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ads_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ads_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1171,8 +1171,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1251,7 +1251,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Ad = json::value::from_value(object).unwrap(); let mut call = self.hub.ads().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1264,7 +1264,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1277,7 +1277,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1300,10 +1300,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ads_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ads_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ads().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "type" => { @@ -1388,7 +1388,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["landing-page-ids", "overridden-event-tag-id", "campaign-ids", "archived", "creative-optimization-configuration-ids", "ssl-compliant", "size-ids", "page-token", "sort-order", "type", "ssl-required", "creative-ids", "max-results", "creative-type", "placement-ids", "active", "compatibility", "advertiser-id", "search-string", "sort-field", "audience-segment-ids", "ids", "remarketing-list-ids", "dynamic-click-tracker"].iter().map(|v|*v)); @@ -1402,7 +1402,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1425,13 +1425,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ads_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ads_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1445,8 +1445,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1525,7 +1525,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Ad = json::value::from_value(object).unwrap(); let mut call = self.hub.ads().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1538,7 +1538,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1551,7 +1551,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1574,13 +1574,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ads_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ads_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1594,8 +1594,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1674,7 +1674,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Ad = json::value::from_value(object).unwrap(); let mut call = self.hub.ads().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1687,7 +1687,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1700,7 +1700,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1723,10 +1723,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertiser_groups().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1739,7 +1739,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1752,7 +1752,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1767,10 +1767,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertiser_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1783,7 +1783,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1796,7 +1796,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1819,13 +1819,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1839,8 +1839,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1858,7 +1858,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.advertiser_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1871,7 +1871,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1884,7 +1884,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1907,10 +1907,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertiser_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -1941,7 +1941,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -1955,7 +1955,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1978,13 +1978,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1998,8 +1998,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2017,7 +2017,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.advertiser_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2030,7 +2030,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2043,7 +2043,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2066,13 +2066,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertiser_groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertiser_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2086,8 +2086,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2105,7 +2105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.advertiser_groups().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2118,7 +2118,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2131,7 +2131,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2154,10 +2154,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertisers().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2170,7 +2170,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2183,7 +2183,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2206,13 +2206,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2226,8 +2226,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2266,7 +2266,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Advertiser = json::value::from_value(object).unwrap(); let mut call = self.hub.advertisers().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2279,7 +2279,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2292,7 +2292,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2315,10 +2315,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertisers().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "subaccount-id" => { @@ -2367,7 +2367,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "search-string", "subaccount-id", "include-advertisers-without-groups-only", "sort-field", "ids", "max-results", "page-token", "only-parent", "sort-order", "floodlight-configuration-ids", "advertiser-group-ids"].iter().map(|v|*v)); @@ -2381,7 +2381,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2404,13 +2404,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2424,8 +2424,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2464,7 +2464,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Advertiser = json::value::from_value(object).unwrap(); let mut call = self.hub.advertisers().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2477,7 +2477,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2490,7 +2490,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2513,13 +2513,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2533,8 +2533,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2573,7 +2573,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Advertiser = json::value::from_value(object).unwrap(); let mut call = self.hub.advertisers().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2586,7 +2586,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2599,7 +2599,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2622,10 +2622,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _browsers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _browsers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.browsers().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2638,7 +2638,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2651,7 +2651,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2674,13 +2674,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaign_creative_associations_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaign_creative_associations_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2694,8 +2694,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "creative-id" => Some(("creativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2711,7 +2711,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CampaignCreativeAssociation = json::value::from_value(object).unwrap(); let mut call = self.hub.campaign_creative_associations().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2724,7 +2724,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2737,7 +2737,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2760,10 +2760,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaign_creative_associations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaign_creative_associations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.campaign_creative_associations().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -2785,7 +2785,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "sort-order", "max-results"].iter().map(|v|*v)); @@ -2799,7 +2799,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2822,10 +2822,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaigns_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaigns_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.campaigns().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2838,7 +2838,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2851,7 +2851,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2874,13 +2874,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaigns_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaigns_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2894,8 +2894,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2949,7 +2949,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Campaign = json::value::from_value(object).unwrap(); let mut call = self.hub.campaigns().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("default-landing-page-name").unwrap_or(""), opt.value_of("default-landing-page-url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2962,7 +2962,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2975,7 +2975,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2998,10 +2998,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaigns_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaigns_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.campaigns().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "subaccount-id" => { @@ -3053,7 +3053,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["archived", "search-string", "subaccount-id", "sort-field", "advertiser-ids", "ids", "max-results", "excluded-ids", "page-token", "advertiser-group-ids", "sort-order", "overridden-event-tag-id", "at-least-one-optimization-activity"].iter().map(|v|*v)); @@ -3067,7 +3067,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3090,13 +3090,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaigns_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaigns_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3110,8 +3110,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3165,7 +3165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Campaign = json::value::from_value(object).unwrap(); let mut call = self.hub.campaigns().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3178,7 +3178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3191,7 +3191,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3214,13 +3214,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _campaigns_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _campaigns_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3234,8 +3234,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3289,7 +3289,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Campaign = json::value::from_value(object).unwrap(); let mut call = self.hub.campaigns().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3302,7 +3302,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3315,7 +3315,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3338,10 +3338,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _change_logs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _change_logs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.change_logs().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3354,7 +3354,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3367,7 +3367,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3390,10 +3390,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _change_logs_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _change_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.change_logs().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-profile-ids" => { @@ -3436,7 +3436,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["min-change-time", "search-string", "max-change-time", "user-profile-ids", "ids", "max-results", "object-ids", "page-token", "action", "object-type"].iter().map(|v|*v)); @@ -3450,7 +3450,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3473,10 +3473,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _cities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _cities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.cities().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "region-dart-ids" => { @@ -3501,7 +3501,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["dart-ids", "country-dart-ids", "region-dart-ids", "name-prefix"].iter().map(|v|*v)); @@ -3515,7 +3515,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3538,10 +3538,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _connection_types_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _connection_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.connection_types().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3554,7 +3554,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3567,7 +3567,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3590,10 +3590,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _connection_types_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _connection_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.connection_types().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3606,7 +3606,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3619,7 +3619,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3642,10 +3642,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.content_categories().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3658,7 +3658,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3671,7 +3671,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3686,10 +3686,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.content_categories().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3702,7 +3702,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3715,7 +3715,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3738,13 +3738,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3758,8 +3758,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3777,7 +3777,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); let mut call = self.hub.content_categories().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3790,7 +3790,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3803,7 +3803,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3826,10 +3826,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.content_categories().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -3860,7 +3860,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -3874,7 +3874,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3897,13 +3897,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3917,8 +3917,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3936,7 +3936,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); let mut call = self.hub.content_categories().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3949,7 +3949,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3962,7 +3962,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3985,13 +3985,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _content_categories_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _content_categories_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4005,8 +4005,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4024,7 +4024,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); let mut call = self.hub.content_categories().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4037,7 +4037,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4050,7 +4050,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4073,10 +4073,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _countries_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _countries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.countries().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("dart-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4089,7 +4089,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4102,7 +4102,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4125,10 +4125,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _countries_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _countries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.countries().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4141,7 +4141,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4154,7 +4154,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4177,13 +4177,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_assets_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_assets_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4197,8 +4197,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "warned-validation-rules" => Some(("warnedValidationRules", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "detected-features" => Some(("detectedFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -4217,7 +4217,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeAssetMetadata = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_assets().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4230,7 +4230,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4238,7 +4238,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -4246,7 +4246,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4270,10 +4270,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_field_values().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4286,7 +4286,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4299,7 +4299,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4314,10 +4314,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_field_values().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4330,7 +4330,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4343,7 +4343,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4366,13 +4366,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4386,8 +4386,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4404,7 +4404,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_field_values().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4417,7 +4417,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4430,7 +4430,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4453,10 +4453,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_field_values().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -4487,7 +4487,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -4501,7 +4501,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4524,13 +4524,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4544,8 +4544,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4562,7 +4562,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_field_values().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4575,7 +4575,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4588,7 +4588,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4611,13 +4611,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_field_values_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_field_values_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4631,8 +4631,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4649,7 +4649,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_field_values().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4662,7 +4662,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4675,7 +4675,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4698,10 +4698,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_fields().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4714,7 +4714,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4727,7 +4727,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4742,10 +4742,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_fields().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4758,7 +4758,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4771,7 +4771,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4794,13 +4794,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4814,8 +4814,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4841,7 +4841,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeField = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_fields().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4854,7 +4854,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4867,7 +4867,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4890,10 +4890,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_fields().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -4927,7 +4927,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -4941,7 +4941,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4964,13 +4964,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4984,8 +4984,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5011,7 +5011,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeField = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_fields().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5024,7 +5024,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5037,7 +5037,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5060,13 +5060,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_fields_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_fields_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5080,8 +5080,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5107,7 +5107,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeField = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_fields().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5120,7 +5120,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5133,7 +5133,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5156,10 +5156,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5172,7 +5172,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5185,7 +5185,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5208,13 +5208,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5228,8 +5228,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5256,7 +5256,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5269,7 +5269,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5282,7 +5282,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5305,10 +5305,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creative_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -5345,7 +5345,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "group-number", "page-token", "sort-order"].iter().map(|v|*v)); @@ -5359,7 +5359,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5382,13 +5382,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_groups_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5402,8 +5402,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5430,7 +5430,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5443,7 +5443,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5456,7 +5456,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5479,13 +5479,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creative_groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creative_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5499,8 +5499,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5527,7 +5527,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.creative_groups().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5540,7 +5540,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5553,7 +5553,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5576,10 +5576,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creatives().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5592,7 +5592,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5605,7 +5605,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5628,13 +5628,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5648,8 +5648,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5732,7 +5732,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Creative = json::value::from_value(object).unwrap(); let mut call = self.hub.creatives().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5745,7 +5745,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5758,7 +5758,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5781,10 +5781,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.creatives().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "types" => { @@ -5845,7 +5845,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["advertiser-id", "archived", "search-string", "max-results", "campaign-id", "sort-field", "rendering-ids", "ids", "studio-creative-id", "size-ids", "page-token", "sort-order", "companion-creative-ids", "active", "creative-field-ids", "types"].iter().map(|v|*v)); @@ -5859,7 +5859,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5882,13 +5882,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5902,8 +5902,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5986,7 +5986,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Creative = json::value::from_value(object).unwrap(); let mut call = self.hub.creatives().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5999,7 +5999,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6012,7 +6012,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6035,13 +6035,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _creatives_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _creatives_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6055,8 +6055,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6139,7 +6139,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Creative = json::value::from_value(object).unwrap(); let mut call = self.hub.creatives().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6152,7 +6152,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6165,7 +6165,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6188,13 +6188,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _dimension_values_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _dimension_values_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6208,8 +6208,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "dimension-name" => Some(("dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6227,7 +6227,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DimensionValueRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.dimension_values().query(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -6246,7 +6246,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -6260,7 +6260,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6283,10 +6283,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _directory_site_contacts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _directory_site_contacts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.directory_site_contacts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6299,7 +6299,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6312,7 +6312,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6335,10 +6335,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _directory_site_contacts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _directory_site_contacts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.directory_site_contacts().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -6372,7 +6372,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "directory-site-ids", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -6386,7 +6386,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6409,10 +6409,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _directory_sites_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _directory_sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.directory_sites().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6425,7 +6425,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6438,7 +6438,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6461,13 +6461,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _directory_sites_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _directory_sites_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6481,8 +6481,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "country-id" => Some(("countryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -6524,7 +6524,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DirectorySite = json::value::from_value(object).unwrap(); let mut call = self.hub.directory_sites().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6537,7 +6537,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6550,7 +6550,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6573,10 +6573,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _directory_sites_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _directory_sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.directory_sites().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -6628,7 +6628,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["accepts-interstitial-placements", "accepts-publisher-paid-placements", "search-string", "country-id", "accepts-in-stream-video-placements", "sort-field", "ids", "max-results", "page-token", "sort-order", "parent-id", "active", "dfp-network-code"].iter().map(|v|*v)); @@ -6642,7 +6642,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6665,10 +6665,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.event_tags().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6681,7 +6681,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6694,7 +6694,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -6709,10 +6709,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.event_tags().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6725,7 +6725,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6738,7 +6738,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6761,13 +6761,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6781,8 +6781,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -6824,7 +6824,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EventTag = json::value::from_value(object).unwrap(); let mut call = self.hub.event_tags().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -6837,7 +6837,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -6850,7 +6850,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6873,10 +6873,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.event_tags().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -6919,7 +6919,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "campaign-id", "sort-field", "enabled", "ids", "advertiser-id", "ad-id", "sort-order", "event-tag-types", "definitions-only"].iter().map(|v|*v)); @@ -6933,7 +6933,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -6956,13 +6956,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -6976,8 +6976,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -7019,7 +7019,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EventTag = json::value::from_value(object).unwrap(); let mut call = self.hub.event_tags().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7032,7 +7032,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7045,7 +7045,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7068,13 +7068,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _event_tags_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _event_tags_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7088,8 +7088,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -7131,7 +7131,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EventTag = json::value::from_value(object).unwrap(); let mut call = self.hub.event_tags().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7144,7 +7144,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7157,7 +7157,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7180,11 +7180,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.files().get(opt.value_of("report-id").unwrap_or(""), opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7200,7 +7200,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7213,7 +7213,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7241,10 +7241,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.files().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -7272,7 +7272,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort-field", "max-results", "sort-order", "page-token", "scope"].iter().map(|v|*v)); @@ -7286,7 +7286,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7309,10 +7309,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activities().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7325,7 +7325,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7338,7 +7338,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -7353,10 +7353,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_generatetag(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_generatetag(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activities().generatetag(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "floodlight-activity-id" => { @@ -7372,7 +7372,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["floodlight-activity-id"].iter().map(|v|*v)); @@ -7386,7 +7386,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7409,10 +7409,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activities().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7425,7 +7425,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7438,7 +7438,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7461,13 +7461,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7481,8 +7481,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -7537,7 +7537,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activities().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7550,7 +7550,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7563,7 +7563,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7586,10 +7586,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activities().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tag-string" => { @@ -7641,7 +7641,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["floodlight-activity-group-ids", "search-string", "floodlight-activity-group-name", "sort-field", "floodlight-configuration-id", "ids", "max-results", "advertiser-id", "page-token", "sort-order", "tag-string", "floodlight-activity-group-tag-string", "floodlight-activity-group-type"].iter().map(|v|*v)); @@ -7655,7 +7655,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7678,13 +7678,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7698,8 +7698,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -7754,7 +7754,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activities().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7767,7 +7767,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7780,7 +7780,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7803,13 +7803,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activities_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activities_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -7823,8 +7823,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -7879,7 +7879,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activities().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7892,7 +7892,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7905,7 +7905,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -7928,10 +7928,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activity_groups().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7944,7 +7944,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -7957,7 +7957,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -7972,10 +7972,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activity_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -7988,7 +7988,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8001,7 +8001,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8024,13 +8024,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8044,8 +8044,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8086,7 +8086,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activity_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8099,7 +8099,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8112,7 +8112,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8135,10 +8135,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_activity_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "type" => { @@ -8178,7 +8178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "floodlight-configuration-id", "ids", "max-results", "advertiser-id", "page-token", "sort-order", "type"].iter().map(|v|*v)); @@ -8192,7 +8192,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8215,13 +8215,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8235,8 +8235,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8277,7 +8277,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activity_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8290,7 +8290,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8303,7 +8303,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8326,13 +8326,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_activity_groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_activity_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8346,8 +8346,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8388,7 +8388,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_activity_groups().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8401,7 +8401,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8414,7 +8414,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8437,10 +8437,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_configurations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_configurations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_configurations().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8453,7 +8453,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8466,7 +8466,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8489,10 +8489,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_configurations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_configurations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.floodlight_configurations().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "ids" => { @@ -8508,7 +8508,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ids"].iter().map(|v|*v)); @@ -8522,7 +8522,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8545,13 +8545,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_configurations_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_configurations_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8565,8 +8565,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "natural-search-conversion-attribution-option" => Some(("naturalSearchConversionAttributionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8610,7 +8610,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightConfiguration = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_configurations().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8623,7 +8623,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8636,7 +8636,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8659,13 +8659,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _floodlight_configurations_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _floodlight_configurations_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -8679,8 +8679,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "natural-search-conversion-attribution-option" => Some(("naturalSearchConversionAttributionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -8724,7 +8724,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FloodlightConfiguration = json::value::from_value(object).unwrap(); let mut call = self.hub.floodlight_configurations().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8737,7 +8737,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8750,7 +8750,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8773,10 +8773,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inventory_items_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inventory_items_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.inventory_items().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8789,7 +8789,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8802,7 +8802,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8825,10 +8825,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _inventory_items_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _inventory_items_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.inventory_items().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -8865,7 +8865,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-id", "sort-field", "ids", "max-results", "page-token", "in-plan", "site-id", "sort-order"].iter().map(|v|*v)); @@ -8879,7 +8879,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8902,10 +8902,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.landing_pages().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8918,7 +8918,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8931,7 +8931,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -8946,10 +8946,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.landing_pages().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -8962,7 +8962,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -8975,7 +8975,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -8998,13 +8998,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -9018,8 +9018,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -9038,7 +9038,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LandingPage = json::value::from_value(object).unwrap(); let mut call = self.hub.landing_pages().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9051,7 +9051,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9064,7 +9064,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9087,10 +9087,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.landing_pages().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9103,7 +9103,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9116,7 +9116,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9139,13 +9139,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -9159,8 +9159,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -9179,7 +9179,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LandingPage = json::value::from_value(object).unwrap(); let mut call = self.hub.landing_pages().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9192,7 +9192,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9205,7 +9205,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9228,13 +9228,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _landing_pages_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _landing_pages_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -9248,8 +9248,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -9268,7 +9268,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LandingPage = json::value::from_value(object).unwrap(); let mut call = self.hub.landing_pages().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9281,7 +9281,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9294,7 +9294,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9317,10 +9317,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _metros_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _metros_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.metros().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9333,7 +9333,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9346,7 +9346,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9369,10 +9369,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mobile_carriers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mobile_carriers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mobile_carriers().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9385,7 +9385,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9398,7 +9398,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9421,10 +9421,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _mobile_carriers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _mobile_carriers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.mobile_carriers().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9437,7 +9437,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9450,7 +9450,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9473,10 +9473,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operating_system_versions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operating_system_versions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operating_system_versions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9489,7 +9489,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9502,7 +9502,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9525,10 +9525,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operating_system_versions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operating_system_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operating_system_versions().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9541,7 +9541,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9554,7 +9554,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9577,10 +9577,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operating_systems_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operating_systems_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operating_systems().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("dart-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9593,7 +9593,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9606,7 +9606,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9629,10 +9629,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operating_systems_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operating_systems_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operating_systems().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9645,7 +9645,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9658,7 +9658,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9681,10 +9681,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _order_documents_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _order_documents_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.order_documents().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9697,7 +9697,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9710,7 +9710,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9733,10 +9733,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _order_documents_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _order_documents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.order_documents().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -9776,7 +9776,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-id", "search-string", "sort-field", "ids", "max-results", "page-token", "site-id", "sort-order", "approved"].iter().map(|v|*v)); @@ -9790,7 +9790,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9813,10 +9813,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9829,7 +9829,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9842,7 +9842,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9865,10 +9865,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _orders_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _orders_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.orders().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -9902,7 +9902,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "site-id", "sort-order"].iter().map(|v|*v)); @@ -9916,7 +9916,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9939,10 +9939,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placement_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -9955,7 +9955,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -9968,7 +9968,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -9991,13 +9991,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10011,8 +10011,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10089,7 +10089,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10102,7 +10102,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10115,7 +10115,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10138,10 +10138,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placement_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -10211,7 +10211,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["placement-strategy-ids", "site-ids", "search-string", "min-end-date", "directory-site-ids", "sort-field", "advertiser-ids", "archived", "ids", "max-results", "min-start-date", "page-token", "max-start-date", "sort-order", "placement-group-type", "pricing-types", "content-category-ids", "campaign-ids", "max-end-date"].iter().map(|v|*v)); @@ -10225,7 +10225,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10248,13 +10248,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_groups_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10268,8 +10268,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10346,7 +10346,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10359,7 +10359,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10372,7 +10372,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10395,13 +10395,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10415,8 +10415,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10493,7 +10493,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_groups().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10506,7 +10506,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10519,7 +10519,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10542,10 +10542,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placement_strategies().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10558,7 +10558,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10571,7 +10571,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -10586,10 +10586,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placement_strategies().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10602,7 +10602,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10615,7 +10615,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10638,13 +10638,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10658,8 +10658,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10677,7 +10677,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_strategies().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10690,7 +10690,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10703,7 +10703,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10726,10 +10726,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placement_strategies().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -10760,7 +10760,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -10774,7 +10774,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10797,13 +10797,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10817,8 +10817,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10836,7 +10836,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_strategies().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10849,7 +10849,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10862,7 +10862,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10885,13 +10885,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placement_strategies_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placement_strategies_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -10905,8 +10905,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -10924,7 +10924,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); let mut call = self.hub.placement_strategies().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -10937,7 +10937,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -10950,7 +10950,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -10973,10 +10973,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_generatetags(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_generatetags(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placements().generatetags(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tag-formats" => { @@ -10998,7 +10998,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["tag-formats", "placement-ids", "campaign-id"].iter().map(|v|*v)); @@ -11012,7 +11012,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11035,10 +11035,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placements().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11051,7 +11051,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11064,7 +11064,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11087,13 +11087,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11107,8 +11107,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -11203,7 +11203,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Placement = json::value::from_value(object).unwrap(); let mut call = self.hub.placements().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11216,7 +11216,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11229,7 +11229,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11252,10 +11252,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.placements().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -11334,7 +11334,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["site-ids", "payment-source", "pricing-types", "campaign-ids", "archived", "advertiser-ids", "size-ids", "page-token", "max-start-date", "sort-order", "max-end-date", "placement-strategy-ids", "content-category-ids", "max-results", "min-start-date", "compatibilities", "search-string", "min-end-date", "directory-site-ids", "sort-field", "ids", "group-ids"].iter().map(|v|*v)); @@ -11348,7 +11348,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11371,13 +11371,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11391,8 +11391,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -11487,7 +11487,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Placement = json::value::from_value(object).unwrap(); let mut call = self.hub.placements().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11500,7 +11500,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11513,7 +11513,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11536,13 +11536,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _placements_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _placements_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -11556,8 +11556,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -11652,7 +11652,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Placement = json::value::from_value(object).unwrap(); let mut call = self.hub.placements().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11665,7 +11665,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11678,7 +11678,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11701,10 +11701,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _platform_types_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _platform_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.platform_types().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11717,7 +11717,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11730,7 +11730,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11753,10 +11753,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _platform_types_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _platform_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.platform_types().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11769,7 +11769,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11782,7 +11782,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11805,10 +11805,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _postal_codes_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _postal_codes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.postal_codes().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("code").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11821,7 +11821,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11834,7 +11834,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11857,10 +11857,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _postal_codes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _postal_codes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.postal_codes().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11873,7 +11873,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11886,7 +11886,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11909,10 +11909,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -11925,7 +11925,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -11938,7 +11938,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -11961,10 +11961,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -11998,7 +11998,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -12012,7 +12012,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12035,10 +12035,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _regions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _regions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.regions().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12051,7 +12051,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12064,7 +12064,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12087,10 +12087,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_list_shares_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_list_shares_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.remarketing_list_shares().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("remarketing-list-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12103,7 +12103,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12116,7 +12116,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12139,13 +12139,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_list_shares_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_list_shares_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12159,8 +12159,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "shared-advertiser-ids" => Some(("sharedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12178,7 +12178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RemarketingListShare = json::value::from_value(object).unwrap(); let mut call = self.hub.remarketing_list_shares().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("remarketing-list-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12191,7 +12191,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12204,7 +12204,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12227,13 +12227,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_list_shares_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_list_shares_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12247,8 +12247,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "shared-advertiser-ids" => Some(("sharedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12266,7 +12266,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RemarketingListShare = json::value::from_value(object).unwrap(); let mut call = self.hub.remarketing_list_shares().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12279,7 +12279,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12292,7 +12292,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12315,10 +12315,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_lists_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_lists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.remarketing_lists().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12331,7 +12331,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12344,7 +12344,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12367,13 +12367,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_lists_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_lists_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12387,8 +12387,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12421,7 +12421,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); let mut call = self.hub.remarketing_lists().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12434,7 +12434,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12447,7 +12447,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12470,10 +12470,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_lists_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_lists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.remarketing_lists().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -12507,7 +12507,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["name", "sort-field", "max-results", "page-token", "sort-order", "active", "floodlight-activity-id"].iter().map(|v|*v)); @@ -12521,7 +12521,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12544,13 +12544,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_lists_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_lists_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12564,8 +12564,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12598,7 +12598,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); let mut call = self.hub.remarketing_lists().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12611,7 +12611,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12624,7 +12624,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12647,13 +12647,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _remarketing_lists_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _remarketing_lists_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12667,8 +12667,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -12701,7 +12701,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); let mut call = self.hub.remarketing_lists().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12714,7 +12714,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12727,7 +12727,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12750,13 +12750,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_compatible_fields_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_compatible_fields_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -12770,8 +12770,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -12866,7 +12866,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Report = json::value::from_value(object).unwrap(); let mut call = self.hub.reports().compatible_fields_query(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12879,7 +12879,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12892,7 +12892,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -12915,10 +12915,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12931,7 +12931,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12944,7 +12944,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -12959,11 +12959,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_files_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.reports().files_get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or(""), opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -12979,7 +12979,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -12992,7 +12992,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13020,10 +13020,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_files_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().files_list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -13048,7 +13048,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort-field", "sort-order", "max-results", "page-token"].iter().map(|v|*v)); @@ -13062,7 +13062,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13085,10 +13085,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13101,7 +13101,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13114,7 +13114,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13137,13 +13137,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -13157,8 +13157,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -13253,7 +13253,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Report = json::value::from_value(object).unwrap(); let mut call = self.hub.reports().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13266,7 +13266,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13279,7 +13279,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13302,10 +13302,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -13333,7 +13333,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort-field", "max-results", "sort-order", "page-token", "scope"].iter().map(|v|*v)); @@ -13347,7 +13347,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13370,13 +13370,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -13390,8 +13390,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -13486,7 +13486,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Report = json::value::from_value(object).unwrap(); let mut call = self.hub.reports().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13499,7 +13499,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13512,7 +13512,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13535,10 +13535,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_run(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_run(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().run(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "synchronous" => { @@ -13554,7 +13554,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["synchronous"].iter().map(|v|*v)); @@ -13568,7 +13568,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13591,13 +13591,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -13611,8 +13611,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -13707,7 +13707,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Report = json::value::from_value(object).unwrap(); let mut call = self.hub.reports().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13720,7 +13720,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13733,7 +13733,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13756,10 +13756,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sites().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13772,7 +13772,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13785,7 +13785,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13808,13 +13808,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -13828,8 +13828,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -13874,7 +13874,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Site = json::value::from_value(object).unwrap(); let mut call = self.hub.sites().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -13887,7 +13887,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -13900,7 +13900,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -13923,10 +13923,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sites().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "unmapped-site" => { @@ -13984,7 +13984,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["accepts-interstitial-placements", "accepts-publisher-paid-placements", "search-string", "subaccount-id", "directory-site-ids", "sort-field", "ids", "max-results", "page-token", "unmapped-site", "accepts-in-stream-video-placements", "ad-words-site", "campaign-ids", "approved", "sort-order"].iter().map(|v|*v)); @@ -13998,7 +13998,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14021,13 +14021,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14041,8 +14041,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -14087,7 +14087,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Site = json::value::from_value(object).unwrap(); let mut call = self.hub.sites().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14100,7 +14100,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14113,7 +14113,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14136,13 +14136,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14156,8 +14156,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -14202,7 +14202,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Site = json::value::from_value(object).unwrap(); let mut call = self.hub.sites().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14215,7 +14215,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14228,7 +14228,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14251,10 +14251,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sizes_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sizes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sizes().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14267,7 +14267,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14280,7 +14280,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14303,13 +14303,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sizes_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sizes_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14323,8 +14323,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "width" => Some(("width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -14343,7 +14343,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Size = json::value::from_value(object).unwrap(); let mut call = self.hub.sizes().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14356,7 +14356,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14369,7 +14369,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14392,10 +14392,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sizes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sizes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sizes().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "width" => { @@ -14420,7 +14420,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["iab-standard", "width", "ids", "height"].iter().map(|v|*v)); @@ -14434,7 +14434,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14457,10 +14457,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subaccounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subaccounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subaccounts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14473,7 +14473,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14486,7 +14486,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14509,13 +14509,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subaccounts_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subaccounts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14529,8 +14529,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -14549,7 +14549,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subaccount = json::value::from_value(object).unwrap(); let mut call = self.hub.subaccounts().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14562,7 +14562,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14575,7 +14575,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14598,10 +14598,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subaccounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subaccounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subaccounts().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -14632,7 +14632,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); @@ -14646,7 +14646,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14669,13 +14669,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subaccounts_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subaccounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14689,8 +14689,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -14709,7 +14709,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subaccount = json::value::from_value(object).unwrap(); let mut call = self.hub.subaccounts().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14722,7 +14722,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14735,7 +14735,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14758,13 +14758,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subaccounts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subaccounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -14778,8 +14778,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -14798,7 +14798,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subaccount = json::value::from_value(object).unwrap(); let mut call = self.hub.subaccounts().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14811,7 +14811,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14824,7 +14824,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14847,10 +14847,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _targetable_remarketing_lists_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _targetable_remarketing_lists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.targetable_remarketing_lists().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14863,7 +14863,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14876,7 +14876,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14899,10 +14899,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _targetable_remarketing_lists_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _targetable_remarketing_lists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.targetable_remarketing_lists().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -14933,7 +14933,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["name", "sort-field", "max-results", "page-token", "sort-order", "active"].iter().map(|v|*v)); @@ -14947,7 +14947,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -14970,10 +14970,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_profiles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_profiles().get(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -14986,7 +14986,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -14999,7 +14999,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15022,10 +15022,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_profiles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_profiles().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15038,7 +15038,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15051,7 +15051,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15074,10 +15074,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_role_permission_groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_role_permission_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_role_permission_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15090,7 +15090,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15103,7 +15103,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15126,10 +15126,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_role_permission_groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_role_permission_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_role_permission_groups().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15142,7 +15142,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15155,7 +15155,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15178,10 +15178,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_role_permissions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_role_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_role_permissions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15194,7 +15194,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15207,7 +15207,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15230,10 +15230,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_role_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_role_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_role_permissions().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "ids" => { @@ -15249,7 +15249,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ids"].iter().map(|v|*v)); @@ -15263,7 +15263,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15286,10 +15286,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_roles().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15302,7 +15302,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15315,7 +15315,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -15330,10 +15330,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_roles().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15346,7 +15346,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15359,7 +15359,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15382,13 +15382,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -15402,8 +15402,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -15424,7 +15424,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserRole = json::value::from_value(object).unwrap(); let mut call = self.hub.user_roles().insert(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15437,7 +15437,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15450,7 +15450,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15473,10 +15473,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_roles().list(opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "subaccount-id" => { @@ -15513,7 +15513,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["search-string", "subaccount-id", "sort-field", "ids", "max-results", "page-token", "sort-order", "account-user-role-only"].iter().map(|v|*v)); @@ -15527,7 +15527,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15550,13 +15550,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -15570,8 +15570,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -15592,7 +15592,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserRole = json::value::from_value(object).unwrap(); let mut call = self.hub.user_roles().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15605,7 +15605,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15618,7 +15618,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -15641,13 +15641,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_roles_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_roles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -15661,8 +15661,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -15683,7 +15683,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserRole = json::value::from_value(object).unwrap(); let mut call = self.hub.user_roles().update(request, opt.value_of("profile-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -15696,7 +15696,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -15709,7 +15709,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -16773,14 +16773,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "dfareporting2d2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "dfareporting2d2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -16800,7 +16800,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -16840,7 +16840,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("account-active-ad-summaries", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Gets the account's active ad summary by account ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/account-active-ad-summaries_get", vec![ @@ -16871,7 +16871,7 @@ fn main() { ]), ("account-permission-groups", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one account permission group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/account-permission-groups_get", vec![ @@ -16899,7 +16899,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of account permission groups."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/account-permission-groups_list", vec![ @@ -16924,7 +16924,7 @@ fn main() { ]), ("account-permissions", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one account permission by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/account-permissions_get", vec![ @@ -16952,7 +16952,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of account permissions."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/account-permissions_list", vec![ @@ -16977,7 +16977,7 @@ fn main() { ]), ("account-user-profiles", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one account user profile by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/account-user-profiles_get", vec![ @@ -17005,7 +17005,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new account user profile."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/account-user-profiles_insert", vec![ @@ -17033,7 +17033,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of account user profiles, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/account-user-profiles_list", vec![ @@ -17055,7 +17055,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing account user profile. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/account-user-profiles_patch", vec![ @@ -17089,7 +17089,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing account user profile."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/account-user-profiles_update", vec![ @@ -17120,7 +17120,7 @@ fn main() { ]), ("accounts", "methods: 'get', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one account by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/accounts_get", vec![ @@ -17148,7 +17148,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of accounts, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/accounts_list", vec![ @@ -17170,7 +17170,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing account. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/accounts_patch", vec![ @@ -17204,7 +17204,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing account."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/accounts_update", vec![ @@ -17235,7 +17235,7 @@ fn main() { ]), ("ads", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one ad by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/ads_get", vec![ @@ -17263,7 +17263,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new ad."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/ads_insert", vec![ @@ -17291,7 +17291,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of ads, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/ads_list", vec![ @@ -17313,7 +17313,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing ad. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/ads_patch", vec![ @@ -17347,7 +17347,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing ad."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/ads_update", vec![ @@ -17378,7 +17378,7 @@ fn main() { ]), ("advertiser-groups", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing advertiser group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertiser-groups_delete", vec![ @@ -17400,7 +17400,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one advertiser group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertiser-groups_get", vec![ @@ -17428,7 +17428,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new advertiser group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertiser-groups_insert", vec![ @@ -17456,7 +17456,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of advertiser groups, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertiser-groups_list", vec![ @@ -17478,7 +17478,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing advertiser group. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertiser-groups_patch", vec![ @@ -17512,7 +17512,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing advertiser group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertiser-groups_update", vec![ @@ -17543,7 +17543,7 @@ fn main() { ]), ("advertisers", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one advertiser by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertisers_get", vec![ @@ -17571,7 +17571,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new advertiser."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertisers_insert", vec![ @@ -17599,7 +17599,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of advertisers, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertisers_list", vec![ @@ -17621,7 +17621,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing advertiser. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertisers_patch", vec![ @@ -17655,7 +17655,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing advertiser."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/advertisers_update", vec![ @@ -17686,7 +17686,7 @@ fn main() { ]), ("browsers", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of browsers."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/browsers_list", vec![ @@ -17711,7 +17711,7 @@ fn main() { ]), ("campaign-creative-associations", "methods: 'insert' and 'list'", vec![ - ("insert", + ("insert", Some(r##"Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/campaign-creative-associations_insert", vec![ @@ -17745,7 +17745,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of creative IDs associated with the specified campaign."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/campaign-creative-associations_list", vec![ @@ -17776,7 +17776,7 @@ fn main() { ]), ("campaigns", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one campaign by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/campaigns_get", vec![ @@ -17804,7 +17804,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new campaign."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/campaigns_insert", vec![ @@ -17844,7 +17844,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of campaigns, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/campaigns_list", vec![ @@ -17866,7 +17866,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing campaign. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/campaigns_patch", vec![ @@ -17900,7 +17900,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing campaign."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/campaigns_update", vec![ @@ -17931,7 +17931,7 @@ fn main() { ]), ("change-logs", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one change log by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/change-logs_get", vec![ @@ -17959,7 +17959,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of change logs."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/change-logs_list", vec![ @@ -17984,7 +17984,7 @@ fn main() { ]), ("cities", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of cities, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/cities_list", vec![ @@ -18009,7 +18009,7 @@ fn main() { ]), ("connection-types", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one connection type by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/connection-types_get", vec![ @@ -18037,7 +18037,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of connection types."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/connection-types_list", vec![ @@ -18062,7 +18062,7 @@ fn main() { ]), ("content-categories", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing content category."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/content-categories_delete", vec![ @@ -18084,7 +18084,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one content category by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/content-categories_get", vec![ @@ -18112,7 +18112,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new content category."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/content-categories_insert", vec![ @@ -18140,7 +18140,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of content categories, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/content-categories_list", vec![ @@ -18162,7 +18162,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing content category. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/content-categories_patch", vec![ @@ -18196,7 +18196,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing content category."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/content-categories_update", vec![ @@ -18227,7 +18227,7 @@ fn main() { ]), ("countries", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one country by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/countries_get", vec![ @@ -18255,7 +18255,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of countries."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/countries_list", vec![ @@ -18280,7 +18280,7 @@ fn main() { ]), ("creative-assets", "methods: 'insert'", vec![ - ("insert", + ("insert", Some(r##"Inserts a new creative asset."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-assets_insert", vec![ @@ -18323,7 +18323,7 @@ fn main() { ]), ("creative-field-values", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing creative field value."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-field-values_delete", vec![ @@ -18351,7 +18351,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one creative field value by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-field-values_get", vec![ @@ -18385,7 +18385,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new creative field value."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-field-values_insert", vec![ @@ -18419,7 +18419,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of creative field values, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-field-values_list", vec![ @@ -18447,7 +18447,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing creative field value. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-field-values_patch", vec![ @@ -18487,7 +18487,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing creative field value."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-field-values_update", vec![ @@ -18524,7 +18524,7 @@ fn main() { ]), ("creative-fields", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing creative field."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-fields_delete", vec![ @@ -18546,7 +18546,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one creative field by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-fields_get", vec![ @@ -18574,7 +18574,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new creative field."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-fields_insert", vec![ @@ -18602,7 +18602,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of creative fields, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-fields_list", vec![ @@ -18624,7 +18624,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing creative field. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-fields_patch", vec![ @@ -18658,7 +18658,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing creative field."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-fields_update", vec![ @@ -18689,7 +18689,7 @@ fn main() { ]), ("creative-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one creative group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-groups_get", vec![ @@ -18717,7 +18717,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new creative group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-groups_insert", vec![ @@ -18745,7 +18745,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of creative groups, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-groups_list", vec![ @@ -18767,7 +18767,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing creative group. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-groups_patch", vec![ @@ -18801,7 +18801,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing creative group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creative-groups_update", vec![ @@ -18832,7 +18832,7 @@ fn main() { ]), ("creatives", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one creative by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creatives_get", vec![ @@ -18860,7 +18860,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new creative."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creatives_insert", vec![ @@ -18888,7 +18888,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of creatives, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creatives_list", vec![ @@ -18910,7 +18910,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing creative. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creatives_patch", vec![ @@ -18944,7 +18944,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing creative."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/creatives_update", vec![ @@ -18975,7 +18975,7 @@ fn main() { ]), ("dimension-values", "methods: 'query'", vec![ - ("query", + ("query", Some(r##"Retrieves list of report dimension values for a list of filters."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/dimension-values_query", vec![ @@ -19006,7 +19006,7 @@ fn main() { ]), ("directory-site-contacts", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one directory site contact by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/directory-site-contacts_get", vec![ @@ -19034,7 +19034,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of directory site contacts, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/directory-site-contacts_list", vec![ @@ -19059,7 +19059,7 @@ fn main() { ]), ("directory-sites", "methods: 'get', 'insert' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one directory site by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/directory-sites_get", vec![ @@ -19087,7 +19087,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new directory site."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/directory-sites_insert", vec![ @@ -19115,7 +19115,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of directory sites, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/directory-sites_list", vec![ @@ -19140,7 +19140,7 @@ fn main() { ]), ("event-tags", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing event tag."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/event-tags_delete", vec![ @@ -19162,7 +19162,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one event tag by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/event-tags_get", vec![ @@ -19190,7 +19190,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new event tag."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/event-tags_insert", vec![ @@ -19218,7 +19218,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of event tags, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/event-tags_list", vec![ @@ -19240,7 +19240,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing event tag. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/event-tags_patch", vec![ @@ -19274,7 +19274,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing event tag."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/event-tags_update", vec![ @@ -19305,7 +19305,7 @@ fn main() { ]), ("files", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves a report file by its report ID and file ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/files_get", vec![ @@ -19333,7 +19333,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists files for a user profile."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/files_list", vec![ @@ -19358,7 +19358,7 @@ fn main() { ]), ("floodlight-activities", "methods: 'delete', 'generatetag', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing floodlight activity."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activities_delete", vec![ @@ -19380,7 +19380,7 @@ fn main() { Some(false), Some(true)), ]), - ("generatetag", + ("generatetag", Some(r##"Generates a tag for a floodlight activity."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activities_generatetag", vec![ @@ -19402,7 +19402,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets one floodlight activity by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activities_get", vec![ @@ -19430,7 +19430,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new floodlight activity."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activities_insert", vec![ @@ -19458,7 +19458,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of floodlight activities, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activities_list", vec![ @@ -19480,7 +19480,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing floodlight activity. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activities_patch", vec![ @@ -19514,7 +19514,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing floodlight activity."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activities_update", vec![ @@ -19545,7 +19545,7 @@ fn main() { ]), ("floodlight-activity-groups", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing floodlight activity group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activity-groups_delete", vec![ @@ -19567,7 +19567,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one floodlight activity group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activity-groups_get", vec![ @@ -19595,7 +19595,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new floodlight activity group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activity-groups_insert", vec![ @@ -19623,7 +19623,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of floodlight activity groups, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activity-groups_list", vec![ @@ -19645,7 +19645,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing floodlight activity group. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activity-groups_patch", vec![ @@ -19679,7 +19679,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing floodlight activity group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-activity-groups_update", vec![ @@ -19710,7 +19710,7 @@ fn main() { ]), ("floodlight-configurations", "methods: 'get', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one floodlight configuration by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-configurations_get", vec![ @@ -19738,7 +19738,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of floodlight configurations, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-configurations_list", vec![ @@ -19760,7 +19760,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing floodlight configuration. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-configurations_patch", vec![ @@ -19794,7 +19794,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing floodlight configuration."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/floodlight-configurations_update", vec![ @@ -19825,7 +19825,7 @@ fn main() { ]), ("inventory-items", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one inventory item by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/inventory-items_get", vec![ @@ -19859,7 +19859,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of inventory items, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/inventory-items_list", vec![ @@ -19890,7 +19890,7 @@ fn main() { ]), ("landing-pages", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing campaign landing page."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/landing-pages_delete", vec![ @@ -19918,7 +19918,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one campaign landing page by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/landing-pages_get", vec![ @@ -19952,7 +19952,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new landing page for the specified campaign."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/landing-pages_insert", vec![ @@ -19986,7 +19986,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of landing pages for the specified campaign."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/landing-pages_list", vec![ @@ -20014,7 +20014,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing campaign landing page. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/landing-pages_patch", vec![ @@ -20054,7 +20054,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing campaign landing page."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/landing-pages_update", vec![ @@ -20091,7 +20091,7 @@ fn main() { ]), ("metros", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of metros."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/metros_list", vec![ @@ -20116,7 +20116,7 @@ fn main() { ]), ("mobile-carriers", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one mobile carrier by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/mobile-carriers_get", vec![ @@ -20144,7 +20144,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of mobile carriers."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/mobile-carriers_list", vec![ @@ -20169,7 +20169,7 @@ fn main() { ]), ("operating-system-versions", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one operating system version by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/operating-system-versions_get", vec![ @@ -20197,7 +20197,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of operating system versions."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/operating-system-versions_list", vec![ @@ -20222,7 +20222,7 @@ fn main() { ]), ("operating-systems", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one operating system by DART ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/operating-systems_get", vec![ @@ -20250,7 +20250,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of operating systems."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/operating-systems_list", vec![ @@ -20275,7 +20275,7 @@ fn main() { ]), ("order-documents", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one order document by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/order-documents_get", vec![ @@ -20309,7 +20309,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of order documents, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/order-documents_list", vec![ @@ -20340,7 +20340,7 @@ fn main() { ]), ("orders", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one order by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/orders_get", vec![ @@ -20374,7 +20374,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of orders, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/orders_list", vec![ @@ -20405,7 +20405,7 @@ fn main() { ]), ("placement-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one placement group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-groups_get", vec![ @@ -20433,7 +20433,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new placement group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-groups_insert", vec![ @@ -20461,7 +20461,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of placement groups, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-groups_list", vec![ @@ -20483,7 +20483,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing placement group. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-groups_patch", vec![ @@ -20517,7 +20517,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing placement group."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-groups_update", vec![ @@ -20548,7 +20548,7 @@ fn main() { ]), ("placement-strategies", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing placement strategy."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-strategies_delete", vec![ @@ -20570,7 +20570,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one placement strategy by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-strategies_get", vec![ @@ -20598,7 +20598,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new placement strategy."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-strategies_insert", vec![ @@ -20626,7 +20626,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of placement strategies, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-strategies_list", vec![ @@ -20648,7 +20648,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing placement strategy. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-strategies_patch", vec![ @@ -20682,7 +20682,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing placement strategy."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placement-strategies_update", vec![ @@ -20713,7 +20713,7 @@ fn main() { ]), ("placements", "methods: 'generatetags', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("generatetags", + ("generatetags", Some(r##"Generates tags for a placement."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placements_generatetags", vec![ @@ -20735,7 +20735,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets one placement by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placements_get", vec![ @@ -20763,7 +20763,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new placement."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placements_insert", vec![ @@ -20791,7 +20791,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of placements, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placements_list", vec![ @@ -20813,7 +20813,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing placement. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placements_patch", vec![ @@ -20847,7 +20847,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing placement."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/placements_update", vec![ @@ -20878,7 +20878,7 @@ fn main() { ]), ("platform-types", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one platform type by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/platform-types_get", vec![ @@ -20906,7 +20906,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of platform types."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/platform-types_list", vec![ @@ -20931,7 +20931,7 @@ fn main() { ]), ("postal-codes", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one postal code by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/postal-codes_get", vec![ @@ -20959,7 +20959,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of postal codes."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/postal-codes_list", vec![ @@ -20984,7 +20984,7 @@ fn main() { ]), ("projects", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one project by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/projects_get", vec![ @@ -21012,7 +21012,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of projects, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/projects_list", vec![ @@ -21037,7 +21037,7 @@ fn main() { ]), ("regions", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of regions."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/regions_list", vec![ @@ -21062,7 +21062,7 @@ fn main() { ]), ("remarketing-list-shares", "methods: 'get', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one remarketing list share by remarketing list ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/remarketing-list-shares_get", vec![ @@ -21090,7 +21090,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing remarketing list share. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/remarketing-list-shares_patch", vec![ @@ -21124,7 +21124,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing remarketing list share."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/remarketing-list-shares_update", vec![ @@ -21155,7 +21155,7 @@ fn main() { ]), ("remarketing-lists", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one remarketing list by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/remarketing-lists_get", vec![ @@ -21183,7 +21183,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new remarketing list."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/remarketing-lists_insert", vec![ @@ -21211,7 +21211,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of remarketing lists, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/remarketing-lists_list", vec![ @@ -21239,7 +21239,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing remarketing list. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/remarketing-lists_patch", vec![ @@ -21273,7 +21273,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing remarketing list."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/remarketing-lists_update", vec![ @@ -21304,7 +21304,7 @@ fn main() { ]), ("reports", "methods: 'compatible-fields-query', 'delete', 'files-get', 'files-list', 'get', 'insert', 'list', 'patch', 'run' and 'update'", vec![ - ("compatible-fields-query", + ("compatible-fields-query", Some(r##"Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/reports_compatible-fields-query", vec![ @@ -21332,7 +21332,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a report by its ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/reports_delete", vec![ @@ -21354,7 +21354,7 @@ fn main() { Some(false), Some(true)), ]), - ("files-get", + ("files-get", Some(r##"Retrieves a report file."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/reports_files-get", vec![ @@ -21388,7 +21388,7 @@ fn main() { Some(false), Some(false)), ]), - ("files-list", + ("files-list", Some(r##"Lists files for a report."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/reports_files-list", vec![ @@ -21416,7 +21416,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves a report by its ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/reports_get", vec![ @@ -21444,7 +21444,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a report."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/reports_insert", vec![ @@ -21472,7 +21472,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves list of reports."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/reports_list", vec![ @@ -21494,7 +21494,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a report. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/reports_patch", vec![ @@ -21528,7 +21528,7 @@ fn main() { Some(false), Some(false)), ]), - ("run", + ("run", Some(r##"Runs a report."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/reports_run", vec![ @@ -21556,7 +21556,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a report."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/reports_update", vec![ @@ -21593,7 +21593,7 @@ fn main() { ]), ("sites", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one site by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/sites_get", vec![ @@ -21621,7 +21621,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new site."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/sites_insert", vec![ @@ -21649,7 +21649,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of sites, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/sites_list", vec![ @@ -21671,7 +21671,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing site. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/sites_patch", vec![ @@ -21705,7 +21705,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing site."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/sites_update", vec![ @@ -21736,7 +21736,7 @@ fn main() { ]), ("sizes", "methods: 'get', 'insert' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one size by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/sizes_get", vec![ @@ -21764,7 +21764,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new size."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/sizes_insert", vec![ @@ -21792,7 +21792,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of sizes, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/sizes_list", vec![ @@ -21817,7 +21817,7 @@ fn main() { ]), ("subaccounts", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one subaccount by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/subaccounts_get", vec![ @@ -21845,7 +21845,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new subaccount."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/subaccounts_insert", vec![ @@ -21873,7 +21873,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Gets a list of subaccounts, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/subaccounts_list", vec![ @@ -21895,7 +21895,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing subaccount. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/subaccounts_patch", vec![ @@ -21929,7 +21929,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing subaccount."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/subaccounts_update", vec![ @@ -21960,7 +21960,7 @@ fn main() { ]), ("targetable-remarketing-lists", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one remarketing list by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/targetable-remarketing-lists_get", vec![ @@ -21988,7 +21988,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of targetable remarketing lists, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/targetable-remarketing-lists_list", vec![ @@ -22019,7 +22019,7 @@ fn main() { ]), ("user-profiles", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one user profile by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-profiles_get", vec![ @@ -22041,7 +22041,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves list of user profiles for a user."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-profiles_list", vec![ @@ -22060,7 +22060,7 @@ fn main() { ]), ("user-role-permission-groups", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one user role permission group by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-role-permission-groups_get", vec![ @@ -22088,7 +22088,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Gets a list of all supported user role permission groups."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-role-permission-groups_list", vec![ @@ -22113,7 +22113,7 @@ fn main() { ]), ("user-role-permissions", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets one user role permission by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-role-permissions_get", vec![ @@ -22141,7 +22141,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Gets a list of user role permissions, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-role-permissions_list", vec![ @@ -22166,7 +22166,7 @@ fn main() { ]), ("user-roles", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes an existing user role."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-roles_delete", vec![ @@ -22188,7 +22188,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets one user role by ID."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-roles_get", vec![ @@ -22216,7 +22216,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new user role."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-roles_insert", vec![ @@ -22244,7 +22244,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of user roles, possibly filtered."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-roles_list", vec![ @@ -22266,7 +22266,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing user role. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-roles_patch", vec![ @@ -22300,7 +22300,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing user role."##), "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli/user-roles_update", vec![ @@ -22334,7 +22334,7 @@ fn main() { let mut app = App::new("dfareporting2d2") .author("Sebastian Thiel ") - .version("0.3.2+20150717") + .version("0.3.3+20151109") .about("Manage your DoubleClick Campaign Manager ad campaigns and reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dfareporting2d2_cli") .arg(Arg::with_name("url") @@ -22358,7 +22358,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -22369,7 +22369,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/dfareporting2d2/Cargo.toml b/gen/dfareporting2d2/Cargo.toml index bad6dd4fd0..55680232b6 100644 --- a/gen/dfareporting2d2/Cargo.toml +++ b/gen/dfareporting2d2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d2" -version = "0.1.10+20150717" +version = "0.1.11+20151109" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d2" diff --git a/gen/dfareporting2d2/LICENSE.md b/gen/dfareporting2d2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/dfareporting2d2/LICENSE.md +++ b/gen/dfareporting2d2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/dfareporting2d2/README.md b/gen/dfareporting2d2/README.md index 57399bd38c..d2dbdf7383 100644 --- a/gen/dfareporting2d2/README.md +++ b/gen/dfareporting2d2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-dfareporting2d2` library allows access to all features of the *Google dfareporting* service. -This documentation was generated from *dfareporting* crate version *0.1.10+20150717*, where *20150717* is the exact revision of the *dfareporting:v2.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *dfareporting* crate version *0.1.11+20151109*, where *20151109* is the exact revision of the *dfareporting:v2.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *dfareporting* *v2d2* API can be found at the [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). diff --git a/gen/dfareporting2d2/src/cmn.rs b/gen/dfareporting2d2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/dfareporting2d2/src/cmn.rs +++ b/gen/dfareporting2d2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/dfareporting2d2/src/lib.rs b/gen/dfareporting2d2/src/lib.rs index 397f14ac3c..7d2db26668 100644 --- a/gen/dfareporting2d2/src/lib.rs +++ b/gen/dfareporting2d2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *dfareporting* crate version *0.1.10+20150717*, where *20150717* is the exact revision of the *dfareporting:v2.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *dfareporting* crate version *0.1.11+20151109*, where *20151109* is the exact revision of the *dfareporting:v2.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *dfareporting* *v2d2* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). diff --git a/gen/dfareporting2d2/src/lib.rs.in b/gen/dfareporting2d2/src/lib.rs.in index a8d32cfa9e..2a9769a582 100644 --- a/gen/dfareporting2d2/src/lib.rs.in +++ b/gen/dfareporting2d2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -135,7 +136,7 @@ impl<'a, C, A> Dfareporting Dfareporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -306,7 +307,7 @@ impl<'a, C, A> Dfareporting } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1088,7 +1089,10 @@ pub struct Account { /// - "33" for CHF /// - "34" for VEF /// - "35" for COP - /// - "36" for GTQ + /// - "36" for GTQ + /// - "37" for PLN + /// - "39" for INR + /// - "40" for THB #[serde(rename="currencyId")] pub currency_id: Option, /// Reporting configuration of this account. @@ -3009,7 +3013,10 @@ pub struct DirectorySite { /// - "33" for CHF /// - "34" for VEF /// - "35" for COP - /// - "36" for GTQ + /// - "36" for GTQ + /// - "37" for PLN + /// - "39" for INR + /// - "40" for THB #[serde(rename="currencyId")] pub currency_id: Option, /// Tag types for regular placements. @@ -3285,7 +3292,7 @@ pub struct CreativeCustomEvent { /// Artwork type used by the creative.This is a read-only field. #[serde(rename="artworkType")] pub artwork_type: Option, - /// Reporting ID, used to differentiate multiple videos in a single creative. + /// Video reporting ID, used to differentiate multiple videos in a single creative. This is a read-only field. #[serde(rename="videoReportingId")] pub video_reporting_id: Option, /// Properties for rich media popup windows. This field is used only for exit events. @@ -3433,7 +3440,7 @@ pub struct Creative { /// Latest Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. #[serde(rename="latestTraffickedCreativeId")] pub latest_trafficked_creative_id: Option, - /// List of counter events configured for the creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + /// List of counter events configured for the creative. For ENHANCED_IMAGE creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: ENHANCED_IMAGE, all RICH_MEDIA, and all VPAID. #[serde(rename="counterCustomEvents")] pub counter_custom_events: Option>, /// Advertiser ID of this creative. This is a required field. Applicable to all creative types. @@ -3441,7 +3448,7 @@ pub struct Creative { pub advertiser_id: Option, /// Whether the creative is active. Applicable to all creative types. pub active: Option, - /// List of timer events configured for the creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + /// List of timer events configured for the creative. For ENHANCED_IMAGE creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: ENHANCED_IMAGE, all RICH_MEDIA, and all VPAID. #[serde(rename="timerCustomEvents")] pub timer_custom_events: Option>, /// Dimension value for the rendering ID of this creative. This is a read-only field. Applicable to all creative types. @@ -3469,13 +3476,13 @@ pub struct Creative { /// The internal Flash version for this creative as calculated by DoubleClick Studio. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE, ENHANCED_BANNER, all RICH_MEDIA, and all VPAID. #[serde(rename="requiredFlashVersion")] pub required_flash_version: Option, - /// List of exit events configured for the creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + /// List of exit events configured for the creative. For ENHANCED_BANNER and ENHANCED_IMAGE creatives, these are read-only and auto-generated from clickTags, For ENHANCED_BANNER, an event is also created from the backupImageReportingLabel. Applicable to the following creative types: ENHANCED_BANNER, ENHANCED_IMAGE, all RICH_MEDIA, and all VPAID. #[serde(rename="exitCustomEvents")] pub exit_custom_events: Option>, /// ID of current rendering version. This is a read-only field. Applicable to all creative types. #[serde(rename="renderingId")] pub rendering_id: Option, - /// Description of the video ad. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + /// Description of the video ad. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. #[serde(rename="videoDescription")] pub video_description: Option, /// Third-party URL used to record backup image impressions. Applicable to the following creative types: all RICH_MEDIA @@ -3520,7 +3527,7 @@ pub struct Creative { /// Creative video duration in seconds. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO, all RICH_MEDIA, and all VPAID. #[serde(rename="videoDuration")] pub video_duration: Option, - /// URL of hosted image or another ad tag. This is a required field when applicable. Applicable to the following creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and REDIRECT + /// URL of hosted image or hosted video or another ad tag. For INSTREAM_VIDEO_REDIRECT creatives this is the in-stream video redirect URL. The standard for a VAST (Video Ad Serving Template) ad response allows for a redirect link to another VAST 2.0 or 3.0 call. This is a required field when applicable. Applicable to the following creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, REDIRECT, and INSTREAM_VIDEO_REDIRECT #[serde(rename="redirectUrl")] pub redirect_url: Option, /// Click tags of the creative. For ENHANCED_BANNER, FLASH_INPAGE, and HTML5_BANNER creatives, this is a subset of detected click tags for the assets associated with this creative. After creating a flash asset, detected click tags will be returned in the creativeAssetMetadata. When inserting the creative, populate the creative clickTags field using the creativeAssetMetadata.clickTags field. For ENHANCED_IMAGE creatives, there should be exactly one entry in this list for each image creative asset. A click tag is matched with a corresponding creative asset by matching the clickTag.name field with the creativeAsset.assetIdentifier.name field. Applicable to the following creative types: ENHANCED_BANNER, ENHANCED_IMAGE, FLASH_INPAGE, HTML5_BANNER. @@ -3563,7 +3570,7 @@ pub struct Creative { /// Whether Flash assets associated with the creative need to be automatically converted to HTML5. This flag is enabled by default and users can choose to disable it if they don't want the system to generate and use HTML5 asset for this creative. Applicable to the following creative types: ENHANCED_BANNER and FLASH_INPAGE. #[serde(rename="convertFlashToHtml5")] pub convert_flash_to_html5: Option, - /// Whether creative should be treated as SSL compliant even if the system scan shows it's not. + /// Whether creative should be treated as SSL compliant even if the system scan shows it's not. Applicable to all creative types. #[serde(rename="sslOverride")] pub ssl_override: Option, /// Creative last modification information. This is a read-only field. Applicable to all creative types. @@ -3578,10 +3585,10 @@ pub struct Creative { /// Authoring tool for HTML5 banner creatives. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. #[serde(rename="authoringTool")] pub authoring_tool: Option, - /// Third-party URLs for tracking in-stream video creative events. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + /// Third-party URLs for tracking in-stream video creative events. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. #[serde(rename="thirdPartyUrls")] pub third_party_urls: Option>, - /// List of companion creatives assigned to an in-Stream videocreative. Acceptable values include IDs of existing flash and image creatives. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + /// List of companion creatives assigned to an in-Stream videocreative. Acceptable values include IDs of existing flash and image creatives. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. #[serde(rename="companionCreatives")] pub companion_creatives: Option>, /// HTML code for the creative. This is a required field when applicable. This field is ignored if htmlCodeLocked is false. Applicable to the following creative types: all CUSTOM, FLASH_INPAGE, and HTML5_BANNER, and all RICH_MEDIA. @@ -3590,10 +3597,10 @@ pub struct Creative { /// Whether the creative is SSL-compliant. This is a read-only field. Applicable to all creative types. #[serde(rename="sslCompliant")] pub ssl_compliant: Option, - /// Industry standard ID assigned to creative for reach and frequency. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + /// Industry standard ID assigned to creative for reach and frequency. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. #[serde(rename="commercialId")] pub commercial_id: Option, - /// Whether the user can choose to skip the creative. Applicable to the following creative types: INSTREAM_VIDEO. + /// Whether the user can choose to skip the creative. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. pub skippable: Option, } @@ -12900,7 +12907,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -12943,7 +12950,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12979,7 +12986,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12989,10 +12996,10 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -13035,7 +13042,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -13053,12 +13060,12 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserRolePermissionGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13147,7 +13154,7 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -13189,7 +13196,7 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13225,7 +13232,7 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13235,10 +13242,10 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -13289,12 +13296,12 @@ impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserRolePermissionGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13384,7 +13391,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.platformTypes.get", + dlg.begin(MethodInfo { id: "dfareporting.platformTypes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -13427,7 +13434,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13463,7 +13470,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13473,10 +13480,10 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13509,7 +13516,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlatformTypeGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -13519,7 +13526,7 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> PlatformTypeGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -13537,12 +13544,12 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13559,17 +13566,17 @@ impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlatformTypeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlatformTypeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13631,7 +13638,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.platformTypes.list", + dlg.begin(MethodInfo { id: "dfareporting.platformTypes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -13673,7 +13680,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13709,7 +13716,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13719,10 +13726,10 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13755,7 +13762,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlatformTypeListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -13773,12 +13780,12 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13795,17 +13802,17 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlatformTypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlatformTypeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13876,7 +13883,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.patch", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -13920,14 +13927,14 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13971,7 +13978,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13981,10 +13988,10 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> { self._request = new_value; @@ -14026,7 +14033,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -14036,7 +14043,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -14046,7 +14053,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -14064,12 +14071,12 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValuePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValuePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14160,7 +14167,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.get", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -14204,7 +14211,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14240,7 +14247,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14250,10 +14257,10 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -14296,7 +14303,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -14306,7 +14313,7 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -14324,12 +14331,12 @@ impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValueGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14420,7 +14427,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.delete", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -14463,7 +14470,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14499,7 +14506,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14509,10 +14516,10 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -14545,7 +14552,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -14555,7 +14562,7 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -14573,12 +14580,12 @@ impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValueDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14675,7 +14682,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.insert", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -14718,14 +14725,14 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14769,7 +14776,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14779,10 +14786,10 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> { self._request = new_value; @@ -14824,7 +14831,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -14834,7 +14841,7 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -14852,12 +14859,12 @@ impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValueInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14954,7 +14961,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.update", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -14997,14 +15004,14 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15048,7 +15055,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15058,10 +15065,10 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> { self._request = new_value; @@ -15103,7 +15110,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -15113,7 +15120,7 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -15131,12 +15138,12 @@ impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValueUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15238,7 +15245,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.list", + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -15303,7 +15310,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15339,7 +15346,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15349,10 +15356,10 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -15395,7 +15402,7 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> { self._creative_field_id = new_value.to_string(); @@ -15456,12 +15463,12 @@ impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldValueListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldValueListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15557,7 +15564,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.update", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -15599,14 +15606,14 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15650,7 +15657,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15660,10 +15667,10 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> { self._request = new_value; @@ -15705,7 +15712,7 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -15723,12 +15730,12 @@ impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15831,7 +15838,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.list", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -15902,7 +15909,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15938,7 +15945,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15948,10 +15955,10 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15984,7 +15991,7 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -16053,12 +16060,12 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16075,17 +16082,17 @@ impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeFieldListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16148,7 +16155,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.delete", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -16190,7 +16197,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16226,7 +16233,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16236,10 +16243,10 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -16272,7 +16279,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -16290,12 +16297,12 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16385,7 +16392,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.get", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -16428,7 +16435,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16464,7 +16471,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16474,10 +16481,10 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16510,7 +16517,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeFieldGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -16520,7 +16527,7 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CreativeFieldGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -16538,12 +16545,12 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16560,17 +16567,17 @@ impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeFieldGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16639,7 +16646,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.insert", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -16681,14 +16688,14 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -16732,7 +16739,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16742,10 +16749,10 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> { self._request = new_value; @@ -16787,7 +16794,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -16805,12 +16812,12 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16907,7 +16914,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeFields.patch", + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -16950,14 +16957,14 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17001,7 +17008,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17011,10 +17018,10 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> { self._request = new_value; @@ -17056,7 +17063,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -17066,7 +17073,7 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -17084,12 +17091,12 @@ impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeFieldPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeFieldPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17185,7 +17192,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.insert", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -17227,14 +17234,14 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17278,7 +17285,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17288,10 +17295,10 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17323,7 +17330,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UserRole) -> UserRoleInsertCall<'a, C, A> { self._request = new_value; @@ -17333,7 +17340,7 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRoleInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -17351,12 +17358,12 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17373,17 +17380,17 @@ impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRoleInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRoleInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17446,7 +17453,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.get", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -17489,7 +17496,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17525,7 +17532,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17535,10 +17542,10 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17571,7 +17578,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRoleGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -17581,7 +17588,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserRoleGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -17599,12 +17606,12 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17621,17 +17628,17 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRoleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRoleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17700,7 +17707,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.update", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -17742,14 +17749,14 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17793,7 +17800,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17803,10 +17810,10 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17838,7 +17845,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UserRole) -> UserRoleUpdateCall<'a, C, A> { self._request = new_value; @@ -17848,7 +17855,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRoleUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -17866,12 +17873,12 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17888,17 +17895,17 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRoleUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRoleUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17961,7 +17968,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.delete", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -18003,7 +18010,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18039,7 +18046,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18049,10 +18056,10 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18075,7 +18082,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRoleDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -18085,7 +18092,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserRoleDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -18103,12 +18110,12 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18125,17 +18132,17 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRoleDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRoleDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18205,7 +18212,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.patch", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -18248,14 +18255,14 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -18299,7 +18306,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18309,10 +18316,10 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18344,7 +18351,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UserRole) -> UserRolePatchCall<'a, C, A> { self._request = new_value; @@ -18354,7 +18361,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRolePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -18364,7 +18371,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserRolePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -18382,12 +18389,12 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18404,17 +18411,17 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRolePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRolePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18492,7 +18499,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRoles.list", + dlg.begin(MethodInfo { id: "dfareporting.userRoles.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -18562,7 +18569,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18598,7 +18605,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18608,10 +18615,10 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18644,7 +18651,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -18719,12 +18726,12 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18741,17 +18748,17 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserRoleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRoleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18814,7 +18821,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.get", + dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -18857,7 +18864,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18893,7 +18900,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18903,10 +18910,10 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -18949,7 +18956,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -18967,12 +18974,12 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OperatingSystemVersionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperatingSystemVersionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19061,7 +19068,7 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.list", + dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -19103,7 +19110,7 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19139,7 +19146,7 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19149,10 +19156,10 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -19203,12 +19210,12 @@ impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OperatingSystemVersionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperatingSystemVersionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19299,7 +19306,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.get", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -19343,7 +19350,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19379,7 +19386,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19389,10 +19396,10 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19425,7 +19432,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -19435,7 +19442,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -19445,7 +19452,7 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -19463,12 +19470,12 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19485,17 +19492,17 @@ impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPageGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPageGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19565,7 +19572,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.update", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -19608,14 +19615,14 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19659,7 +19666,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19669,10 +19676,10 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19704,7 +19711,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LandingPage) -> LandingPageUpdateCall<'a, C, A> { self._request = new_value; @@ -19714,7 +19721,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPageUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -19724,7 +19731,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPageUpdateCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -19742,12 +19749,12 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19764,17 +19771,17 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPageUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPageUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19837,7 +19844,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.list", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -19880,7 +19887,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19916,7 +19923,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19926,10 +19933,10 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19962,7 +19969,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPageListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -19972,7 +19979,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPageListCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -19990,12 +19997,12 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20012,17 +20019,17 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPageListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPageListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20092,7 +20099,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.insert", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -20135,14 +20142,14 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -20186,7 +20193,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20196,10 +20203,10 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20231,7 +20238,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LandingPage) -> LandingPageInsertCall<'a, C, A> { self._request = new_value; @@ -20241,7 +20248,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPageInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -20251,7 +20258,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPageInsertCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -20269,12 +20276,12 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20291,17 +20298,17 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPageInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPageInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20372,7 +20379,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.patch", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -20416,14 +20423,14 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -20467,7 +20474,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20477,10 +20484,10 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20512,7 +20519,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LandingPage) -> LandingPagePatchCall<'a, C, A> { self._request = new_value; @@ -20522,7 +20529,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -20532,7 +20539,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -20542,7 +20549,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -20560,12 +20567,12 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20582,17 +20589,17 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPagePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPagePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20656,7 +20663,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.landingPages.delete", + dlg.begin(MethodInfo { id: "dfareporting.landingPages.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -20699,7 +20706,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -20735,7 +20742,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20745,10 +20752,10 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20771,7 +20778,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -20781,7 +20788,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -20791,7 +20798,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -20809,12 +20816,12 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20831,17 +20838,17 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LandingPageDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LandingPageDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20913,7 +20920,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeAssets.insert", + dlg.begin(MethodInfo { id: "dfareporting.creativeAssets.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -20930,13 +20937,13 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -21048,7 +21055,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21058,10 +21065,10 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> { self._request = new_value; @@ -21174,7 +21181,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -21184,7 +21191,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> { self._advertiser_id = new_value.to_string(); @@ -21202,12 +21209,12 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut CreativeAssetInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeAssetInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeAssetInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21304,7 +21311,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.insert", + dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -21347,14 +21354,14 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -21398,7 +21405,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21408,10 +21415,10 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21443,7 +21450,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CampaignCreativeAssociation) -> CampaignCreativeAssociationInsertCall<'a, C, A> { self._request = new_value; @@ -21453,7 +21460,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -21463,7 +21470,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -21481,12 +21488,12 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -21503,17 +21510,17 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignCreativeAssociationInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignCreativeAssociationInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21582,7 +21589,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.list", + dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -21634,7 +21641,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -21670,7 +21677,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21680,10 +21687,10 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21716,7 +21723,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -21726,7 +21733,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< /// /// Sets the *campaign id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn campaign_id(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { self._campaign_id = new_value.to_string(); @@ -21765,12 +21772,12 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -21787,17 +21794,17 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignCreativeAssociationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignCreativeAssociationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21879,7 +21886,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.changeLogs.list", + dlg.begin(MethodInfo { id: "dfareporting.changeLogs.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -21963,7 +21970,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -21999,7 +22006,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22009,10 +22016,10 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22045,7 +22052,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -22136,12 +22143,12 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22158,17 +22165,17 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChangeLogListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChangeLogListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22231,7 +22238,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.changeLogs.get", + dlg.begin(MethodInfo { id: "dfareporting.changeLogs.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -22274,7 +22281,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22310,7 +22317,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22320,10 +22327,10 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22356,7 +22363,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ChangeLogGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -22366,7 +22373,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ChangeLogGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -22384,12 +22391,12 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22406,17 +22413,17 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChangeLogGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChangeLogGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22479,7 +22486,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.get", + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -22522,7 +22529,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22558,7 +22565,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22568,10 +22575,10 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -22614,7 +22621,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> { self._remarketing_list_id = new_value.to_string(); @@ -22632,12 +22639,12 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListShareGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListShareGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListShareGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22734,7 +22741,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.patch", + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -22777,14 +22784,14 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -22828,7 +22835,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22838,10 +22845,10 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> { self._request = new_value; @@ -22883,7 +22890,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -22893,7 +22900,7 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> { self._remarketing_list_id = new_value.to_string(); @@ -22911,12 +22918,12 @@ impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListSharePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListSharePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23012,7 +23019,7 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.update", + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -23054,14 +23061,14 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -23105,7 +23112,7 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23115,10 +23122,10 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> { self._request = new_value; @@ -23160,7 +23167,7 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -23178,12 +23185,12 @@ impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListShareUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListShareUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23275,7 +23282,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.run", + dlg.begin(MethodInfo { id: "dfareporting.reports.run", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -23321,7 +23328,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23357,7 +23364,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23367,10 +23374,10 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23403,7 +23410,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportRunCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -23413,7 +23420,7 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportRunCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -23438,12 +23445,12 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -23460,17 +23467,17 @@ impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportRunCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportRunCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23540,7 +23547,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.patch", + dlg.begin(MethodInfo { id: "dfareporting.reports.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -23583,14 +23590,14 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -23634,7 +23641,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23644,10 +23651,10 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23679,7 +23686,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Report) -> ReportPatchCall<'a, C, A> { self._request = new_value; @@ -23689,7 +23696,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -23699,7 +23706,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportPatchCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -23717,12 +23724,12 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -23739,17 +23746,17 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23820,7 +23827,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.files.list", + dlg.begin(MethodInfo { id: "dfareporting.reports.files.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -23875,7 +23882,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23911,7 +23918,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23921,10 +23928,10 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23957,7 +23964,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -23967,7 +23974,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -24013,12 +24020,12 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -24035,17 +24042,17 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportFileListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportFileListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24114,7 +24121,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.insert", + dlg.begin(MethodInfo { id: "dfareporting.reports.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -24156,14 +24163,14 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -24207,7 +24214,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24217,10 +24224,10 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24252,7 +24259,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Report) -> ReportInsertCall<'a, C, A> { self._request = new_value; @@ -24262,7 +24269,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -24280,12 +24287,12 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -24302,17 +24309,17 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24382,7 +24389,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.update", + dlg.begin(MethodInfo { id: "dfareporting.reports.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -24425,14 +24432,14 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -24476,7 +24483,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24486,10 +24493,10 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24521,7 +24528,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Report) -> ReportUpdateCall<'a, C, A> { self._request = new_value; @@ -24531,7 +24538,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -24541,7 +24548,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportUpdateCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -24559,12 +24566,12 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -24581,17 +24588,17 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24660,7 +24667,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.compatibleFields.query", + dlg.begin(MethodInfo { id: "dfareporting.reports.compatibleFields.query", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -24702,14 +24709,14 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -24753,7 +24760,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24763,10 +24770,10 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> { self._request = new_value; @@ -24808,7 +24815,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -24826,12 +24833,12 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ReportCompatibleFieldQueryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportCompatibleFieldQueryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -24921,7 +24928,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.get", + dlg.begin(MethodInfo { id: "dfareporting.reports.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -24964,7 +24971,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25000,7 +25007,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25010,10 +25017,10 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25046,7 +25053,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -25056,7 +25063,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -25074,12 +25081,12 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25096,17 +25103,17 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25175,7 +25182,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.files.get", + dlg.begin(MethodInfo { id: "dfareporting.reports.files.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -25235,7 +25242,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25271,7 +25278,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25281,10 +25288,10 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25317,7 +25324,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -25327,7 +25334,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -25337,7 +25344,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -25355,12 +25362,12 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25377,17 +25384,17 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportFileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportFileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25450,7 +25457,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.delete", + dlg.begin(MethodInfo { id: "dfareporting.reports.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -25492,7 +25499,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25528,7 +25535,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25538,10 +25545,10 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25564,7 +25571,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -25574,7 +25581,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportDeleteCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -25592,12 +25599,12 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25614,17 +25621,17 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25696,7 +25703,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.reports.list", + dlg.begin(MethodInfo { id: "dfareporting.reports.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -25753,7 +25760,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -25789,7 +25796,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25799,10 +25806,10 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -25835,7 +25842,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ReportListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -25888,12 +25895,12 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -25910,17 +25917,17 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -25989,7 +25996,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertisers.insert", + dlg.begin(MethodInfo { id: "dfareporting.advertisers.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -26031,14 +26038,14 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -26082,7 +26089,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26092,10 +26099,10 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26127,7 +26134,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Advertiser) -> AdvertiserInsertCall<'a, C, A> { self._request = new_value; @@ -26137,7 +26144,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdvertiserInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -26155,12 +26162,12 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26177,17 +26184,17 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdvertiserInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26257,7 +26264,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertisers.patch", + dlg.begin(MethodInfo { id: "dfareporting.advertisers.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -26300,14 +26307,14 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -26351,7 +26358,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26361,10 +26368,10 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26396,7 +26403,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Advertiser) -> AdvertiserPatchCall<'a, C, A> { self._request = new_value; @@ -26406,7 +26413,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdvertiserPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -26416,7 +26423,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AdvertiserPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -26434,12 +26441,12 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26456,17 +26463,17 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdvertiserPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26552,7 +26559,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertisers.list", + dlg.begin(MethodInfo { id: "dfareporting.advertisers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -26642,7 +26649,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -26678,7 +26685,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26688,10 +26695,10 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -26724,7 +26731,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -26829,12 +26836,12 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -26851,17 +26858,17 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdvertiserListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -26930,7 +26937,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertisers.update", + dlg.begin(MethodInfo { id: "dfareporting.advertisers.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -26972,14 +26979,14 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -27023,7 +27030,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27033,10 +27040,10 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27068,7 +27075,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Advertiser) -> AdvertiserUpdateCall<'a, C, A> { self._request = new_value; @@ -27078,7 +27085,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdvertiserUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -27096,12 +27103,12 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -27118,17 +27125,17 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdvertiserUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27191,7 +27198,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertisers.get", + dlg.begin(MethodInfo { id: "dfareporting.advertisers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -27234,7 +27241,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -27270,7 +27277,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27280,10 +27287,10 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27316,7 +27323,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -27326,7 +27333,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -27344,12 +27351,12 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -27366,17 +27373,17 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdvertiserGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27449,7 +27456,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.dimensionValues.query", + dlg.begin(MethodInfo { id: "dfareporting.dimensionValues.query", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -27497,14 +27504,14 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -27548,7 +27555,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27558,10 +27565,10 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> { self._request = new_value; @@ -27603,7 +27610,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -27635,12 +27642,12 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut DimensionValueQueryCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DimensionValueQueryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DimensionValueQueryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27730,7 +27737,7 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.delete", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -27772,7 +27779,7 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -27808,7 +27815,7 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -27818,10 +27825,10 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -27854,7 +27861,7 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -27872,12 +27879,12 @@ impl<'a, C, A> FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -27967,7 +27974,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -28010,7 +28017,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -28046,7 +28053,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28056,10 +28063,10 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -28102,7 +28109,7 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -28120,12 +28127,12 @@ impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -28222,7 +28229,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.patch", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -28265,14 +28272,14 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -28316,7 +28323,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28326,10 +28333,10 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> { self._request = new_value; @@ -28371,7 +28378,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -28381,7 +28388,7 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -28399,12 +28406,12 @@ impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -28511,7 +28518,7 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -28584,7 +28591,7 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -28620,7 +28627,7 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28630,10 +28637,10 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -28748,12 +28755,12 @@ impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -28849,7 +28856,7 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.insert", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -28891,14 +28898,14 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -28942,7 +28949,7 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -28952,10 +28959,10 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> { self._request = new_value; @@ -28997,7 +29004,7 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -29015,12 +29022,12 @@ impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29116,7 +29123,7 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.update", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -29158,14 +29165,14 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -29209,7 +29216,7 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29219,10 +29226,10 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> { self._request = new_value; @@ -29264,7 +29271,7 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -29282,12 +29289,12 @@ impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29376,7 +29383,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.metros.list", + dlg.begin(MethodInfo { id: "dfareporting.metros.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -29418,7 +29425,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -29454,7 +29461,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29464,10 +29471,10 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29500,7 +29507,7 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> MetroListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -29518,12 +29525,12 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -29540,17 +29547,17 @@ impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MetroListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MetroListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29627,7 +29634,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.orders.list", + dlg.begin(MethodInfo { id: "dfareporting.orders.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -29699,7 +29706,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -29735,7 +29742,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29745,10 +29752,10 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -29781,7 +29788,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -29791,7 +29798,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -29860,12 +29867,12 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -29882,17 +29889,17 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -29956,7 +29963,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.orders.get", + dlg.begin(MethodInfo { id: "dfareporting.orders.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -30000,7 +30007,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30036,7 +30043,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30046,10 +30053,10 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30082,7 +30089,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -30092,7 +30099,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -30102,7 +30109,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -30120,12 +30127,12 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -30142,17 +30149,17 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30215,7 +30222,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.get", + dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -30258,7 +30265,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30294,7 +30301,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30304,10 +30311,10 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -30350,7 +30357,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -30368,12 +30375,12 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DirectorySiteContactGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectorySiteContactGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30476,7 +30483,7 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.list", + dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -30547,7 +30554,7 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30583,7 +30590,7 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30593,10 +30600,10 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -30698,12 +30705,12 @@ impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DirectorySiteContactListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectorySiteContactListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30791,7 +30798,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userProfiles.list", + dlg.begin(MethodInfo { id: "dfareporting.userProfiles.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -30811,7 +30818,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -30847,7 +30854,7 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30857,10 +30864,10 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -30901,12 +30908,12 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -30923,17 +30930,17 @@ impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserProfileListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserProfileListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -30995,7 +31002,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userProfiles.get", + dlg.begin(MethodInfo { id: "dfareporting.userProfiles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -31037,7 +31044,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -31073,7 +31080,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31083,10 +31090,10 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31119,7 +31126,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> UserProfileGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -31137,12 +31144,12 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -31159,17 +31166,17 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserProfileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserProfileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -31239,7 +31246,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.ads.patch", + dlg.begin(MethodInfo { id: "dfareporting.ads.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -31282,14 +31289,14 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -31333,7 +31340,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31343,10 +31350,10 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31378,7 +31385,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Ad) -> AdPatchCall<'a, C, A> { self._request = new_value; @@ -31388,7 +31395,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -31398,7 +31405,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AdPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -31416,12 +31423,12 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -31438,17 +31445,17 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -31517,7 +31524,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.ads.insert", + dlg.begin(MethodInfo { id: "dfareporting.ads.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -31559,14 +31566,14 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -31610,7 +31617,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31620,10 +31627,10 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -31655,7 +31662,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Ad) -> AdInsertCall<'a, C, A> { self._request = new_value; @@ -31665,7 +31672,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -31683,12 +31690,12 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -31705,17 +31712,17 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -31825,7 +31832,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.ads.list", + dlg.begin(MethodInfo { id: "dfareporting.ads.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((27 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -31979,7 +31986,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -32015,7 +32022,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32025,10 +32032,10 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32061,7 +32068,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -32257,12 +32264,12 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -32279,17 +32286,17 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -32352,7 +32359,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.ads.get", + dlg.begin(MethodInfo { id: "dfareporting.ads.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -32395,7 +32402,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -32431,7 +32438,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32441,10 +32448,10 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32477,7 +32484,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -32487,7 +32494,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AdGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -32505,12 +32512,12 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -32527,17 +32534,17 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -32606,7 +32613,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.ads.update", + dlg.begin(MethodInfo { id: "dfareporting.ads.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -32648,14 +32655,14 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -32699,7 +32706,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32709,10 +32716,10 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32744,7 +32751,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Ad) -> AdUpdateCall<'a, C, A> { self._request = new_value; @@ -32754,7 +32761,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AdUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -32772,12 +32779,12 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -32794,17 +32801,17 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AdUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -32867,7 +32874,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.get", + dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -32910,7 +32917,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -32946,7 +32953,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -32956,10 +32963,10 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -33002,7 +33009,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -33020,12 +33027,12 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33114,7 +33121,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.list", + dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -33156,7 +33163,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -33192,7 +33199,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33202,10 +33209,10 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -33256,12 +33263,12 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33350,7 +33357,7 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.list", + dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -33392,7 +33399,7 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -33428,7 +33435,7 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33438,10 +33445,10 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -33492,12 +33499,12 @@ impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ConnectionTypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ConnectionTypeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33587,7 +33594,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.get", + dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -33630,7 +33637,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -33666,7 +33673,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33676,10 +33683,10 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33712,7 +33719,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ConnectionTypeGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -33722,7 +33729,7 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ConnectionTypeGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -33740,12 +33747,12 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -33762,17 +33769,17 @@ impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ConnectionTypeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ConnectionTypeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -33835,7 +33842,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -33878,7 +33885,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -33914,7 +33921,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -33924,10 +33931,10 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -33970,7 +33977,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -33988,12 +33995,12 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34094,7 +34101,7 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -34158,7 +34165,7 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -34194,7 +34201,7 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -34204,10 +34211,10 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -34301,12 +34308,12 @@ impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34402,7 +34409,7 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.insert", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -34444,14 +34451,14 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -34495,7 +34502,7 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -34505,10 +34512,10 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> { self._request = new_value; @@ -34550,7 +34557,7 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -34568,12 +34575,12 @@ impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34669,7 +34676,7 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.update", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -34711,14 +34718,14 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -34762,7 +34769,7 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -34772,10 +34779,10 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> { self._request = new_value; @@ -34817,7 +34824,7 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -34835,12 +34842,12 @@ impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -34937,7 +34944,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.patch", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -34980,14 +34987,14 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -35031,7 +35038,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35041,10 +35048,10 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> { self._request = new_value; @@ -35086,7 +35093,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -35096,7 +35103,7 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -35114,12 +35121,12 @@ impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35209,7 +35216,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.delete", + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -35251,7 +35258,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -35287,7 +35294,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35297,10 +35304,10 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -35333,7 +35340,7 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -35351,12 +35358,12 @@ impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AdvertiserGroupDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AdvertiserGroupDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35452,7 +35459,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sites.insert", + dlg.begin(MethodInfo { id: "dfareporting.sites.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -35494,14 +35501,14 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -35545,7 +35552,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35555,10 +35562,10 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35590,7 +35597,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Site) -> SiteInsertCall<'a, C, A> { self._request = new_value; @@ -35600,7 +35607,7 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SiteInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -35618,12 +35625,12 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -35640,17 +35647,17 @@ impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35713,7 +35720,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sites.get", + dlg.begin(MethodInfo { id: "dfareporting.sites.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -35756,7 +35763,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -35792,7 +35799,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35802,10 +35809,10 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -35838,7 +35845,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -35848,7 +35855,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -35866,12 +35873,12 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -35888,17 +35895,17 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -35990,7 +35997,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sites.list", + dlg.begin(MethodInfo { id: "dfareporting.sites.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((18 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -36089,7 +36096,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -36125,7 +36132,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36135,10 +36142,10 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36171,7 +36178,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SiteListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -36297,12 +36304,12 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -36319,17 +36326,17 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -36398,7 +36405,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sites.update", + dlg.begin(MethodInfo { id: "dfareporting.sites.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -36440,14 +36447,14 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -36491,7 +36498,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36501,10 +36508,10 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36536,7 +36543,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Site) -> SiteUpdateCall<'a, C, A> { self._request = new_value; @@ -36546,7 +36553,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SiteUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -36564,12 +36571,12 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -36586,17 +36593,17 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -36666,7 +36673,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sites.patch", + dlg.begin(MethodInfo { id: "dfareporting.sites.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -36709,14 +36716,14 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -36760,7 +36767,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36770,10 +36777,10 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -36805,7 +36812,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Site) -> SitePatchCall<'a, C, A> { self._request = new_value; @@ -36815,7 +36822,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SitePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -36825,7 +36832,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SitePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -36843,12 +36850,12 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -36865,17 +36872,17 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SitePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SitePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -36938,7 +36945,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.get", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -36981,7 +36988,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -37017,7 +37024,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37027,10 +37034,10 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -37073,7 +37080,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -37091,12 +37098,12 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -37211,7 +37218,7 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.list", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -37300,7 +37307,7 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -37336,7 +37343,7 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37346,10 +37353,10 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -37493,12 +37500,12 @@ impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -37594,7 +37601,7 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.insert", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -37636,14 +37643,14 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -37687,7 +37694,7 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37697,10 +37704,10 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> { self._request = new_value; @@ -37742,7 +37749,7 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -37760,12 +37767,12 @@ impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -37855,7 +37862,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.delete", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -37897,7 +37904,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -37933,7 +37940,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -37943,10 +37950,10 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -37979,7 +37986,7 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -37997,12 +38004,12 @@ impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38099,7 +38106,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.patch", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -38142,14 +38149,14 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -38193,7 +38200,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38203,10 +38210,10 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> { self._request = new_value; @@ -38248,7 +38255,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -38258,7 +38265,7 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -38276,12 +38283,12 @@ impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38372,7 +38379,7 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.generatetag", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.generatetag", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -38417,7 +38424,7 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -38453,7 +38460,7 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38463,10 +38470,10 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -38524,12 +38531,12 @@ impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityGeneratetagCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityGeneratetagCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38625,7 +38632,7 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.update", + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -38667,14 +38674,14 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -38718,7 +38725,7 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38728,10 +38735,10 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> { self._request = new_value; @@ -38773,7 +38780,7 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -38791,12 +38798,12 @@ impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightActivityUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightActivityUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -38885,7 +38892,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.regions.list", + dlg.begin(MethodInfo { id: "dfareporting.regions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -38927,7 +38934,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -38963,7 +38970,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -38973,10 +38980,10 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39009,7 +39016,7 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> RegionListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -39027,12 +39034,12 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -39049,17 +39056,17 @@ impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RegionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RegionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39128,7 +39135,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.insert", + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -39170,14 +39177,14 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -39221,7 +39228,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39231,10 +39238,10 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> { self._request = new_value; @@ -39276,7 +39283,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -39294,12 +39301,12 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeGroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39389,7 +39396,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -39432,7 +39439,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -39468,7 +39475,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39478,10 +39485,10 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39514,7 +39521,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -39524,7 +39531,7 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CreativeGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -39542,12 +39549,12 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -39564,17 +39571,17 @@ impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39643,7 +39650,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.update", + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -39685,14 +39692,14 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -39736,7 +39743,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -39746,10 +39753,10 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> { self._request = new_value; @@ -39791,7 +39798,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -39809,12 +39816,12 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeGroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -39919,7 +39926,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -39993,7 +40000,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -40029,7 +40036,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40039,10 +40046,10 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40075,7 +40082,7 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -40151,12 +40158,12 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -40173,17 +40180,17 @@ impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -40253,7 +40260,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.patch", + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -40296,14 +40303,14 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -40347,7 +40354,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40357,10 +40364,10 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> { self._request = new_value; @@ -40402,7 +40409,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -40412,7 +40419,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -40430,12 +40437,12 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut CreativeGroupPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CreativeGroupPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGroupPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -40537,7 +40544,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.list", + dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -40598,7 +40605,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -40634,7 +40641,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40644,10 +40651,10 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -40690,7 +40697,7 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> { self._advertiser_id = new_value.to_string(); @@ -40750,12 +40757,12 @@ impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetableRemarketingListListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetableRemarketingListListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -40845,7 +40852,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.get", + dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -40888,7 +40895,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -40924,7 +40931,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -40934,10 +40941,10 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -40980,7 +40987,7 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -40998,12 +41005,12 @@ impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TargetableRemarketingListGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TargetableRemarketingListGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41100,7 +41107,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.subaccounts.patch", + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -41143,14 +41150,14 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -41194,7 +41201,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41204,10 +41211,10 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41239,7 +41246,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Subaccount) -> SubaccountPatchCall<'a, C, A> { self._request = new_value; @@ -41249,7 +41256,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SubaccountPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -41259,7 +41266,7 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SubaccountPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -41277,12 +41284,12 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -41299,17 +41306,17 @@ impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubaccountPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubaccountPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41378,7 +41385,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.subaccounts.insert", + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -41420,14 +41427,14 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -41471,7 +41478,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41481,10 +41488,10 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41516,7 +41523,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Subaccount) -> SubaccountInsertCall<'a, C, A> { self._request = new_value; @@ -41526,7 +41533,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SubaccountInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -41544,12 +41551,12 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -41566,17 +41573,17 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubaccountInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubaccountInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41650,7 +41657,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.subaccounts.list", + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -41714,7 +41721,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -41750,7 +41757,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41760,10 +41767,10 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -41796,7 +41803,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -41857,12 +41864,12 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -41879,17 +41886,17 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubaccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubaccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -41958,7 +41965,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.subaccounts.update", + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -42000,14 +42007,14 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -42051,7 +42058,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42061,10 +42068,10 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42096,7 +42103,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Subaccount) -> SubaccountUpdateCall<'a, C, A> { self._request = new_value; @@ -42106,7 +42113,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SubaccountUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -42124,12 +42131,12 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -42146,17 +42153,17 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubaccountUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubaccountUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42219,7 +42226,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.subaccounts.get", + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -42262,7 +42269,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -42298,7 +42305,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42308,10 +42315,10 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42344,7 +42351,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SubaccountGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -42354,7 +42361,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SubaccountGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -42372,12 +42379,12 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -42394,17 +42401,17 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubaccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubaccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42467,7 +42474,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.get", + dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -42510,7 +42517,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -42546,7 +42553,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42556,10 +42563,10 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42592,7 +42599,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> MobileCarrierGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -42602,7 +42609,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> MobileCarrierGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -42620,12 +42627,12 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -42642,17 +42649,17 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MobileCarrierGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MobileCarrierGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42714,7 +42721,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.list", + dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -42756,7 +42763,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -42792,7 +42799,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42802,10 +42809,10 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -42838,7 +42845,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> MobileCarrierListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -42856,12 +42863,12 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -42878,17 +42885,17 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MobileCarrierListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MobileCarrierListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -42951,7 +42958,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.get", + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -42994,7 +43001,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -43030,7 +43037,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43040,10 +43047,10 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -43086,7 +43093,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -43104,12 +43111,12 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightConfigurationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43205,7 +43212,7 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.update", + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -43247,14 +43254,14 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -43298,7 +43305,7 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43308,10 +43315,10 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> { self._request = new_value; @@ -43353,7 +43360,7 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -43371,12 +43378,12 @@ impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightConfigurationUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43473,7 +43480,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.patch", + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -43516,14 +43523,14 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -43567,7 +43574,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43577,10 +43584,10 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> { self._request = new_value; @@ -43622,7 +43629,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -43632,7 +43639,7 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -43650,12 +43657,12 @@ impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightConfigurationPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43746,7 +43753,7 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.list", + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -43795,7 +43802,7 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -43831,7 +43838,7 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -43841,10 +43848,10 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -43903,12 +43910,12 @@ impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> FloodlightConfigurationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FloodlightConfigurationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -43997,7 +44004,7 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.list", + dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -44039,7 +44046,7 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -44075,7 +44082,7 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44085,10 +44092,10 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -44139,12 +44146,12 @@ impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OperatingSystemListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperatingSystemListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -44234,7 +44241,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.get", + dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -44277,7 +44284,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -44313,7 +44320,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44323,10 +44330,10 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -44369,7 +44376,7 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> { self._dart_id = new_value.to_string(); @@ -44387,12 +44394,12 @@ impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> OperatingSystemGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperatingSystemGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -44491,7 +44498,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.files.list", + dlg.begin(MethodInfo { id: "dfareporting.files.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -44548,7 +44555,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -44584,7 +44591,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44594,10 +44601,10 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44630,7 +44637,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> FileListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -44683,12 +44690,12 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -44705,17 +44712,17 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -44783,7 +44790,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.files.get", + dlg.begin(MethodInfo { id: "dfareporting.files.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("reportId", self._report_id.to_string())); @@ -44842,7 +44849,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -44878,7 +44885,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44888,10 +44895,10 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -44924,7 +44931,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -44934,7 +44941,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -44952,12 +44959,12 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -44974,17 +44981,17 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -45084,7 +45091,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((22 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -45215,7 +45222,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -45251,7 +45258,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45261,10 +45268,10 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -45456,12 +45463,12 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -45557,7 +45564,7 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementGroups.update", + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -45599,14 +45606,14 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -45650,7 +45657,7 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45660,10 +45667,10 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> { self._request = new_value; @@ -45705,7 +45712,7 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -45723,12 +45730,12 @@ impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementGroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -45824,7 +45831,7 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementGroups.insert", + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -45866,14 +45873,14 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -45917,7 +45924,7 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -45927,10 +45934,10 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> { self._request = new_value; @@ -45972,7 +45979,7 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -45990,12 +45997,12 @@ impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementGroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46085,7 +46092,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -46128,7 +46135,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -46164,7 +46171,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46174,10 +46181,10 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46210,7 +46217,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -46220,7 +46227,7 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> PlacementGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -46238,12 +46245,12 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -46260,17 +46267,17 @@ impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46340,7 +46347,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementGroups.patch", + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -46383,14 +46390,14 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -46434,7 +46441,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46444,10 +46451,10 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> { self._request = new_value; @@ -46489,7 +46496,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -46499,7 +46506,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -46517,12 +46524,12 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut PlacementGroupPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementGroupPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGroupPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46628,7 +46635,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.list", + dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -46707,7 +46714,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -46743,7 +46750,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46753,10 +46760,10 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -46789,7 +46796,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -46799,7 +46806,7 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -46876,12 +46883,12 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -46898,17 +46905,17 @@ impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InventoryItemListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InventoryItemListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -46972,7 +46979,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.get", + dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -47016,7 +47023,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47052,7 +47059,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47062,10 +47069,10 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47098,7 +47105,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -47108,7 +47115,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -47118,7 +47125,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -47136,12 +47143,12 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -47158,17 +47165,17 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InventoryItemGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InventoryItemGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47231,7 +47238,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.get", + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -47274,7 +47281,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47310,7 +47317,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47320,10 +47327,10 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -47366,7 +47373,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -47384,12 +47391,12 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserRolePermissionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRolePermissionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47480,7 +47487,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.list", + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -47529,7 +47536,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47565,7 +47572,7 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47575,10 +47582,10 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -47637,12 +47644,12 @@ impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserRolePermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserRolePermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47731,7 +47738,7 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.list", + dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -47773,7 +47780,7 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -47809,7 +47816,7 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -47819,10 +47826,10 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -47873,12 +47880,12 @@ impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionGroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionGroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -47968,7 +47975,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.get", + dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -48011,7 +48018,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -48047,7 +48054,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48057,10 +48064,10 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -48103,7 +48110,7 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -48121,12 +48128,12 @@ impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionGroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionGroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48227,7 +48234,7 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.list", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -48291,7 +48298,7 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -48327,7 +48334,7 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48337,10 +48344,10 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -48434,12 +48441,12 @@ impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48535,7 +48542,7 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.update", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -48577,14 +48584,14 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -48628,7 +48635,7 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48638,10 +48645,10 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> { self._request = new_value; @@ -48683,7 +48690,7 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -48701,12 +48708,12 @@ impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -48802,7 +48809,7 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.insert", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -48844,14 +48851,14 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -48895,7 +48902,7 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -48905,10 +48912,10 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> { self._request = new_value; @@ -48950,7 +48957,7 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -48968,12 +48975,12 @@ impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -49063,7 +49070,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.delete", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -49105,7 +49112,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -49141,7 +49148,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49151,10 +49158,10 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -49187,7 +49194,7 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -49205,12 +49212,12 @@ impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -49300,7 +49307,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.get", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -49343,7 +49350,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -49379,7 +49386,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49389,10 +49396,10 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -49435,7 +49442,7 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -49453,12 +49460,12 @@ impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -49555,7 +49562,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.contentCategories.patch", + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -49598,14 +49605,14 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -49649,7 +49656,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49659,10 +49666,10 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> { self._request = new_value; @@ -49704,7 +49711,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -49714,7 +49721,7 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -49732,12 +49739,12 @@ impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ContentCategoryPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContentCategoryPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -49833,7 +49840,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creatives.update", + dlg.begin(MethodInfo { id: "dfareporting.creatives.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -49875,14 +49882,14 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -49926,7 +49933,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49936,10 +49943,10 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -49971,7 +49978,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Creative) -> CreativeUpdateCall<'a, C, A> { self._request = new_value; @@ -49981,7 +49988,7 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -49999,12 +50006,12 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -50021,17 +50028,17 @@ impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -50100,7 +50107,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creatives.insert", + dlg.begin(MethodInfo { id: "dfareporting.creatives.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -50142,14 +50149,14 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -50193,7 +50200,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50203,10 +50210,10 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50238,7 +50245,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Creative) -> CreativeInsertCall<'a, C, A> { self._request = new_value; @@ -50248,7 +50255,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -50266,12 +50273,12 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -50288,17 +50295,17 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -50361,7 +50368,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creatives.get", + dlg.begin(MethodInfo { id: "dfareporting.creatives.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -50404,7 +50411,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -50440,7 +50447,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50450,10 +50457,10 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50486,7 +50493,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -50496,7 +50503,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -50514,12 +50521,12 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -50536,17 +50543,17 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -50640,7 +50647,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creatives.list", + dlg.begin(MethodInfo { id: "dfareporting.creatives.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((19 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -50754,7 +50761,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -50790,7 +50797,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50800,10 +50807,10 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -50836,7 +50843,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -50972,12 +50979,12 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -50994,17 +51001,17 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51074,7 +51081,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.creatives.patch", + dlg.begin(MethodInfo { id: "dfareporting.creatives.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -51117,14 +51124,14 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -51168,7 +51175,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51178,10 +51185,10 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51213,7 +51220,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Creative) -> CreativePatchCall<'a, C, A> { self._request = new_value; @@ -51223,7 +51230,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CreativePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -51233,7 +51240,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CreativePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -51251,12 +51258,12 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -51273,17 +51280,17 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CreativePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CreativePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51346,7 +51353,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaigns.get", + dlg.begin(MethodInfo { id: "dfareporting.campaigns.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -51389,7 +51396,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -51425,7 +51432,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51435,10 +51442,10 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51471,7 +51478,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -51481,7 +51488,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CampaignGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -51499,12 +51506,12 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -51521,17 +51528,17 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51602,7 +51609,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaigns.insert", + dlg.begin(MethodInfo { id: "dfareporting.campaigns.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -51646,14 +51653,14 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -51697,7 +51704,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51707,10 +51714,10 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51742,7 +51749,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Campaign) -> CampaignInsertCall<'a, C, A> { self._request = new_value; @@ -51752,7 +51759,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -51762,7 +51769,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *default landing page name* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn default_landing_page_name(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { self._default_landing_page_name = new_value.to_string(); @@ -51772,7 +51779,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *default landing page url* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn default_landing_page_url(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { self._default_landing_page_url = new_value.to_string(); @@ -51790,12 +51797,12 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -51812,17 +51819,17 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -51892,7 +51899,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaigns.patch", + dlg.begin(MethodInfo { id: "dfareporting.campaigns.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -51935,14 +51942,14 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -51986,7 +51993,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -51996,10 +52003,10 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52031,7 +52038,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Campaign) -> CampaignPatchCall<'a, C, A> { self._request = new_value; @@ -52041,7 +52048,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -52051,7 +52058,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> CampaignPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -52069,12 +52076,12 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -52091,17 +52098,17 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -52170,7 +52177,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaigns.update", + dlg.begin(MethodInfo { id: "dfareporting.campaigns.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -52212,14 +52219,14 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -52263,7 +52270,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52273,10 +52280,10 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52308,7 +52315,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Campaign) -> CampaignUpdateCall<'a, C, A> { self._request = new_value; @@ -52318,7 +52325,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -52336,12 +52343,12 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -52358,17 +52365,17 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -52456,7 +52463,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.campaigns.list", + dlg.begin(MethodInfo { id: "dfareporting.campaigns.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -52553,7 +52560,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -52589,7 +52596,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52599,10 +52606,10 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52635,7 +52642,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -52748,12 +52755,12 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -52770,17 +52777,17 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CampaignListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CampaignListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -52843,7 +52850,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.delete", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -52885,7 +52892,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -52921,7 +52928,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52931,10 +52938,10 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -52957,7 +52964,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -52967,7 +52974,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> EventTagDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -52985,12 +52992,12 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -53007,17 +53014,17 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53099,7 +53106,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.list", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -53179,7 +53186,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -53215,7 +53222,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53225,10 +53232,10 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53261,7 +53268,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -53351,12 +53358,12 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -53373,17 +53380,17 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53452,7 +53459,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.insert", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -53494,14 +53501,14 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -53545,7 +53552,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53555,10 +53562,10 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53590,7 +53597,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EventTag) -> EventTagInsertCall<'a, C, A> { self._request = new_value; @@ -53600,7 +53607,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -53618,12 +53625,12 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -53640,17 +53647,17 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53720,7 +53727,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.patch", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -53763,14 +53770,14 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -53814,7 +53821,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53824,10 +53831,10 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -53859,7 +53866,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EventTag) -> EventTagPatchCall<'a, C, A> { self._request = new_value; @@ -53869,7 +53876,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -53879,7 +53886,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> EventTagPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -53897,12 +53904,12 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -53919,17 +53926,17 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -53998,7 +54005,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.update", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -54040,14 +54047,14 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -54091,7 +54098,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54101,10 +54108,10 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54136,7 +54143,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EventTag) -> EventTagUpdateCall<'a, C, A> { self._request = new_value; @@ -54146,7 +54153,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -54164,12 +54171,12 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -54186,17 +54193,17 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -54259,7 +54266,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.eventTags.get", + dlg.begin(MethodInfo { id: "dfareporting.eventTags.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -54302,7 +54309,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -54338,7 +54345,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54348,10 +54355,10 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54384,7 +54391,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> EventTagGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -54394,7 +54401,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> EventTagGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -54412,12 +54419,12 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -54434,17 +54441,17 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventTagGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventTagGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -54507,7 +54514,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.get", + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -54550,7 +54557,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -54586,7 +54593,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54596,10 +54603,10 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -54642,7 +54649,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -54660,12 +54667,12 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -54761,7 +54768,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.update", + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -54803,14 +54810,14 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -54854,7 +54861,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -54864,10 +54871,10 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> { self._request = new_value; @@ -54909,7 +54916,7 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -54927,12 +54934,12 @@ impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55036,7 +55043,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.list", + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -55100,7 +55107,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -55136,7 +55143,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55146,10 +55153,10 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -55192,7 +55199,7 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> { self._advertiser_id = new_value.to_string(); @@ -55259,12 +55266,12 @@ impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55361,7 +55368,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.patch", + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -55404,14 +55411,14 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -55455,7 +55462,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55465,10 +55472,10 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> { self._request = new_value; @@ -55510,7 +55517,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -55520,7 +55527,7 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -55538,12 +55545,12 @@ impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55639,7 +55646,7 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.insert", + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -55681,14 +55688,14 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -55732,7 +55739,7 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -55742,10 +55749,10 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> { self._request = new_value; @@ -55787,7 +55794,7 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -55805,12 +55812,12 @@ impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RemarketingListInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RemarketingListInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -55907,7 +55914,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.cities.list", + dlg.begin(MethodInfo { id: "dfareporting.cities.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -55973,7 +55980,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -56009,7 +56016,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56019,10 +56026,10 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56055,7 +56062,7 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CityListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -56104,12 +56111,12 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -56126,17 +56133,17 @@ impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CityListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CityListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56205,7 +56212,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.update", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -56247,14 +56254,14 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -56298,7 +56305,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56308,10 +56315,10 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> { self._request = new_value; @@ -56353,7 +56360,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -56371,12 +56378,12 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56466,7 +56473,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.get", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -56509,7 +56516,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -56545,7 +56552,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56555,10 +56562,10 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -56601,7 +56608,7 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -56619,12 +56626,12 @@ impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -56725,7 +56732,7 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.list", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -56789,7 +56796,7 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -56825,7 +56832,7 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -56835,10 +56842,10 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -56932,12 +56939,12 @@ impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57027,7 +57034,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.delete", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -57069,7 +57076,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -57105,7 +57112,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57115,10 +57122,10 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -57151,7 +57158,7 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -57169,12 +57176,12 @@ impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57270,7 +57277,7 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.insert", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -57312,14 +57319,14 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -57363,7 +57370,7 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57373,10 +57380,10 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> { self._request = new_value; @@ -57418,7 +57425,7 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -57436,12 +57443,12 @@ impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57538,7 +57545,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.patch", + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -57581,14 +57588,14 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -57632,7 +57639,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57642,10 +57649,10 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> { self._request = new_value; @@ -57687,7 +57694,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -57697,7 +57704,7 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -57715,12 +57722,12 @@ impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementStrategyPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementStrategyPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -57823,7 +57830,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.projects.list", + dlg.begin(MethodInfo { id: "dfareporting.projects.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -57894,7 +57901,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -57930,7 +57937,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57940,10 +57947,10 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -57976,7 +57983,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -58045,12 +58052,12 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -58067,17 +58074,17 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58140,7 +58147,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.projects.get", + dlg.begin(MethodInfo { id: "dfareporting.projects.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -58183,7 +58190,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -58219,7 +58226,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58229,10 +58236,10 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58265,7 +58272,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -58275,7 +58282,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -58293,12 +58300,12 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -58315,17 +58322,17 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58394,7 +58401,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.directorySites.insert", + dlg.begin(MethodInfo { id: "dfareporting.directorySites.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -58436,14 +58443,14 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -58487,7 +58494,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58497,10 +58504,10 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> { self._request = new_value; @@ -58542,7 +58549,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -58560,12 +58567,12 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DirectorySiteInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectorySiteInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -58680,7 +58687,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.directorySites.list", + dlg.begin(MethodInfo { id: "dfareporting.directorySites.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -58765,7 +58772,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -58801,7 +58808,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58811,10 +58818,10 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -58847,7 +58854,7 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -58957,12 +58964,12 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -58979,17 +58986,17 @@ impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DirectorySiteListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectorySiteListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -59052,7 +59059,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.directorySites.get", + dlg.begin(MethodInfo { id: "dfareporting.directorySites.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -59095,7 +59102,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -59131,7 +59138,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59141,10 +59148,10 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59177,7 +59184,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> DirectorySiteGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -59187,7 +59194,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> DirectorySiteGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -59205,12 +59212,12 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59227,17 +59234,17 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DirectorySiteGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DirectorySiteGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -59306,7 +59313,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sizes.insert", + dlg.begin(MethodInfo { id: "dfareporting.sizes.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -59348,14 +59355,14 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -59399,7 +59406,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59409,10 +59416,10 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59444,7 +59451,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Size) -> SizeInsertCall<'a, C, A> { self._request = new_value; @@ -59454,7 +59461,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SizeInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -59472,12 +59479,12 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59494,17 +59501,17 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SizeInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SizeInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -59574,7 +59581,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sizes.list", + dlg.begin(MethodInfo { id: "dfareporting.sizes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -59632,7 +59639,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -59668,7 +59675,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59678,10 +59685,10 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59714,7 +59721,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SizeListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -59761,12 +59768,12 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -59783,17 +59790,17 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SizeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SizeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -59856,7 +59863,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.sizes.get", + dlg.begin(MethodInfo { id: "dfareporting.sizes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -59899,7 +59906,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -59935,7 +59942,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59945,10 +59952,10 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -59981,7 +59988,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> SizeGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -59991,7 +59998,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SizeGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -60009,12 +60016,12 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -60031,17 +60038,17 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SizeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SizeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60104,7 +60111,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountActiveAdSummaries.get", + dlg.begin(MethodInfo { id: "dfareporting.accountActiveAdSummaries.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -60147,7 +60154,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -60183,7 +60190,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60193,10 +60200,10 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -60239,7 +60246,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> { self._summary_account_id = new_value.to_string(); @@ -60257,12 +60264,12 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountActiveAdSummaryGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountActiveAdSummaryGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60358,7 +60365,7 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.update", + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -60400,14 +60407,14 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -60451,7 +60458,7 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60461,10 +60468,10 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> { self._request = new_value; @@ -60506,7 +60513,7 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -60524,12 +60531,12 @@ impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUserProfileUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUserProfileUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60636,7 +60643,7 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.list", + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -60709,7 +60716,7 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -60745,7 +60752,7 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -60755,10 +60762,10 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -60873,12 +60880,12 @@ impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUserProfileListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUserProfileListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -60974,7 +60981,7 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.insert", + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -61016,14 +61023,14 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -61067,7 +61074,7 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61077,10 +61084,10 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> { self._request = new_value; @@ -61122,7 +61129,7 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -61140,12 +61147,12 @@ impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUserProfileInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUserProfileInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61242,7 +61249,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.patch", + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -61285,14 +61292,14 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -61336,7 +61343,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61346,10 +61353,10 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> { self._request = new_value; @@ -61391,7 +61398,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -61401,7 +61408,7 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -61419,12 +61426,12 @@ impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUserProfilePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUserProfilePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61514,7 +61521,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.get", + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -61557,7 +61564,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -61593,7 +61600,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61603,10 +61610,10 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -61649,7 +61656,7 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -61667,12 +61674,12 @@ impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountUserProfileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUserProfileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61761,7 +61768,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.countries.list", + dlg.begin(MethodInfo { id: "dfareporting.countries.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -61803,7 +61810,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -61839,7 +61846,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61849,10 +61856,10 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -61885,7 +61892,7 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CountryListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -61903,12 +61910,12 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -61925,17 +61932,17 @@ impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CountryListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CountryListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -61998,7 +62005,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.countries.get", + dlg.begin(MethodInfo { id: "dfareporting.countries.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -62041,7 +62048,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -62077,7 +62084,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62087,10 +62094,10 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62123,7 +62130,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> CountryGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -62133,7 +62140,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *dart id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dart_id(mut self, new_value: &str) -> CountryGetCall<'a, C, A> { self._dart_id = new_value.to_string(); @@ -62151,12 +62158,12 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -62173,17 +62180,17 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CountryGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CountryGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -62247,7 +62254,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.get", + dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -62291,7 +62298,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -62327,7 +62334,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62337,10 +62344,10 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62373,7 +62380,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -62383,7 +62390,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -62393,7 +62400,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -62411,12 +62418,12 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -62433,17 +62440,17 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderDocumentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderDocumentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -62524,7 +62531,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.list", + dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -62606,7 +62613,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -62642,7 +62649,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62652,10 +62659,10 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62688,7 +62695,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -62698,7 +62705,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -62782,12 +62789,12 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -62804,17 +62811,17 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OrderDocumentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OrderDocumentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -62877,7 +62884,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.postalCodes.get", + dlg.begin(MethodInfo { id: "dfareporting.postalCodes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -62920,7 +62927,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -62956,7 +62963,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -62966,10 +62973,10 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63002,7 +63009,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PostalCodeGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -63012,7 +63019,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *code* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn code(mut self, new_value: &str) -> PostalCodeGetCall<'a, C, A> { self._code = new_value.to_string(); @@ -63030,12 +63037,12 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -63052,17 +63059,17 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostalCodeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostalCodeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -63124,7 +63131,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.postalCodes.list", + dlg.begin(MethodInfo { id: "dfareporting.postalCodes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -63166,7 +63173,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -63202,7 +63209,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63212,10 +63219,10 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63248,7 +63255,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PostalCodeListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -63266,12 +63273,12 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -63288,17 +63295,17 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PostalCodeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PostalCodeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -63360,7 +63367,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.browsers.list", + dlg.begin(MethodInfo { id: "dfareporting.browsers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -63402,7 +63409,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -63438,7 +63445,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63448,10 +63455,10 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63484,7 +63491,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> BrowserListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -63502,12 +63509,12 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -63524,17 +63531,17 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BrowserListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BrowserListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -63597,7 +63604,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accounts.get", + dlg.begin(MethodInfo { id: "dfareporting.accounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -63640,7 +63647,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -63676,7 +63683,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63686,10 +63693,10 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63722,7 +63729,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -63732,7 +63739,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -63750,12 +63757,12 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -63772,17 +63779,17 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -63858,7 +63865,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accounts.list", + dlg.begin(MethodInfo { id: "dfareporting.accounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -63925,7 +63932,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -63961,7 +63968,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -63971,10 +63978,10 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64007,7 +64014,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AccountListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -64075,12 +64082,12 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -64097,17 +64104,17 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -64176,7 +64183,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accounts.update", + dlg.begin(MethodInfo { id: "dfareporting.accounts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -64218,14 +64225,14 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -64269,7 +64276,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64279,10 +64286,10 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64314,7 +64321,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountUpdateCall<'a, C, A> { self._request = new_value; @@ -64324,7 +64331,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AccountUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -64342,12 +64349,12 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -64364,17 +64371,17 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -64444,7 +64451,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.accounts.patch", + dlg.begin(MethodInfo { id: "dfareporting.accounts.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -64487,14 +64494,14 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -64538,7 +64545,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64548,10 +64555,10 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64583,7 +64590,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountPatchCall<'a, C, A> { self._request = new_value; @@ -64593,7 +64600,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -64603,7 +64610,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -64621,12 +64628,12 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -64643,17 +64650,17 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -64723,7 +64730,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.patch", + dlg.begin(MethodInfo { id: "dfareporting.placements.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -64766,14 +64773,14 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -64817,7 +64824,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64827,10 +64834,10 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -64862,7 +64869,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Placement) -> PlacementPatchCall<'a, C, A> { self._request = new_value; @@ -64872,7 +64879,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementPatchCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -64882,7 +64889,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> PlacementPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -64900,12 +64907,12 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -64922,17 +64929,17 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -65038,7 +65045,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.list", + dlg.begin(MethodInfo { id: "dfareporting.placements.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((25 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -65190,7 +65197,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -65226,7 +65233,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65236,10 +65243,10 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65272,7 +65279,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -65455,12 +65462,12 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -65477,17 +65484,17 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -65556,7 +65563,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.insert", + dlg.begin(MethodInfo { id: "dfareporting.placements.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -65598,14 +65605,14 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -65649,7 +65656,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65659,10 +65666,10 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65694,7 +65701,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Placement) -> PlacementInsertCall<'a, C, A> { self._request = new_value; @@ -65704,7 +65711,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementInsertCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -65722,12 +65729,12 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -65744,17 +65751,17 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -65823,7 +65830,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.update", + dlg.begin(MethodInfo { id: "dfareporting.placements.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -65865,14 +65872,14 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -65916,7 +65923,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65926,10 +65933,10 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -65961,7 +65968,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Placement) -> PlacementUpdateCall<'a, C, A> { self._request = new_value; @@ -65971,7 +65978,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementUpdateCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -65989,12 +65996,12 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -66011,17 +66018,17 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -66089,7 +66096,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.generatetags", + dlg.begin(MethodInfo { id: "dfareporting.placements.generatetags", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -66148,7 +66155,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -66184,7 +66191,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -66194,10 +66201,10 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut PlacementGeneratetagCall<'a, C, A> where C: BorrowMut PlacementGeneratetagCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -66271,12 +66278,12 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut PlacementGeneratetagCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PlacementGeneratetagCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGeneratetagCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -66366,7 +66373,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dfareporting.placements.get", + dlg.begin(MethodInfo { id: "dfareporting.placements.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("profileId", self._profile_id.to_string())); @@ -66409,7 +66416,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -66445,7 +66452,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -66455,10 +66462,10 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -66491,7 +66498,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *profile id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn profile_id(mut self, new_value: &str) -> PlacementGetCall<'a, C, A> { self._profile_id = new_value.to_string(); @@ -66501,7 +66508,7 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> PlacementGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -66519,12 +66526,12 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -66541,17 +66548,17 @@ impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Dfatrafficking`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlacementGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlacementGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/dfareporting2d3-cli/Cargo.toml b/gen/dfareporting2d3-cli/Cargo.toml new file mode 100644 index 0000000000..0e37866469 --- /dev/null +++ b/gen/dfareporting2d3-cli/Cargo.toml @@ -0,0 +1,35 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-dfareporting2d3-cli" +version = "0.3.3+20151109" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with dfareporting (protocol v2.3)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d3-cli" +homepage = "https://developers.google.com/doubleclick-advertisers/reporting/" +documentation = "http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli" +license = "MIT" +keywords = ["dfareporting", "google", "cli"] + +[[bin]] +name = "dfareporting2d3" + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +strsim = "0.4" +yup-hyper-mock = "1.0" +clap = "2.0" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + + +[dependencies.google-dfareporting2d3] +path = "../dfareporting2d3" diff --git a/gen/dfareporting2d3-cli/LICENSE.md b/gen/dfareporting2d3-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/dfareporting2d3-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/dfareporting2d3-cli/README.md b/gen/dfareporting2d3-cli/README.md new file mode 100644 index 0000000000..377f7baeef --- /dev/null +++ b/gen/dfareporting2d3-cli/README.md @@ -0,0 +1,358 @@ + +The `dfareporting2d3` command-line interface *(CLI)* allows to use most features of the *Google dfareporting* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *dfareporting* API can be found at the +[official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/dfareporting2d3.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/dfareporting2d3.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d3-cli). + +# Usage + +This documentation was generated from the *dfareporting* API at revision *20151109*. The CLI is at version *0.3.3*. + +```bash +dfareporting2d3 [options] + account-active-ad-summaries + get [-p ]... [-o ] + account-permission-groups + get [-p ]... [-o ] + list [-p ]... [-o ] + account-permissions + get [-p ]... [-o ] + list [-p ]... [-o ] + account-user-profiles + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + accounts + get [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + ads + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + advertiser-groups + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + advertisers + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + browsers + list [-p ]... [-o ] + campaign-creative-associations + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + campaigns + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + change-logs + get [-p ]... [-o ] + list [-p ]... [-o ] + cities + list [-p ]... [-o ] + connection-types + get [-p ]... [-o ] + list [-p ]... [-o ] + content-categories + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + countries + get [-p ]... [-o ] + list [-p ]... [-o ] + creative-assets + insert (-r )... (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] + creative-field-values + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + creative-fields + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + creative-groups + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + creatives + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + dimension-values + query (-r )... [-p ]... [-o ] + directory-site-contacts + get [-p ]... [-o ] + list [-p ]... [-o ] + directory-sites + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + event-tags + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + files + get [-p ]... [-o ] + list [-p ]... [-o ] + floodlight-activities + delete [-p ]... + generatetag [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + floodlight-activity-groups + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + floodlight-configurations + get [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + inventory-items + get [-p ]... [-o ] + list [-p ]... [-o ] + landing-pages + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + metros + list [-p ]... [-o ] + mobile-carriers + get [-p ]... [-o ] + list [-p ]... [-o ] + operating-system-versions + get [-p ]... [-o ] + list [-p ]... [-o ] + operating-systems + get [-p ]... [-o ] + list [-p ]... [-o ] + order-documents + get [-p ]... [-o ] + list [-p ]... [-o ] + orders + get [-p ]... [-o ] + list [-p ]... [-o ] + placement-groups + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + placement-strategies + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + placements + generatetags [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + platform-types + get [-p ]... [-o ] + list [-p ]... [-o ] + postal-codes + get [-p ]... [-o ] + list [-p ]... [-o ] + projects + get [-p ]... [-o ] + list [-p ]... [-o ] + regions + list [-p ]... [-o ] + remarketing-list-shares + get [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + remarketing-lists + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + reports + compatible-fields-query (-r )... [-p ]... [-o ] + delete [-p ]... + files-get [-p ]... [-o ] + files-list [-p ]... [-o ] + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + run [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + sites + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + sizes + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + subaccounts + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + targetable-remarketing-lists + get [-p ]... [-o ] + list [-p ]... [-o ] + user-profiles + get [-p ]... [-o ] + list [-p ]... [-o ] + user-role-permission-groups + get [-p ]... [-o ] + list [-p ]... [-o ] + user-role-permissions + get [-p ]... [-o ] + list [-p ]... [-o ] + user-roles + delete [-p ]... + get [-p ]... [-o ] + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + dfareporting2d3 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `dfareporting2d3-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/dfareporting2d3-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/dfareporting2d3-secret.json`, assuming that the required *dfareporting* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `dfareporting2d3 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/dfareporting2d3-cli/mkdocs.yml b/gen/dfareporting2d3-cli/mkdocs.yml new file mode 100644 index 0000000000..3b0378ba0f --- /dev/null +++ b/gen/dfareporting2d3-cli/mkdocs.yml @@ -0,0 +1,208 @@ +site_name: dfareporting v0.3.3+20151109 +site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d3-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d3-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['account-active-ad-summaries_get.md', 'Account Active Ad Summaries', 'Get'] +- ['account-permission-groups_get.md', 'Account Permission Groups', 'Get'] +- ['account-permission-groups_list.md', 'Account Permission Groups', 'List'] +- ['account-permissions_get.md', 'Account Permissions', 'Get'] +- ['account-permissions_list.md', 'Account Permissions', 'List'] +- ['account-user-profiles_get.md', 'Account User Profiles', 'Get'] +- ['account-user-profiles_insert.md', 'Account User Profiles', 'Insert'] +- ['account-user-profiles_list.md', 'Account User Profiles', 'List'] +- ['account-user-profiles_patch.md', 'Account User Profiles', 'Patch'] +- ['account-user-profiles_update.md', 'Account User Profiles', 'Update'] +- ['accounts_get.md', 'Accounts', 'Get'] +- ['accounts_list.md', 'Accounts', 'List'] +- ['accounts_patch.md', 'Accounts', 'Patch'] +- ['accounts_update.md', 'Accounts', 'Update'] +- ['ads_get.md', 'Ads', 'Get'] +- ['ads_insert.md', 'Ads', 'Insert'] +- ['ads_list.md', 'Ads', 'List'] +- ['ads_patch.md', 'Ads', 'Patch'] +- ['ads_update.md', 'Ads', 'Update'] +- ['advertiser-groups_delete.md', 'Advertiser Groups', 'Delete'] +- ['advertiser-groups_get.md', 'Advertiser Groups', 'Get'] +- ['advertiser-groups_insert.md', 'Advertiser Groups', 'Insert'] +- ['advertiser-groups_list.md', 'Advertiser Groups', 'List'] +- ['advertiser-groups_patch.md', 'Advertiser Groups', 'Patch'] +- ['advertiser-groups_update.md', 'Advertiser Groups', 'Update'] +- ['advertisers_get.md', 'Advertisers', 'Get'] +- ['advertisers_insert.md', 'Advertisers', 'Insert'] +- ['advertisers_list.md', 'Advertisers', 'List'] +- ['advertisers_patch.md', 'Advertisers', 'Patch'] +- ['advertisers_update.md', 'Advertisers', 'Update'] +- ['browsers_list.md', 'Browsers', 'List'] +- ['campaign-creative-associations_insert.md', 'Campaign Creative Associations', 'Insert'] +- ['campaign-creative-associations_list.md', 'Campaign Creative Associations', 'List'] +- ['campaigns_get.md', 'Campaigns', 'Get'] +- ['campaigns_insert.md', 'Campaigns', 'Insert'] +- ['campaigns_list.md', 'Campaigns', 'List'] +- ['campaigns_patch.md', 'Campaigns', 'Patch'] +- ['campaigns_update.md', 'Campaigns', 'Update'] +- ['change-logs_get.md', 'Change Logs', 'Get'] +- ['change-logs_list.md', 'Change Logs', 'List'] +- ['cities_list.md', 'Cities', 'List'] +- ['connection-types_get.md', 'Connection Types', 'Get'] +- ['connection-types_list.md', 'Connection Types', 'List'] +- ['content-categories_delete.md', 'Content Categories', 'Delete'] +- ['content-categories_get.md', 'Content Categories', 'Get'] +- ['content-categories_insert.md', 'Content Categories', 'Insert'] +- ['content-categories_list.md', 'Content Categories', 'List'] +- ['content-categories_patch.md', 'Content Categories', 'Patch'] +- ['content-categories_update.md', 'Content Categories', 'Update'] +- ['countries_get.md', 'Countries', 'Get'] +- ['countries_list.md', 'Countries', 'List'] +- ['creative-assets_insert.md', 'Creative Assets', 'Insert'] +- ['creative-field-values_delete.md', 'Creative Field Values', 'Delete'] +- ['creative-field-values_get.md', 'Creative Field Values', 'Get'] +- ['creative-field-values_insert.md', 'Creative Field Values', 'Insert'] +- ['creative-field-values_list.md', 'Creative Field Values', 'List'] +- ['creative-field-values_patch.md', 'Creative Field Values', 'Patch'] +- ['creative-field-values_update.md', 'Creative Field Values', 'Update'] +- ['creative-fields_delete.md', 'Creative Fields', 'Delete'] +- ['creative-fields_get.md', 'Creative Fields', 'Get'] +- ['creative-fields_insert.md', 'Creative Fields', 'Insert'] +- ['creative-fields_list.md', 'Creative Fields', 'List'] +- ['creative-fields_patch.md', 'Creative Fields', 'Patch'] +- ['creative-fields_update.md', 'Creative Fields', 'Update'] +- ['creative-groups_get.md', 'Creative Groups', 'Get'] +- ['creative-groups_insert.md', 'Creative Groups', 'Insert'] +- ['creative-groups_list.md', 'Creative Groups', 'List'] +- ['creative-groups_patch.md', 'Creative Groups', 'Patch'] +- ['creative-groups_update.md', 'Creative Groups', 'Update'] +- ['creatives_get.md', 'Creatives', 'Get'] +- ['creatives_insert.md', 'Creatives', 'Insert'] +- ['creatives_list.md', 'Creatives', 'List'] +- ['creatives_patch.md', 'Creatives', 'Patch'] +- ['creatives_update.md', 'Creatives', 'Update'] +- ['dimension-values_query.md', 'Dimension Values', 'Query'] +- ['directory-site-contacts_get.md', 'Directory Site Contacts', 'Get'] +- ['directory-site-contacts_list.md', 'Directory Site Contacts', 'List'] +- ['directory-sites_get.md', 'Directory Sites', 'Get'] +- ['directory-sites_insert.md', 'Directory Sites', 'Insert'] +- ['directory-sites_list.md', 'Directory Sites', 'List'] +- ['event-tags_delete.md', 'Event Tags', 'Delete'] +- ['event-tags_get.md', 'Event Tags', 'Get'] +- ['event-tags_insert.md', 'Event Tags', 'Insert'] +- ['event-tags_list.md', 'Event Tags', 'List'] +- ['event-tags_patch.md', 'Event Tags', 'Patch'] +- ['event-tags_update.md', 'Event Tags', 'Update'] +- ['files_get.md', 'Files', 'Get'] +- ['files_list.md', 'Files', 'List'] +- ['floodlight-activities_delete.md', 'Floodlight Activities', 'Delete'] +- ['floodlight-activities_generatetag.md', 'Floodlight Activities', 'Generatetag'] +- ['floodlight-activities_get.md', 'Floodlight Activities', 'Get'] +- ['floodlight-activities_insert.md', 'Floodlight Activities', 'Insert'] +- ['floodlight-activities_list.md', 'Floodlight Activities', 'List'] +- ['floodlight-activities_patch.md', 'Floodlight Activities', 'Patch'] +- ['floodlight-activities_update.md', 'Floodlight Activities', 'Update'] +- ['floodlight-activity-groups_get.md', 'Floodlight Activity Groups', 'Get'] +- ['floodlight-activity-groups_insert.md', 'Floodlight Activity Groups', 'Insert'] +- ['floodlight-activity-groups_list.md', 'Floodlight Activity Groups', 'List'] +- ['floodlight-activity-groups_patch.md', 'Floodlight Activity Groups', 'Patch'] +- ['floodlight-activity-groups_update.md', 'Floodlight Activity Groups', 'Update'] +- ['floodlight-configurations_get.md', 'Floodlight Configurations', 'Get'] +- ['floodlight-configurations_list.md', 'Floodlight Configurations', 'List'] +- ['floodlight-configurations_patch.md', 'Floodlight Configurations', 'Patch'] +- ['floodlight-configurations_update.md', 'Floodlight Configurations', 'Update'] +- ['inventory-items_get.md', 'Inventory Items', 'Get'] +- ['inventory-items_list.md', 'Inventory Items', 'List'] +- ['landing-pages_delete.md', 'Landing Pages', 'Delete'] +- ['landing-pages_get.md', 'Landing Pages', 'Get'] +- ['landing-pages_insert.md', 'Landing Pages', 'Insert'] +- ['landing-pages_list.md', 'Landing Pages', 'List'] +- ['landing-pages_patch.md', 'Landing Pages', 'Patch'] +- ['landing-pages_update.md', 'Landing Pages', 'Update'] +- ['metros_list.md', 'Metros', 'List'] +- ['mobile-carriers_get.md', 'Mobile Carriers', 'Get'] +- ['mobile-carriers_list.md', 'Mobile Carriers', 'List'] +- ['operating-system-versions_get.md', 'Operating System Versions', 'Get'] +- ['operating-system-versions_list.md', 'Operating System Versions', 'List'] +- ['operating-systems_get.md', 'Operating Systems', 'Get'] +- ['operating-systems_list.md', 'Operating Systems', 'List'] +- ['order-documents_get.md', 'Order Documents', 'Get'] +- ['order-documents_list.md', 'Order Documents', 'List'] +- ['orders_get.md', 'Orders', 'Get'] +- ['orders_list.md', 'Orders', 'List'] +- ['placement-groups_get.md', 'Placement Groups', 'Get'] +- ['placement-groups_insert.md', 'Placement Groups', 'Insert'] +- ['placement-groups_list.md', 'Placement Groups', 'List'] +- ['placement-groups_patch.md', 'Placement Groups', 'Patch'] +- ['placement-groups_update.md', 'Placement Groups', 'Update'] +- ['placement-strategies_delete.md', 'Placement Strategies', 'Delete'] +- ['placement-strategies_get.md', 'Placement Strategies', 'Get'] +- ['placement-strategies_insert.md', 'Placement Strategies', 'Insert'] +- ['placement-strategies_list.md', 'Placement Strategies', 'List'] +- ['placement-strategies_patch.md', 'Placement Strategies', 'Patch'] +- ['placement-strategies_update.md', 'Placement Strategies', 'Update'] +- ['placements_generatetags.md', 'Placements', 'Generatetags'] +- ['placements_get.md', 'Placements', 'Get'] +- ['placements_insert.md', 'Placements', 'Insert'] +- ['placements_list.md', 'Placements', 'List'] +- ['placements_patch.md', 'Placements', 'Patch'] +- ['placements_update.md', 'Placements', 'Update'] +- ['platform-types_get.md', 'Platform Types', 'Get'] +- ['platform-types_list.md', 'Platform Types', 'List'] +- ['postal-codes_get.md', 'Postal Codes', 'Get'] +- ['postal-codes_list.md', 'Postal Codes', 'List'] +- ['projects_get.md', 'Projects', 'Get'] +- ['projects_list.md', 'Projects', 'List'] +- ['regions_list.md', 'Regions', 'List'] +- ['remarketing-list-shares_get.md', 'Remarketing List Shares', 'Get'] +- ['remarketing-list-shares_patch.md', 'Remarketing List Shares', 'Patch'] +- ['remarketing-list-shares_update.md', 'Remarketing List Shares', 'Update'] +- ['remarketing-lists_get.md', 'Remarketing Lists', 'Get'] +- ['remarketing-lists_insert.md', 'Remarketing Lists', 'Insert'] +- ['remarketing-lists_list.md', 'Remarketing Lists', 'List'] +- ['remarketing-lists_patch.md', 'Remarketing Lists', 'Patch'] +- ['remarketing-lists_update.md', 'Remarketing Lists', 'Update'] +- ['reports_compatible-fields-query.md', 'Reports', 'Compatible Fields Query'] +- ['reports_delete.md', 'Reports', 'Delete'] +- ['reports_files-get.md', 'Reports', 'Files Get'] +- ['reports_files-list.md', 'Reports', 'Files List'] +- ['reports_get.md', 'Reports', 'Get'] +- ['reports_insert.md', 'Reports', 'Insert'] +- ['reports_list.md', 'Reports', 'List'] +- ['reports_patch.md', 'Reports', 'Patch'] +- ['reports_run.md', 'Reports', 'Run'] +- ['reports_update.md', 'Reports', 'Update'] +- ['sites_get.md', 'Sites', 'Get'] +- ['sites_insert.md', 'Sites', 'Insert'] +- ['sites_list.md', 'Sites', 'List'] +- ['sites_patch.md', 'Sites', 'Patch'] +- ['sites_update.md', 'Sites', 'Update'] +- ['sizes_get.md', 'Sizes', 'Get'] +- ['sizes_insert.md', 'Sizes', 'Insert'] +- ['sizes_list.md', 'Sizes', 'List'] +- ['subaccounts_get.md', 'Subaccounts', 'Get'] +- ['subaccounts_insert.md', 'Subaccounts', 'Insert'] +- ['subaccounts_list.md', 'Subaccounts', 'List'] +- ['subaccounts_patch.md', 'Subaccounts', 'Patch'] +- ['subaccounts_update.md', 'Subaccounts', 'Update'] +- ['targetable-remarketing-lists_get.md', 'Targetable Remarketing Lists', 'Get'] +- ['targetable-remarketing-lists_list.md', 'Targetable Remarketing Lists', 'List'] +- ['user-profiles_get.md', 'User Profiles', 'Get'] +- ['user-profiles_list.md', 'User Profiles', 'List'] +- ['user-role-permission-groups_get.md', 'User Role Permission Groups', 'Get'] +- ['user-role-permission-groups_list.md', 'User Role Permission Groups', 'List'] +- ['user-role-permissions_get.md', 'User Role Permissions', 'Get'] +- ['user-role-permissions_list.md', 'User Role Permissions', 'List'] +- ['user-roles_delete.md', 'User Roles', 'Delete'] +- ['user-roles_get.md', 'User Roles', 'Get'] +- ['user-roles_insert.md', 'User Roles', 'Insert'] +- ['user-roles_list.md', 'User Roles', 'List'] +- ['user-roles_patch.md', 'User Roles', 'Patch'] +- ['user-roles_update.md', 'User Roles', 'Update'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/dfareporting2d3-cli/src/cmn.rs b/gen/dfareporting2d3-cli/src/cmn.rs new file mode 100644 index 0000000000..ae86fdef65 --- /dev/null +++ b/gen/dfareporting2d3-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::IoError(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::IoError(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::IoError(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + IOError((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::IOError((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + IOError((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::IOError((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::IOError( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::IoError(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::IoError(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/dfareporting2d3-cli/src/main.rs b/gen/dfareporting2d3-cli/src/main.rs new file mode 100644 index 0000000000..846a8a5e4b --- /dev/null +++ b/gen/dfareporting2d3-cli/src/main.rs @@ -0,0 +1,22376 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_dfareporting2d3 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Dfareporting>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _account_active_ad_summaries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_active_ad_summaries().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("summary-account-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permission_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permission_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permission_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permission_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permissions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_permissions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_user_profiles().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.object-ids" => Some(("userRoleFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-role-filter.status" => Some(("userRoleFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.kind" => Some(("userRoleFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.object-ids" => Some(("siteFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "site-filter.status" => Some(("siteFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.kind" => Some(("siteFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-type" => Some(("traffickerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.object-ids" => Some(("advertiserFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "advertiser-filter.status" => Some(("advertiserFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.kind" => Some(("advertiserFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.object-ids" => Some(("campaignFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "campaign-filter.status" => Some(("campaignFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.kind" => Some(("campaignFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-id" => Some(("userRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-access-type" => Some(("userAccessType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-filter", "campaign-filter", "comments", "email", "id", "kind", "locale", "name", "object-ids", "site-filter", "status", "subaccount-id", "trafficker-type", "user-access-type", "user-role-filter", "user-role-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.account_user_profiles().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.account_user_profiles().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "user-role-id" => { + call = call.user_role_id(value.unwrap_or("")); + }, + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "subaccount-id", "sort-field", "ids", "max-results", "page-token", "user-role-id", "sort-order", "active"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.object-ids" => Some(("userRoleFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-role-filter.status" => Some(("userRoleFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.kind" => Some(("userRoleFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.object-ids" => Some(("siteFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "site-filter.status" => Some(("siteFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.kind" => Some(("siteFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-type" => Some(("traffickerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.object-ids" => Some(("advertiserFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "advertiser-filter.status" => Some(("advertiserFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.kind" => Some(("advertiserFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.object-ids" => Some(("campaignFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "campaign-filter.status" => Some(("campaignFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.kind" => Some(("campaignFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-id" => Some(("userRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-access-type" => Some(("userAccessType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-filter", "campaign-filter", "comments", "email", "id", "kind", "locale", "name", "object-ids", "site-filter", "status", "subaccount-id", "trafficker-type", "user-access-type", "user-role-filter", "user-role-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.account_user_profiles().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _account_user_profiles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.object-ids" => Some(("userRoleFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "user-role-filter.status" => Some(("userRoleFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-filter.kind" => Some(("userRoleFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.object-ids" => Some(("siteFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "site-filter.status" => Some(("siteFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter.kind" => Some(("siteFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-type" => Some(("traffickerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.object-ids" => Some(("advertiserFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "advertiser-filter.status" => Some(("advertiserFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-filter.kind" => Some(("advertiserFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.object-ids" => Some(("campaignFilter.objectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "campaign-filter.status" => Some(("campaignFilter.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-filter.kind" => Some(("campaignFilter.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-role-id" => Some(("userRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-access-type" => Some(("userAccessType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-filter", "campaign-filter", "comments", "email", "id", "kind", "locale", "name", "object-ids", "site-filter", "status", "subaccount-id", "trafficker-type", "user-access-type", "user-role-filter", "user-role-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AccountUserProfile = json::value::from_value(object).unwrap(); + let mut call = self.hub.account_user_profiles().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.accounts().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order", "active"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teaser-size-limit" => Some(("teaserSizeLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active-view-opt-out" => Some(("activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "maximum-image-size" => Some(("maximumImageSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-creative-size-id" => Some(("defaultCreativeSizeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-permission-ids" => Some(("accountPermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "account-profile" => Some(("accountProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.report-generation-time-zone-id" => Some(("reportsConfiguration.reportGenerationTimeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reports-configuration.exposure-to-conversion-enabled" => Some(("reportsConfiguration.exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.click-duration" => Some(("reportsConfiguration.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.post-impression-activities-duration" => Some(("reportsConfiguration.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "currency-id" => Some(("currencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comscore-vce-enabled" => Some(("comscoreVceEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "active-ads-limit-tier" => Some(("activeAdsLimitTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "country-id" => Some(("countryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-permission-ids", "account-profile", "active", "active-ads-limit-tier", "active-view-opt-out", "available-permission-ids", "click-duration", "comscore-vce-enabled", "country-id", "currency-id", "default-creative-size-id", "description", "exposure-to-conversion-enabled", "id", "kind", "locale", "lookback-configuration", "maximum-image-size", "name", "nielsen-ocr-enabled", "post-impression-activities-duration", "report-generation-time-zone-id", "reports-configuration", "teaser-size-limit"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Account = json::value::from_value(object).unwrap(); + let mut call = self.hub.accounts().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "teaser-size-limit" => Some(("teaserSizeLimit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active-view-opt-out" => Some(("activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "maximum-image-size" => Some(("maximumImageSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "locale" => Some(("locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-creative-size-id" => Some(("defaultCreativeSizeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-permission-ids" => Some(("accountPermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "account-profile" => Some(("accountProfile", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.report-generation-time-zone-id" => Some(("reportsConfiguration.reportGenerationTimeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reports-configuration.exposure-to-conversion-enabled" => Some(("reportsConfiguration.exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.click-duration" => Some(("reportsConfiguration.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "reports-configuration.lookback-configuration.post-impression-activities-duration" => Some(("reportsConfiguration.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "currency-id" => Some(("currencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comscore-vce-enabled" => Some(("comscoreVceEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "active-ads-limit-tier" => Some(("activeAdsLimitTier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "country-id" => Some(("countryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-permission-ids", "account-profile", "active", "active-ads-limit-tier", "active-view-opt-out", "available-permission-ids", "click-duration", "comscore-vce-enabled", "country-id", "currency-id", "default-creative-size-id", "description", "exposure-to-conversion-enabled", "id", "kind", "locale", "lookback-configuration", "maximum-image-size", "name", "nielsen-ocr-enabled", "post-impression-activities-duration", "report-generation-time-zone-id", "reports-configuration", "teaser-size-limit"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Account = json::value::from_value(object).unwrap(); + let mut call = self.hub.accounts().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.ads().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.priority" => Some(("deliverySchedule.priority", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.hard-cutoff" => Some(("deliverySchedule.hardCutoff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.duration" => Some(("deliverySchedule.frequencyCap.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.impressions" => Some(("deliverySchedule.frequencyCap.impressions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.impression-ratio" => Some(("deliverySchedule.impressionRatio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "creative-rotation.weight-calculation-strategy" => Some(("creativeRotation.weightCalculationStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.creative-optimization-configuration-id" => Some(("creativeRotation.creativeOptimizationConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.type" => Some(("creativeRotation.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.computed-click-through-url" => Some(("clickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.custom-click-through-url" => Some(("clickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.landing-page-id" => Some(("clickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.default-landing-page" => Some(("clickThroughUrl.defaultLandingPage", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-expression.expression" => Some(("remarketingListExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "audience-segment-id" => Some(("audienceSegmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-click-tracker" => Some(("dynamicClickTracker", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "archived", "audience-segment-id", "campaign-id", "campaign-id-dimension-value", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comments", "compatibility", "computed-click-through-url", "create-info", "creative-optimization-configuration-id", "creative-rotation", "custom-click-through-url", "day-part-targeting", "days-of-week", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page", "delivery-schedule", "dimension-name", "duration", "dynamic-click-tracker", "end-time", "etag", "exclude-countries", "expression", "frequency-cap", "geo-targeting", "hard-cutoff", "height", "hours-of-day", "iab", "id", "id-dimension-value", "impression-ratio", "impressions", "key-value-targeting-expression", "kind", "landing-page-id", "last-modified-info", "match-type", "name", "override-inherited-event-tag", "override-inherited-suffix", "priority", "remarketing-list-expression", "size", "ssl-compliant", "ssl-required", "start-time", "subaccount-id", "time", "type", "user-local-time", "value", "weight-calculation-strategy", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Ad = json::value::from_value(object).unwrap(); + let mut call = self.hub.ads().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.ads().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "type" => { + call = call.add_type(value.unwrap_or("")); + }, + "ssl-required" => { + call = call.ssl_required(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); + }, + "ssl-compliant" => { + call = call.ssl_compliant(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "size-ids" => { + call = call.add_size_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "remarketing-list-ids" => { + call = call.add_remarketing_list_ids(value.unwrap_or("")); + }, + "placement-ids" => { + call = call.add_placement_ids(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "overridden-event-tag-id" => { + call = call.overridden_event_tag_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "landing-page-ids" => { + call = call.add_landing_page_ids(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "dynamic-click-tracker" => { + call = call.dynamic_click_tracker(arg_from_str(value.unwrap_or("false"), err, "dynamic-click-tracker", "boolean")); + }, + "creative-type" => { + call = call.creative_type(value.unwrap_or("")); + }, + "creative-optimization-configuration-ids" => { + call = call.add_creative_optimization_configuration_ids(value.unwrap_or("")); + }, + "creative-ids" => { + call = call.add_creative_ids(value.unwrap_or("")); + }, + "compatibility" => { + call = call.compatibility(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "audience-segment-ids" => { + call = call.add_audience_segment_ids(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["landing-page-ids", "overridden-event-tag-id", "campaign-ids", "archived", "creative-optimization-configuration-ids", "ssl-compliant", "size-ids", "page-token", "sort-order", "type", "ssl-required", "creative-ids", "max-results", "creative-type", "placement-ids", "active", "compatibility", "advertiser-id", "search-string", "sort-field", "audience-segment-ids", "ids", "remarketing-list-ids", "dynamic-click-tracker"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.priority" => Some(("deliverySchedule.priority", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.hard-cutoff" => Some(("deliverySchedule.hardCutoff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.duration" => Some(("deliverySchedule.frequencyCap.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.impressions" => Some(("deliverySchedule.frequencyCap.impressions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.impression-ratio" => Some(("deliverySchedule.impressionRatio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "creative-rotation.weight-calculation-strategy" => Some(("creativeRotation.weightCalculationStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.creative-optimization-configuration-id" => Some(("creativeRotation.creativeOptimizationConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.type" => Some(("creativeRotation.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.computed-click-through-url" => Some(("clickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.custom-click-through-url" => Some(("clickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.landing-page-id" => Some(("clickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.default-landing-page" => Some(("clickThroughUrl.defaultLandingPage", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-expression.expression" => Some(("remarketingListExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "audience-segment-id" => Some(("audienceSegmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-click-tracker" => Some(("dynamicClickTracker", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "archived", "audience-segment-id", "campaign-id", "campaign-id-dimension-value", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comments", "compatibility", "computed-click-through-url", "create-info", "creative-optimization-configuration-id", "creative-rotation", "custom-click-through-url", "day-part-targeting", "days-of-week", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page", "delivery-schedule", "dimension-name", "duration", "dynamic-click-tracker", "end-time", "etag", "exclude-countries", "expression", "frequency-cap", "geo-targeting", "hard-cutoff", "height", "hours-of-day", "iab", "id", "id-dimension-value", "impression-ratio", "impressions", "key-value-targeting-expression", "kind", "landing-page-id", "last-modified-info", "match-type", "name", "override-inherited-event-tag", "override-inherited-suffix", "priority", "remarketing-list-expression", "size", "ssl-compliant", "ssl-required", "start-time", "subaccount-id", "time", "type", "user-local-time", "value", "weight-calculation-strategy", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Ad = json::value::from_value(object).unwrap(); + let mut call = self.hub.ads().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _ads_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "geo-targeting.exclude-countries" => Some(("geoTargeting.excludeCountries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.priority" => Some(("deliverySchedule.priority", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.hard-cutoff" => Some(("deliverySchedule.hardCutoff", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.duration" => Some(("deliverySchedule.frequencyCap.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.frequency-cap.impressions" => Some(("deliverySchedule.frequencyCap.impressions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery-schedule.impression-ratio" => Some(("deliverySchedule.impressionRatio", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "creative-rotation.weight-calculation-strategy" => Some(("creativeRotation.weightCalculationStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.creative-optimization-configuration-id" => Some(("creativeRotation.creativeOptimizationConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-rotation.type" => Some(("creativeRotation.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.computed-click-through-url" => Some(("clickThroughUrl.computedClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.custom-click-through-url" => Some(("clickThroughUrl.customClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.landing-page-id" => Some(("clickThroughUrl.landingPageId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url.default-landing-page" => Some(("clickThroughUrl.defaultLandingPage", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "comments" => Some(("comments", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-expression.expression" => Some(("remarketingListExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "audience-segment-id" => Some(("audienceSegmentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-value-targeting-expression.expression" => Some(("keyValueTargetingExpression.expression", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-time" => Some(("startTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "day-part-targeting.user-local-time" => Some(("dayPartTargeting.userLocalTime", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "day-part-targeting.hours-of-day" => Some(("dayPartTargeting.hoursOfDay", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Vec })), + "day-part-targeting.days-of-week" => Some(("dayPartTargeting.daysOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "end-time" => Some(("endTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "dynamic-click-tracker" => Some(("dynamicClickTracker", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "archived", "audience-segment-id", "campaign-id", "campaign-id-dimension-value", "click-through-url", "click-through-url-suffix", "click-through-url-suffix-properties", "comments", "compatibility", "computed-click-through-url", "create-info", "creative-optimization-configuration-id", "creative-rotation", "custom-click-through-url", "day-part-targeting", "days-of-week", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "default-landing-page", "delivery-schedule", "dimension-name", "duration", "dynamic-click-tracker", "end-time", "etag", "exclude-countries", "expression", "frequency-cap", "geo-targeting", "hard-cutoff", "height", "hours-of-day", "iab", "id", "id-dimension-value", "impression-ratio", "impressions", "key-value-targeting-expression", "kind", "landing-page-id", "last-modified-info", "match-type", "name", "override-inherited-event-tag", "override-inherited-suffix", "priority", "remarketing-list-expression", "size", "ssl-compliant", "ssl-required", "start-time", "subaccount-id", "time", "type", "user-local-time", "value", "weight-calculation-strategy", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Ad = json::value::from_value(object).unwrap(); + let mut call = self.hub.ads().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_groups().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _advertiser_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertiser_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertiser_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::AdvertiserGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertiser_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertisers().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-floodlight-configuration-id" => Some(("originalFloodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix" => Some(("clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "suspended" => Some(("suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-email" => Some(("defaultEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "click-through-url-suffix", "default-click-through-event-tag-id", "default-email", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "original-floodlight-configuration-id", "status", "subaccount-id", "suspended", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Advertiser = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertisers().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.advertisers().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "status" => { + call = call.status(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "only-parent" => { + call = call.only_parent(arg_from_str(value.unwrap_or("false"), err, "only-parent", "boolean")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "include-advertisers-without-groups-only" => { + call = call.include_advertisers_without_groups_only(arg_from_str(value.unwrap_or("false"), err, "include-advertisers-without-groups-only", "boolean")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "floodlight-configuration-ids" => { + call = call.add_floodlight_configuration_ids(value.unwrap_or("")); + }, + "advertiser-group-ids" => { + call = call.add_advertiser_group_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["status", "search-string", "subaccount-id", "include-advertisers-without-groups-only", "sort-field", "ids", "max-results", "page-token", "only-parent", "sort-order", "floodlight-configuration-ids", "advertiser-group-ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-floodlight-configuration-id" => Some(("originalFloodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix" => Some(("clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "suspended" => Some(("suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-email" => Some(("defaultEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "click-through-url-suffix", "default-click-through-event-tag-id", "default-email", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "original-floodlight-configuration-id", "status", "subaccount-id", "suspended", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Advertiser = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertisers().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _advertisers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-floodlight-configuration-id" => Some(("originalFloodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix" => Some(("clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "suspended" => Some(("suspended", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "default-email" => Some(("defaultEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "click-through-url-suffix", "default-click-through-event-tag-id", "default-email", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "original-floodlight-configuration-id", "status", "subaccount-id", "suspended", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Advertiser = json::value::from_value(object).unwrap(); + let mut call = self.hub.advertisers().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _browsers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.browsers().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaign_creative_associations_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "creative-id" => Some(("creativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["creative-id", "kind"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CampaignCreativeAssociation = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaign_creative_associations().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaign_creative_associations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.campaign_creative_associations().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "sort-order", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.campaigns().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.optimization-model" => Some(("creativeOptimizationConfiguration.optimizationModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.id" => Some(("creativeOptimizationConfiguration.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.name" => Some(("creativeOptimizationConfiguration.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-emails" => Some(("traffickerEmails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billing-invoice-code" => Some(("billingInvoiceCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comscore-vce-enabled" => Some(("comscoreVceEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "creative-group-ids" => Some(("creativeGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "billing-invoice-code", "click-duration", "click-through-url-suffix", "click-through-url-suffix-properties", "comment", "comscore-vce-enabled", "create-info", "creative-group-ids", "creative-optimization-configuration", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "dimension-name", "end-date", "etag", "external-id", "id", "id-dimension-value", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "nielsen-ocr-enabled", "optimization-model", "override-inherited-event-tag", "override-inherited-suffix", "post-impression-activities-duration", "start-date", "subaccount-id", "time", "trafficker-emails", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Campaign = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaigns().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("default-landing-page-name").unwrap_or(""), opt.value_of("default-landing-page-url").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.campaigns().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "overridden-event-tag-id" => { + call = call.overridden_event_tag_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "excluded-ids" => { + call = call.add_excluded_ids(value.unwrap_or("")); + }, + "at-least-one-optimization-activity" => { + call = call.at_least_one_optimization_activity(arg_from_str(value.unwrap_or("false"), err, "at-least-one-optimization-activity", "boolean")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + "advertiser-group-ids" => { + call = call.add_advertiser_group_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["archived", "search-string", "subaccount-id", "sort-field", "advertiser-ids", "ids", "max-results", "excluded-ids", "page-token", "advertiser-group-ids", "sort-order", "overridden-event-tag-id", "at-least-one-optimization-activity"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.optimization-model" => Some(("creativeOptimizationConfiguration.optimizationModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.id" => Some(("creativeOptimizationConfiguration.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.name" => Some(("creativeOptimizationConfiguration.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-emails" => Some(("traffickerEmails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billing-invoice-code" => Some(("billingInvoiceCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comscore-vce-enabled" => Some(("comscoreVceEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "creative-group-ids" => Some(("creativeGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "billing-invoice-code", "click-duration", "click-through-url-suffix", "click-through-url-suffix-properties", "comment", "comscore-vce-enabled", "create-info", "creative-group-ids", "creative-optimization-configuration", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "dimension-name", "end-date", "etag", "external-id", "id", "id-dimension-value", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "nielsen-ocr-enabled", "optimization-model", "override-inherited-event-tag", "override-inherited-suffix", "post-impression-activities-duration", "start-date", "subaccount-id", "time", "trafficker-emails", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Campaign = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaigns().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _campaigns_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.click-through-url-suffix" => Some(("clickThroughUrlSuffixProperties.clickThroughUrlSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "click-through-url-suffix-properties.override-inherited-suffix" => Some(("clickThroughUrlSuffixProperties.overrideInheritedSuffix", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.optimization-model" => Some(("creativeOptimizationConfiguration.optimizationModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.id" => Some(("creativeOptimizationConfiguration.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creative-optimization-configuration.name" => Some(("creativeOptimizationConfiguration.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "trafficker-emails" => Some(("traffickerEmails", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-group-id" => Some(("advertiserGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "billing-invoice-code" => Some(("billingInvoiceCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "comscore-vce-enabled" => Some(("comscoreVceEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "creative-group-ids" => Some(("creativeGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "default-click-through-event-tag-properties.override-inherited-event-tag" => Some(("defaultClickThroughEventTagProperties.overrideInheritedEventTag", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "default-click-through-event-tag-properties.default-click-through-event-tag-id" => Some(("defaultClickThroughEventTagProperties.defaultClickThroughEventTagId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "nielsen-ocr-enabled" => Some(("nielsenOcrEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-group-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "billing-invoice-code", "click-duration", "click-through-url-suffix", "click-through-url-suffix-properties", "comment", "comscore-vce-enabled", "create-info", "creative-group-ids", "creative-optimization-configuration", "default-click-through-event-tag-id", "default-click-through-event-tag-properties", "dimension-name", "end-date", "etag", "external-id", "id", "id-dimension-value", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "nielsen-ocr-enabled", "optimization-model", "override-inherited-event-tag", "override-inherited-suffix", "post-impression-activities-duration", "start-date", "subaccount-id", "time", "trafficker-emails", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Campaign = json::value::from_value(object).unwrap(); + let mut call = self.hub.campaigns().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _change_logs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.change_logs().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _change_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.change_logs().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "user-profile-ids" => { + call = call.add_user_profile_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "object-type" => { + call = call.object_type(value.unwrap_or("")); + }, + "object-ids" => { + call = call.add_object_ids(value.unwrap_or("")); + }, + "min-change-time" => { + call = call.min_change_time(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "max-change-time" => { + call = call.max_change_time(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "action" => { + call = call.action(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["min-change-time", "search-string", "max-change-time", "user-profile-ids", "ids", "max-results", "object-ids", "page-token", "action", "object-type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _cities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.cities().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "region-dart-ids" => { + call = call.add_region_dart_ids(value.unwrap_or("")); + }, + "name-prefix" => { + call = call.name_prefix(value.unwrap_or("")); + }, + "dart-ids" => { + call = call.add_dart_ids(value.unwrap_or("")); + }, + "country-dart-ids" => { + call = call.add_country_dart_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["dart-ids", "country-dart-ids", "region-dart-ids", "name-prefix"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _connection_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.connection_types().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _connection_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.connection_types().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.content_categories().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _content_categories_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.content_categories().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); + let mut call = self.hub.content_categories().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.content_categories().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); + let mut call = self.hub.content_categories().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _content_categories_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ContentCategory = json::value::from_value(object).unwrap(); + let mut call = self.hub.content_categories().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _countries_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.countries().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("dart-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _countries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.countries().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_assets_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "warned-validation-rules" => Some(("warnedValidationRules", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "detected-features" => Some(("detectedFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "asset-identifier.type" => Some(("assetIdentifier.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "asset-identifier.name" => Some(("assetIdentifier.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["asset-identifier", "detected-features", "kind", "name", "type", "warned-validation-rules"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeAssetMetadata = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_assets().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let vals = opt.values_of("mode").unwrap().collect::>(); + let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); + let mut input_file = input_file_from_opts(vals[1], err); + let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Upload(UploadProtocol::Simple) => call.upload(input_file.unwrap(), mime_type.unwrap()), + CallType::Upload(UploadProtocol::Resumable) => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), + CallType::Standard => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_field_values().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _creative_field_values_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_field_values().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_field_values().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_field_values().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_field_values().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_field_values_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "kind", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeFieldValue = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_field_values().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("creative-field-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_fields().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _creative_fields_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_fields().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeField = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_fields().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_fields().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeField = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_fields().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_fields_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeField = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_fields().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-number" => Some(("groupNumber", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "group-number", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creative_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "group-number" => { + call = call.group_number(arg_from_str(value.unwrap_or("-0"), err, "group-number", "integer")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "group-number", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-number" => Some(("groupNumber", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "group-number", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creative_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "group-number" => Some(("groupNumber", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "group-number", "id", "kind", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreativeGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.creative_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creatives().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-plugin-version" => Some(("requiredFlashPluginVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.window-height" => Some(("fsCommand.windowHeight", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.top" => Some(("fsCommand.top", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.window-width" => Some(("fsCommand.windowWidth", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.position-option" => Some(("fsCommand.positionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.left" => Some(("fsCommand.left", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.kind" => Some(("renderingIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.value" => Some(("renderingIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.dimension-name" => Some(("renderingIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.etag" => Some(("renderingIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.match-type" => Some(("renderingIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.id" => Some(("renderingIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "studio-trafficked-creative-id" => Some(("studioTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "override-css" => Some(("overrideCss", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-source" => Some(("authoringSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-version" => Some(("requiredFlashVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id" => Some(("renderingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-description" => Some(("videoDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-backup-image-impressions-url" => Some(("thirdPartyBackupImageImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "background-color" => Some(("backgroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-key-values" => Some(("customKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code" => Some(("htmlCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "total-file-size" => Some(("totalFileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-rich-media-impressions-url" => Some(("thirdPartyRichMediaImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-advertiser-id" => Some(("studioAdvertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-duration" => Some(("videoDuration", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "redirect-url" => Some(("redirectUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "commercial-id" => Some(("commercialId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-reporting-label" => Some(("backupImageReportingLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "ad-parameters" => Some(("adParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code-locked" => Some(("htmlCodeLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-tag-keys" => Some(("adTagKeys", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "convert-flash-to-html5" => Some(("convertFlashToHtml5", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ssl-override" => Some(("sslOverride", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url" => Some(("backupImageClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "studio-creative-id" => Some(("studioCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-tool" => Some(("authoringTool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-script-access" => Some(("allowScriptAccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "companion-creatives" => Some(("companionCreatives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "auto-advance-images" => Some(("auto_advance_images", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-features" => Some(("backupImageFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "backup-image-target-window.custom-html" => Some(("backupImageTargetWindow.customHtml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.target-window-option" => Some(("backupImageTargetWindow.targetWindowOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skippable" => Some(("skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "ad-parameters", "ad-tag-keys", "advertiser-id", "allow-script-access", "archived", "artwork-type", "authoring-source", "authoring-tool", "auto-advance-images", "background-color", "backup-image-click-through-url", "backup-image-features", "backup-image-reporting-label", "backup-image-target-window", "commercial-id", "companion-creatives", "compatibility", "convert-flash-to-html5", "custom-html", "custom-key-values", "dimension-name", "etag", "fs-command", "height", "html-code", "html-code-locked", "iab", "id", "id-dimension-value", "kind", "last-modified-info", "latest-trafficked-creative-id", "left", "match-type", "name", "override-css", "position-option", "redirect-url", "rendering-id", "rendering-id-dimension-value", "required-flash-plugin-version", "required-flash-version", "size", "skippable", "ssl-compliant", "ssl-override", "studio-advertiser-id", "studio-creative-id", "studio-trafficked-creative-id", "subaccount-id", "target-window-option", "third-party-backup-image-impressions-url", "third-party-rich-media-impressions-url", "time", "top", "total-file-size", "type", "value", "version", "video-description", "video-duration", "width", "window-height", "window-width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Creative = json::value::from_value(object).unwrap(); + let mut call = self.hub.creatives().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.creatives().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "types" => { + call = call.add_types(value.unwrap_or("")); + }, + "studio-creative-id" => { + call = call.studio_creative_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "size-ids" => { + call = call.add_size_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "rendering-ids" => { + call = call.add_rendering_ids(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "creative-field-ids" => { + call = call.add_creative_field_ids(value.unwrap_or("")); + }, + "companion-creative-ids" => { + call = call.add_companion_creative_ids(value.unwrap_or("")); + }, + "campaign-id" => { + call = call.campaign_id(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["advertiser-id", "archived", "search-string", "max-results", "campaign-id", "sort-field", "rendering-ids", "ids", "studio-creative-id", "size-ids", "page-token", "sort-order", "companion-creative-ids", "active", "creative-field-ids", "types"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-plugin-version" => Some(("requiredFlashPluginVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.window-height" => Some(("fsCommand.windowHeight", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.top" => Some(("fsCommand.top", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.window-width" => Some(("fsCommand.windowWidth", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.position-option" => Some(("fsCommand.positionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.left" => Some(("fsCommand.left", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.kind" => Some(("renderingIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.value" => Some(("renderingIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.dimension-name" => Some(("renderingIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.etag" => Some(("renderingIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.match-type" => Some(("renderingIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.id" => Some(("renderingIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "studio-trafficked-creative-id" => Some(("studioTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "override-css" => Some(("overrideCss", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-source" => Some(("authoringSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-version" => Some(("requiredFlashVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id" => Some(("renderingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-description" => Some(("videoDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-backup-image-impressions-url" => Some(("thirdPartyBackupImageImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "background-color" => Some(("backgroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-key-values" => Some(("customKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code" => Some(("htmlCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "total-file-size" => Some(("totalFileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-rich-media-impressions-url" => Some(("thirdPartyRichMediaImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-advertiser-id" => Some(("studioAdvertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-duration" => Some(("videoDuration", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "redirect-url" => Some(("redirectUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "commercial-id" => Some(("commercialId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-reporting-label" => Some(("backupImageReportingLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "ad-parameters" => Some(("adParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code-locked" => Some(("htmlCodeLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-tag-keys" => Some(("adTagKeys", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "convert-flash-to-html5" => Some(("convertFlashToHtml5", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ssl-override" => Some(("sslOverride", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url" => Some(("backupImageClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "studio-creative-id" => Some(("studioCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-tool" => Some(("authoringTool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-script-access" => Some(("allowScriptAccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "companion-creatives" => Some(("companionCreatives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "auto-advance-images" => Some(("auto_advance_images", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-features" => Some(("backupImageFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "backup-image-target-window.custom-html" => Some(("backupImageTargetWindow.customHtml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.target-window-option" => Some(("backupImageTargetWindow.targetWindowOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skippable" => Some(("skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "ad-parameters", "ad-tag-keys", "advertiser-id", "allow-script-access", "archived", "artwork-type", "authoring-source", "authoring-tool", "auto-advance-images", "background-color", "backup-image-click-through-url", "backup-image-features", "backup-image-reporting-label", "backup-image-target-window", "commercial-id", "companion-creatives", "compatibility", "convert-flash-to-html5", "custom-html", "custom-key-values", "dimension-name", "etag", "fs-command", "height", "html-code", "html-code-locked", "iab", "id", "id-dimension-value", "kind", "last-modified-info", "latest-trafficked-creative-id", "left", "match-type", "name", "override-css", "position-option", "redirect-url", "rendering-id", "rendering-id-dimension-value", "required-flash-plugin-version", "required-flash-version", "size", "skippable", "ssl-compliant", "ssl-override", "studio-advertiser-id", "studio-creative-id", "studio-trafficked-creative-id", "subaccount-id", "target-window-option", "third-party-backup-image-impressions-url", "third-party-rich-media-impressions-url", "time", "top", "total-file-size", "type", "value", "version", "video-description", "video-duration", "width", "window-height", "window-width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Creative = json::value::from_value(object).unwrap(); + let mut call = self.hub.creatives().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _creatives_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "artwork-type" => Some(("artworkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "latest-trafficked-creative-id" => Some(("latestTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-plugin-version" => Some(("requiredFlashPluginVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.window-height" => Some(("fsCommand.windowHeight", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.top" => Some(("fsCommand.top", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.window-width" => Some(("fsCommand.windowWidth", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "fs-command.position-option" => Some(("fsCommand.positionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fs-command.left" => Some(("fsCommand.left", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.kind" => Some(("renderingIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.value" => Some(("renderingIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.dimension-name" => Some(("renderingIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.etag" => Some(("renderingIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.match-type" => Some(("renderingIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "rendering-id-dimension-value.id" => Some(("renderingIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "studio-trafficked-creative-id" => Some(("studioTraffickedCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "override-css" => Some(("overrideCss", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-source" => Some(("authoringSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "required-flash-version" => Some(("requiredFlashVersion", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "rendering-id" => Some(("renderingId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-description" => Some(("videoDescription", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-backup-image-impressions-url" => Some(("thirdPartyBackupImageImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "background-color" => Some(("backgroundColor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "custom-key-values" => Some(("customKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code" => Some(("htmlCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "total-file-size" => Some(("totalFileSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "third-party-rich-media-impressions-url" => Some(("thirdPartyRichMediaImpressionsUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "studio-advertiser-id" => Some(("studioAdvertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-duration" => Some(("videoDuration", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "redirect-url" => Some(("redirectUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "commercial-id" => Some(("commercialId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-reporting-label" => Some(("backupImageReportingLabel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "ad-parameters" => Some(("adParameters", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-code-locked" => Some(("htmlCodeLocked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ad-tag-keys" => Some(("adTagKeys", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "convert-flash-to-html5" => Some(("convertFlashToHtml5", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "ssl-override" => Some(("sslOverride", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-click-through-url" => Some(("backupImageClickThroughUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "studio-creative-id" => Some(("studioCreativeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "authoring-tool" => Some(("authoringTool", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-script-access" => Some(("allowScriptAccess", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "companion-creatives" => Some(("companionCreatives", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "auto-advance-images" => Some(("auto_advance_images", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "backup-image-features" => Some(("backupImageFeatures", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "backup-image-target-window.custom-html" => Some(("backupImageTargetWindow.customHtml", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "backup-image-target-window.target-window-option" => Some(("backupImageTargetWindow.targetWindowOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "skippable" => Some(("skippable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "ad-parameters", "ad-tag-keys", "advertiser-id", "allow-script-access", "archived", "artwork-type", "authoring-source", "authoring-tool", "auto-advance-images", "background-color", "backup-image-click-through-url", "backup-image-features", "backup-image-reporting-label", "backup-image-target-window", "commercial-id", "companion-creatives", "compatibility", "convert-flash-to-html5", "custom-html", "custom-key-values", "dimension-name", "etag", "fs-command", "height", "html-code", "html-code-locked", "iab", "id", "id-dimension-value", "kind", "last-modified-info", "latest-trafficked-creative-id", "left", "match-type", "name", "override-css", "position-option", "redirect-url", "rendering-id", "rendering-id-dimension-value", "required-flash-plugin-version", "required-flash-version", "size", "skippable", "ssl-compliant", "ssl-override", "studio-advertiser-id", "studio-creative-id", "studio-trafficked-creative-id", "subaccount-id", "target-window-option", "third-party-backup-image-impressions-url", "third-party-rich-media-impressions-url", "time", "top", "total-file-size", "type", "value", "version", "video-description", "video-duration", "width", "window-height", "window-width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Creative = json::value::from_value(object).unwrap(); + let mut call = self.hub.creatives().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _dimension_values_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "dimension-name" => Some(("dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["dimension-name", "end-date", "kind", "start-date"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DimensionValueRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.dimension_values().query(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_site_contacts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.directory_site_contacts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_site_contacts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.directory_site_contacts().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "directory-site-ids", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.directory_sites().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_sites_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "country-id" => Some(("countryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.nielsen-ocr-opt-out" => Some(("settings.nielsenOcrOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.active-view-opt-out" => Some(("settings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.dfp-network-name" => Some(("settings.dfp_settings.dfp_network_name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.dfp-settings.publisher-portal-only" => Some(("settings.dfp_settings.publisherPortalOnly", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.programmatic-placement-accepted" => Some(("settings.dfp_settings.programmaticPlacementAccepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.pub-paid-placement-accepted" => Some(("settings.dfp_settings.pubPaidPlacementAccepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.dfp-settings.dfp-network-code" => Some(("settings.dfp_settings.dfp_network_code", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.verification-tag-opt-out" => Some(("settings.verificationTagOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.instream-video-placement-accepted" => Some(("settings.instream_video_placement_accepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.interstitial-placement-accepted" => Some(("settings.interstitialPlacementAccepted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.video-active-view-opt-out" => Some(("settings.videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "currency-id" => Some(("currencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "inpage-tag-formats" => Some(("inpageTagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-id" => Some(("parentId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "interstitial-tag-formats" => Some(("interstitialTagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["active", "active-view-opt-out", "country-id", "currency-id", "description", "dfp-network-code", "dfp-network-name", "dfp-settings", "dimension-name", "etag", "id", "id-dimension-value", "inpage-tag-formats", "instream-video-placement-accepted", "interstitial-placement-accepted", "interstitial-tag-formats", "kind", "match-type", "name", "nielsen-ocr-opt-out", "parent-id", "programmatic-placement-accepted", "pub-paid-placement-accepted", "publisher-portal-only", "settings", "url", "value", "verification-tag-opt-out", "video-active-view-opt-out"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::DirectorySite = json::value::from_value(object).unwrap(); + let mut call = self.hub.directory_sites().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _directory_sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.directory_sites().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "parent-id" => { + call = call.parent_id(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "dfp-network-code" => { + call = call.dfp_network_code(value.unwrap_or("")); + }, + "country-id" => { + call = call.country_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + "accepts-publisher-paid-placements" => { + call = call.accepts_publisher_paid_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-publisher-paid-placements", "boolean")); + }, + "accepts-interstitial-placements" => { + call = call.accepts_interstitial_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-interstitial-placements", "boolean")); + }, + "accepts-in-stream-video-placements" => { + call = call.accepts_in_stream_video_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-in-stream-video-placements", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["accepts-interstitial-placements", "accepts-publisher-paid-placements", "search-string", "country-id", "accepts-in-stream-video-placements", "sort-field", "ids", "max-results", "page-token", "sort-order", "parent-id", "active", "dfp-network-code"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.event_tags().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _event_tags_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.event_tags().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url-escape-levels" => Some(("urlEscapeLevels", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled-by-default" => Some(("enabledByDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter-type" => Some(("siteFilterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exclude-from-adx-requests" => Some(("excludeFromAdxRequests", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "campaign-id", "campaign-id-dimension-value", "dimension-name", "enabled-by-default", "etag", "exclude-from-adx-requests", "id", "kind", "match-type", "name", "site-filter-type", "site-ids", "ssl-compliant", "status", "subaccount-id", "type", "url", "url-escape-levels", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::EventTag = json::value::from_value(object).unwrap(); + let mut call = self.hub.event_tags().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.event_tags().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "event-tag-types" => { + call = call.add_event_tag_types(value.unwrap_or("")); + }, + "enabled" => { + call = call.enabled(arg_from_str(value.unwrap_or("false"), err, "enabled", "boolean")); + }, + "definitions-only" => { + call = call.definitions_only(arg_from_str(value.unwrap_or("false"), err, "definitions-only", "boolean")); + }, + "campaign-id" => { + call = call.campaign_id(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + "ad-id" => { + call = call.ad_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "campaign-id", "sort-field", "enabled", "ids", "advertiser-id", "ad-id", "sort-order", "event-tag-types", "definitions-only"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url-escape-levels" => Some(("urlEscapeLevels", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled-by-default" => Some(("enabledByDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter-type" => Some(("siteFilterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exclude-from-adx-requests" => Some(("excludeFromAdxRequests", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "campaign-id", "campaign-id-dimension-value", "dimension-name", "enabled-by-default", "etag", "exclude-from-adx-requests", "id", "kind", "match-type", "name", "site-filter-type", "site-ids", "ssl-compliant", "status", "subaccount-id", "type", "url", "url-escape-levels", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::EventTag = json::value::from_value(object).unwrap(); + let mut call = self.hub.event_tags().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _event_tags_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-ids" => Some(("siteIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url-escape-levels" => Some(("urlEscapeLevels", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "enabled-by-default" => Some(("enabledByDefault", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-filter-type" => Some(("siteFilterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exclude-from-adx-requests" => Some(("excludeFromAdxRequests", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "campaign-id", "campaign-id-dimension-value", "dimension-name", "enabled-by-default", "etag", "exclude-from-adx-requests", "id", "kind", "match-type", "name", "site-filter-type", "site-ids", "ssl-compliant", "status", "subaccount-id", "type", "url", "url-escape-levels", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::EventTag = json::value::from_value(object).unwrap(); + let mut call = self.hub.event_tags().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut download_mode = false; + let mut call = self.hub.files().get(opt.value_of("report-id").unwrap_or(""), opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + if !download_mode { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.files().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "scope" => { + call = call.scope(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["sort-field", "max-results", "sort-order", "page-token", "scope"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _floodlight_activities_generatetag(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().generatetag(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "floodlight-activity-id" => { + call = call.floodlight_activity_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["floodlight-activity-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-activity-group-name" => Some(("floodlightActivityGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-tag-enabled" => Some(("imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-id" => Some(("floodlightActivityGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-tag-string" => Some(("floodlightActivityGroupTagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cache-busting-type" => Some(("cacheBustingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hidden" => Some(("hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "expected-url" => Some(("expectedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-format" => Some(("tagFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-defined-variable-types" => Some(("userDefinedVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "counting-method" => Some(("countingMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-type" => Some(("floodlightActivityGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "cache-busting-type", "counting-method", "dimension-name", "etag", "expected-url", "floodlight-activity-group-id", "floodlight-activity-group-name", "floodlight-activity-group-tag-string", "floodlight-activity-group-type", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "hidden", "id", "id-dimension-value", "image-tag-enabled", "kind", "match-type", "name", "notes", "secure", "ssl-compliant", "ssl-required", "subaccount-id", "tag-format", "tag-string", "user-defined-variable-types", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activities().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activities().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "tag-string" => { + call = call.tag_string(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "floodlight-configuration-id" => { + call = call.floodlight_configuration_id(value.unwrap_or("")); + }, + "floodlight-activity-group-type" => { + call = call.floodlight_activity_group_type(value.unwrap_or("")); + }, + "floodlight-activity-group-tag-string" => { + call = call.floodlight_activity_group_tag_string(value.unwrap_or("")); + }, + "floodlight-activity-group-name" => { + call = call.floodlight_activity_group_name(value.unwrap_or("")); + }, + "floodlight-activity-group-ids" => { + call = call.add_floodlight_activity_group_ids(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["floodlight-activity-group-ids", "search-string", "floodlight-activity-group-name", "sort-field", "floodlight-configuration-id", "ids", "max-results", "advertiser-id", "page-token", "sort-order", "tag-string", "floodlight-activity-group-tag-string", "floodlight-activity-group-type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-activity-group-name" => Some(("floodlightActivityGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-tag-enabled" => Some(("imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-id" => Some(("floodlightActivityGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-tag-string" => Some(("floodlightActivityGroupTagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cache-busting-type" => Some(("cacheBustingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hidden" => Some(("hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "expected-url" => Some(("expectedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-format" => Some(("tagFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-defined-variable-types" => Some(("userDefinedVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "counting-method" => Some(("countingMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-type" => Some(("floodlightActivityGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "cache-busting-type", "counting-method", "dimension-name", "etag", "expected-url", "floodlight-activity-group-id", "floodlight-activity-group-name", "floodlight-activity-group-tag-string", "floodlight-activity-group-type", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "hidden", "id", "id-dimension-value", "image-tag-enabled", "kind", "match-type", "name", "notes", "secure", "ssl-compliant", "ssl-required", "subaccount-id", "tag-format", "tag-string", "user-defined-variable-types", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activities().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activities_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "secure" => Some(("secure", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-activity-group-name" => Some(("floodlightActivityGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-tag-enabled" => Some(("imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-id" => Some(("floodlightActivityGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-tag-string" => Some(("floodlightActivityGroupTagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-compliant" => Some(("sslCompliant", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cache-busting-type" => Some(("cacheBustingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "hidden" => Some(("hidden", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "expected-url" => Some(("expectedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-format" => Some(("tagFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "user-defined-variable-types" => Some(("userDefinedVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "counting-method" => Some(("countingMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-activity-group-type" => Some(("floodlightActivityGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "cache-busting-type", "counting-method", "dimension-name", "etag", "expected-url", "floodlight-activity-group-id", "floodlight-activity-group-name", "floodlight-activity-group-tag-string", "floodlight-activity-group-type", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "hidden", "id", "id-dimension-value", "image-tag-enabled", "kind", "match-type", "name", "notes", "secure", "ssl-compliant", "ssl-required", "subaccount-id", "tag-format", "tag-string", "user-defined-variable-types", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivity = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activities().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activity_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "subaccount-id", "tag-string", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activity_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_activity_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "type" => { + call = call.type_(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "floodlight-configuration-id" => { + call = call.floodlight_configuration_id(value.unwrap_or("")); + }, + "advertiser-id" => { + call = call.advertiser_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "floodlight-configuration-id", "ids", "max-results", "advertiser-id", "page-token", "sort-order", "type"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "subaccount-id", "tag-string", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activity_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_activity_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id" => Some(("floodlightConfigurationId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.kind" => Some(("floodlightConfigurationIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.value" => Some(("floodlightConfigurationIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.dimension-name" => Some(("floodlightConfigurationIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.etag" => Some(("floodlightConfigurationIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.match-type" => Some(("floodlightConfigurationIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-configuration-id-dimension-value.id" => Some(("floodlightConfigurationIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-string" => Some(("tagString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "dimension-name", "etag", "floodlight-configuration-id", "floodlight-configuration-id-dimension-value", "id", "id-dimension-value", "kind", "match-type", "name", "subaccount-id", "tag-string", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightActivityGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_activity_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_configurations().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.floodlight_configurations().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "natural-search-conversion-attribution-option" => Some(("naturalSearchConversionAttributionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exposure-to-conversion-enabled" => Some(("exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "analytics-data-sharing-enabled" => Some(("analyticsDataSharingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "first-day-of-week" => Some(("firstDayOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "standard-variable-types" => Some(("standardVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "omniture-settings.omniture-cost-data-enabled" => Some(("omnitureSettings.omnitureCostDataEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "omniture-settings.omniture-integration-enabled" => Some(("omnitureSettings.omnitureIntegrationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-settings.dynamic-tag-enabled" => Some(("tagSettings.dynamicTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-settings.image-tag-enabled" => Some(("tagSettings.imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "in-app-attribution-tracking-enabled" => Some(("inAppAttributionTrackingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "analytics-data-sharing-enabled", "click-duration", "dimension-name", "dynamic-tag-enabled", "etag", "exposure-to-conversion-enabled", "first-day-of-week", "id", "id-dimension-value", "image-tag-enabled", "in-app-attribution-tracking-enabled", "kind", "lookback-configuration", "match-type", "natural-search-conversion-attribution-option", "omniture-cost-data-enabled", "omniture-integration-enabled", "omniture-settings", "post-impression-activities-duration", "standard-variable-types", "subaccount-id", "tag-settings", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightConfiguration = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_configurations().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _floodlight_configurations_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "natural-search-conversion-attribution-option" => Some(("naturalSearchConversionAttributionOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "exposure-to-conversion-enabled" => Some(("exposureToConversionEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "analytics-data-sharing-enabled" => Some(("analyticsDataSharingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "first-day-of-week" => Some(("firstDayOfWeek", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "standard-variable-types" => Some(("standardVariableTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "omniture-settings.omniture-cost-data-enabled" => Some(("omnitureSettings.omnitureCostDataEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "omniture-settings.omniture-integration-enabled" => Some(("omnitureSettings.omnitureIntegrationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-settings.dynamic-tag-enabled" => Some(("tagSettings.dynamicTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-settings.image-tag-enabled" => Some(("tagSettings.imageTagEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "in-app-attribution-tracking-enabled" => Some(("inAppAttributionTrackingEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "analytics-data-sharing-enabled", "click-duration", "dimension-name", "dynamic-tag-enabled", "etag", "exposure-to-conversion-enabled", "first-day-of-week", "id", "id-dimension-value", "image-tag-enabled", "in-app-attribution-tracking-enabled", "kind", "lookback-configuration", "match-type", "natural-search-conversion-attribution-option", "omniture-cost-data-enabled", "omniture-integration-enabled", "omniture-settings", "post-impression-activities-duration", "standard-variable-types", "subaccount-id", "tag-settings", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::FloodlightConfiguration = json::value::from_value(object).unwrap(); + let mut call = self.hub.floodlight_configurations().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _inventory_items_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.inventory_items().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _inventory_items_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.inventory_items().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-id" => { + call = call.add_site_id(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "order-id" => { + call = call.add_order_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "in-plan" => { + call = call.in_plan(arg_from_str(value.unwrap_or("false"), err, "in-plan", "boolean")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-id", "sort-field", "ids", "max-results", "page-token", "in-plan", "site-id", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _landing_pages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.landing_pages().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _landing_pages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.landing_pages().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _landing_pages_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["default", "id", "kind", "name", "url"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LandingPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.landing_pages().insert(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _landing_pages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.landing_pages().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _landing_pages_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["default", "id", "kind", "name", "url"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LandingPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.landing_pages().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _landing_pages_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default" => Some(("default", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["default", "id", "kind", "name", "url"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LandingPage = json::value::from_value(object).unwrap(); + let mut call = self.hub.landing_pages().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("campaign-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _metros_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.metros().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _mobile_carriers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.mobile_carriers().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _mobile_carriers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.mobile_carriers().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_system_versions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_system_versions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_system_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_system_versions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_systems_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_systems().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("dart-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _operating_systems_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.operating_systems().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _order_documents_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.order_documents().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _order_documents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.order_documents().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-id" => { + call = call.add_site_id(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "order-id" => { + call = call.add_order_id(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "approved" => { + call = call.approved(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-id", "search-string", "sort-field", "ids", "max-results", "page-token", "site-id", "sort-order", "approved"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _orders_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.orders().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _orders_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.orders().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("project-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-id" => { + call = call.add_site_id(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "site-id", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-type" => Some(("placementGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "child-placement-ids" => Some(("childPlacementIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.kind" => Some(("primaryPlacementIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.value" => Some(("primaryPlacementIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.dimension-name" => Some(("primaryPlacementIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.etag" => Some(("primaryPlacementIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.match-type" => Some(("primaryPlacementIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.id" => Some(("primaryPlacementIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "child-placement-ids", "comment", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "placement-group-type", "placement-strategy-id", "pricing-schedule", "pricing-type", "primary-placement-id", "primary-placement-id-dimension-value", "site-id", "site-id-dimension-value", "start-date", "subaccount-id", "testing-start-date", "time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_groups().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "site-ids" => { + call = call.add_site_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "pricing-types" => { + call = call.add_pricing_types(value.unwrap_or("")); + }, + "placement-strategy-ids" => { + call = call.add_placement_strategy_ids(value.unwrap_or("")); + }, + "placement-group-type" => { + call = call.placement_group_type(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "min-start-date" => { + call = call.min_start_date(value.unwrap_or("")); + }, + "min-end-date" => { + call = call.min_end_date(value.unwrap_or("")); + }, + "max-start-date" => { + call = call.max_start_date(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "max-end-date" => { + call = call.max_end_date(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + "content-category-ids" => { + call = call.add_content_category_ids(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["placement-strategy-ids", "site-ids", "search-string", "min-end-date", "directory-site-ids", "sort-field", "advertiser-ids", "archived", "ids", "max-results", "min-start-date", "page-token", "max-start-date", "sort-order", "placement-group-type", "pricing-types", "content-category-ids", "campaign-ids", "max-end-date"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-type" => Some(("placementGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "child-placement-ids" => Some(("childPlacementIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.kind" => Some(("primaryPlacementIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.value" => Some(("primaryPlacementIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.dimension-name" => Some(("primaryPlacementIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.etag" => Some(("primaryPlacementIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.match-type" => Some(("primaryPlacementIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.id" => Some(("primaryPlacementIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "child-placement-ids", "comment", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "placement-group-type", "placement-strategy-id", "pricing-schedule", "pricing-type", "primary-placement-id", "primary-placement-id-dimension-value", "site-id", "site-id-dimension-value", "start-date", "subaccount-id", "testing-start-date", "time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_groups().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id" => Some(("primaryPlacementId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-type" => Some(("placementGroupType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "child-placement-ids" => Some(("childPlacementIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.kind" => Some(("primaryPlacementIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.value" => Some(("primaryPlacementIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.dimension-name" => Some(("primaryPlacementIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.etag" => Some(("primaryPlacementIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.match-type" => Some(("primaryPlacementIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary-placement-id-dimension-value.id" => Some(("primaryPlacementIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "child-placement-ids", "comment", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "id", "id-dimension-value", "kind", "last-modified-info", "match-type", "name", "placement-group-type", "placement-strategy-id", "pricing-schedule", "pricing-type", "primary-placement-id", "primary-placement-id-dimension-value", "site-id", "site-id-dimension-value", "start-date", "subaccount-id", "testing-start-date", "time", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementGroup = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_groups().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_strategies().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _placement_strategies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_strategies().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_strategies().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placement_strategies().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_strategies().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placement_strategies_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::PlacementStrategy = json::value::from_value(object).unwrap(); + let mut call = self.hub.placement_strategies().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_generatetags(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placements().generatetags(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "tag-formats" => { + call = call.add_tag_formats(value.unwrap_or("")); + }, + "placement-ids" => { + call = call.add_placement_ids(value.unwrap_or("")); + }, + "campaign-id" => { + call = call.campaign_id(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["tag-formats", "placement-ids", "campaign-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placements().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payment-source" => Some(("paymentSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "publisher-update-info.time" => Some(("publisherUpdateInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-formats" => Some(("tagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payment-approved" => Some(("paymentApproved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-through-urls" => Some(("tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-tracking" => Some(("tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.additional-key-values" => Some(("tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-setting.keyword-option" => Some(("tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary" => Some(("primary", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "placement-group-id" => Some(("placementGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.kind" => Some(("placementGroupIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.value" => Some(("placementGroupIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.dimension-name" => Some(("placementGroupIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.etag" => Some(("placementGroupIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.match-type" => Some(("placementGroupIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.id" => Some(("placementGroupIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "additional-key-values", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "click-duration", "comment", "compatibility", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "height", "iab", "id", "id-dimension-value", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "payment-approved", "payment-source", "placement-group-id", "placement-group-id-dimension-value", "placement-strategy-id", "post-impression-activities-duration", "pricing-schedule", "pricing-type", "primary", "publisher-update-info", "site-id", "site-id-dimension-value", "size", "ssl-required", "start-date", "status", "subaccount-id", "tag-formats", "tag-setting", "testing-start-date", "time", "value", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Placement = json::value::from_value(object).unwrap(); + let mut call = self.hub.placements().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.placements().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "size-ids" => { + call = call.add_size_ids(value.unwrap_or("")); + }, + "site-ids" => { + call = call.add_site_ids(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "pricing-types" => { + call = call.add_pricing_types(value.unwrap_or("")); + }, + "placement-strategy-ids" => { + call = call.add_placement_strategy_ids(value.unwrap_or("")); + }, + "payment-source" => { + call = call.payment_source(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "min-start-date" => { + call = call.min_start_date(value.unwrap_or("")); + }, + "min-end-date" => { + call = call.min_end_date(value.unwrap_or("")); + }, + "max-start-date" => { + call = call.max_start_date(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "max-end-date" => { + call = call.max_end_date(value.unwrap_or("")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "group-ids" => { + call = call.add_group_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + "content-category-ids" => { + call = call.add_content_category_ids(value.unwrap_or("")); + }, + "compatibilities" => { + call = call.add_compatibilities(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "archived" => { + call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["site-ids", "payment-source", "pricing-types", "campaign-ids", "archived", "advertiser-ids", "size-ids", "page-token", "max-start-date", "sort-order", "max-end-date", "placement-strategy-ids", "content-category-ids", "max-results", "min-start-date", "compatibilities", "search-string", "min-end-date", "directory-site-ids", "sort-field", "ids", "group-ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payment-source" => Some(("paymentSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "publisher-update-info.time" => Some(("publisherUpdateInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-formats" => Some(("tagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payment-approved" => Some(("paymentApproved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-through-urls" => Some(("tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-tracking" => Some(("tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.additional-key-values" => Some(("tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-setting.keyword-option" => Some(("tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary" => Some(("primary", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "placement-group-id" => Some(("placementGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.kind" => Some(("placementGroupIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.value" => Some(("placementGroupIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.dimension-name" => Some(("placementGroupIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.etag" => Some(("placementGroupIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.match-type" => Some(("placementGroupIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.id" => Some(("placementGroupIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "additional-key-values", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "click-duration", "comment", "compatibility", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "height", "iab", "id", "id-dimension-value", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "payment-approved", "payment-source", "placement-group-id", "placement-group-id-dimension-value", "placement-strategy-id", "post-impression-activities-duration", "pricing-schedule", "pricing-type", "primary", "publisher-update-info", "site-id", "site-id-dimension-value", "size", "ssl-required", "start-date", "status", "subaccount-id", "tag-formats", "tag-setting", "testing-start-date", "time", "value", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Placement = json::value::from_value(object).unwrap(); + let mut call = self.hub.placements().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _placements_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "comment" => Some(("comment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id" => Some(("campaignId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payment-source" => Some(("paymentSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "archived" => Some(("archived", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "publisher-update-info.time" => Some(("publisherUpdateInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-formats" => Some(("tagFormats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "payment-approved" => Some(("paymentApproved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-through-urls" => Some(("tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.include-click-tracking" => Some(("tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "tag-setting.additional-key-values" => Some(("tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "tag-setting.keyword-option" => Some(("tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-category-id" => Some(("contentCategoryId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "external-id" => Some(("externalId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.width" => Some(("size.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "size.kind" => Some(("size.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.iab" => Some(("size.iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size.id" => Some(("size.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size.height" => Some(("size.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "ssl-required" => Some(("sslRequired", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.kind" => Some(("campaignIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.value" => Some(("campaignIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.dimension-name" => Some(("campaignIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.etag" => Some(("campaignIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.match-type" => Some(("campaignIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "campaign-id-dimension-value.id" => Some(("campaignIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "primary" => Some(("primary", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "placement-group-id" => Some(("placementGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "create-info.time" => Some(("createInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id" => Some(("siteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.kind" => Some(("siteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.value" => Some(("siteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.dimension-name" => Some(("siteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.etag" => Some(("siteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.match-type" => Some(("siteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-id-dimension-value.id" => Some(("siteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "compatibility" => Some(("compatibility", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-strategy-id" => Some(("placementStrategyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.kind" => Some(("placementGroupIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.value" => Some(("placementGroupIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.dimension-name" => Some(("placementGroupIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.etag" => Some(("placementGroupIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.match-type" => Some(("placementGroupIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "placement-group-id-dimension-value.id" => Some(("placementGroupIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "lookback-configuration.click-duration" => Some(("lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "lookback-configuration.post-impression-activities-duration" => Some(("lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modified-info.time" => Some(("lastModifiedInfo.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.start-date" => Some(("pricingSchedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.end-date" => Some(("pricingSchedule.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.flighted" => Some(("pricingSchedule.flighted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.disregard-overdelivery" => Some(("pricingSchedule.disregardOverdelivery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "pricing-schedule.pricing-type" => Some(("pricingSchedule.pricingType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.cap-cost-option" => Some(("pricingSchedule.capCostOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.testing-start-date" => Some(("pricingSchedule.testingStartDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pricing-schedule.floodlight-activity-id" => Some(("pricingSchedule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "additional-key-values", "advertiser-id", "advertiser-id-dimension-value", "archived", "campaign-id", "campaign-id-dimension-value", "cap-cost-option", "click-duration", "comment", "compatibility", "content-category-id", "create-info", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disregard-overdelivery", "end-date", "etag", "external-id", "flighted", "floodlight-activity-id", "height", "iab", "id", "id-dimension-value", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "last-modified-info", "lookback-configuration", "match-type", "name", "payment-approved", "payment-source", "placement-group-id", "placement-group-id-dimension-value", "placement-strategy-id", "post-impression-activities-duration", "pricing-schedule", "pricing-type", "primary", "publisher-update-info", "site-id", "site-id-dimension-value", "size", "ssl-required", "start-date", "status", "subaccount-id", "tag-formats", "tag-setting", "testing-start-date", "time", "value", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Placement = json::value::from_value(object).unwrap(); + let mut call = self.hub.placements().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _platform_types_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.platform_types().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _platform_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.platform_types().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _postal_codes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.postal_codes().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("code").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _postal_codes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.postal_codes().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "advertiser-ids" => { + call = call.add_advertiser_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "advertiser-ids", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _regions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.regions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_list_shares_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.remarketing_list_shares().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("remarketing-list-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_list_shares_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "shared-advertiser-ids" => Some(("sharedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-id" => Some(("remarketingListId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "shared-account-ids" => Some(("sharedAccountIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "remarketing-list-id", "shared-account-ids", "shared-advertiser-ids"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingListShare = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_list_shares().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("remarketing-list-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_list_shares_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "shared-advertiser-ids" => Some(("sharedAdvertiserIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "remarketing-list-id" => Some(("remarketingListId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "shared-account-ids" => Some(("sharedAccountIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["kind", "remarketing-list-id", "shared-account-ids", "shared-advertiser-ids"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingListShare = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_list_shares().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.remarketing_lists().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-size" => Some(("listSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "life-span" => Some(("lifeSpan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-source" => Some(("listSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "description", "dimension-name", "etag", "floodlight-activity-id", "floodlight-activity-name", "id", "kind", "life-span", "list-population-rule", "list-size", "list-source", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_lists().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.remarketing_lists().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "name" => { + call = call.name(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "floodlight-activity-id" => { + call = call.floodlight_activity_id(value.unwrap_or("")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["name", "sort-field", "max-results", "page-token", "sort-order", "active", "floodlight-activity-id"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-size" => Some(("listSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "life-span" => Some(("lifeSpan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-source" => Some(("listSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "description", "dimension-name", "etag", "floodlight-activity-id", "floodlight-activity-name", "id", "kind", "life-span", "list-population-rule", "list-size", "list-source", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_lists().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _remarketing_lists_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "list-population-rule.floodlight-activity-name" => Some(("listPopulationRule.floodlightActivityName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-population-rule.floodlight-activity-id" => Some(("listPopulationRule.floodlightActivityId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-size" => Some(("listSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "life-span" => Some(("lifeSpan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id" => Some(("advertiserId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "active" => Some(("active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.kind" => Some(("advertiserIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.value" => Some(("advertiserIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.dimension-name" => Some(("advertiserIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.etag" => Some(("advertiserIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.match-type" => Some(("advertiserIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "advertiser-id-dimension-value.id" => Some(("advertiserIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "list-source" => Some(("listSource", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "advertiser-id", "advertiser-id-dimension-value", "description", "dimension-name", "etag", "floodlight-activity-id", "floodlight-activity-name", "id", "kind", "life-span", "list-population-rule", "list-size", "list-source", "match-type", "name", "subaccount-id", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::RemarketingList = json::value::from_value(object).unwrap(); + let mut call = self.hub.remarketing_lists().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_compatible_fields_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().compatible_fields_query(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _reports_files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut download_mode = false; + let mut call = self.hub.reports().files_get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or(""), opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + if !download_mode { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _reports_files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().files_list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["sort-field", "sort-order", "max-results", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "scope" => { + call = call.scope(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["sort-field", "max-results", "sort-order", "page-token", "scope"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_run(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.reports().run(opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "synchronous" => { + call = call.synchronous(arg_from_str(value.unwrap_or("false"), err, "synchronous", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["synchronous"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _reports_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "criteria.activities.kind" => Some(("criteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.activities.metric-names" => Some(("criteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "criteria.date-range.start-date" => Some(("criteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.kind" => Some(("criteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.end-date" => Some(("criteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.date-range.relative-date-range" => Some(("criteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.custom-rich-media-events.kind" => Some(("criteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "criteria.metric-names" => Some(("criteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sub-account-id" => Some(("subAccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.start-date" => Some(("schedule.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.runs-on-day-of-month" => Some(("schedule.runsOnDayOfMonth", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.every" => Some(("schedule.every", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "schedule.expiration-date" => Some(("schedule.expirationDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.active" => Some(("schedule.active", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "schedule.repeats" => Some(("schedule.repeats", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "schedule.repeats-on-week-days" => Some(("schedule.repeatsOnWeekDays", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "path-to-conversion-criteria.date-range.start-date" => Some(("pathToConversionCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.kind" => Some(("pathToConversionCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.end-date" => Some(("pathToConversionCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.date-range.relative-date-range" => Some(("pathToConversionCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.kind" => Some(("pathToConversionCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.value" => Some(("pathToConversionCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.dimension-name" => Some(("pathToConversionCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.etag" => Some(("pathToConversionCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.match-type" => Some(("pathToConversionCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.floodlight-config-id.id" => Some(("pathToConversionCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.clicks-lookback-window" => Some(("pathToConversionCriteria.reportProperties.clicksLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => Some(("pathToConversionCriteria.reportProperties.pivotOnInteractionPath", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.impressions-lookback-window" => Some(("pathToConversionCriteria.reportProperties.impressionsLookbackWindow", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("pathToConversionCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => Some(("pathToConversionCriteria.reportProperties.maximumInteractionGap", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => Some(("pathToConversionCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-click-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumClickInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => Some(("pathToConversionCriteria.reportProperties.maximumImpressionInteractions", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "path-to-conversion-criteria.metric-names" => Some(("pathToConversionCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.kind" => Some(("reachCriteria.activities.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.activities.metric-names" => Some(("reachCriteria.activities.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.metric-names" => Some(("reachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.date-range.start-date" => Some(("reachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.kind" => Some(("reachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.end-date" => Some(("reachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.date-range.relative-date-range" => Some(("reachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.reach-by-frequency-metric-names" => Some(("reachCriteria.reachByFrequencyMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reach-criteria.custom-rich-media-events.kind" => Some(("reachCriteria.customRichMediaEvents.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reach-criteria.enable-all-dimension-combinations" => Some(("reachCriteria.enableAllDimensionCombinations", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "file-name" => Some(("fileName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.message" => Some(("delivery.message", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner-delivery-type" => Some(("delivery.emailOwnerDeliveryType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delivery.email-owner" => Some(("delivery.emailOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "owner-profile-id" => Some(("ownerProfileId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modified-time" => Some(("lastModifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.start-date" => Some(("floodlightCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.kind" => Some(("floodlightCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.end-date" => Some(("floodlightCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.date-range.relative-date-range" => Some(("floodlightCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.kind" => Some(("floodlightCriteria.floodlightConfigId.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.value" => Some(("floodlightCriteria.floodlightConfigId.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.dimension-name" => Some(("floodlightCriteria.floodlightConfigId.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.etag" => Some(("floodlightCriteria.floodlightConfigId.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.match-type" => Some(("floodlightCriteria.floodlightConfigId.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.floodlight-config-id.id" => Some(("floodlightCriteria.floodlightConfigId.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => Some(("floodlightCriteria.reportProperties.includeUnattributedCookieConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.report-properties.include-attributed-ip-conversions" => Some(("floodlightCriteria.reportProperties.includeAttributedIPConversions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "floodlight-criteria.metric-names" => Some(("floodlightCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.pivoted" => Some(("crossDimensionReachCriteria.pivoted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.start-date" => Some(("crossDimensionReachCriteria.dateRange.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.kind" => Some(("crossDimensionReachCriteria.dateRange.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.end-date" => Some(("crossDimensionReachCriteria.dateRange.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.date-range.relative-date-range" => Some(("crossDimensionReachCriteria.dateRange.relativeDateRange", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.dimension" => Some(("crossDimensionReachCriteria.dimension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "cross-dimension-reach-criteria.overlap-metric-names" => Some(("crossDimensionReachCriteria.overlapMetricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "cross-dimension-reach-criteria.metric-names" => Some(("crossDimensionReachCriteria.metricNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active", "activities", "clicks-lookback-window", "criteria", "cross-dimension-reach-criteria", "custom-rich-media-events", "date-range", "delivery", "dimension", "dimension-name", "email-owner", "email-owner-delivery-type", "enable-all-dimension-combinations", "end-date", "etag", "every", "expiration-date", "file-name", "floodlight-config-id", "floodlight-criteria", "format", "id", "impressions-lookback-window", "include-attributed-ip-conversions", "include-unattributed-cookie-conversions", "include-unattributed-ip-conversions", "kind", "last-modified-time", "match-type", "maximum-click-interactions", "maximum-impression-interactions", "maximum-interaction-gap", "message", "metric-names", "name", "overlap-metric-names", "owner-profile-id", "path-to-conversion-criteria", "pivot-on-interaction-path", "pivoted", "reach-by-frequency-metric-names", "reach-criteria", "relative-date-range", "repeats", "repeats-on-week-days", "report-properties", "runs-on-day-of-month", "schedule", "start-date", "sub-account-id", "type", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Report = json::value::from_value(object).unwrap(); + let mut call = self.hub.reports().update(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sites().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.disable-brand-safe-ads" => Some(("siteSettings.disableBrandSafeAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.active-view-opt-out" => Some(("siteSettings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.click-duration" => Some(("siteSettings.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.post-impression-activities-duration" => Some(("siteSettings.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.disable-new-cookie" => Some(("siteSettings.disableNewCookie", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-through-urls" => Some(("siteSettings.tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-tracking" => Some(("siteSettings.tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.additional-key-values" => Some(("siteSettings.tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.tag-setting.keyword-option" => Some(("siteSettings.tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-header" => Some(("siteSettings.creativeSettings.iFrameHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-footer" => Some(("siteSettings.creativeSettings.iFrameFooter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.video-active-view-opt-out" => Some(("siteSettings.videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "approved" => Some(("approved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active-view-opt-out", "additional-key-values", "approved", "click-duration", "creative-settings", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disable-brand-safe-ads", "disable-new-cookie", "etag", "i-frame-footer", "i-frame-header", "id", "id-dimension-value", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "lookback-configuration", "match-type", "name", "post-impression-activities-duration", "site-settings", "subaccount-id", "tag-setting", "value", "video-active-view-opt-out"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Site = json::value::from_value(object).unwrap(); + let mut call = self.hub.sites().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sites().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "unmapped-site" => { + call = call.unmapped_site(arg_from_str(value.unwrap_or("false"), err, "unmapped-site", "boolean")); + }, + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "directory-site-ids" => { + call = call.add_directory_site_ids(value.unwrap_or("")); + }, + "campaign-ids" => { + call = call.add_campaign_ids(value.unwrap_or("")); + }, + "approved" => { + call = call.approved(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); + }, + "ad-words-site" => { + call = call.ad_words_site(arg_from_str(value.unwrap_or("false"), err, "ad-words-site", "boolean")); + }, + "accepts-publisher-paid-placements" => { + call = call.accepts_publisher_paid_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-publisher-paid-placements", "boolean")); + }, + "accepts-interstitial-placements" => { + call = call.accepts_interstitial_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-interstitial-placements", "boolean")); + }, + "accepts-in-stream-video-placements" => { + call = call.accepts_in_stream_video_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-in-stream-video-placements", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["accepts-interstitial-placements", "accepts-publisher-paid-placements", "search-string", "subaccount-id", "directory-site-ids", "sort-field", "ids", "max-results", "page-token", "unmapped-site", "accepts-in-stream-video-placements", "ad-words-site", "campaign-ids", "approved", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.disable-brand-safe-ads" => Some(("siteSettings.disableBrandSafeAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.active-view-opt-out" => Some(("siteSettings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.click-duration" => Some(("siteSettings.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.post-impression-activities-duration" => Some(("siteSettings.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.disable-new-cookie" => Some(("siteSettings.disableNewCookie", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-through-urls" => Some(("siteSettings.tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-tracking" => Some(("siteSettings.tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.additional-key-values" => Some(("siteSettings.tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.tag-setting.keyword-option" => Some(("siteSettings.tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-header" => Some(("siteSettings.creativeSettings.iFrameHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-footer" => Some(("siteSettings.creativeSettings.iFrameFooter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.video-active-view-opt-out" => Some(("siteSettings.videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "approved" => Some(("approved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active-view-opt-out", "additional-key-values", "approved", "click-duration", "creative-settings", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disable-brand-safe-ads", "disable-new-cookie", "etag", "i-frame-footer", "i-frame-header", "id", "id-dimension-value", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "lookback-configuration", "match-type", "name", "post-impression-activities-duration", "site-settings", "subaccount-id", "tag-setting", "value", "video-active-view-opt-out"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Site = json::value::from_value(object).unwrap(); + let mut call = self.hub.sites().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sites_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.kind" => Some(("directorySiteIdDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.value" => Some(("directorySiteIdDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.dimension-name" => Some(("directorySiteIdDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.etag" => Some(("directorySiteIdDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.match-type" => Some(("directorySiteIdDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id-dimension-value.id" => Some(("directorySiteIdDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.disable-brand-safe-ads" => Some(("siteSettings.disableBrandSafeAds", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.active-view-opt-out" => Some(("siteSettings.activeViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.click-duration" => Some(("siteSettings.lookbackConfiguration.clickDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.lookback-configuration.post-impression-activities-duration" => Some(("siteSettings.lookbackConfiguration.postImpressionActivitiesDuration", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "site-settings.disable-new-cookie" => Some(("siteSettings.disableNewCookie", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-through-urls" => Some(("siteSettings.tagSetting.includeClickThroughUrls", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.include-click-tracking" => Some(("siteSettings.tagSetting.includeClickTracking", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "site-settings.tag-setting.additional-key-values" => Some(("siteSettings.tagSetting.additionalKeyValues", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.tag-setting.keyword-option" => Some(("siteSettings.tagSetting.keywordOption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-header" => Some(("siteSettings.creativeSettings.iFrameHeader", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.creative-settings.i-frame-footer" => Some(("siteSettings.creativeSettings.iFrameFooter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "site-settings.video-active-view-opt-out" => Some(("siteSettings.videoActiveViewOptOut", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "approved" => Some(("approved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id-dimension-value.kind" => Some(("idDimensionValue.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.value" => Some(("idDimensionValue.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.dimension-name" => Some(("idDimensionValue.dimensionName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.etag" => Some(("idDimensionValue.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.match-type" => Some(("idDimensionValue.matchType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id-dimension-value.id" => Some(("idDimensionValue.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "key-name" => Some(("keyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "directory-site-id" => Some(("directorySiteId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "active-view-opt-out", "additional-key-values", "approved", "click-duration", "creative-settings", "dimension-name", "directory-site-id", "directory-site-id-dimension-value", "disable-brand-safe-ads", "disable-new-cookie", "etag", "i-frame-footer", "i-frame-header", "id", "id-dimension-value", "include-click-through-urls", "include-click-tracking", "key-name", "keyword-option", "kind", "lookback-configuration", "match-type", "name", "post-impression-activities-duration", "site-settings", "subaccount-id", "tag-setting", "value", "video-active-view-opt-out"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Site = json::value::from_value(object).unwrap(); + let mut call = self.hub.sites().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sizes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sizes().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sizes_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "width" => Some(("width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "iab" => Some(("iab", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "height" => Some(("height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["height", "iab", "id", "kind", "width"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Size = json::value::from_value(object).unwrap(); + let mut call = self.hub.sizes().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _sizes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sizes().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "width" => { + call = call.width(arg_from_str(value.unwrap_or("-0"), err, "width", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "iab-standard" => { + call = call.iab_standard(arg_from_str(value.unwrap_or("false"), err, "iab-standard", "boolean")); + }, + "height" => { + call = call.height(arg_from_str(value.unwrap_or("-0"), err, "height", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["iab-standard", "width", "ids", "height"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.subaccounts().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "available-permission-ids", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Subaccount = json::value::from_value(object).unwrap(); + let mut call = self.hub.subaccounts().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.subaccounts().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "sort-field", "ids", "max-results", "page-token", "sort-order"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "available-permission-ids", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Subaccount = json::value::from_value(object).unwrap(); + let mut call = self.hub.subaccounts().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subaccounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "available-permission-ids" => Some(("availablePermissionIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "available-permission-ids", "id", "kind", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Subaccount = json::value::from_value(object).unwrap(); + let mut call = self.hub.subaccounts().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targetable_remarketing_lists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.targetable_remarketing_lists().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _targetable_remarketing_lists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.targetable_remarketing_lists().list(opt.value_of("profile-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "name" => { + call = call.name(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "active" => { + call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["name", "sort-field", "max-results", "page-token", "sort-order", "active"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_profiles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_profiles().get(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_profiles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_profiles().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permission_groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permission_groups().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permission_groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permission_groups().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permissions().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_role_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_role_permissions().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["ids"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_roles().delete(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _user_roles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_roles().get(opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-user-role-id" => Some(("parentUserRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "default-user-role", "id", "kind", "name", "parent-user-role-id", "subaccount-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UserRole = json::value::from_value(object).unwrap(); + let mut call = self.hub.user_roles().insert(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.user_roles().list(opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "subaccount-id" => { + call = call.subaccount_id(value.unwrap_or("")); + }, + "sort-order" => { + call = call.sort_order(value.unwrap_or("")); + }, + "sort-field" => { + call = call.sort_field(value.unwrap_or("")); + }, + "search-string" => { + call = call.search_string(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + "account-user-role-only" => { + call = call.account_user_role_only(arg_from_str(value.unwrap_or("false"), err, "account-user-role-only", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["search-string", "subaccount-id", "sort-field", "ids", "max-results", "page-token", "sort-order", "account-user-role-only"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-user-role-id" => Some(("parentUserRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "default-user-role", "id", "kind", "name", "parent-user-role-id", "subaccount-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UserRole = json::value::from_value(object).unwrap(); + let mut call = self.hub.user_roles().patch(request, opt.value_of("profile-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _user_roles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "default-user-role" => Some(("defaultUserRole", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "subaccount-id" => Some(("subaccountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parent-user-role-id" => Some(("parentUserRoleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "default-user-role", "id", "kind", "name", "parent-user-role-id", "subaccount-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::UserRole = json::value::from_value(object).unwrap(); + let mut call = self.hub.user_roles().update(request, opt.value_of("profile-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("account-active-ad-summaries", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_active_ad_summaries_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-active-ad-summaries".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("account-permission-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_permission_groups_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._account_permission_groups_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-permission-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("account-permissions", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_permissions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._account_permissions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-permissions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("account-user-profiles", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._account_user_profiles_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._account_user_profiles_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._account_user_profiles_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._account_user_profiles_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._account_user_profiles_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("account-user-profiles".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("accounts", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._accounts_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._accounts_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._accounts_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._accounts_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("accounts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("ads", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._ads_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._ads_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._ads_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._ads_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._ads_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("ads".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("advertiser-groups", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._advertiser_groups_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._advertiser_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._advertiser_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._advertiser_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._advertiser_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._advertiser_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("advertiser-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("advertisers", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._advertisers_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._advertisers_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._advertisers_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._advertisers_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._advertisers_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("advertisers".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("browsers", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._browsers_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("browsers".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("campaign-creative-associations", Some(opt)) => { + match opt.subcommand() { + ("insert", Some(opt)) => { + call_result = self._campaign_creative_associations_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._campaign_creative_associations_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("campaign-creative-associations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("campaigns", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._campaigns_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._campaigns_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._campaigns_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._campaigns_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._campaigns_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("campaigns".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("change-logs", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._change_logs_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._change_logs_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("change-logs".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("cities", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._cities_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("cities".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("connection-types", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._connection_types_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._connection_types_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("connection-types".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("content-categories", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._content_categories_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._content_categories_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._content_categories_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._content_categories_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._content_categories_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._content_categories_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("content-categories".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("countries", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._countries_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._countries_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("countries".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-assets", Some(opt)) => { + match opt.subcommand() { + ("insert", Some(opt)) => { + call_result = self._creative_assets_insert(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-assets".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-field-values", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._creative_field_values_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._creative_field_values_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creative_field_values_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creative_field_values_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creative_field_values_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creative_field_values_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-field-values".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-fields", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._creative_fields_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._creative_fields_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creative_fields_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creative_fields_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creative_fields_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creative_fields_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-fields".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creative-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._creative_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creative_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creative_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creative_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creative_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creative-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("creatives", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._creatives_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._creatives_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._creatives_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._creatives_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._creatives_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("creatives".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("dimension-values", Some(opt)) => { + match opt.subcommand() { + ("query", Some(opt)) => { + call_result = self._dimension_values_query(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("dimension-values".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("directory-site-contacts", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._directory_site_contacts_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._directory_site_contacts_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("directory-site-contacts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("directory-sites", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._directory_sites_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._directory_sites_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._directory_sites_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("directory-sites".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("event-tags", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._event_tags_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._event_tags_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._event_tags_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._event_tags_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._event_tags_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._event_tags_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("event-tags".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("files", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._files_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._files_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("files".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("floodlight-activities", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._floodlight_activities_delete(opt, dry_run, &mut err); + }, + ("generatetag", Some(opt)) => { + call_result = self._floodlight_activities_generatetag(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._floodlight_activities_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._floodlight_activities_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._floodlight_activities_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._floodlight_activities_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._floodlight_activities_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("floodlight-activities".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("floodlight-activity-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._floodlight_activity_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._floodlight_activity_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._floodlight_activity_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._floodlight_activity_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._floodlight_activity_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("floodlight-activity-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("floodlight-configurations", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._floodlight_configurations_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._floodlight_configurations_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._floodlight_configurations_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._floodlight_configurations_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("floodlight-configurations".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("inventory-items", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._inventory_items_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._inventory_items_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("inventory-items".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("landing-pages", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._landing_pages_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._landing_pages_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._landing_pages_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._landing_pages_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._landing_pages_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._landing_pages_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("landing-pages".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("metros", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._metros_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("metros".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("mobile-carriers", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._mobile_carriers_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._mobile_carriers_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("mobile-carriers".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("operating-system-versions", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._operating_system_versions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._operating_system_versions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operating-system-versions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("operating-systems", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._operating_systems_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._operating_systems_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("operating-systems".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("order-documents", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._order_documents_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._order_documents_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("order-documents".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("orders", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._orders_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._orders_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("orders".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("placement-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._placement_groups_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._placement_groups_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._placement_groups_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._placement_groups_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._placement_groups_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("placement-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("placement-strategies", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._placement_strategies_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._placement_strategies_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._placement_strategies_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._placement_strategies_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._placement_strategies_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._placement_strategies_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("placement-strategies".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("placements", Some(opt)) => { + match opt.subcommand() { + ("generatetags", Some(opt)) => { + call_result = self._placements_generatetags(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._placements_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._placements_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._placements_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._placements_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._placements_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("placements".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("platform-types", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._platform_types_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._platform_types_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("platform-types".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("postal-codes", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._postal_codes_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._postal_codes_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("postal-codes".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("projects", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._projects_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._projects_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("regions", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._regions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("regions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("remarketing-list-shares", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._remarketing_list_shares_get(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._remarketing_list_shares_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._remarketing_list_shares_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("remarketing-list-shares".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("remarketing-lists", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._remarketing_lists_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._remarketing_lists_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._remarketing_lists_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._remarketing_lists_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._remarketing_lists_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("remarketing-lists".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("reports", Some(opt)) => { + match opt.subcommand() { + ("compatible-fields-query", Some(opt)) => { + call_result = self._reports_compatible_fields_query(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._reports_delete(opt, dry_run, &mut err); + }, + ("files-get", Some(opt)) => { + call_result = self._reports_files_get(opt, dry_run, &mut err); + }, + ("files-list", Some(opt)) => { + call_result = self._reports_files_list(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._reports_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._reports_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._reports_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._reports_patch(opt, dry_run, &mut err); + }, + ("run", Some(opt)) => { + call_result = self._reports_run(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._reports_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("reports".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("sites", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._sites_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._sites_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._sites_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._sites_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._sites_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("sites".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("sizes", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._sizes_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._sizes_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._sizes_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("sizes".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("subaccounts", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._subaccounts_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._subaccounts_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._subaccounts_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._subaccounts_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._subaccounts_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("subaccounts".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("targetable-remarketing-lists", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._targetable_remarketing_lists_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._targetable_remarketing_lists_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("targetable-remarketing-lists".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-profiles", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._user_profiles_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_profiles_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-profiles".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-role-permission-groups", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._user_role_permission_groups_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_role_permission_groups_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-role-permission-groups".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-role-permissions", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._user_role_permissions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_role_permissions_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-role-permissions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("user-roles", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._user_roles_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._user_roles_get(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._user_roles_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._user_roles_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._user_roles_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._user_roles_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("user-roles".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "dfareporting2d3-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "dfareporting2d3", + db_dir: config_dir.clone(), + }, None); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::Dfareporting::new(client, auth), + gp: vec!["alt", "fields", "key", "oauth-token", "pretty-print", "quota-user", "user-ip"], + gpm: vec![ + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("user-ip", "userIp"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let upload_value_names = ["mode", "file"]; + let arg_data = [ + ("account-active-ad-summaries", "methods: 'get'", vec![ + ("get", + Some(r##"Gets the account's active ad summary by account ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/account-active-ad-summaries_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"summary-account-id"##), + None, + Some(r##"Account ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("account-permission-groups", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one account permission group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/account-permission-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account permission group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of account permission groups."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/account-permission-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("account-permissions", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one account permission by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/account-permissions_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account permission ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of account permissions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/account-permissions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("account-user-profiles", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one account user profile by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/account-user-profiles_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new account user profile."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/account-user-profiles_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of account user profiles, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/account-user-profiles_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing account user profile. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/account-user-profiles_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing account user profile."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/account-user-profiles_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("accounts", "methods: 'get', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one account by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/accounts_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of accounts, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/accounts_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing account. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/accounts_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Account ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing account."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/accounts_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("ads", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one ad by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/ads_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Ad ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new ad."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/ads_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of ads, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/ads_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing ad. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/ads_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Ad ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing ad."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/ads_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("advertiser-groups", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing advertiser group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertiser-groups_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one advertiser group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertiser-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new advertiser group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertiser-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of advertiser groups, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertiser-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing advertiser group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertiser-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing advertiser group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertiser-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("advertisers", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one advertiser by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertisers_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new advertiser."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertisers_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of advertisers, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertisers_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing advertiser. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertisers_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Advertiser ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing advertiser."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/advertisers_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("browsers", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of browsers."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/browsers_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("campaign-creative-associations", "methods: 'insert' and 'list'", vec![ + ("insert", + Some(r##"Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/campaign-creative-associations_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Campaign ID in this association."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of creative IDs associated with the specified campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/campaign-creative-associations_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Campaign ID in this association."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("campaigns", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one campaign by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/campaigns_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/campaigns_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"default-landing-page-name"##), + None, + Some(r##"Default landing page name for this new campaign. Must be less than 256 characters long."##), + Some(true), + Some(false)), + + (Some(r##"default-landing-page-url"##), + None, + Some(r##"Default landing page URL for this new campaign."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of campaigns, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/campaigns_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing campaign. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/campaigns_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/campaigns_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("change-logs", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one change log by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/change-logs_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Change log ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of change logs."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/change-logs_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("cities", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of cities, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/cities_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("connection-types", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one connection type by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/connection-types_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Connection type ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of connection types."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/connection-types_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("content-categories", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing content category."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/content-categories_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Content category ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one content category by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/content-categories_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Content category ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new content category."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/content-categories_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of content categories, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/content-categories_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing content category. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/content-categories_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Content category ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing content category."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/content-categories_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("countries", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one country by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/countries_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"dart-id"##), + None, + Some(r##"Country DART ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of countries."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/countries_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-assets", "methods: 'insert'", vec![ + ("insert", + Some(r##"Inserts a new creative asset."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-assets_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"advertiser-id"##), + None, + Some(r##"Advertiser ID of this creative. This is a required field."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"mode"##), + Some(r##"u"##), + Some(r##"Specify the upload protocol (simple|resumable) and the file to upload"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-field-values", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing creative field value."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-field-values_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field Value ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one creative field value by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-field-values_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field Value ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative field value."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-field-values_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creative field values, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-field-values_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative field value. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-field-values_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field Value ID"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative field value."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-field-values_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"creative-field-id"##), + None, + Some(r##"Creative field ID for this creative field value."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-fields", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing creative field."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-fields_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one creative field by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-fields_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field ID"##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative field."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-fields_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creative fields, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-fields_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative field. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-fields_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative Field ID"##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative field."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-fields_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creative-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one creative group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creative groups, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creative-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("creatives", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one creative by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creatives_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new creative."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creatives_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of creatives, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creatives_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing creative. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creatives_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Creative ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing creative."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/creatives_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("dimension-values", "methods: 'query'", vec![ + ("query", + Some(r##"Retrieves list of report dimension values for a list of filters."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/dimension-values_query", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("directory-site-contacts", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one directory site contact by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/directory-site-contacts_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Directory site contact ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of directory site contacts, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/directory-site-contacts_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("directory-sites", "methods: 'get', 'insert' and 'list'", vec![ + ("get", + Some(r##"Gets one directory site by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/directory-sites_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Directory site ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new directory site."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/directory-sites_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of directory sites, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/directory-sites_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("event-tags", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing event tag."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/event-tags_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Event tag ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one event tag by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/event-tags_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Event tag ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new event tag."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/event-tags_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of event tags, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/event-tags_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing event tag. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/event-tags_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Event tag ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing event tag."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/event-tags_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("files", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Retrieves a report file by its report ID and file ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/files_get", + vec![ + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"file-id"##), + None, + Some(r##"The ID of the report file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists files for a user profile."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/files_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("floodlight-activities", "methods: 'delete', 'generatetag', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activities_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("generatetag", + Some(r##"Generates a tag for a floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activities_generatetag", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets one floodlight activity by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activities_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activities_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of floodlight activities, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activities_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing floodlight activity. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activities_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing floodlight activity."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activities_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("floodlight-activity-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one floodlight activity group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activity-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity Group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new floodlight activity group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activity-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of floodlight activity groups, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activity-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing floodlight activity group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activity-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight activity Group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing floodlight activity group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-activity-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("floodlight-configurations", "methods: 'get', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one floodlight configuration by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-configurations_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight configuration ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of floodlight configurations, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-configurations_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing floodlight configuration. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-configurations_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Floodlight configuration ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing floodlight configuration."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/floodlight-configurations_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("inventory-items", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one inventory item by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/inventory-items_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Inventory item ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of inventory items, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/inventory-items_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("landing-pages", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing campaign landing page."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/landing-pages_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Landing page ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one campaign landing page by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/landing-pages_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Landing page ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new landing page for the specified campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/landing-pages_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves the list of landing pages for the specified campaign."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/landing-pages_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing campaign landing page. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/landing-pages_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Landing page ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing campaign landing page."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/landing-pages_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"campaign-id"##), + None, + Some(r##"Landing page campaign ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("metros", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of metros."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/metros_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("mobile-carriers", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one mobile carrier by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/mobile-carriers_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Mobile carrier ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of mobile carriers."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/mobile-carriers_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("operating-system-versions", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one operating system version by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/operating-system-versions_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Operating system version ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of operating system versions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/operating-system-versions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("operating-systems", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one operating system by DART ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/operating-systems_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"dart-id"##), + None, + Some(r##"Operating system DART ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of operating systems."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/operating-systems_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("order-documents", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one order document by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/order-documents_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Order document ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of order documents, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/order-documents_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for order documents."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("orders", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one order by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/orders_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for orders."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Order ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of orders, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/orders_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"project-id"##), + None, + Some(r##"Project ID for orders."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("placement-groups", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one placement group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new placement group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-groups_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of placement groups, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing placement group. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-groups_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement group ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing placement group."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-groups_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("placement-strategies", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing placement strategy."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-strategies_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement strategy ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one placement strategy by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-strategies_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement strategy ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new placement strategy."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-strategies_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of placement strategies, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-strategies_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing placement strategy. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-strategies_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement strategy ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing placement strategy."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placement-strategies_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("placements", "methods: 'generatetags', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("generatetags", + Some(r##"Generates tags for a placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placements_generatetags", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets one placement by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placements_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placements_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of placements, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placements_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing placement. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placements_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Placement ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing placement."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/placements_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("platform-types", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one platform type by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/platform-types_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Platform type ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of platform types."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/platform-types_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("postal-codes", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one postal code by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/postal-codes_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"code"##), + None, + Some(r##"Postal code ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of postal codes."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/postal-codes_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("projects", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one project by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/projects_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Project ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of projects, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/projects_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("regions", "methods: 'list'", vec![ + ("list", + Some(r##"Retrieves a list of regions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/regions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("remarketing-list-shares", "methods: 'get', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one remarketing list share by remarketing list ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/remarketing-list-shares_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"remarketing-list-id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing remarketing list share. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/remarketing-list-shares_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"remarketing-list-id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing remarketing list share."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/remarketing-list-shares_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("remarketing-lists", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one remarketing list by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/remarketing-lists_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new remarketing list."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/remarketing-lists_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of remarketing lists, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/remarketing-lists_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"advertiser-id"##), + None, + Some(r##"Select only remarketing lists owned by this advertiser."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing remarketing list. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/remarketing-lists_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing remarketing list."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/remarketing-lists_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("reports", "methods: 'compatible-fields-query', 'delete', 'files-get', 'files-list', 'get', 'insert', 'list', 'patch', 'run' and 'update'", vec![ + ("compatible-fields-query", + Some(r##"Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/reports_compatible-fields-query", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes a report by its ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/reports_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("files-get", + Some(r##"Retrieves a report file."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/reports_files-get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"file-id"##), + None, + Some(r##"The ID of the report file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("files-list", + Some(r##"Lists files for a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/reports_files-list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the parent report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Retrieves a report by its ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/reports_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Creates a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/reports_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves list of reports."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/reports_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates a report. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/reports_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("run", + Some(r##"Runs a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/reports_run", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates a report."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/reports_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The DFA user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"report-id"##), + None, + Some(r##"The ID of the report."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("sites", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one site by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/sites_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Site ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new site."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/sites_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of sites, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/sites_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing site. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/sites_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Site ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing site."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/sites_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("sizes", "methods: 'get', 'insert' and 'list'", vec![ + ("get", + Some(r##"Gets one size by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/sizes_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Size ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new size."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/sizes_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of sizes, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/sizes_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("subaccounts", "methods: 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("get", + Some(r##"Gets one subaccount by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/subaccounts_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Subaccount ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new subaccount."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/subaccounts_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Gets a list of subaccounts, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/subaccounts_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing subaccount. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/subaccounts_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Subaccount ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing subaccount."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/subaccounts_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("targetable-remarketing-lists", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one remarketing list by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/targetable-remarketing-lists_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"Remarketing list ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of targetable remarketing lists, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/targetable-remarketing-lists_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"advertiser-id"##), + None, + Some(r##"Select only targetable remarketing lists targetable by these advertisers."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-profiles", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one user profile by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-profiles_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"The user profile ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves list of user profiles for a user."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-profiles_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-role-permission-groups", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one user role permission group by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-role-permission-groups_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role permission group ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Gets a list of all supported user role permission groups."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-role-permission-groups_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-role-permissions", "methods: 'get' and 'list'", vec![ + ("get", + Some(r##"Gets one user role permission by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-role-permissions_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role permission ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Gets a list of user role permissions, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-role-permissions_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("user-roles", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an existing user role."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-roles_delete", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets one user role by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-roles_get", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role ID."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("insert", + Some(r##"Inserts a new user role."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-roles_insert", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Retrieves a list of user roles, possibly filtered."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-roles_list", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("patch", + Some(r##"Updates an existing user role. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-roles_patch", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"id"##), + None, + Some(r##"User role ID."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates an existing user role."##), + "Details at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli/user-roles_update", + vec![ + (Some(r##"profile-id"##), + None, + Some(r##"User profile ID associated with this request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("dfareporting2d3") + .author("Sebastian Thiel ") + .version("0.3.3+20151109") + .about("Manage your DoubleClick Campaign Manager ad campaigns and reports.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dfareporting2d3_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + if arg_name_str == "mode" { + arg = arg.number_of_values(2); + arg = arg.value_names(&upload_value_names); + + scmd = scmd.arg(Arg::with_name("mime") + .short("m") + .requires("mode") + .required(false) + .help("The file's mime time, like 'application/octet-stream'") + .takes_value(true)); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/dfareporting2d3/Cargo.toml b/gen/dfareporting2d3/Cargo.toml new file mode 100644 index 0000000000..80432d640c --- /dev/null +++ b/gen/dfareporting2d3/Cargo.toml @@ -0,0 +1,29 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-dfareporting2d3" +version = "0.1.11+20151109" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with dfareporting (protocol v2.3)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d3" +homepage = "https://developers.google.com/doubleclick-advertisers/reporting/" +documentation = "http://byron.github.io/google-apis-rs/google_dfareporting2d3" +license = "MIT" +keywords = ["dfareporting", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = "0.5" +url = ">= 0.5" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + diff --git a/gen/dfareporting2d3/LICENSE.md b/gen/dfareporting2d3/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/dfareporting2d3/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/dfareporting2d3/README.md b/gen/dfareporting2d3/README.md new file mode 100644 index 0000000000..56aa5bb3d2 --- /dev/null +++ b/gen/dfareporting2d3/README.md @@ -0,0 +1,304 @@ + +The `google-dfareporting2d3` library allows access to all features of the *Google dfareporting* service. + +This documentation was generated from *dfareporting* crate version *0.1.11+20151109*, where *20151109* is the exact revision of the *dfareporting:v2.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. + +Everything else about the *dfareporting* *v2d3* API can be found at the +[official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Dfareporting.html) ... + +* [account active ad summaries](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountActiveAdSummary.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountPermissionGroup.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountPermissionGroupGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountPermissionGroupListCall.html) +* [account permissions](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountPermission.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountPermissionGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountPermissionListCall.html) +* [account user profiles](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountUserProfile.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountUserProfileGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountUserProfileInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountUserProfileListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountUserProfilePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountUserProfileUpdateCall.html) +* [accounts](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Account.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AccountUpdateCall.html) +* [ads](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Ad.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdUpdateCall.html) +* [advertiser groups](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserGroup.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserGroupDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserGroupGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserGroupInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserGroupListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserGroupPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserGroupUpdateCall.html) +* [advertisers](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Advertiser.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.AdvertiserUpdateCall.html) +* [browsers](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Browser.html) + * [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.BrowserListCall.html) +* [campaign creative associations](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CampaignCreativeAssociation.html) + * [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Campaign.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CampaignGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CampaignInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CampaignListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CampaignPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CampaignUpdateCall.html) +* [change logs](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ChangeLog.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ChangeLogGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ChangeLogListCall.html) +* [cities](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.City.html) + * [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CityListCall.html) +* [connection types](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ConnectionType.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ConnectionTypeGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ConnectionTypeListCall.html) +* [content categories](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ContentCategory.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ContentCategoryDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ContentCategoryGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ContentCategoryInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ContentCategoryListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ContentCategoryPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ContentCategoryUpdateCall.html) +* [countries](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Country.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CountryGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CountryListCall.html) +* [creative assets](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeAsset.html) + * [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeAssetInsertCall.html) +* [creative field values](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldValue.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldValueDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldValueGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldValueInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldValueListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldValuePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeField.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeFieldUpdateCall.html) +* [creative groups](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeGroup.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeGroupGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeGroupInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeGroupListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeGroupPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeGroupUpdateCall.html) +* [creatives](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Creative.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeUpdateCall.html) +* [dimension values](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.DimensionValue.html) + * [*query*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.DimensionValueQueryCall.html) +* [directory site contacts](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.DirectorySiteContact.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.DirectorySiteContactGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.DirectorySiteContactListCall.html) +* [directory sites](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.DirectorySite.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.DirectorySiteGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.DirectorySiteInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.DirectorySiteListCall.html) +* [event tags](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.EventTag.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.EventTagDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.EventTagGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.EventTagInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.EventTagListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.EventTagPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.EventTagUpdateCall.html) +* [files](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.File.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FileGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FileListCall.html) +* [floodlight activities](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivity.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityDeleteCall.html), [*generatetag*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityGeneratetagCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityGroup.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityGroupGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityGroupInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityGroupListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityGroupPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightConfiguration.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightConfigurationGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightConfigurationListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightConfigurationPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.InventoryItem.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.InventoryItemGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.InventoryItemListCall.html) +* [landing pages](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.LandingPage.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.LandingPageDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.LandingPageGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.LandingPageInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.LandingPageListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.LandingPagePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.LandingPageUpdateCall.html) +* [metros](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Metro.html) + * [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.MetroListCall.html) +* [mobile carriers](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.MobileCarrier.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.MobileCarrierGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.MobileCarrierListCall.html) +* [operating system versions](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OperatingSystemVersion.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OperatingSystemVersionGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OperatingSystemVersionListCall.html) +* [operating systems](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OperatingSystem.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OperatingSystemGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OperatingSystemListCall.html) +* [order documents](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OrderDocument.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OrderDocumentGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OrderDocumentListCall.html) +* [orders](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Order.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OrderGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.OrderListCall.html) +* [placement groups](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementGroup.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementGroupGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementGroupInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementGroupListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementGroupPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementGroupUpdateCall.html) +* [placement strategies](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementStrategy.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementStrategyDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementStrategyGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementStrategyInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementStrategyListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementStrategyPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementStrategyUpdateCall.html) +* [placements](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Placement.html) + * [*generatetags*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementGeneratetagCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlacementUpdateCall.html) +* [platform types](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlatformType.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlatformTypeGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PlatformTypeListCall.html) +* [postal codes](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PostalCode.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PostalCodeGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.PostalCodeListCall.html) +* [projects](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Project.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ProjectGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ProjectListCall.html) +* [regions](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Region.html) + * [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RegionListCall.html) +* [remarketing list shares](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RemarketingListShare.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RemarketingListShareGetCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RemarketingListSharePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RemarketingList.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RemarketingListGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RemarketingListInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RemarketingListListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RemarketingListPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.RemarketingListUpdateCall.html) +* [reports](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Report.html) + * [*compatible fields query*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportCompatibleFieldQueryCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportDeleteCall.html), [*files get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportFileGetCall.html), [*files list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportFileListCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportPatchCall.html), [*run*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportRunCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportUpdateCall.html) +* [sites](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Site.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SiteGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SiteInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SiteListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SitePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SiteUpdateCall.html) +* [sizes](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Size.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SizeGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SizeInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SizeListCall.html) +* [subaccounts](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Subaccount.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SubaccountGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SubaccountInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SubaccountListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SubaccountPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.TargetableRemarketingList.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.TargetableRemarketingListGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.TargetableRemarketingListListCall.html) +* [user profiles](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserProfile.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserProfileGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserProfileListCall.html) +* [user role permission groups](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRolePermissionGroup.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRolePermissionGroupGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRolePermission.html) + * [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRolePermissionGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRolePermissionListCall.html) +* [user roles](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRole.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRoleDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRoleGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRoleInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRoleListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRolePatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.UserRoleUpdateCall.html) + + +Upload supported by ... + +* [*insert creative assets*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.CreativeAssetInsertCall.html) + +Download supported by ... + +* [*get files*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.FileGetCall.html) +* [*files get reports*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.ReportFileGetCall.html) + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_dfareporting2d3/struct.Dfareporting.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.reports().run(...).doit() +let r = hub.reports().get(...).doit() +let r = hub.reports().list(...).doit() +let r = hub.reports().delete(...).doit() +let r = hub.reports().files_list(...).doit() +let r = hub.reports().insert(...).doit() +let r = hub.reports().patch(...).doit() +let r = hub.reports().compatible_fields_query(...).doit() +let r = hub.reports().update(...).doit() +let r = hub.reports().files_get(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-dfareporting2d3 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_dfareporting2d3 as dfareporting2d3; +use dfareporting2d3::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use dfareporting2d3::Dfareporting; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +let result = hub.reports().list("profileId") + .sort_order("sit") + .sort_field("Stet") + .scope("sed") + .page_token("et") + .max_results(-18) + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_dfareporting2d3/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_dfareporting2d3/../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](http://byron.github.io/google-apis-rs/google_dfareporting2d3/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.ResponseResult.html), 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")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.CallBuilder.html) 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](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.Delegate.html) 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 [enocodable](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.Part.html) 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](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.CallBuilder.html), 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](http://byron.github.io/google-apis-rs/google_dfareporting2d3/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **dfareporting2d3** 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-rs/LICENSE.md diff --git a/gen/genomics1_beta2/src/build.rs b/gen/dfareporting2d3/src/build.rs similarity index 84% rename from gen/genomics1_beta2/src/build.rs rename to gen/dfareporting2d3/src/build.rs index 66b63f2f77..51eb388b81 100644 --- a/gen/genomics1_beta2/src/build.rs +++ b/gen/dfareporting2d3/src/build.rs @@ -12,5 +12,5 @@ pub fn main() { let mut registry = syntex::Registry::new(); serde_codegen::register(&mut registry); - registry.expand("google-genomics1_beta2", &src, &dst).unwrap(); + registry.expand("google-dfareporting2d3", &src, &dst).unwrap(); } diff --git a/gen/cloudsearch1/src/cmn.rs b/gen/dfareporting2d3/src/cmn.rs similarity index 79% rename from gen/cloudsearch1/src/cmn.rs rename to gen/dfareporting2d3/src/cmn.rs index b7665b194b..87b91a8986 100644 --- a/gen/cloudsearch1/src/cmn.rs +++ b/gen/dfareporting2d3/src/cmn.rs @@ -5,18 +5,19 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; use hyper; use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, HeaderFormat}; -use hyper::http::LINE_ENDING; +use hyper::http::h1::LINE_ENDING; use hyper::method::Method; use hyper::status::StatusCode; -use serde; +use serde_json as json; /// Identifies the Hub. There is only one per library, this trait is supposed /// to make intended use more explicit. @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -114,13 +115,21 @@ impl hyper::net::NetworkStream for DummyNetworkStream { fn peer_addr(&mut self) -> io::Result { Ok("127.0.0.1:1337".parse().unwrap()) } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } } /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -128,21 +137,21 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// /// Return retry information. - fn http_error(&mut self, &hyper::HttpError) -> Retry { + fn http_error(&mut self, &hyper::Error) -> Retry { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -171,27 +180,30 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. - fn store_upload_url(&mut self, url: &str) { + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { let _ = url; } /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. /// * `json_decode_error` - The decoder error - fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &serde::json::Error) { + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { let _ = json_encoded_value; let _ = json_decode_error; } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -202,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -221,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -247,7 +259,7 @@ impl Delegate for DefaultDelegate {} #[derive(Debug)] pub enum Error { /// The http connection failed - HttpError(hyper::HttpError), + HttpError(hyper::Error), /// An attempt was made to upload a resource with size stored in field `.0` /// even though the maximum upload size is what is stored in field `.1`. @@ -272,7 +284,7 @@ pub enum Error { /// Shows that we failed to decode the server response. /// This can happen if the protocol changes in conjunction with strict json decoding. - JsonDecodeError(String, serde::json::Error), + JsonDecodeError(String, json::Error), /// Indicates an HTTP repsonse with a non-success status code Failure(hyper::client::Response), @@ -287,20 +299,32 @@ impl Display for Error { writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" , resource_size, max_size), Error::MissingAPIKey => { - writeln!(f, "The application's API key was not found in the configuration").ok(); + (writeln!(f, "The application's API key was not found in the configuration")).ok(); writeln!(f, "It is used as there are no Scopes defined for this method.") }, - Error::BadRequest(ref err) - => writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message), + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -395,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -409,8 +433,8 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, - headers, LINE_ENDING).unwrap(); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); } @@ -423,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -456,9 +480,52 @@ impl<'a> Read for MultiPartReader<'a> { } } -header!{ - #[doc="The `X-Upload-Content-Type` header."] - (XUploadContentType, "X-Upload-Content-Type") => [Mime] +// The following macro invocation needs to be expanded, as `include!` +// doens't support external macros +// header!{ +// #[doc="The `X-Upload-Content-Type` header."] +// (XUploadContentType, "X-Upload-Content-Type") => [Mime] + +// xupload_content_type { +// test_header!( +// test1, +// vec![b"text/plain"], +// Some(HeaderField( +// vec![Mime(TopLevel::Text, SubLevel::Plain, Vec::new())] +// ))); + +// } +// } + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } } #[derive(Clone, PartialEq, Debug)] @@ -469,7 +536,7 @@ pub struct Chunk { impl fmt::Display for Chunk { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!(fmt, "{}-{}", self.first, self.last).ok(); + (write!(fmt, "{}-{}", self.first, self.last)).ok(); Ok(()) } } @@ -511,8 +578,8 @@ impl Header for ContentRange { } /// We are not parsable, as parsing is done by the `Range` header - fn parse_header(_: &[Vec]) -> Option { - None + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) } } @@ -524,7 +591,7 @@ impl HeaderFormat for ContentRange { Some(ref c) => try!(c.fmt(fmt)), None => try!(fmt.write_str("*")) } - write!(fmt, "/{}", self.total_length).ok(); + (write!(fmt, "/{}", self.total_length)).ok(); Ok(()) } } @@ -537,18 +604,19 @@ impl Header for RangeResponseHeader { "Range" } - fn parse_header(raw: &[Vec]) -> Option { - if let [ref v] = raw { + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; if let Ok(s) = std::str::from_utf8(v) { const PREFIX: &'static str = "bytes "; if s.starts_with(PREFIX) { if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { - return Some(RangeResponseHeader(c)) + return Ok(RangeResponseHeader(c)) } } } } - None + Err(hyper::error::Error::Method) } } @@ -576,7 +644,7 @@ pub struct ResumableUploadHelper<'a, A: 'a> { impl<'a, A> ResumableUploadHelper<'a, A> where A: oauth2::GetToken { - fn query_transfer_status(&mut self) -> std::result::Result> { + fn query_transfer_status(&mut self) -> std::result::Result> { loop { match self.client.post(self.url) .header(UserAgent(self.user_agent.to_string())) @@ -590,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -600,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -612,7 +680,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> /// returns None if operation was cancelled by delegate, or the HttpResult. /// It can be that we return the result just because we didn't understand the status code - /// caller should check for status himself before assuming it's OK to use - pub fn upload(&mut self) -> Option> { + pub fn upload(&mut self) -> Option> { let mut start = match self.start_at { Some(s) => s, None => match self.query_transfer_status() { @@ -643,12 +711,14 @@ impl<'a, A> ResumableUploadHelper<'a, A> if self.delegate.cancel_chunk_upload(&range_header) { return None } - match self.client.post(self.url) - .header(range_header) - .header(ContentType(self.media_type.clone())) - .header(UserAgent(self.user_agent.to_string())) - .body(&mut section_reader) - .send() { + // workaround https://github.com/rust-lang/rust/issues/22252 + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { Ok(mut res) => { if res.status == StatusCode::PermanentRedirect { continue @@ -656,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, - serde::json::from_str(&json_err).ok(), - serde::json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); continue; } } @@ -667,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) @@ -675,4 +745,27 @@ impl<'a, A> ResumableUploadHelper<'a, A> } } } -} \ No newline at end of file +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/dfareporting2d3/src/lib.rs b/gen/dfareporting2d3/src/lib.rs new file mode 100644 index 0000000000..a724764c03 --- /dev/null +++ b/gen/dfareporting2d3/src/lib.rs @@ -0,0 +1,308 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *dfareporting* crate version *0.1.11+20151109*, where *20151109* is the exact revision of the *dfareporting:v2.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. +//! +//! Everything else about the *dfareporting* *v2d3* API can be found at the +//! [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d3). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Dfareporting.html) ... +//! +//! * [account active ad summaries](struct.AccountActiveAdSummary.html) +//! * [*get*](struct.AccountActiveAdSummaryGetCall.html) +//! * [account permission groups](struct.AccountPermissionGroup.html) +//! * [*get*](struct.AccountPermissionGroupGetCall.html) and [*list*](struct.AccountPermissionGroupListCall.html) +//! * [account permissions](struct.AccountPermission.html) +//! * [*get*](struct.AccountPermissionGetCall.html) and [*list*](struct.AccountPermissionListCall.html) +//! * [account user profiles](struct.AccountUserProfile.html) +//! * [*get*](struct.AccountUserProfileGetCall.html), [*insert*](struct.AccountUserProfileInsertCall.html), [*list*](struct.AccountUserProfileListCall.html), [*patch*](struct.AccountUserProfilePatchCall.html) and [*update*](struct.AccountUserProfileUpdateCall.html) +//! * [accounts](struct.Account.html) +//! * [*get*](struct.AccountGetCall.html), [*list*](struct.AccountListCall.html), [*patch*](struct.AccountPatchCall.html) and [*update*](struct.AccountUpdateCall.html) +//! * [ads](struct.Ad.html) +//! * [*get*](struct.AdGetCall.html), [*insert*](struct.AdInsertCall.html), [*list*](struct.AdListCall.html), [*patch*](struct.AdPatchCall.html) and [*update*](struct.AdUpdateCall.html) +//! * [advertiser groups](struct.AdvertiserGroup.html) +//! * [*delete*](struct.AdvertiserGroupDeleteCall.html), [*get*](struct.AdvertiserGroupGetCall.html), [*insert*](struct.AdvertiserGroupInsertCall.html), [*list*](struct.AdvertiserGroupListCall.html), [*patch*](struct.AdvertiserGroupPatchCall.html) and [*update*](struct.AdvertiserGroupUpdateCall.html) +//! * [advertisers](struct.Advertiser.html) +//! * [*get*](struct.AdvertiserGetCall.html), [*insert*](struct.AdvertiserInsertCall.html), [*list*](struct.AdvertiserListCall.html), [*patch*](struct.AdvertiserPatchCall.html) and [*update*](struct.AdvertiserUpdateCall.html) +//! * [browsers](struct.Browser.html) +//! * [*list*](struct.BrowserListCall.html) +//! * [campaign creative associations](struct.CampaignCreativeAssociation.html) +//! * [*insert*](struct.CampaignCreativeAssociationInsertCall.html) and [*list*](struct.CampaignCreativeAssociationListCall.html) +//! * [campaigns](struct.Campaign.html) +//! * [*get*](struct.CampaignGetCall.html), [*insert*](struct.CampaignInsertCall.html), [*list*](struct.CampaignListCall.html), [*patch*](struct.CampaignPatchCall.html) and [*update*](struct.CampaignUpdateCall.html) +//! * [change logs](struct.ChangeLog.html) +//! * [*get*](struct.ChangeLogGetCall.html) and [*list*](struct.ChangeLogListCall.html) +//! * [cities](struct.City.html) +//! * [*list*](struct.CityListCall.html) +//! * [connection types](struct.ConnectionType.html) +//! * [*get*](struct.ConnectionTypeGetCall.html) and [*list*](struct.ConnectionTypeListCall.html) +//! * [content categories](struct.ContentCategory.html) +//! * [*delete*](struct.ContentCategoryDeleteCall.html), [*get*](struct.ContentCategoryGetCall.html), [*insert*](struct.ContentCategoryInsertCall.html), [*list*](struct.ContentCategoryListCall.html), [*patch*](struct.ContentCategoryPatchCall.html) and [*update*](struct.ContentCategoryUpdateCall.html) +//! * [countries](struct.Country.html) +//! * [*get*](struct.CountryGetCall.html) and [*list*](struct.CountryListCall.html) +//! * [creative assets](struct.CreativeAsset.html) +//! * [*insert*](struct.CreativeAssetInsertCall.html) +//! * [creative field values](struct.CreativeFieldValue.html) +//! * [*delete*](struct.CreativeFieldValueDeleteCall.html), [*get*](struct.CreativeFieldValueGetCall.html), [*insert*](struct.CreativeFieldValueInsertCall.html), [*list*](struct.CreativeFieldValueListCall.html), [*patch*](struct.CreativeFieldValuePatchCall.html) and [*update*](struct.CreativeFieldValueUpdateCall.html) +//! * [creative fields](struct.CreativeField.html) +//! * [*delete*](struct.CreativeFieldDeleteCall.html), [*get*](struct.CreativeFieldGetCall.html), [*insert*](struct.CreativeFieldInsertCall.html), [*list*](struct.CreativeFieldListCall.html), [*patch*](struct.CreativeFieldPatchCall.html) and [*update*](struct.CreativeFieldUpdateCall.html) +//! * [creative groups](struct.CreativeGroup.html) +//! * [*get*](struct.CreativeGroupGetCall.html), [*insert*](struct.CreativeGroupInsertCall.html), [*list*](struct.CreativeGroupListCall.html), [*patch*](struct.CreativeGroupPatchCall.html) and [*update*](struct.CreativeGroupUpdateCall.html) +//! * [creatives](struct.Creative.html) +//! * [*get*](struct.CreativeGetCall.html), [*insert*](struct.CreativeInsertCall.html), [*list*](struct.CreativeListCall.html), [*patch*](struct.CreativePatchCall.html) and [*update*](struct.CreativeUpdateCall.html) +//! * [dimension values](struct.DimensionValue.html) +//! * [*query*](struct.DimensionValueQueryCall.html) +//! * [directory site contacts](struct.DirectorySiteContact.html) +//! * [*get*](struct.DirectorySiteContactGetCall.html) and [*list*](struct.DirectorySiteContactListCall.html) +//! * [directory sites](struct.DirectorySite.html) +//! * [*get*](struct.DirectorySiteGetCall.html), [*insert*](struct.DirectorySiteInsertCall.html) and [*list*](struct.DirectorySiteListCall.html) +//! * [event tags](struct.EventTag.html) +//! * [*delete*](struct.EventTagDeleteCall.html), [*get*](struct.EventTagGetCall.html), [*insert*](struct.EventTagInsertCall.html), [*list*](struct.EventTagListCall.html), [*patch*](struct.EventTagPatchCall.html) and [*update*](struct.EventTagUpdateCall.html) +//! * [files](struct.File.html) +//! * [*get*](struct.FileGetCall.html) and [*list*](struct.FileListCall.html) +//! * [floodlight activities](struct.FloodlightActivity.html) +//! * [*delete*](struct.FloodlightActivityDeleteCall.html), [*generatetag*](struct.FloodlightActivityGeneratetagCall.html), [*get*](struct.FloodlightActivityGetCall.html), [*insert*](struct.FloodlightActivityInsertCall.html), [*list*](struct.FloodlightActivityListCall.html), [*patch*](struct.FloodlightActivityPatchCall.html) and [*update*](struct.FloodlightActivityUpdateCall.html) +//! * [floodlight activity groups](struct.FloodlightActivityGroup.html) +//! * [*get*](struct.FloodlightActivityGroupGetCall.html), [*insert*](struct.FloodlightActivityGroupInsertCall.html), [*list*](struct.FloodlightActivityGroupListCall.html), [*patch*](struct.FloodlightActivityGroupPatchCall.html) and [*update*](struct.FloodlightActivityGroupUpdateCall.html) +//! * [floodlight configurations](struct.FloodlightConfiguration.html) +//! * [*get*](struct.FloodlightConfigurationGetCall.html), [*list*](struct.FloodlightConfigurationListCall.html), [*patch*](struct.FloodlightConfigurationPatchCall.html) and [*update*](struct.FloodlightConfigurationUpdateCall.html) +//! * [inventory items](struct.InventoryItem.html) +//! * [*get*](struct.InventoryItemGetCall.html) and [*list*](struct.InventoryItemListCall.html) +//! * [landing pages](struct.LandingPage.html) +//! * [*delete*](struct.LandingPageDeleteCall.html), [*get*](struct.LandingPageGetCall.html), [*insert*](struct.LandingPageInsertCall.html), [*list*](struct.LandingPageListCall.html), [*patch*](struct.LandingPagePatchCall.html) and [*update*](struct.LandingPageUpdateCall.html) +//! * [metros](struct.Metro.html) +//! * [*list*](struct.MetroListCall.html) +//! * [mobile carriers](struct.MobileCarrier.html) +//! * [*get*](struct.MobileCarrierGetCall.html) and [*list*](struct.MobileCarrierListCall.html) +//! * [operating system versions](struct.OperatingSystemVersion.html) +//! * [*get*](struct.OperatingSystemVersionGetCall.html) and [*list*](struct.OperatingSystemVersionListCall.html) +//! * [operating systems](struct.OperatingSystem.html) +//! * [*get*](struct.OperatingSystemGetCall.html) and [*list*](struct.OperatingSystemListCall.html) +//! * [order documents](struct.OrderDocument.html) +//! * [*get*](struct.OrderDocumentGetCall.html) and [*list*](struct.OrderDocumentListCall.html) +//! * [orders](struct.Order.html) +//! * [*get*](struct.OrderGetCall.html) and [*list*](struct.OrderListCall.html) +//! * [placement groups](struct.PlacementGroup.html) +//! * [*get*](struct.PlacementGroupGetCall.html), [*insert*](struct.PlacementGroupInsertCall.html), [*list*](struct.PlacementGroupListCall.html), [*patch*](struct.PlacementGroupPatchCall.html) and [*update*](struct.PlacementGroupUpdateCall.html) +//! * [placement strategies](struct.PlacementStrategy.html) +//! * [*delete*](struct.PlacementStrategyDeleteCall.html), [*get*](struct.PlacementStrategyGetCall.html), [*insert*](struct.PlacementStrategyInsertCall.html), [*list*](struct.PlacementStrategyListCall.html), [*patch*](struct.PlacementStrategyPatchCall.html) and [*update*](struct.PlacementStrategyUpdateCall.html) +//! * [placements](struct.Placement.html) +//! * [*generatetags*](struct.PlacementGeneratetagCall.html), [*get*](struct.PlacementGetCall.html), [*insert*](struct.PlacementInsertCall.html), [*list*](struct.PlacementListCall.html), [*patch*](struct.PlacementPatchCall.html) and [*update*](struct.PlacementUpdateCall.html) +//! * [platform types](struct.PlatformType.html) +//! * [*get*](struct.PlatformTypeGetCall.html) and [*list*](struct.PlatformTypeListCall.html) +//! * [postal codes](struct.PostalCode.html) +//! * [*get*](struct.PostalCodeGetCall.html) and [*list*](struct.PostalCodeListCall.html) +//! * [projects](struct.Project.html) +//! * [*get*](struct.ProjectGetCall.html) and [*list*](struct.ProjectListCall.html) +//! * [regions](struct.Region.html) +//! * [*list*](struct.RegionListCall.html) +//! * [remarketing list shares](struct.RemarketingListShare.html) +//! * [*get*](struct.RemarketingListShareGetCall.html), [*patch*](struct.RemarketingListSharePatchCall.html) and [*update*](struct.RemarketingListShareUpdateCall.html) +//! * [remarketing lists](struct.RemarketingList.html) +//! * [*get*](struct.RemarketingListGetCall.html), [*insert*](struct.RemarketingListInsertCall.html), [*list*](struct.RemarketingListListCall.html), [*patch*](struct.RemarketingListPatchCall.html) and [*update*](struct.RemarketingListUpdateCall.html) +//! * [reports](struct.Report.html) +//! * [*compatible fields query*](struct.ReportCompatibleFieldQueryCall.html), [*delete*](struct.ReportDeleteCall.html), [*files get*](struct.ReportFileGetCall.html), [*files list*](struct.ReportFileListCall.html), [*get*](struct.ReportGetCall.html), [*insert*](struct.ReportInsertCall.html), [*list*](struct.ReportListCall.html), [*patch*](struct.ReportPatchCall.html), [*run*](struct.ReportRunCall.html) and [*update*](struct.ReportUpdateCall.html) +//! * [sites](struct.Site.html) +//! * [*get*](struct.SiteGetCall.html), [*insert*](struct.SiteInsertCall.html), [*list*](struct.SiteListCall.html), [*patch*](struct.SitePatchCall.html) and [*update*](struct.SiteUpdateCall.html) +//! * [sizes](struct.Size.html) +//! * [*get*](struct.SizeGetCall.html), [*insert*](struct.SizeInsertCall.html) and [*list*](struct.SizeListCall.html) +//! * [subaccounts](struct.Subaccount.html) +//! * [*get*](struct.SubaccountGetCall.html), [*insert*](struct.SubaccountInsertCall.html), [*list*](struct.SubaccountListCall.html), [*patch*](struct.SubaccountPatchCall.html) and [*update*](struct.SubaccountUpdateCall.html) +//! * [targetable remarketing lists](struct.TargetableRemarketingList.html) +//! * [*get*](struct.TargetableRemarketingListGetCall.html) and [*list*](struct.TargetableRemarketingListListCall.html) +//! * [user profiles](struct.UserProfile.html) +//! * [*get*](struct.UserProfileGetCall.html) and [*list*](struct.UserProfileListCall.html) +//! * [user role permission groups](struct.UserRolePermissionGroup.html) +//! * [*get*](struct.UserRolePermissionGroupGetCall.html) and [*list*](struct.UserRolePermissionGroupListCall.html) +//! * [user role permissions](struct.UserRolePermission.html) +//! * [*get*](struct.UserRolePermissionGetCall.html) and [*list*](struct.UserRolePermissionListCall.html) +//! * [user roles](struct.UserRole.html) +//! * [*delete*](struct.UserRoleDeleteCall.html), [*get*](struct.UserRoleGetCall.html), [*insert*](struct.UserRoleInsertCall.html), [*list*](struct.UserRoleListCall.html), [*patch*](struct.UserRolePatchCall.html) and [*update*](struct.UserRoleUpdateCall.html) +//! +//! +//! Upload supported by ... +//! +//! * [*insert creative assets*](struct.CreativeAssetInsertCall.html) +//! +//! Download supported by ... +//! +//! * [*get files*](struct.FileGetCall.html) +//! * [*files get reports*](struct.ReportFileGetCall.html) +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Dfareporting.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.reports().run(...).doit() +//! let r = hub.reports().get(...).doit() +//! let r = hub.reports().list(...).doit() +//! let r = hub.reports().delete(...).doit() +//! let r = hub.reports().files_list(...).doit() +//! let r = hub.reports().insert(...).doit() +//! let r = hub.reports().patch(...).doit() +//! let r = hub.reports().compatible_fields_query(...).doit() +//! let r = hub.reports().update(...).doit() +//! let r = hub.reports().files_get(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-dfareporting2d3 = "*" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_dfareporting2d3 as dfareporting2d3; +//! use dfareporting2d3::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use dfareporting2d3::Dfareporting; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::new(), +//! ::default(), None); +//! let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +//! let result = hub.reports().list("profileId") +//! .sort_order("et") +//! .sort_field("sea") +//! .scope("justo") +//! .page_token("dolore") +//! .max_results(-26) +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../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](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), 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")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) 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](trait.Delegate.html) 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 [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) 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](trait.CallBuilder.html), 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](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/dfareporting2d3/src/lib.rs.in b/gen/dfareporting2d3/src/lib.rs.in new file mode 100644 index 0000000000..2853ccf3fc --- /dev/null +++ b/gen/dfareporting2d3/src/lib.rs.in @@ -0,0 +1,66317 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +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; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your DoubleClick Campaign Manager's (DCM) display ad campaigns + Dfatrafficking, + + /// View and manage DoubleClick for Advertisers reports + Full, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::Dfatrafficking => "https://www.googleapis.com/auth/dfatrafficking", + Scope::Full => "https://www.googleapis.com/auth/dfareporting", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::Full + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Dfareporting related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.reports().list("profileId") +/// .sort_order("accusam") +/// .sort_field("takimata") +/// .scope("justo") +/// .page_token("amet.") +/// .max_results(-81) +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Dfareporting { + client: RefCell, + auth: RefCell, + _user_agent: String, +} + +impl<'a, C, A> Hub for Dfareporting {} + +impl<'a, C, A> Dfareporting + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Dfareporting { + Dfareporting { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/0.1.11".to_string(), + } + } + + pub fn account_active_ad_summaries(&'a self) -> AccountActiveAdSummaryMethods<'a, C, A> { + AccountActiveAdSummaryMethods { hub: &self } + } + pub fn account_permission_groups(&'a self) -> AccountPermissionGroupMethods<'a, C, A> { + AccountPermissionGroupMethods { hub: &self } + } + pub fn account_permissions(&'a self) -> AccountPermissionMethods<'a, C, A> { + AccountPermissionMethods { hub: &self } + } + pub fn account_user_profiles(&'a self) -> AccountUserProfileMethods<'a, C, A> { + AccountUserProfileMethods { hub: &self } + } + pub fn accounts(&'a self) -> AccountMethods<'a, C, A> { + AccountMethods { hub: &self } + } + pub fn ads(&'a self) -> AdMethods<'a, C, A> { + AdMethods { hub: &self } + } + pub fn advertiser_groups(&'a self) -> AdvertiserGroupMethods<'a, C, A> { + AdvertiserGroupMethods { hub: &self } + } + pub fn advertisers(&'a self) -> AdvertiserMethods<'a, C, A> { + AdvertiserMethods { hub: &self } + } + pub fn browsers(&'a self) -> BrowserMethods<'a, C, A> { + BrowserMethods { hub: &self } + } + pub fn campaign_creative_associations(&'a self) -> CampaignCreativeAssociationMethods<'a, C, A> { + CampaignCreativeAssociationMethods { hub: &self } + } + pub fn campaigns(&'a self) -> CampaignMethods<'a, C, A> { + CampaignMethods { hub: &self } + } + pub fn change_logs(&'a self) -> ChangeLogMethods<'a, C, A> { + ChangeLogMethods { hub: &self } + } + pub fn cities(&'a self) -> CityMethods<'a, C, A> { + CityMethods { hub: &self } + } + pub fn connection_types(&'a self) -> ConnectionTypeMethods<'a, C, A> { + ConnectionTypeMethods { hub: &self } + } + pub fn content_categories(&'a self) -> ContentCategoryMethods<'a, C, A> { + ContentCategoryMethods { hub: &self } + } + pub fn countries(&'a self) -> CountryMethods<'a, C, A> { + CountryMethods { hub: &self } + } + pub fn creative_assets(&'a self) -> CreativeAssetMethods<'a, C, A> { + CreativeAssetMethods { hub: &self } + } + pub fn creative_field_values(&'a self) -> CreativeFieldValueMethods<'a, C, A> { + CreativeFieldValueMethods { hub: &self } + } + pub fn creative_fields(&'a self) -> CreativeFieldMethods<'a, C, A> { + CreativeFieldMethods { hub: &self } + } + pub fn creative_groups(&'a self) -> CreativeGroupMethods<'a, C, A> { + CreativeGroupMethods { hub: &self } + } + pub fn creatives(&'a self) -> CreativeMethods<'a, C, A> { + CreativeMethods { hub: &self } + } + pub fn dimension_values(&'a self) -> DimensionValueMethods<'a, C, A> { + DimensionValueMethods { hub: &self } + } + pub fn directory_site_contacts(&'a self) -> DirectorySiteContactMethods<'a, C, A> { + DirectorySiteContactMethods { hub: &self } + } + pub fn directory_sites(&'a self) -> DirectorySiteMethods<'a, C, A> { + DirectorySiteMethods { hub: &self } + } + pub fn event_tags(&'a self) -> EventTagMethods<'a, C, A> { + EventTagMethods { hub: &self } + } + pub fn files(&'a self) -> FileMethods<'a, C, A> { + FileMethods { hub: &self } + } + pub fn floodlight_activities(&'a self) -> FloodlightActivityMethods<'a, C, A> { + FloodlightActivityMethods { hub: &self } + } + pub fn floodlight_activity_groups(&'a self) -> FloodlightActivityGroupMethods<'a, C, A> { + FloodlightActivityGroupMethods { hub: &self } + } + pub fn floodlight_configurations(&'a self) -> FloodlightConfigurationMethods<'a, C, A> { + FloodlightConfigurationMethods { hub: &self } + } + pub fn inventory_items(&'a self) -> InventoryItemMethods<'a, C, A> { + InventoryItemMethods { hub: &self } + } + pub fn landing_pages(&'a self) -> LandingPageMethods<'a, C, A> { + LandingPageMethods { hub: &self } + } + pub fn metros(&'a self) -> MetroMethods<'a, C, A> { + MetroMethods { hub: &self } + } + pub fn mobile_carriers(&'a self) -> MobileCarrierMethods<'a, C, A> { + MobileCarrierMethods { hub: &self } + } + pub fn operating_system_versions(&'a self) -> OperatingSystemVersionMethods<'a, C, A> { + OperatingSystemVersionMethods { hub: &self } + } + pub fn operating_systems(&'a self) -> OperatingSystemMethods<'a, C, A> { + OperatingSystemMethods { hub: &self } + } + pub fn order_documents(&'a self) -> OrderDocumentMethods<'a, C, A> { + OrderDocumentMethods { hub: &self } + } + pub fn orders(&'a self) -> OrderMethods<'a, C, A> { + OrderMethods { hub: &self } + } + pub fn placement_groups(&'a self) -> PlacementGroupMethods<'a, C, A> { + PlacementGroupMethods { hub: &self } + } + pub fn placement_strategies(&'a self) -> PlacementStrategyMethods<'a, C, A> { + PlacementStrategyMethods { hub: &self } + } + pub fn placements(&'a self) -> PlacementMethods<'a, C, A> { + PlacementMethods { hub: &self } + } + pub fn platform_types(&'a self) -> PlatformTypeMethods<'a, C, A> { + PlatformTypeMethods { hub: &self } + } + pub fn postal_codes(&'a self) -> PostalCodeMethods<'a, C, A> { + PostalCodeMethods { hub: &self } + } + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + pub fn regions(&'a self) -> RegionMethods<'a, C, A> { + RegionMethods { hub: &self } + } + pub fn remarketing_list_shares(&'a self) -> RemarketingListShareMethods<'a, C, A> { + RemarketingListShareMethods { hub: &self } + } + pub fn remarketing_lists(&'a self) -> RemarketingListMethods<'a, C, A> { + RemarketingListMethods { hub: &self } + } + pub fn reports(&'a self) -> ReportMethods<'a, C, A> { + ReportMethods { hub: &self } + } + pub fn sites(&'a self) -> SiteMethods<'a, C, A> { + SiteMethods { hub: &self } + } + pub fn sizes(&'a self) -> SizeMethods<'a, C, A> { + SizeMethods { hub: &self } + } + pub fn subaccounts(&'a self) -> SubaccountMethods<'a, C, A> { + SubaccountMethods { hub: &self } + } + pub fn targetable_remarketing_lists(&'a self) -> TargetableRemarketingListMethods<'a, C, A> { + TargetableRemarketingListMethods { hub: &self } + } + pub fn user_profiles(&'a self) -> UserProfileMethods<'a, C, A> { + UserProfileMethods { hub: &self } + } + pub fn user_role_permission_groups(&'a self) -> UserRolePermissionGroupMethods<'a, C, A> { + UserRolePermissionGroupMethods { hub: &self } + } + pub fn user_role_permissions(&'a self) -> UserRolePermissionMethods<'a, C, A> { + UserRolePermissionMethods { hub: &self } + } + pub fn user_roles(&'a self) -> UserRoleMethods<'a, C, A> { + UserRoleMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/0.1.11`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Operating System List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operating systems](struct.OperatingSystemListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystemsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemsListResponse". + pub kind: Option, + /// Operating system collection. + #[serde(rename="operatingSystems")] + pub operating_systems: Option>, +} + +impl ResponseResult for OperatingSystemsListResponse {} + + +/// Directory Site Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySiteSettings { + /// Whether this site accepts interstitial ads. + #[serde(rename="interstitialPlacementAccepted")] + pub interstitial_placement_accepted: Option, + /// Whether this directory site has disabled Nielsen OCR reach ratings. + #[serde(rename="nielsenOcrOptOut")] + pub nielsen_ocr_opt_out: Option, + /// Whether this directory site has disabled active view creatives. + #[serde(rename="activeViewOptOut")] + pub active_view_opt_out: Option, + /// Whether this directory site has disabled active view for in-stream video creatives. + #[serde(rename="videoActiveViewOptOut")] + pub video_active_view_opt_out: Option, + /// Directory site DFP settings. + pub dfp_settings: Option, + /// Whether this directory site has disabled generation of Verification ins tags. + #[serde(rename="verificationTagOptOut")] + pub verification_tag_opt_out: Option, + /// Whether this site accepts in-stream video ads. + pub instream_video_placement_accepted: Option, +} + +impl Part for DirectorySiteSettings {} + + +/// Contains information about a mobile carrier that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list mobile carriers](struct.MobileCarrierListCall.html) (none) +/// * [get mobile carriers](struct.MobileCarrierGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MobileCarrier { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileCarrier". + pub kind: Option, + /// DART ID of the country to which this mobile carrier belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// ID of this mobile carrier. + pub id: Option, + /// Country code of the country to which this mobile carrier belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Name of this mobile carrier. + pub name: Option, +} + +impl Resource for MobileCarrier {} +impl ResponseResult for MobileCarrier {} + + +/// Contains properties of a DCM subaccount. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get subaccounts](struct.SubaccountGetCall.html) (response) +/// * [update subaccounts](struct.SubaccountUpdateCall.html) (request|response) +/// * [patch subaccounts](struct.SubaccountPatchCall.html) (request|response) +/// * [list subaccounts](struct.SubaccountListCall.html) (none) +/// * [insert subaccounts](struct.SubaccountInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Subaccount { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#subaccount". + pub kind: Option, + /// ID of the account that contains this subaccount. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// IDs of the available user role permissions for this subaccount. + #[serde(rename="availablePermissionIds")] + pub available_permission_ids: Option>, + /// ID of this subaccount. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this subaccount. This is a required field. Must be less than 128 characters long and be unique among subaccounts of the same account. + pub name: Option, +} + +impl RequestValue for Subaccount {} +impl Resource for Subaccount {} +impl ResponseResult for Subaccount {} + + +/// AccountPermissionGroups contains a mapping of permission group IDs to names. A permission group is a grouping of account permissions. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permission groups](struct.AccountPermissionGroupListCall.html) (none) +/// * [get account permission groups](struct.AccountPermissionGroupGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermissionGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionGroup". + pub kind: Option, + /// ID of this account permission group. + pub id: Option, + /// Name of this account permission group. + pub name: Option, +} + +impl Resource for AccountPermissionGroup {} +impl ResponseResult for AccountPermissionGroup {} + + +/// Represents the list of DimensionValue resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query dimension values](struct.DimensionValueQueryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionValueList { + /// Continuation token used to page through dimension values. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The dimension values returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#dimensionValueList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for DimensionValueList {} + + +/// Campaign Creative Association List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list campaign creative associations](struct.CampaignCreativeAssociationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CampaignCreativeAssociationsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Campaign creative association collection + #[serde(rename="campaignCreativeAssociations")] + pub campaign_creative_associations: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignCreativeAssociationsListResponse". + pub kind: Option, +} + +impl ResponseResult for CampaignCreativeAssociationsListResponse {} + + +/// Floodlight Activity List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight activities](struct.FloodlightActivityListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivitiesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivitiesListResponse". + pub kind: Option, + /// Floodlight activity collection. + #[serde(rename="floodlightActivities")] + pub floodlight_activities: Option>, +} + +impl ResponseResult for FloodlightActivitiesListResponse {} + + +/// User Role Permission Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user role permission groups](struct.UserRolePermissionGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermissionGroupsListResponse { + /// User role permission group collection. + #[serde(rename="userRolePermissionGroups")] + pub user_role_permission_groups: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionGroupsListResponse". + pub kind: Option, +} + +impl ResponseResult for UserRolePermissionGroupsListResponse {} + + +/// Represents the list of File resources. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list files](struct.FileListCall.html) (response) +/// * [files list reports](struct.ReportFileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileList { + /// Continuation token used to page through files. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The files returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#fileList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for FileList {} + + +/// Represents a Custom Rich Media Events group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CustomRichMediaEvents { + /// The kind of resource this is, in this case dfareporting#customRichMediaEvents. + pub kind: Option, + /// List of custom rich media event IDs. Dimension values must be all of type dfa:richMediaEventTypeIdAndName. + #[serde(rename="filteredEventIds")] + pub filtered_event_ids: Option>, +} + +impl Part for CustomRichMediaEvents {} + + +/// Event tag override information. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EventTagOverride { + /// Whether this override is enabled. + pub enabled: Option, + /// ID of this event tag override. This is a read-only, auto-generated field. + pub id: Option, +} + +impl Part for EventTagOverride {} + + +/// Gets a summary of active ads in an account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get account active ad summaries](struct.AccountActiveAdSummaryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountActiveAdSummary { + /// Ads that can be activated for the account. + #[serde(rename="availableAds")] + pub available_ads: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountActiveAdSummary". + pub kind: Option, + /// ID of the account. + #[serde(rename="accountId")] + pub account_id: Option, + /// Ads that have been activated for the account + #[serde(rename="activeAds")] + pub active_ads: Option, + /// Maximum number of active ads allowed for the account. + #[serde(rename="activeAdsLimitTier")] + pub active_ads_limit_tier: Option, +} + +impl ResponseResult for AccountActiveAdSummary {} + + +/// Lookback configuration settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LookbackConfiguration { + /// Lookback window, in days, from the last time a given user clicked on one of your ads. If you enter 0, clicks will not be considered as triggering events for floodlight tracking. If you leave this field blank, the default value for your account will be used. + #[serde(rename="clickDuration")] + pub click_duration: Option, + /// Lookback window, in days, from the last time a given user viewed one of your ads. If you enter 0, impressions will not be considered as triggering events for floodlight tracking. If you leave this field blank, the default value for your account will be used. + #[serde(rename="postImpressionActivitiesDuration")] + pub post_impression_activities_duration: Option, +} + +impl Part for LookbackConfiguration {} + + +/// Floodlight Activity GenerateTag Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [generatetag floodlight activities](struct.FloodlightActivityGeneratetagCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivitiesGenerateTagResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivitiesGenerateTagResponse". + pub kind: Option, + /// Generated tag for this floodlight activity. + #[serde(rename="floodlightActivityTag")] + pub floodlight_activity_tag: Option, +} + +impl ResponseResult for FloodlightActivitiesGenerateTagResponse {} + + +/// Remarketing List Population Rule Term. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListPopulationTerm { + /// ID of the list in question. This field is only relevant when type is set to LIST_MEMBERSHIP_TERM. + #[serde(rename="remarketingListId")] + pub remarketing_list_id: Option, + /// Will be true if the term should check if the user is in the list and false if the term should check if the user is not in the list. This field is only relevant when type is set to LIST_MEMBERSHIP_TERM. False by default. + pub contains: Option, + /// Whether to negate the comparison result of this term during rule evaluation. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM. + pub negation: Option, + /// Literal to compare the variable to. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM. + pub value: Option, + /// Friendly name of this term's variable. This is a read-only, auto-generated field. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM. + #[serde(rename="variableFriendlyName")] + pub variable_friendly_name: Option, + /// Comparison operator of this term. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM. + pub operator: Option, + /// List population term type determines the applicable fields in this object. If left unset or set to CUSTOM_VARIABLE_TERM, then variableName, variableFriendlyName, operator, value, and negation are applicable. If set to LIST_MEMBERSHIP_TERM then remarketingListId and contains are applicable. If set to REFERRER_TERM then operator, value, and negation are applicable. + #[serde(rename="type")] + pub type_: Option, + /// Name of the variable (U1, U2, etc.) being compared in this term. This field is only relevant when type is set to null, CUSTOM_VARIABLE_TERM or REFERRER_TERM. + #[serde(rename="variableName")] + pub variable_name: Option, +} + +impl Part for ListPopulationTerm {} + + +/// Site Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteSettings { + /// Whether brand safe ads are disabled for this site. + #[serde(rename="disableBrandSafeAds")] + pub disable_brand_safe_ads: Option, + /// Site-wide creative settings. + #[serde(rename="creativeSettings")] + pub creative_settings: Option, + /// Whether active view creatives are disabled for this site. + #[serde(rename="activeViewOptOut")] + pub active_view_opt_out: Option, + /// Lookback window settings for this site. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, + /// Whether new cookies are disabled for this site. + #[serde(rename="disableNewCookie")] + pub disable_new_cookie: Option, + /// Whether Verification and ActiveView are disabled for in-stream video creatives on this site. The same setting videoActiveViewOptOut exists on the directory site level -- the opt out occurs if either of these settings are true. These settings are distinct from DirectorySites.settings.activeViewOptOut or Sites.siteSettings.activeViewOptOut which only apply to display ads. However, Accounts.activeViewOptOut opts out both video traffic, as well as display ads, from Verification and ActiveView. + #[serde(rename="videoActiveViewOptOut")] + pub video_active_view_opt_out: Option, + /// Configuration settings for dynamic and image floodlight tags. + #[serde(rename="tagSetting")] + pub tag_setting: Option, +} + +impl Part for SiteSettings {} + + +/// AccountUserProfiles contains properties of a DCM user profile. This resource is specifically for managing user profiles, whereas UserProfiles is for accessing the API. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch account user profiles](struct.AccountUserProfilePatchCall.html) (request|response) +/// * [list account user profiles](struct.AccountUserProfileListCall.html) (none) +/// * [insert account user profiles](struct.AccountUserProfileInsertCall.html) (request|response) +/// * [get account user profiles](struct.AccountUserProfileGetCall.html) (response) +/// * [update account user profiles](struct.AccountUserProfileUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountUserProfile { + /// Locale of the user profile. This is a required field. + /// Acceptable values are: + /// - "cs" (Czech) + /// - "de" (German) + /// - "en" (English) + /// - "en-GB" (English United Kingdom) + /// - "es" (Spanish) + /// - "fr" (French) + /// - "it" (Italian) + /// - "ja" (Japanese) + /// - "ko" (Korean) + /// - "pl" (Polish) + /// - "pt-BR" (Portuguese Brazil) + /// - "ru" (Russian) + /// - "sv" (Swedish) + /// - "tr" (Turkish) + /// - "zh-CN" (Chinese Simplified) + /// - "zh-TW" (Chinese Traditional) + pub locale: Option, + /// Filter that describes which sites are visible to the user profile. + #[serde(rename="siteFilter")] + pub site_filter: Option, + /// Filter that describes which campaigns are visible to the user profile. + #[serde(rename="campaignFilter")] + pub campaign_filter: Option, + /// User role ID of the user profile. This is a required field. + #[serde(rename="userRoleId")] + pub user_role_id: Option, + /// User type of the user profile. This is a read-only field that can be left blank. + #[serde(rename="userAccessType")] + pub user_access_type: Option, + /// Whether this user profile is active. This defaults to false, and must be set true on insert for the user profile to be usable. + pub active: Option, + /// ID of the user profile. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of the user profile. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountUserProfile". + pub kind: Option, + /// Subaccount ID of the user profile. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Filter that describes which user roles are visible to the user profile. + #[serde(rename="userRoleFilter")] + pub user_role_filter: Option, + /// Trafficker type of this user profile. + #[serde(rename="traffickerType")] + pub trafficker_type: Option, + /// Comments for this user profile. + pub comments: Option, + /// Name of the user profile. This is a required field. Must be less than 64 characters long, must be globally unique, and cannot contain whitespace or any of the following characters: "&;"#%,". + pub name: Option, + /// Filter that describes which advertisers are visible to the user profile. + #[serde(rename="advertiserFilter")] + pub advertiser_filter: Option, + /// Email of the user profile. The email addresss must be linked to a Google Account. This field is required on insertion and is read-only after insertion. + pub email: Option, +} + +impl RequestValue for AccountUserProfile {} +impl Resource for AccountUserProfile {} +impl ResponseResult for AccountUserProfile {} + + +/// Dynamic and Image Tag Settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TagSettings { + /// Whether dynamic floodlight tags are enabled. + #[serde(rename="dynamicTagEnabled")] + pub dynamic_tag_enabled: Option, + /// Whether image tags are enabled. + #[serde(rename="imageTagEnabled")] + pub image_tag_enabled: Option, +} + +impl Part for TagSettings {} + + +/// Contains properties of a targetable remarketing list. Remarketing enables you to create lists of users who have performed specific actions on a site, then target ads to members of those lists. This resource is a read-only view of a remarketing list to be used to faciliate targeting ads to specific lists. Remarketing lists that are owned by your advertisers and those that are shared to your advertisers or account are accessible via this resource. To manage remarketing lists that are owned by your advertisers, use the RemarketingLists resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list targetable remarketing lists](struct.TargetableRemarketingListListCall.html) (none) +/// * [get targetable remarketing lists](struct.TargetableRemarketingListGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetableRemarketingList { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetableRemarketingList". + pub kind: Option, + /// Subaccount ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Targetable remarketing list description. + pub description: Option, + /// Number of users currently in the list. This is a read-only field. + #[serde(rename="listSize")] + pub list_size: Option, + /// Number of days that a user should remain in the targetable remarketing list without an impression. + #[serde(rename="lifeSpan")] + pub life_span: Option, + /// Dimension value for the advertiser ID that owns this targetable remarketing list. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Product from which this targetable remarketing list was originated. + #[serde(rename="listSource")] + pub list_source: Option, + /// Whether this targetable remarketing list is active. + pub active: Option, + /// Dimension value for the ID of the advertiser. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Account ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="accountId")] + pub account_id: Option, + /// Targetable remarketing list ID. + pub id: Option, + /// Name of the targetable remarketing list. Is no greater than 128 characters long. + pub name: Option, +} + +impl Resource for TargetableRemarketingList {} +impl ResponseResult for TargetableRemarketingList {} + + +/// Contains information about a particular version of an operating system that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get operating system versions](struct.OperatingSystemVersionGetCall.html) (response) +/// * [list operating system versions](struct.OperatingSystemVersionListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystemVersion { + /// Major version (leftmost number) of this operating system version. + #[serde(rename="majorVersion")] + pub major_version: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemVersion". + pub kind: Option, + /// Minor version (number after the first dot) of this operating system version. + #[serde(rename="minorVersion")] + pub minor_version: Option, + /// Name of this operating system version. + pub name: Option, + /// Operating system of this operating system version. + #[serde(rename="operatingSystem")] + pub operating_system: Option, + /// ID of this operating system version. + pub id: Option, +} + +impl Resource for OperatingSystemVersion {} +impl ResponseResult for OperatingSystemVersion {} + + +/// Remarketing list response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list remarketing lists](struct.RemarketingListListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RemarketingListsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Remarketing list collection. + #[serde(rename="remarketingLists")] + pub remarketing_lists: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingListsListResponse". + pub kind: Option, +} + +impl ResponseResult for RemarketingListsListResponse {} + + +/// Creative Field Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldAssignment { + /// ID of the creative field. + #[serde(rename="creativeFieldId")] + pub creative_field_id: Option, + /// ID of the creative field value. + #[serde(rename="creativeFieldValueId")] + pub creative_field_value_id: Option, +} + +impl Part for CreativeFieldAssignment {} + + +/// Remarketing List Population Rule. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListPopulationRule { + /// Floodlight activity ID associated with this rule. This field can be left blank. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, + /// Name of floodlight activity associated with this rule. This is a read-only, auto-generated field. + #[serde(rename="floodlightActivityName")] + pub floodlight_activity_name: Option, + /// Clauses that make up this list population rule. Clauses are joined by ANDs, and the clauses themselves are made up of list population terms which are joined by ORs. + #[serde(rename="listPopulationClauses")] + pub list_population_clauses: Option>, +} + +impl Part for ListPopulationRule {} + + +/// Contains properties of a DCM account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update accounts](struct.AccountUpdateCall.html) (request|response) +/// * [list accounts](struct.AccountListCall.html) (none) +/// * [get accounts](struct.AccountGetCall.html) (response) +/// * [patch accounts](struct.AccountPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Account { + /// File size limit in kilobytes of Rich Media teaser creatives. Must be between 1 and 10240. + #[serde(rename="teaserSizeLimit")] + pub teaser_size_limit: Option, + /// Whether to serve creatives with Active View tags. If disabled, viewability data will not be available for any impressions. + #[serde(rename="activeViewOptOut")] + pub active_view_opt_out: Option, + /// Description of this account. + pub description: Option, + /// Locale of this account. + /// Acceptable values are: + /// - "cs" (Czech) + /// - "de" (German) + /// - "en" (English) + /// - "en-GB" (English United Kingdom) + /// - "es" (Spanish) + /// - "fr" (French) + /// - "it" (Italian) + /// - "ja" (Japanese) + /// - "ko" (Korean) + /// - "pl" (Polish) + /// - "pt-BR" (Portuguese Brazil) + /// - "ru" (Russian) + /// - "sv" (Swedish) + /// - "tr" (Turkish) + /// - "zh-CN" (Chinese Simplified) + /// - "zh-TW" (Chinese Traditional) + pub locale: Option, + /// Profile for this account. This is a read-only field that can be left blank. + #[serde(rename="accountProfile")] + pub account_profile: Option, + /// Whether this account is active. + pub active: Option, + /// Whether campaigns created in this account will be enabled for comScore vCE by default. + #[serde(rename="comscoreVceEnabled")] + pub comscore_vce_enabled: Option, + /// ID of this account. This is a read-only, auto-generated field. + pub id: Option, + /// User role permissions available to the user roles of this account. + #[serde(rename="availablePermissionIds")] + pub available_permission_ids: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#account". + pub kind: Option, + /// ID of the country associated with this account. + #[serde(rename="countryId")] + pub country_id: Option, + /// Name of this account. This is a required field, and must be less than 128 characters long and be globally unique. + pub name: Option, + /// Maximum image size allowed for this account. + #[serde(rename="maximumImageSize")] + pub maximum_image_size: Option, + /// Whether campaigns created in this account will be enabled for Nielsen OCR reach ratings by default. + #[serde(rename="nielsenOcrEnabled")] + pub nielsen_ocr_enabled: Option, + /// Default placement dimensions for this account. + #[serde(rename="defaultCreativeSizeId")] + pub default_creative_size_id: Option, + /// Account permissions assigned to this account. + #[serde(rename="accountPermissionIds")] + pub account_permission_ids: Option>, + /// ID of currency associated with this account. This is a required field. + /// Acceptable values are: + /// - "1" for USD + /// - "2" for GBP + /// - "3" for ESP + /// - "4" for SEK + /// - "5" for CAD + /// - "6" for JPY + /// - "7" for DEM + /// - "8" for AUD + /// - "9" for FRF + /// - "10" for ITL + /// - "11" for DKK + /// - "12" for NOK + /// - "13" for FIM + /// - "14" for ZAR + /// - "15" for IEP + /// - "16" for NLG + /// - "17" for EUR + /// - "18" for KRW + /// - "19" for TWD + /// - "20" for SGD + /// - "21" for CNY + /// - "22" for HKD + /// - "23" for NZD + /// - "24" for MYR + /// - "25" for BRL + /// - "26" for PTE + /// - "27" for MXP + /// - "28" for CLP + /// - "29" for TRY + /// - "30" for ARS + /// - "31" for PEN + /// - "32" for ILS + /// - "33" for CHF + /// - "34" for VEF + /// - "35" for COP + /// - "36" for GTQ + /// - "37" for PLN + /// - "39" for INR + /// - "40" for THB + #[serde(rename="currencyId")] + pub currency_id: Option, + /// Reporting configuration of this account. + #[serde(rename="reportsConfiguration")] + pub reports_configuration: Option, + /// Maximum number of active ads allowed for this account. + #[serde(rename="activeAdsLimitTier")] + pub active_ads_limit_tier: Option, +} + +impl RequestValue for Account {} +impl Resource for Account {} +impl ResponseResult for Account {} + + +/// Day Part Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DayPartTargeting { + /// Days of the week when the ad will serve. + /// + /// Acceptable values are: + /// - "SUNDAY" + /// - "MONDAY" + /// - "TUESDAY" + /// - "WEDNESDAY" + /// - "THURSDAY" + /// - "FRIDAY" + /// - "SATURDAY" + #[serde(rename="daysOfWeek")] + pub days_of_week: Option>, + /// Hours of the day when the ad will serve. Must be an integer between 0 and 23 (inclusive), where 0 is midnight to 1 AM, and 23 is 11 PM to midnight. Can be specified with days of week, in which case the ad would serve during these hours on the specified days. For example, if Monday, Wednesday, Friday are the days of week specified and 9-10am, 3-5pm (hours 9, 15, and 16) is specified, the ad would serve Monday, Wednesdays, and Fridays at 9-10am and 3-5pm. + #[serde(rename="hoursOfDay")] + pub hours_of_day: Option>, + /// Whether or not to use the user's local time. If false, the America/New York time zone applies. + #[serde(rename="userLocalTime")] + pub user_local_time: Option, +} + +impl Part for DayPartTargeting {} + + +/// Represents a response to the queryCompatibleFields method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [compatible fields query reports](struct.ReportCompatibleFieldQueryCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompatibleFields { + /// The kind of resource this is, in this case dfareporting#compatibleFields. + pub kind: Option, + /// Contains items that are compatible to be selected for a report of type "CROSS_DIMENSION_REACH". + #[serde(rename="crossDimensionReachReportCompatibleFields")] + pub cross_dimension_reach_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "REACH". + #[serde(rename="reachReportCompatibleFields")] + pub reach_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "PATH_TO_CONVERSION". + #[serde(rename="pathToConversionReportCompatibleFields")] + pub path_to_conversion_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "FLOODLIGHT". + #[serde(rename="floodlightReportCompatibleFields")] + pub floodlight_report_compatible_fields: Option, + /// Contains items that are compatible to be selected for a report of type "STANDARD". + #[serde(rename="reportCompatibleFields")] + pub report_compatible_fields: Option, +} + +impl ResponseResult for CompatibleFields {} + + +/// Contains information about a region that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list regions](struct.RegionListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Region { + /// Region code. + #[serde(rename="regionCode")] + pub region_code: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#region". + pub kind: Option, + /// DART ID of the country to which this region belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// Name of this region. + pub name: Option, + /// Country code of the country to which this region belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// DART ID of this region. + #[serde(rename="dartId")] + pub dart_id: Option, +} + +impl Resource for Region {} + + +/// The report criteria for a report of type "STANDARD". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportCriteria { + /// Activity group. + pub activities: Option, + /// The list of standard dimensions the report should include. + pub dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range for which this report should be run. + #[serde(rename="dateRange")] + pub date_range: Option, + /// Custom Rich Media Events group. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option, + /// The list of filters on which dimensions are filtered. + /// Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, +} + +impl NestedType for ReportCriteria {} +impl Part for ReportCriteria {} + + +/// Order List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list orders](struct.OrderListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrdersListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#ordersListResponse". + pub kind: Option, + /// Order collection. + pub orders: Option>, +} + +impl ResponseResult for OrdersListResponse {} + + +/// Represents fields that are compatible to be selected for a report of type "CROSS_DIMENSION_REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CrossDimensionReachReportCompatibleFields { + /// Dimensions which are compatible to be selected in the "breakdown" section of the report. + pub breakdown: Option>, + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#crossDimensionReachReportCompatibleFields. + pub kind: Option, + /// Metrics which are compatible to be selected in the "overlapMetricNames" section of the report. + #[serde(rename="overlapMetrics")] + pub overlap_metrics: Option>, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, +} + +impl Part for CrossDimensionReachReportCompatibleFields {} + + +/// Contains properties of auser role, which is used to manage user access. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert user roles](struct.UserRoleInsertCall.html) (request|response) +/// * [update user roles](struct.UserRoleUpdateCall.html) (request|response) +/// * [delete user roles](struct.UserRoleDeleteCall.html) (none) +/// * [patch user roles](struct.UserRolePatchCall.html) (request|response) +/// * [list user roles](struct.UserRoleListCall.html) (none) +/// * [get user roles](struct.UserRoleGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRole { + /// Whether this is a default user role. Default user roles are created by the system for the account/subaccount and cannot be modified or deleted. Each default user role comes with a basic set of preassigned permissions. + #[serde(rename="defaultUserRole")] + pub default_user_role: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRole". + pub kind: Option, + /// Subaccount ID of this user role. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this user role. This is a required field. Must be less than 256 characters long. If this user role is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this user role is a top-level user role, and the name must be unique among top-level user roles of the same account. + pub name: Option, + /// ID of the user role that this user role is based on or copied from. This is a required field. + #[serde(rename="parentUserRoleId")] + pub parent_user_role_id: Option, + /// Account ID of this user role. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this user role. This is a read-only, auto-generated field. + pub id: Option, + /// List of permissions associated with this user role. + pub permissions: Option>, +} + +impl RequestValue for UserRole {} +impl Resource for UserRole {} +impl ResponseResult for UserRole {} + + +/// Event Tag List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list event tags](struct.EventTagListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EventTagsListResponse { + /// Event tag collection. + #[serde(rename="eventTags")] + pub event_tags: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#eventTagsListResponse". + pub kind: Option, +} + +impl ResponseResult for EventTagsListResponse {} + + +/// Contains properties of a Floodlight activity group. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight activity groups](struct.FloodlightActivityGroupListCall.html) (none) +/// * [get floodlight activity groups](struct.FloodlightActivityGroupGetCall.html) (response) +/// * [insert floodlight activity groups](struct.FloodlightActivityGroupInsertCall.html) (request|response) +/// * [patch floodlight activity groups](struct.FloodlightActivityGroupPatchCall.html) (request|response) +/// * [update floodlight activity groups](struct.FloodlightActivityGroupUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivityGroup". + pub kind: Option, + /// Subaccount ID of this floodlight activity group. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this floodlight activity group. This is a required field. Must be less than 65 characters long and cannot contain quotes. + pub name: Option, + /// Floodlight configuration ID of this floodlight activity group. This is a required field. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// Advertiser ID of this floodlight activity group. If this field is left blank, the value will be copied over either from the floodlight configuration's advertiser or from the existing activity group's advertiser. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="floodlightConfigurationIdDimensionValue")] + pub floodlight_configuration_id_dimension_value: Option, + /// Dimension value for the ID of this floodlight activity group. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Value of the type= parameter in the floodlight tag, which the ad servers use to identify the activity group that the activity belongs to. This is optional: if empty, a new tag string will be generated for you. This string must be 1 to 8 characters long, with valid characters being [a-z][A-Z][0-9][-][ _ ]. This tag string must also be unique among activity groups of the same floodlight configuration. This field is read-only after insertion. + #[serde(rename="tagString")] + pub tag_string: Option, + /// Type of the floodlight activity group. This is a required field that is read-only after insertion. + #[serde(rename="type")] + pub type_: Option, + /// ID of this floodlight activity group. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this floodlight activity group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for FloodlightActivityGroup {} +impl Resource for FloodlightActivityGroup {} +impl ResponseResult for FloodlightActivityGroup {} + + +/// Audience Segment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AudienceSegment { + /// Weight allocated to this segment. Must be between 1 and 1000. The weight assigned will be understood in proportion to the weights assigned to other segments in the same segment group. + pub allocation: Option, + /// ID of this audience segment. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this audience segment. This is a required field and must be less than 65 characters long. + pub name: Option, +} + +impl Part for AudienceSegment {} + + +/// Contains properties of a DCM campaign. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert campaigns](struct.CampaignInsertCall.html) (request|response) +/// * [update campaigns](struct.CampaignUpdateCall.html) (request|response) +/// * [patch campaigns](struct.CampaignPatchCall.html) (request|response) +/// * [get campaigns](struct.CampaignGetCall.html) (response) +/// * [list campaigns](struct.CampaignListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Campaign { + /// Arbitrary comments about this campaign. Must be less than 256 characters long. + pub comment: Option, + /// Date on which the campaign starts running. The start date can be any date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. This is a required field. + #[serde(rename="startDate")] + pub start_date: Option, + /// Date on which the campaign will stop running. On insert, the end date must be today or a future date. The end date must be later than or be the same as the start date. If, for example, you set 6/25/2015 as both the start and end dates, the effective campaign run date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. This is a required field. + #[serde(rename="endDate")] + pub end_date: Option, + /// Click-through URL suffix override properties for this campaign. + #[serde(rename="clickThroughUrlSuffixProperties")] + pub click_through_url_suffix_properties: Option, + /// Whether this campaign has been archived. + pub archived: Option, + /// Additional creative optimization configurations for the campaign. + #[serde(rename="additionalCreativeOptimizationConfigurations")] + pub additional_creative_optimization_configurations: Option>, + /// Advertiser ID of this campaign. This is a required field. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Audience segment groups assigned to this campaign. Cannot have more than 300 segment groups. + #[serde(rename="audienceSegmentGroups")] + pub audience_segment_groups: Option>, + /// Information about the creation of this campaign. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Click-through event tag ID override properties for this campaign. + #[serde(rename="defaultClickThroughEventTagProperties")] + pub default_click_through_event_tag_properties: Option, + /// Dimension value for the advertiser ID of this campaign. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Overrides that can be used to activate or deactivate advertiser event tags. + #[serde(rename="eventTagOverrides")] + pub event_tag_overrides: Option>, + /// Creative optimization configuration for the campaign. + #[serde(rename="creativeOptimizationConfiguration")] + pub creative_optimization_configuration: Option, + /// ID of this campaign. This is a read-only auto-generated field. + pub id: Option, + /// Account ID of this campaign. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Campaign trafficker contact emails. + #[serde(rename="traffickerEmails")] + pub trafficker_emails: Option>, + /// List of creative group IDs that are assigned to the campaign. + #[serde(rename="creativeGroupIds")] + pub creative_group_ids: Option>, + /// Subaccount ID of this campaign. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this campaign. This is a required field and must be less than 256 characters long and unique among campaigns of the same advertiser. + pub name: Option, + /// Lookback window settings for the campaign. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, + /// Whether Nielsen reports are enabled for this campaign. + #[serde(rename="nielsenOcrEnabled")] + pub nielsen_ocr_enabled: Option, + /// Information about the most recent modification of this campaign. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Whether comScore vCE reports are enabled for this campaign. + #[serde(rename="comscoreVceEnabled")] + pub comscore_vce_enabled: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaign". + pub kind: Option, + /// External ID for this campaign. + #[serde(rename="externalId")] + pub external_id: Option, + /// Advertiser group ID of the associated advertiser. + #[serde(rename="advertiserGroupId")] + pub advertiser_group_id: Option, + /// Dimension value for the ID of this campaign. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Billing invoice code included in the DCM client billing invoices associated with the campaign. + #[serde(rename="billingInvoiceCode")] + pub billing_invoice_code: Option, +} + +impl RequestValue for Campaign {} +impl Resource for Campaign {} +impl ResponseResult for Campaign {} + + +/// Describes a change that a user has made to a resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list change logs](struct.ChangeLogListCall.html) (none) +/// * [get change logs](struct.ChangeLogGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChangeLog { + /// Time when the object was modified. + #[serde(rename="changeTime")] + pub change_time: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#changeLog". + pub kind: Option, + /// Subaccount ID of the modified object. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Old value of the object field. + #[serde(rename="oldValue")] + pub old_value: Option, + /// ID of the object of this change log. The object could be a campaign, placement, ad, or other type. + #[serde(rename="objectId")] + pub object_id: Option, + /// ID of this change log. + pub id: Option, + /// User profile name of the user who modified the object. + #[serde(rename="userProfileName")] + pub user_profile_name: Option, + /// Field name of the object which changed. + #[serde(rename="fieldName")] + pub field_name: Option, + /// ID of the user who modified the object. + #[serde(rename="userProfileId")] + pub user_profile_id: Option, + /// Action which caused the change. + pub action: Option, + /// Transaction ID of this change log. When a single API call results in many changes, each change will have a separate ID in the change log but will share the same transactionId. + #[serde(rename="transactionId")] + pub transaction_id: Option, + /// Account ID of the modified object. + #[serde(rename="accountId")] + pub account_id: Option, + /// New value of the object field. + #[serde(rename="newValue")] + pub new_value: Option, + /// Object type of the change log. + #[serde(rename="objectType")] + pub object_type: Option, +} + +impl Resource for ChangeLog {} +impl ResponseResult for ChangeLog {} + + +/// Represents a File resource. A file contains the metadata for a report run. It shows the status of the run and holds the URLs to the generated report data if the run is finished and the status is "REPORT_AVAILABLE". +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get files](struct.FileGetCall.html) (response) +/// * [list files](struct.FileListCall.html) (none) +/// * [files get reports](struct.ReportFileGetCall.html) (response) +/// * [run reports](struct.ReportRunCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct File { + /// The status of the report file. + pub status: Option, + /// The kind of resource this is, in this case dfareporting#file. + pub kind: Option, + /// The output format of the report. Only available once the file is available. + pub format: Option, + /// The date range for which the file has report data. The date range will always be the absolute date range for which the report is run. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The filename of the file. + #[serde(rename="fileName")] + pub file_name: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// The ID of the report this file was generated from. + #[serde(rename="reportId")] + pub report_id: Option, + /// The URLs where the completed report file can be downloaded. + pub urls: Option, + /// The timestamp in milliseconds since epoch when this file was last modified. + #[serde(rename="lastModifiedTime")] + pub last_modified_time: Option, + /// The unique ID of this report file. + pub id: Option, +} + +impl Resource for File {} +impl ResponseResult for File {} + + +/// Key Value Targeting Expression. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct KeyValueTargetingExpression { + /// Keyword expression being targeted by the ad. + pub expression: Option, +} + +impl Part for KeyValueTargetingExpression {} + + +/// The report criteria for a report of type "CROSS_DIMENSION_REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportCrossDimensionReachCriteria { + /// The list of dimensions the report should include. + pub breakdown: Option>, + /// Whether the report is pivoted or not. Defaults to true. + pub pivoted: Option, + /// The list of names of overlap metrics the report should include. + #[serde(rename="overlapMetricNames")] + pub overlap_metric_names: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of filters on which dimensions are filtered. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// The dimension option. + pub dimension: Option, +} + +impl NestedType for ReportCrossDimensionReachCriteria {} +impl Part for ReportCrossDimensionReachCriteria {} + + +/// Contains properties of a placement. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [generatetags placements](struct.PlacementGeneratetagCall.html) (none) +/// * [insert placements](struct.PlacementInsertCall.html) (request|response) +/// * [update placements](struct.PlacementUpdateCall.html) (request|response) +/// * [list placements](struct.PlacementListCall.html) (none) +/// * [get placements](struct.PlacementGetCall.html) (response) +/// * [patch placements](struct.PlacementPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Placement { + /// Comments for this placement. + pub comment: Option, + /// Campaign ID of this placement. This field is a required field on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Payment source for this placement. This is a required field that is read-only after insertion. + #[serde(rename="paymentSource")] + pub payment_source: Option, + /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field. + #[serde(rename="directorySiteIdDimensionValue")] + pub directory_site_id_dimension_value: Option, + /// Advertiser ID of this placement. This field can be left blank. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Key name of this placement. This is a read-only, auto-generated field. + #[serde(rename="keyName")] + pub key_name: Option, + /// Directory site ID of this placement. On insert, you must set either this field or the siteId field to specify the site associated with this placement. This is a required field that is read-only after insertion. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of the content category assigned to this placement. + #[serde(rename="contentCategoryId")] + pub content_category_id: Option, + /// Size associated with this placement. When inserting or updating a placement, only the size ID field is used. This field is required on insertion. + pub size: Option, + /// Whether this placement is archived. + pub archived: Option, + /// Information about the last publisher update. This is a read-only field. + #[serde(rename="publisherUpdateInfo")] + pub publisher_update_info: Option, + /// Tag formats to generate for this placement. This field is required on insertion. + /// Acceptable values are: + /// - "PLACEMENT_TAG_STANDARD" + /// - "PLACEMENT_TAG_IFRAME_JAVASCRIPT" + /// - "PLACEMENT_TAG_IFRAME_ILAYER" + /// - "PLACEMENT_TAG_INTERNAL_REDIRECT" + /// - "PLACEMENT_TAG_JAVASCRIPT" + /// - "PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT" + /// - "PLACEMENT_TAG_INTERSTITIAL_INTERNAL_REDIRECT" + /// - "PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT" + /// - "PLACEMENT_TAG_CLICK_COMMANDS" + /// - "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH" + /// - "PLACEMENT_TAG_TRACKING" + /// - "PLACEMENT_TAG_TRACKING_IFRAME" + /// - "PLACEMENT_TAG_TRACKING_JAVASCRIPT" + #[serde(rename="tagFormats")] + pub tag_formats: Option>, + /// Whether payment was approved for this placement. This is a read-only field relevant only to publisher-paid placements. + #[serde(rename="paymentApproved")] + pub payment_approved: Option, + /// Tag settings for this placement. + #[serde(rename="tagSetting")] + pub tag_setting: Option, + /// ID of this placement. This is a read-only, auto-generated field. + pub id: Option, + /// External ID for this placement. + #[serde(rename="externalId")] + pub external_id: Option, + /// Dimension value for the ID of this placement. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Account ID of this placement. This field can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Whether creatives assigned to this placement must be SSL-compliant. + #[serde(rename="sslRequired")] + pub ssl_required: Option, + /// Third-party placement status. + pub status: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Whether this placement is the primary placement of a roadblock (placement group). You cannot change this field from true to false. Setting this field to true will automatically set the primary field on the original primary placement of the roadblock to false, and it will automatically set the roadblock's primaryPlacementId field to the ID of this placement. + pub primary: Option, + /// ID of this placement's group, if applicable. + #[serde(rename="placementGroupId")] + pub placement_group_id: Option, + /// Information about the creation of this placement. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Site ID associated with this placement. On insert, you must set either this field or the directorySiteId field to specify the site associated with this placement. This is a required field that is read-only after insertion. + #[serde(rename="siteId")] + pub site_id: Option, + /// Dimension value for the ID of the site. This is a read-only, auto-generated field. + #[serde(rename="siteIdDimensionValue")] + pub site_id_dimension_value: Option, + /// Placement compatibility. WEB and WEB_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps.IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. This field is required on insertion. + pub compatibility: Option, + /// ID of the placement strategy assigned to this placement. + #[serde(rename="placementStrategyId")] + pub placement_strategy_id: Option, + /// Dimension value for the ID of the placement group. This is a read-only, auto-generated field. + #[serde(rename="placementGroupIdDimensionValue")] + pub placement_group_id_dimension_value: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placement". + pub kind: Option, + /// Subaccount ID of this placement. This field can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this placement.This is a required field and must be less than 256 characters long. + pub name: Option, + /// Lookback window settings for this placement. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, + /// Information about the most recent modification of this placement. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Pricing schedule of this placement. This field is required on insertion, specifically subfields startDate, endDate and pricingType. + #[serde(rename="pricingSchedule")] + pub pricing_schedule: Option, +} + +impl RequestValue for Placement {} +impl Resource for Placement {} +impl ResponseResult for Placement {} + + +/// Inventory item List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list inventory items](struct.InventoryItemListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InventoryItemsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#inventoryItemsListResponse". + pub kind: Option, + /// Inventory item collection + #[serde(rename="inventoryItems")] + pub inventory_items: Option>, +} + +impl ResponseResult for InventoryItemsListResponse {} + + +/// Audience Segment Group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AudienceSegmentGroup { + /// Audience segments assigned to this group. The number of segments must be between 2 and 100. + #[serde(rename="audienceSegments")] + pub audience_segments: Option>, + /// ID of this audience segment group. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this audience segment group. This is a required field and must be less than 65 characters long. + pub name: Option, +} + +impl Part for AudienceSegmentGroup {} + + +/// Contains properties of a placement strategy. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch placement strategies](struct.PlacementStrategyPatchCall.html) (request|response) +/// * [insert placement strategies](struct.PlacementStrategyInsertCall.html) (request|response) +/// * [get placement strategies](struct.PlacementStrategyGetCall.html) (response) +/// * [update placement strategies](struct.PlacementStrategyUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementStrategy { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementStrategy". + pub kind: Option, + /// Account ID of this placement strategy.This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this placement strategy. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this placement strategy. This is a required field. It must be less than 256 characters long and unique among placement strategies of the same account. + pub name: Option, +} + +impl RequestValue for PlacementStrategy {} +impl ResponseResult for PlacementStrategy {} + + +/// Creative optimization activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OptimizationActivity { + /// Floodlight activity ID of this optimization activity. This is a required field. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, + /// Dimension value for the ID of the floodlight activity. This is a read-only, auto-generated field. + #[serde(rename="floodlightActivityIdDimensionValue")] + pub floodlight_activity_id_dimension_value: Option, + /// Weight associated with this optimization. Must be greater than 1. The weight assigned will be understood in proportion to the weights assigned to the other optimization activities. + pub weight: Option, +} + +impl Part for OptimizationActivity {} + + +/// Placement Tag +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementTag { + /// Tags generated for this placement. + #[serde(rename="tagDatas")] + pub tag_datas: Option>, + /// Placement ID + #[serde(rename="placementId")] + pub placement_id: Option, +} + +impl Part for PlacementTag {} + + +/// Country List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list countries](struct.CountryListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CountriesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#countriesListResponse". + pub kind: Option, + /// Country collection. + pub countries: Option>, +} + +impl ResponseResult for CountriesListResponse {} + + +/// Click-through URL +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClickThroughUrl { + /// Read-only convenience field representing the actual URL that will be used for this click-through. The URL is computed as follows: + /// - If defaultLandingPage is enabled then the campaign's default landing page URL is assigned to this field. + /// - If defaultLandingPage is not enabled and a landingPageId is specified then that landing page's URL is assigned to this field. + /// - If neither of the above cases apply, then the customClickThroughUrl is assigned to this field. + #[serde(rename="computedClickThroughUrl")] + pub computed_click_through_url: Option, + /// Custom click-through URL. Applicable if the defaultLandingPage field is set to false and the landingPageId field is left unset. + #[serde(rename="customClickThroughUrl")] + pub custom_click_through_url: Option, + /// ID of the landing page for the click-through URL. Applicable if the defaultLandingPage field is set to false. + #[serde(rename="landingPageId")] + pub landing_page_id: Option, + /// Whether the campaign default landing page is used. + #[serde(rename="defaultLandingPage")] + pub default_landing_page: Option, +} + +impl Part for ClickThroughUrl {} + + +/// Companion Click-through override. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CompanionClickThroughOverride { + /// Click-through URL of this companion click-through override. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// ID of the creative for this companion click-through override. + #[serde(rename="creativeId")] + pub creative_id: Option, +} + +impl Part for CompanionClickThroughOverride {} + + +/// Frequency Cap. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FrequencyCap { + /// Duration of time, in seconds, for this frequency cap. The maximum duration is 90 days in seconds, or 7,776,000. + pub duration: Option, + /// Number of times an individual user can be served the ad within the specified duration. The maximum allowed is 15. + pub impressions: Option, +} + +impl Part for FrequencyCap {} + + +/// Identifies a creative which has been associated with a given campaign. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list campaign creative associations](struct.CampaignCreativeAssociationListCall.html) (none) +/// * [insert campaign creative associations](struct.CampaignCreativeAssociationInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CampaignCreativeAssociation { + /// ID of the creative associated with the campaign. This is a required field. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignCreativeAssociation". + pub kind: Option, +} + +impl RequestValue for CampaignCreativeAssociation {} +impl Resource for CampaignCreativeAssociation {} +impl ResponseResult for CampaignCreativeAssociation {} + + +/// Contains properties of a remarketing list's sharing information. Sharing allows other accounts or advertisers to target to your remarketing lists. This resource can be used to manage remarketing list sharing to other accounts and advertisers. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get remarketing list shares](struct.RemarketingListShareGetCall.html) (response) +/// * [patch remarketing list shares](struct.RemarketingListSharePatchCall.html) (request|response) +/// * [update remarketing list shares](struct.RemarketingListShareUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RemarketingListShare { + /// Advertisers that the remarketing list is shared with. + #[serde(rename="sharedAdvertiserIds")] + pub shared_advertiser_ids: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingListShare". + pub kind: Option, + /// Remarketing list ID. This is a read-only, auto-generated field. + #[serde(rename="remarketingListId")] + pub remarketing_list_id: Option, + /// Accounts that the remarketing list is shared with. + #[serde(rename="sharedAccountIds")] + pub shared_account_ids: Option>, +} + +impl RequestValue for RemarketingListShare {} +impl Resource for RemarketingListShare {} +impl ResponseResult for RemarketingListShare {} + + +/// Operating System Version List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operating system versions](struct.OperatingSystemVersionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystemVersionsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemVersionsListResponse". + pub kind: Option, + /// Operating system version collection. + #[serde(rename="operatingSystemVersions")] + pub operating_system_versions: Option>, +} + +impl ResponseResult for OperatingSystemVersionsListResponse {} + + +/// Organizes placements according to the contents of their associated webpages. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch content categories](struct.ContentCategoryPatchCall.html) (request|response) +/// * [insert content categories](struct.ContentCategoryInsertCall.html) (request|response) +/// * [update content categories](struct.ContentCategoryUpdateCall.html) (request|response) +/// * [get content categories](struct.ContentCategoryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ContentCategory { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#contentCategory". + pub kind: Option, + /// Account ID of this content category. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this content category. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this content category. This is a required field and must be less than 256 characters long and unique among content categories of the same account. + pub name: Option, +} + +impl RequestValue for ContentCategory {} +impl ResponseResult for ContentCategory {} + + +/// Targetable remarketing list response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list targetable remarketing lists](struct.TargetableRemarketingListListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetableRemarketingListsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetableRemarketingListsListResponse". + pub kind: Option, + /// Targetable remarketing list collection. + #[serde(rename="targetableRemarketingLists")] + pub targetable_remarketing_lists: Option>, +} + +impl ResponseResult for TargetableRemarketingListsListResponse {} + + +/// Represents a buy from the DoubleClick Planning inventory store. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get inventory items](struct.InventoryItemGetCall.html) (response) +/// * [list inventory items](struct.InventoryItemListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct InventoryItem { + /// Order ID of this inventory item. + #[serde(rename="orderId")] + pub order_id: Option, + /// Advertiser ID of this inventory item. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// ID of the site this inventory item is associated with. + #[serde(rename="siteId")] + pub site_id: Option, + /// Ad slots of this inventory item. If this inventory item represents a standalone placement, there will be exactly one ad slot. If this inventory item represents a placement group, there will be more than one ad slot, each representing one child placement in that placement group. + #[serde(rename="adSlots")] + pub ad_slots: Option>, + /// RFP ID of this inventory item. + #[serde(rename="rfpId")] + pub rfp_id: Option, + /// Content category ID of this inventory item. + #[serde(rename="contentCategoryId")] + pub content_category_id: Option, + /// Placement strategy ID of this inventory item. + #[serde(rename="placementStrategyId")] + pub placement_strategy_id: Option, + /// Account ID of this inventory item. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#inventoryItem". + pub kind: Option, + /// Negotiation channel ID of this inventory item. + #[serde(rename="negotiationChannelId")] + pub negotiation_channel_id: Option, + /// Subaccount ID of this inventory item. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this inventory item. For standalone inventory items, this is the same name as that of its only ad slot. For group inventory items, this can differ from the name of any of its ad slots. + pub name: Option, + /// Estimated click-through rate of this inventory item. + #[serde(rename="estimatedClickThroughRate")] + pub estimated_click_through_rate: Option, + /// Information about the most recent modification of this inventory item. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Estimated conversion rate of this inventory item. + #[serde(rename="estimatedConversionRate")] + pub estimated_conversion_rate: Option, + /// Whether this inventory item is in plan. + #[serde(rename="inPlan")] + pub in_plan: Option, + /// ID of this inventory item. + pub id: Option, + /// Project ID of this inventory item. + #[serde(rename="projectId")] + pub project_id: Option, + /// Pricing of this inventory item. + pub pricing: Option, +} + +impl Resource for InventoryItem {} +impl ResponseResult for InventoryItem {} + + +/// Represents fields that are compatible to be selected for a report of type "FlOODLIGHT". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#floodlightReportCompatibleFields. + pub kind: Option, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// Dimensions which are compatible to be selected in the "dimensions" section of the report. + pub dimensions: Option>, +} + +impl Part for FloodlightReportCompatibleFields {} + + +/// Creative Asset ID. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssetId { + /// Type of asset to upload. This is a required field. IMAGE is solely used for IMAGE creatives. Other image assets should use HTML_IMAGE. + #[serde(rename="type")] + pub type_: Option, + /// Name of the creative asset. This is a required field while inserting an asset. After insertion, this assetIdentifier is used to identify the uploaded asset. Characters in the name must be alphanumeric or one of the following: ".-_ ". Spaces are allowed. + pub name: Option, +} + +impl Part for CreativeAssetId {} + + +/// Directory Site Contact Assignment +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySiteContactAssignment { + /// ID of this directory site contact. This is a read-only, auto-generated field. + #[serde(rename="contactId")] + pub contact_id: Option, + /// Visibility of this directory site contact assignment. When set to PUBLIC this contact assignment is visible to all account and agency users; when set to PRIVATE it is visible only to the site. + pub visibility: Option, +} + +impl Part for DirectorySiteContactAssignment {} + + +/// Creative Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssignment { + /// Weight of the creative assignment, applicable when the rotation type is CREATIVE_ROTATION_TYPE_RANDOM. + pub weight: Option, + /// Sequence number of the creative assignment, applicable when the rotation type is CREATIVE_ROTATION_TYPE_SEQUENTIAL. + pub sequence: Option, + /// Click-through URL of the creative assignment. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// Rich media exit overrides for this creative assignment. + /// Applicable when the creative type is any of the following: + /// - RICH_MEDIA_INPAGE + /// - RICH_MEDIA_INPAGE_FLOATING + /// - RICH_MEDIA_IM_EXPAND + /// - RICH_MEDIA_EXPANDING + /// - RICH_MEDIA_INTERSTITIAL_FLOAT + /// - RICH_MEDIA_MOBILE_IN_APP + /// - RICH_MEDIA_MULTI_FLOATING + /// - RICH_MEDIA_PEEL_DOWN + /// - ADVANCED_BANNER + /// - VPAID_LINEAR + /// - VPAID_NON_LINEAR + #[serde(rename="richMediaExitOverrides")] + pub rich_media_exit_overrides: Option>, + /// Whether applicable event tags should fire when this creative assignment is rendered. If this value is unset when the ad is inserted or updated, it will default to true for all creative types EXCEPT for INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO. + #[serde(rename="applyEventTags")] + pub apply_event_tags: Option, + /// Creative group assignments for this creative assignment. Only one assignment per creative group number is allowed for a maximum of two assignments. + #[serde(rename="creativeGroupAssignments")] + pub creative_group_assignments: Option>, + /// Companion creative overrides for this creative assignment. Applicable to video ads. + #[serde(rename="companionCreativeOverrides")] + pub companion_creative_overrides: Option>, + /// Date and time that the assigned creative should start serving. + #[serde(rename="startTime")] + pub start_time: Option, + /// Whether the creative to be assigned is SSL-compliant. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Whether this creative assignment is active. When true, the creative will be included in the ad's rotation. + pub active: Option, + /// ID of the creative to be assigned. This is a required field. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// Date and time that the assigned creative should stop serving. Must be later than the start time. + #[serde(rename="endTime")] + pub end_time: Option, + /// Dimension value for the ID of the creative. This is a read-only, auto-generated field. + #[serde(rename="creativeIdDimensionValue")] + pub creative_id_dimension_value: Option, +} + +impl Part for CreativeAssignment {} + + +/// Represents a DimensionValuesRequest. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query dimension values](struct.DimensionValueQueryCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionValueRequest { + /// The name of the dimension for which values should be requested. + #[serde(rename="dimensionName")] + pub dimension_name: Option, + /// The start date of the date range for which to retrieve dimension values. A string of the format "yyyy-MM-dd". + #[serde(rename="startDate")] + pub start_date: Option, + /// The kind of request this is, in this case dfareporting#dimensionValueRequest. + pub kind: Option, + /// The end date of the date range for which to retrieve dimension values. A string of the format "yyyy-MM-dd". + #[serde(rename="endDate")] + pub end_date: Option, + /// The list of filters by which to filter values. The filters are ANDed. + pub filters: Option>, +} + +impl RequestValue for DimensionValueRequest {} + + +/// Ad Slot +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdSlot { + /// Comment for this ad slot. + pub comment: Option, + /// ID of the placement from an external platform that is linked to this ad slot. + #[serde(rename="linkedPlacementId")] + pub linked_placement_id: Option, + /// Name of this ad slot. + pub name: Option, + /// Primary ad slot of a roadblock inventory item. + pub primary: Option, + /// Height of this ad slot. + pub height: Option, + /// Width of this ad slot. + pub width: Option, + /// Payment source type of this ad slot. + #[serde(rename="paymentSourceType")] + pub payment_source_type: Option, + /// Ad slot compatibility. WEB and WEB_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. + pub compatibility: Option, +} + +impl Part for AdSlot {} + + +/// Properties of inheriting and overriding the default click-through event tag. A campaign may override the event tag defined at the advertiser level, and an ad may also override the campaign's setting further. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DefaultClickThroughEventTagProperties { + /// Whether this entity should override the inherited default click-through event tag with its own defined value. + #[serde(rename="overrideInheritedEventTag")] + pub override_inherited_event_tag: Option, + /// ID of the click-through event tag to apply to all ads in this entity's scope. + #[serde(rename="defaultClickThroughEventTagId")] + pub default_click_through_event_tag_id: Option, +} + +impl Part for DefaultClickThroughEventTagProperties {} + + +/// Represents the list of user profiles. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user profiles](struct.UserProfileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserProfileList { + /// The user profiles returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#userProfileList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for UserProfileList {} + + +/// Subaccount List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list subaccounts](struct.SubaccountListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SubaccountsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#subaccountsListResponse". + pub kind: Option, + /// Subaccount collection. + pub subaccounts: Option>, +} + +impl ResponseResult for SubaccountsListResponse {} + + +/// Contains properties of a DoubleClick Planning order document. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get order documents](struct.OrderDocumentGetCall.html) (response) +/// * [list order documents](struct.OrderDocumentListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderDocument { + /// ID of the order from which this order document is created. + #[serde(rename="orderId")] + pub order_id: Option, + /// Timestamp of the last email sent with this order document. + #[serde(rename="lastSentTime")] + pub last_sent_time: Option, + /// The amended order document ID of this order document. An order document can be created by optionally amending another order document so that the change history can be preserved. + #[serde(rename="amendedOrderDocumentId")] + pub amended_order_document_id: Option, + /// List of email addresses that received the last sent document. + #[serde(rename="lastSentRecipients")] + pub last_sent_recipients: Option>, + /// IDs of users who have approved this order document. + #[serde(rename="approvedByUserProfileIds")] + pub approved_by_user_profile_ids: Option>, + /// ID of this order document. + pub id: Option, + /// Account ID of this order document. + #[serde(rename="accountId")] + pub account_id: Option, + /// Advertiser ID of this order document. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#orderDocument". + pub kind: Option, + /// Subaccount ID of this order document. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Effective date of this order document. + #[serde(rename="effectiveDate")] + pub effective_date: Option, + /// Title of this order document. + pub title: Option, + /// Project ID of this order document. + #[serde(rename="projectId")] + pub project_id: Option, + /// Whether this order document has been signed. + pub signed: Option, + /// Information about the creation of this order document. + #[serde(rename="createdInfo")] + pub created_info: Option, + /// Whether this order document is cancelled. + pub cancelled: Option, + /// Type of this order document + #[serde(rename="type")] + pub type_: Option, +} + +impl Resource for OrderDocument {} +impl ResponseResult for OrderDocument {} + + +/// Represents a Report resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [run reports](struct.ReportRunCall.html) (none) +/// * [get reports](struct.ReportGetCall.html) (response) +/// * [list reports](struct.ReportListCall.html) (none) +/// * [delete reports](struct.ReportDeleteCall.html) (none) +/// * [files list reports](struct.ReportFileListCall.html) (none) +/// * [insert reports](struct.ReportInsertCall.html) (request|response) +/// * [patch reports](struct.ReportPatchCall.html) (request|response) +/// * [compatible fields query reports](struct.ReportCompatibleFieldQueryCall.html) (request) +/// * [update reports](struct.ReportUpdateCall.html) (request|response) +/// * [files get reports](struct.ReportFileGetCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Report { + /// The user profile id of the owner of this report. + #[serde(rename="ownerProfileId")] + pub owner_profile_id: Option, + /// The subaccount ID to which this report belongs if applicable. + #[serde(rename="subAccountId")] + pub sub_account_id: Option, + /// The report's schedule. Can only be set if the report's 'dateRange' is a relative date range and the relative date range is not "TODAY". + pub schedule: Option, + /// The report criteria for a report of type "PATH_TO_CONVERSION". + #[serde(rename="pathToConversionCriteria")] + pub path_to_conversion_criteria: Option, + /// The report criteria for a report of type "REACH". + #[serde(rename="reachCriteria")] + pub reach_criteria: Option, + /// The report criteria for a report of type "FLOODLIGHT". + #[serde(rename="floodlightCriteria")] + pub floodlight_criteria: Option, + /// The filename used when generating report files for this report. + #[serde(rename="fileName")] + pub file_name: Option, + /// The report's email delivery settings. + pub delivery: Option, + /// The timestamp (in milliseconds since epoch) of when this report was last modified. + #[serde(rename="lastModifiedTime")] + pub last_modified_time: Option, + /// The report criteria for a report of type "CROSS_DIMENSION_REACH". + #[serde(rename="crossDimensionReachCriteria")] + pub cross_dimension_reach_criteria: Option, + /// The account ID to which this report belongs. + #[serde(rename="accountId")] + pub account_id: Option, + /// The kind of resource this is, in this case dfareporting#report. + pub kind: Option, + /// The name of the report. + pub name: Option, + /// The output format of the report. If not specified, default format is "CSV". Note that the actual format in the completed report file might differ if for instance the report's size exceeds the format's capabilities. "CSV" will then be the fallback format. + pub format: Option, + /// The unique ID identifying this report resource. + pub id: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// The report criteria for a report of type "STANDARD". + pub criteria: Option, + /// The type of the report. + #[serde(rename="type")] + pub type_: Option, +} + +impl RequestValue for Report {} +impl Resource for Report {} +impl ResponseResult for Report {} + + +/// Contains information about a platform type that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get platform types](struct.PlatformTypeGetCall.html) (response) +/// * [list platform types](struct.PlatformTypeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlatformType { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#platformType". + pub kind: Option, + /// ID of this platform type. + pub id: Option, + /// Name of this platform type. + pub name: Option, +} + +impl Resource for PlatformType {} +impl ResponseResult for PlatformType {} + + +/// Advertiser List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list advertisers](struct.AdvertiserListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdvertisersListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Advertiser collection. + pub advertisers: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertisersListResponse". + pub kind: Option, +} + +impl ResponseResult for AdvertisersListResponse {} + + +/// Creative Asset. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creative assets](struct.CreativeAssetInsertCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAsset { + /// Detected MIME type for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// Artwork type of rich media creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="artworkType")] + pub artwork_type: Option, + /// Offset left unit for an asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="positionLeftUnit")] + pub position_left_unit: Option, + /// Size of an asset when collapsed. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID. Additionally, applicable to assets whose displayType is ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN. + #[serde(rename="collapsedSize")] + pub collapsed_size: Option, + /// Flash version of the asset. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE, ENHANCED_BANNER, all RICH_MEDIA, and all VPAID. + #[serde(rename="flashVersion")] + pub flash_version: Option, + /// Whether the asset pushes down other content. Applicable to the following creative types: all RICH_MEDIA. Additionally, only applicable when the asset offsets are 0, the collapsedSize.width matches size.width, and the collapsedSize.height is less than size.height. + pub pushdown: Option, + /// Whether to hide Flash objects flag for an asset. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="hideFlashObjects")] + pub hide_flash_objects: Option, + /// List of feature dependencies for the creative asset that are detected by DCM. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative correctly. This is a read-only, auto-generated field. Applicable to the following creative types: ENHANCED_BANNER and HTML5_BANNER. + #[serde(rename="detectedFeatures")] + pub detected_features: Option>, + /// Duration in seconds for which an asset will be displayed. Applicable to the following creative types: INSTREAM_VIDEO and VPAID_LINEAR. + pub duration: Option, + /// Offset top unit for an asset. This is a read-only field if the asset displayType is ASSET_DISPLAY_TYPE_OVERLAY. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="positionTopUnit")] + pub position_top_unit: Option, + /// Numeric ID of this creative asset. This is a required field and should not be modified. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + pub id: Option, + /// Possible alignments for an asset. This is a read-only field. Applicable to the following creative types: RICH_MEDIA_MULTI_FLOATING. + pub alignment: Option, + /// Size associated with this creative asset. This is a required field when applicable; however for IMAGE and FLASH_INPAGE creatives, if left blank, this field will be automatically set using the actual size of the associated image asset. Applicable to the following creative types: ENHANCED_BANNER, ENHANCED_IMAGE, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all RICH_MEDIA. + pub size: Option, + /// Whether the asset is horizontally locked. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="horizontallyLocked")] + pub horizontally_locked: Option, + /// Initial wait time type before making the asset visible. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="startTimeType")] + pub start_time_type: Option, + /// Type of rich media asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="displayType")] + pub display_type: Option, + /// Detected expanded dimension for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="expandedDimension")] + pub expanded_dimension: Option, + /// Whether the asset is vertically locked. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="verticallyLocked")] + pub vertically_locked: Option, + /// Role of the asset in relation to creative. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. This is a required field. + /// PRIMARY applies to ENHANCED_BANNER, FLASH_INPAGE, HTML5_BANNER, IMAGE, IMAGE_GALLERY, all RICH_MEDIA (which may contain multiple primary assets), and all VPAID creatives. + /// BACKUP_IMAGE applies to ENHANCED_BANNER, FLASH_INPAGE, HTML5_BANNER, all RICH_MEDIA, and all VPAID creatives. + /// ADDITIONAL_IMAGE and ADDITIONAL_FLASH apply to FLASH_INPAGE creatives. + /// OTHER refers to assets from sources other than DCM, such as Studio uploaded assets, applicable to all RICH_MEDIA and all VPAID creatives. + /// PARENT_VIDEO refers to videos uploaded by the user in DCM and is applicable to INSTREAM_VIDEO and VPAID_LINEAR creatives. + /// TRANSCODED_VIDEO refers to videos transcoded by DCM from PARENT_VIDEO assets and is applicable to INSTREAM_VIDEO and VPAID_LINEAR creatives. + /// ALTERNATE_VIDEO refers to the DCM representation of child asset videos from Studio, and is applicable to VPAID_LINEAR creatives. These cannot be added or removed within DCM. + /// For VPAID_LINEAR creatives, PARENT_VIDEO, TRANSCODED_VIDEO and ALTERNATE_VIDEO assets that are marked active serve as backup in case the VPAID creative cannot be served. Only PARENT_VIDEO assets can be added or removed for an INSTREAM_VIDEO or VPAID_LINEAR creative. + pub role: Option, + /// Size of zip file. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. + #[serde(rename="zipFilesize")] + pub zip_filesize: Option, + /// Detected bit-rate for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="bitRate")] + pub bit_rate: Option, + /// Window mode options for flash assets. Applicable to the following creative types: FLASH_INPAGE, RICH_MEDIA_EXPANDING, RICH_MEDIA_IM_EXPAND, RICH_MEDIA_INPAGE, and RICH_MEDIA_INPAGE_FLOATING. + #[serde(rename="windowMode")] + pub window_mode: Option, + /// Progressive URL for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="progressiveServingUrl")] + pub progressive_serving_url: Option, + /// Duration type for which an asset will be displayed. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="durationType")] + pub duration_type: Option, + /// Detected video duration for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="videoDuration")] + pub video_duration: Option, + /// File size associated with this creative asset. This is a read-only field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + #[serde(rename="fileSize")] + pub file_size: Option, + /// Offset position for an asset in collapsed mode. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID. Additionally, only applicable to assets whose displayType is ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN. + pub offset: Option, + /// Whether the video asset is active. This is a read-only field for VPAID_NON_LINEAR assets. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + pub active: Option, + /// Whether the backup asset is original or changed by the user in DCM. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="originalBackup")] + pub original_backup: Option, + /// Whether to hide selection boxes flag for an asset. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="hideSelectionBoxes")] + pub hide_selection_boxes: Option, + /// Streaming URL for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID. + #[serde(rename="streamingServingUrl")] + pub streaming_serving_url: Option, + /// zIndex value of an asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.Additionally, only applicable to assets whose displayType is NOT one of the following types: ASSET_DISPLAY_TYPE_INPAGE or ASSET_DISPLAY_TYPE_OVERLAY. + #[serde(rename="zIndex")] + pub z_index: Option, + /// Rich media child asset type. This is a read-only field. Applicable to the following creative types: all VPAID. + #[serde(rename="childAssetType")] + pub child_asset_type: Option, + /// Exit event configured for the backup image. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="backupImageExit")] + pub backup_image_exit: Option, + /// Whether ActionScript3 is enabled for the flash asset. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE and ENHANCED_BANNER. + #[serde(rename="actionScript3")] + pub action_script3: Option, + /// Pushdown duration in seconds for an asset. Must be between 0 and 9.99. Applicable to the following creative types: all RICH_MEDIA.Additionally, only applicable when the asset pushdown field is true, the offsets are 0, the collapsedSize.width matches size.width, and the collapsedSize.height is less than size.height. + #[serde(rename="pushdownDuration")] + pub pushdown_duration: Option, + /// Identifier of this asset. This is the same identifier returned during creative asset insert operation. This is a required field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + #[serde(rename="assetIdentifier")] + pub asset_identifier: Option, + /// Whether the asset is transparent. Applicable to the following creative types: all RICH_MEDIA. Additionally, only applicable to HTML5 assets. + pub transparency: Option, + /// Whether the asset is SSL-compliant. This is a read-only field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Offset position for an asset. Applicable to the following creative types: all RICH_MEDIA. + pub position: Option, + /// Custom start time in seconds for making the asset visible. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="customStartTimeValue")] + pub custom_start_time_value: Option, + /// File name of zip file. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. + #[serde(rename="zipFilename")] + pub zip_filename: Option, +} + +impl Resource for CreativeAsset {} + + +/// Directory Site List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list directory sites](struct.DirectorySiteListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySitesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySitesListResponse". + pub kind: Option, + /// Directory site collection. + #[serde(rename="directorySites")] + pub directory_sites: Option>, +} + +impl ResponseResult for DirectorySitesListResponse {} + + +/// Modification timestamp. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LastModifiedInfo { + /// Timestamp of the last change in milliseconds since epoch. + pub time: Option, +} + +impl Part for LastModifiedInfo {} + + +/// Region List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list regions](struct.RegionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RegionsListResponse { + /// Region collection. + pub regions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#regionsListResponse". + pub kind: Option, +} + +impl ResponseResult for RegionsListResponse {} + + +/// Represents a grouping of related user role permissions. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user role permission groups](struct.UserRolePermissionGroupListCall.html) (none) +/// * [get user role permission groups](struct.UserRolePermissionGroupGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermissionGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionGroup". + pub kind: Option, + /// ID of this user role permission. + pub id: Option, + /// Name of this user role permission group. + pub name: Option, +} + +impl Resource for UserRolePermissionGroup {} +impl ResponseResult for UserRolePermissionGroup {} + + +/// Creative Click Tag. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClickTag { + /// Advertiser event name associated with the click tag. This field is used by ENHANCED_BANNER, ENHANCED_IMAGE, and HTML5_BANNER creatives. + #[serde(rename="eventName")] + pub event_name: Option, + /// Parameter name for the specified click tag. For ENHANCED_IMAGE creative assets, this field must match the value of the creative asset's creativeAssetId.name field. + pub name: Option, + /// Parameter value for the specified click tag. This field contains a click-through url. + pub value: Option, +} + +impl Part for ClickTag {} + + +/// Contains information about an internet connection type that can be targeted by ads. Clients can use the connection type to target mobile vs. broadband users. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get connection types](struct.ConnectionTypeGetCall.html) (response) +/// * [list connection types](struct.ConnectionTypeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConnectionType { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#connectionType". + pub kind: Option, + /// ID of this connection type. + pub id: Option, + /// Name of this connection type. + pub name: Option, +} + +impl Resource for ConnectionType {} +impl ResponseResult for ConnectionType {} + + +/// Browser List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list browsers](struct.BrowserListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct BrowsersListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#browsersListResponse". + pub kind: Option, + /// Browser collection. + pub browsers: Option>, +} + +impl ResponseResult for BrowsersListResponse {} + + +/// Object Filter. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ObjectFilter { + /// Applicable when status is ASSIGNED. The user has access to objects with these object IDs. + #[serde(rename="objectIds")] + pub object_ids: Option>, + /// Status of the filter. NONE means the user has access to none of the objects. ALL means the user has access to all objects. ASSIGNED means the user has access to the objects with IDs in the objectIds list. + pub status: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#objectFilter". + pub kind: Option, +} + +impl Part for ObjectFilter {} + + +/// Creative Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeSettings { + /// Header text for iFrames for this site. Must be less than or equal to 2000 characters long. + #[serde(rename="iFrameHeader")] + pub i_frame_header: Option, + /// Header text for iFrames for this site. Must be less than or equal to 2000 characters long. + #[serde(rename="iFrameFooter")] + pub i_frame_footer: Option, +} + +impl Part for CreativeSettings {} + + +/// Represents a dimension. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Dimension { + /// The kind of resource this is, in this case dfareporting#dimension. + pub kind: Option, + /// The dimension name, e.g. dfa:advertiser + pub name: Option, +} + +impl Part for Dimension {} + + +/// Contact of an order. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderContact { + /// Type of this contact. + #[serde(rename="contactType")] + pub contact_type: Option, + /// Title of this contact. + #[serde(rename="contactTitle")] + pub contact_title: Option, + /// Free-form information about this contact. It could be any information related to this contact in addition to type, title, name, and signature user profile ID. + #[serde(rename="contactInfo")] + pub contact_info: Option, + /// Name of this contact. + #[serde(rename="contactName")] + pub contact_name: Option, + /// ID of the user profile containing the signature that will be embedded into order documents. + #[serde(rename="signatureUserProfileId")] + pub signature_user_profile_id: Option, +} + +impl Part for OrderContact {} + + +/// DirectorySites contains properties of a website from the Site Directory. Sites need to be added to an account via the Sites resource before they can be assigned to a placement. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get directory sites](struct.DirectorySiteGetCall.html) (response) +/// * [list directory sites](struct.DirectorySiteListCall.html) (none) +/// * [insert directory sites](struct.DirectorySiteInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySite { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySite". + pub kind: Option, + /// Country ID of this directory site. + #[serde(rename="countryId")] + pub country_id: Option, + /// Description of this directory site. + pub description: Option, + /// Directory site settings. + pub settings: Option, + /// Currency ID of this directory site. + /// Possible values are: + /// - "1" for USD + /// - "2" for GBP + /// - "3" for ESP + /// - "4" for SEK + /// - "5" for CAD + /// - "6" for JPY + /// - "7" for DEM + /// - "8" for AUD + /// - "9" for FRF + /// - "10" for ITL + /// - "11" for DKK + /// - "12" for NOK + /// - "13" for FIM + /// - "14" for ZAR + /// - "15" for IEP + /// - "16" for NLG + /// - "17" for EUR + /// - "18" for KRW + /// - "19" for TWD + /// - "20" for SGD + /// - "21" for CNY + /// - "22" for HKD + /// - "23" for NZD + /// - "24" for MYR + /// - "25" for BRL + /// - "26" for PTE + /// - "27" for MXP + /// - "28" for CLP + /// - "29" for TRY + /// - "30" for ARS + /// - "31" for PEN + /// - "32" for ILS + /// - "33" for CHF + /// - "34" for VEF + /// - "35" for COP + /// - "36" for GTQ + /// - "37" for PLN + /// - "39" for INR + /// - "40" for THB + #[serde(rename="currencyId")] + pub currency_id: Option, + /// Tag types for regular placements. + /// + /// Acceptable values are: + /// - "STANDARD" + /// - "IFRAME_JAVASCRIPT_INPAGE" + /// - "INTERNAL_REDIRECT_INPAGE" + /// - "JAVASCRIPT_INPAGE" + #[serde(rename="inpageTagFormats")] + pub inpage_tag_formats: Option>, + /// URL of this directory site. + pub url: Option, + /// Directory site contacts. + #[serde(rename="contactAssignments")] + pub contact_assignments: Option>, + /// Parent directory site ID. + #[serde(rename="parentId")] + pub parent_id: Option, + /// Tag types for interstitial placements. + /// + /// Acceptable values are: + /// - "IFRAME_JAVASCRIPT_INTERSTITIAL" + /// - "INTERNAL_REDIRECT_INTERSTITIAL" + /// - "JAVASCRIPT_INTERSTITIAL" + #[serde(rename="interstitialTagFormats")] + pub interstitial_tag_formats: Option>, + /// Dimension value for the ID of this directory site. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Whether this directory site is active. + pub active: Option, + /// ID of this directory site. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this directory site. + pub name: Option, +} + +impl RequestValue for DirectorySite {} +impl Resource for DirectorySite {} +impl ResponseResult for DirectorySite {} + + +/// City List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list cities](struct.CityListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CitiesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#citiesListResponse". + pub kind: Option, + /// City collection. + pub cities: Option>, +} + +impl ResponseResult for CitiesListResponse {} + + +/// Contains properties of a creative group. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get creative groups](struct.CreativeGroupGetCall.html) (response) +/// * [update creative groups](struct.CreativeGroupUpdateCall.html) (request|response) +/// * [patch creative groups](struct.CreativeGroupPatchCall.html) (request|response) +/// * [list creative groups](struct.CreativeGroupListCall.html) (none) +/// * [insert creative groups](struct.CreativeGroupInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeGroup". + pub kind: Option, + /// Subaccount ID of this creative group. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this creative group. This is a required field and must be less than 256 characters long and unique among creative groups of the same advertiser. + pub name: Option, + /// Subgroup of the creative group. Assign your creative groups to one of the following subgroups in order to filter or manage them more easily. This field is required on insertion and is read-only after insertion. + /// Acceptable values are: + /// - 1 + /// - 2 + #[serde(rename="groupNumber")] + pub group_number: Option, + /// Advertiser ID of this creative group. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of this creative group. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this creative group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for CreativeGroup {} +impl Resource for CreativeGroup {} +impl ResponseResult for CreativeGroup {} + + +/// Represents a metric. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Metric { + /// The kind of resource this is, in this case dfareporting#metric. + pub kind: Option, + /// The metric name, e.g. dfa:impressions + pub name: Option, +} + +impl Part for Metric {} + + +/// Rich Media Exit Override. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RichMediaExitOverride { + /// Click-through URL to override the default exit URL. Applicable if the useCustomExitUrl field is set to true. + #[serde(rename="customExitUrl")] + pub custom_exit_url: Option, + /// Whether to use the custom exit URL. + #[serde(rename="useCustomExitUrl")] + pub use_custom_exit_url: Option, + /// ID for the override to refer to a specific exit in the creative. + #[serde(rename="exitId")] + pub exit_id: Option, +} + +impl Part for RichMediaExitOverride {} + + +/// Account Permission List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permissions](struct.AccountPermissionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermissionsListResponse { + /// Account permission collection. + #[serde(rename="accountPermissions")] + pub account_permissions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionsListResponse". + pub kind: Option, +} + +impl ResponseResult for AccountPermissionsListResponse {} + + +/// Placement GenerateTags Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [generatetags placements](struct.PlacementGeneratetagCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementsGenerateTagsResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementsGenerateTagsResponse". + pub kind: Option, + /// Set of generated tags for the specified placements. + #[serde(rename="placementTags")] + pub placement_tags: Option>, +} + +impl ResponseResult for PlacementsGenerateTagsResponse {} + + +/// Contains properties of a creative field value. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creative field values](struct.CreativeFieldValueInsertCall.html) (request|response) +/// * [get creative field values](struct.CreativeFieldValueGetCall.html) (response) +/// * [update creative field values](struct.CreativeFieldValueUpdateCall.html) (request|response) +/// * [patch creative field values](struct.CreativeFieldValuePatchCall.html) (request|response) +/// * [list creative field values](struct.CreativeFieldValueListCall.html) (none) +/// * [delete creative field values](struct.CreativeFieldValueDeleteCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldValue { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldValue". + pub kind: Option, + /// ID of this creative field value. This is a read-only, auto-generated field. + pub id: Option, + /// Value of this creative field value. It needs to be less than 256 characters in length and unique per creative field. + pub value: Option, +} + +impl RequestValue for CreativeFieldValue {} +impl Resource for CreativeFieldValue {} +impl ResponseResult for CreativeFieldValue {} + + +/// Floodlight Activity Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight activity groups](struct.FloodlightActivityGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivityGroupsListResponse". + pub kind: Option, + /// Floodlight activity group collection. + #[serde(rename="floodlightActivityGroups")] + pub floodlight_activity_groups: Option>, +} + +impl ResponseResult for FloodlightActivityGroupsListResponse {} + + +/// Directory Site Contact List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list directory site contacts](struct.DirectorySiteContactListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySiteContactsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Directory site contact collection + #[serde(rename="directorySiteContacts")] + pub directory_site_contacts: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySiteContactsListResponse". + pub kind: Option, +} + +impl ResponseResult for DirectorySiteContactsListResponse {} + + +/// Creative Custom Event. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeCustomEvent { + /// Target type used by the event. + #[serde(rename="targetType")] + pub target_type: Option, + /// Artwork type used by the creative.This is a read-only field. + #[serde(rename="artworkType")] + pub artwork_type: Option, + /// Video reporting ID, used to differentiate multiple videos in a single creative. This is a read-only field. + #[serde(rename="videoReportingId")] + pub video_reporting_id: Option, + /// Properties for rich media popup windows. This field is used only for exit events. + #[serde(rename="popupWindowProperties")] + pub popup_window_properties: Option, + /// Unique ID of this event used by DDM Reporting and Data Transfer. This is a read-only field. + #[serde(rename="advertiserCustomEventId")] + pub advertiser_custom_event_id: Option, + /// Artwork label column, used to link events in DCM back to events in Studio. This is a required field and should not be modified after insertion. + #[serde(rename="artworkLabel")] + pub artwork_label: Option, + /// Type of the event. This is a read-only field. + #[serde(rename="advertiserCustomEventType")] + pub advertiser_custom_event_type: Option, + /// Exit URL of the event. This field is used only for exit events. + #[serde(rename="exitUrl")] + pub exit_url: Option, + /// ID of this event. This is a required field and should not be modified after insertion. + pub id: Option, + /// User-entered name for the event. + #[serde(rename="advertiserCustomEventName")] + pub advertiser_custom_event_name: Option, +} + +impl Part for CreativeCustomEvent {} + + +/// Creative List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creatives](struct.CreativeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativesListResponse". + pub kind: Option, + /// Creative collection. + pub creatives: Option>, +} + +impl ResponseResult for CreativesListResponse {} + + +/// Omniture Integration Settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OmnitureSettings { + /// Whether placement cost data will be sent to Omniture. This property can be enabled only if omnitureIntegrationEnabled is true. + #[serde(rename="omnitureCostDataEnabled")] + pub omniture_cost_data_enabled: Option, + /// Whether Omniture integration is enabled. This property can be enabled only when the "Advanced Ad Serving" account setting is enabled. + #[serde(rename="omnitureIntegrationEnabled")] + pub omniture_integration_enabled: Option, +} + +impl Part for OmnitureSettings {} + + +/// Represents fields that are compatible to be selected for a report of type "PATH_TO_CONVERSION". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PathToConversionReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// Per-interaction dimensions which are compatible to be selected in the "perInteractionDimensions" section of the report. + #[serde(rename="perInteractionDimensions")] + pub per_interaction_dimensions: Option>, + /// The kind of resource this is, in this case dfareporting#pathToConversionReportCompatibleFields. + pub kind: Option, + /// Conversion dimensions which are compatible to be selected in the "conversionDimensions" section of the report. + #[serde(rename="conversionDimensions")] + pub conversion_dimensions: Option>, + /// Custom floodlight variables which are compatible to be selected in the "customFloodlightVariables" section of the report. + #[serde(rename="customFloodlightVariables")] + pub custom_floodlight_variables: Option>, +} + +impl Part for PathToConversionReportCompatibleFields {} + + +/// Mobile Carrier List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list mobile carriers](struct.MobileCarrierListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MobileCarriersListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileCarriersListResponse". + pub kind: Option, + /// Mobile carrier collection. + #[serde(rename="mobileCarriers")] + pub mobile_carriers: Option>, +} + +impl ResponseResult for MobileCarriersListResponse {} + + +/// Dynamic Tag +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityDynamicTag { + /// Tag code. + pub tag: Option, + /// ID of this dynamic tag. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this tag. + pub name: Option, +} + +impl Part for FloodlightActivityDynamicTag {} + + +/// Contains properties of a Creative. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creatives](struct.CreativeInsertCall.html) (request|response) +/// * [get creatives](struct.CreativeGetCall.html) (response) +/// * [list creatives](struct.CreativeListCall.html) (none) +/// * [update creatives](struct.CreativeUpdateCall.html) (request|response) +/// * [patch creatives](struct.CreativePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Creative { + /// Type of artwork used for the creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="artworkType")] + pub artwork_type: Option, + /// Latest Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="latestTraffickedCreativeId")] + pub latest_trafficked_creative_id: Option, + /// List of counter events configured for the creative. For ENHANCED_IMAGE creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: ENHANCED_IMAGE, all RICH_MEDIA, and all VPAID. + #[serde(rename="counterCustomEvents")] + pub counter_custom_events: Option>, + /// Advertiser ID of this creative. This is a required field. Applicable to all creative types. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Whether the creative is active. Applicable to all creative types. + pub active: Option, + /// List of timer events configured for the creative. For ENHANCED_IMAGE creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: ENHANCED_IMAGE, all RICH_MEDIA, and all VPAID. + #[serde(rename="timerCustomEvents")] + pub timer_custom_events: Option>, + /// Dimension value for the rendering ID of this creative. This is a read-only field. Applicable to all creative types. + #[serde(rename="renderingIdDimensionValue")] + pub rendering_id_dimension_value: Option, + /// OpenWindow FSCommand of this creative. This lets the SWF file communicate with either Flash Player or the program hosting Flash Player, such as a web browser. This is only triggered if allowScriptAccess field is true. Applicable to the following creative types: FLASH_INPAGE. + #[serde(rename="fsCommand")] + pub fs_command: Option, + /// ID of this creative. This is a read-only, auto-generated field. Applicable to all creative types. + pub id: Option, + /// Account ID of this creative. This field, if left unset, will be auto-generated for both insert and update operations. Applicable to all creative types. + #[serde(rename="accountId")] + pub account_id: Option, + /// Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="studioTraffickedCreativeId")] + pub studio_trafficked_creative_id: Option, + /// Whether the creative is archived. Applicable to all creative types. + pub archived: Option, + /// Override CSS value for rich media creatives. Applicable to the following creative types: all RICH_MEDIA. + #[serde(rename="overrideCss")] + pub override_css: Option, + /// Source application where creative was authored. Presently, only DBM authored creatives will have this field set. Applicable to all creative types. + #[serde(rename="authoringSource")] + pub authoring_source: Option, + /// The internal Flash version for this creative as calculated by DoubleClick Studio. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE, ENHANCED_BANNER, all RICH_MEDIA, and all VPAID. + #[serde(rename="requiredFlashVersion")] + pub required_flash_version: Option, + /// List of exit events configured for the creative. For ENHANCED_BANNER and ENHANCED_IMAGE creatives, these are read-only and auto-generated from clickTags, For ENHANCED_BANNER, an event is also created from the backupImageReportingLabel. Applicable to the following creative types: ENHANCED_BANNER, ENHANCED_IMAGE, all RICH_MEDIA, and all VPAID. + #[serde(rename="exitCustomEvents")] + pub exit_custom_events: Option>, + /// ID of current rendering version. This is a read-only field. Applicable to all creative types. + #[serde(rename="renderingId")] + pub rendering_id: Option, + /// Description of the video ad. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. + #[serde(rename="videoDescription")] + pub video_description: Option, + /// Third-party URL used to record backup image impressions. Applicable to the following creative types: all RICH_MEDIA + #[serde(rename="thirdPartyBackupImageImpressionsUrl")] + pub third_party_backup_image_impressions_url: Option, + /// The version number helps you keep track of multiple versions of your creative in your reports. The version number will always be auto-generated during insert operations to start at 1. For tracking creatives the version cannot be incremented and will always remain at 1. For all other creative types the version can be incremented only by 1 during update operations. In addition, the version will be automatically incremented by 1 when undergoing Rich Media creative merging. Applicable to all creative types. + pub version: Option, + /// Creative field assignments for this creative. Applicable to all creative types. + #[serde(rename="creativeFieldAssignments")] + pub creative_field_assignments: Option>, + /// The 6-character HTML color code, beginning with #, for the background of the window area where the Flash file is displayed. Default is white. Applicable to the following creative types: FLASH_INPAGE. + #[serde(rename="backgroundColor")] + pub background_color: Option, + /// Custom key-values for a Rich Media creative. Key-values let you customize the creative settings of a Rich Media ad running on your site without having to contact the advertiser. You can use key-values to dynamically change the look or functionality of a creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="customKeyValues")] + pub custom_key_values: Option>, + /// Dimension value for the ID of this creative. This is a read-only field. Applicable to all creative types. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Whether images are automatically advanced for enhanced image creatives. Applicable to the following creative types: ENHANCED_IMAGE. + pub auto_advance_images: Option, + /// Size associated with this creative. When inserting or updating a creative either the size ID field or size width and height fields can be used. This is a required field when applicable; however for IMAGE and FLASH_INPAGE creatives, if left blank, this field will be automatically set using the actual size of the associated image assets. Applicable to the following creative types: ENHANCED_BANNER, ENHANCED_IMAGE, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all RICH_MEDIA. + pub size: Option, + /// Type of this creative.This is a required field. Applicable to all creative types. + #[serde(rename="type")] + pub type_: Option, + /// Combined size of all creative assets. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="totalFileSize")] + pub total_file_size: Option, + /// Third-party URL used to record rich media impressions. Applicable to the following creative types: all RICH_MEDIA + #[serde(rename="thirdPartyRichMediaImpressionsUrl")] + pub third_party_rich_media_impressions_url: Option, + /// Studio advertiser ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="studioAdvertiserId")] + pub studio_advertiser_id: Option, + /// Assets associated with a creative. Applicable to all but the following creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and REDIRECT + #[serde(rename="creativeAssets")] + pub creative_assets: Option>, + /// List of feature dependencies that will cause a backup image to be served if the browser that serves the ad does not support them. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative asset correctly. This field is initially auto-generated to contain all features detected by DCM for all the assets of this creative and can then be modified by the client. To reset this field, copy over all the creativeAssets' detected features. Applicable to the following creative types: ENHANCED_BANNER and HTML5_BANNER. + #[serde(rename="backupImageFeatures")] + pub backup_image_features: Option>, + /// Creative video duration in seconds. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO, all RICH_MEDIA, and all VPAID. + #[serde(rename="videoDuration")] + pub video_duration: Option, + /// URL of hosted image or hosted video or another ad tag. For INSTREAM_VIDEO_REDIRECT creatives this is the in-stream video redirect URL. The standard for a VAST (Video Ad Serving Template) ad response allows for a redirect link to another VAST 2.0 or 3.0 call. This is a required field when applicable. Applicable to the following creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, REDIRECT, and INSTREAM_VIDEO_REDIRECT + #[serde(rename="redirectUrl")] + pub redirect_url: Option, + /// Click tags of the creative. For ENHANCED_BANNER, FLASH_INPAGE, and HTML5_BANNER creatives, this is a subset of detected click tags for the assets associated with this creative. After creating a flash asset, detected click tags will be returned in the creativeAssetMetadata. When inserting the creative, populate the creative clickTags field using the creativeAssetMetadata.clickTags field. For ENHANCED_IMAGE creatives, there should be exactly one entry in this list for each image creative asset. A click tag is matched with a corresponding creative asset by matching the clickTag.name field with the creativeAsset.assetIdentifier.name field. Applicable to the following creative types: ENHANCED_BANNER, ENHANCED_IMAGE, FLASH_INPAGE, HTML5_BANNER. + #[serde(rename="clickTags")] + pub click_tags: Option>, + /// Target window for backup image. Applicable to the following creative types: ENHANCED_BANNER, FLASH_INPAGE, and HTML5_BANNER. + #[serde(rename="backupImageTargetWindow")] + pub backup_image_target_window: Option, + /// The minimum required Flash plugin version for this creative. For example, 11.2.202.235. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="requiredFlashPluginVersion")] + pub required_flash_plugin_version: Option, + /// Reporting label used for HTML5 banner backup image. Applicable to the following creative types: ENHANCED_BANNER. + #[serde(rename="backupImageReportingLabel")] + pub backup_image_reporting_label: Option, + /// Compatibilities associated with this creative. This is a read-only field. WEB and WEB_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. Applicable to all creative types. + /// + /// Acceptable values are: + /// - "APP" + /// - "APP_INTERSTITIAL" + /// - "IN_STREAM_VIDEO" + /// - "WEB" + /// - "WEB_INTERSTITIAL" + pub compatibility: Option>, + /// Ad parameters user for VPAID creative. This is a read-only field. Applicable to the following creative types: all VPAID. + #[serde(rename="adParameters")] + pub ad_parameters: Option, + /// Whether HTML code is DCM-generated or manually entered. Set to true to ignore changes to htmlCode. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER. + #[serde(rename="htmlCodeLocked")] + pub html_code_locked: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creative". + pub kind: Option, + /// Subaccount ID of this creative. This field, if left unset, will be auto-generated for both insert and update operations. Applicable to all creative types. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of the creative. This is a required field and must be less than 256 characters long. Applicable to all creative types. + pub name: Option, + /// Keywords for a Rich Media creative. Keywords let you customize the creative settings of a Rich Media ad running on your site without having to contact the advertiser. You can use keywords to dynamically change the look or functionality of a creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="adTagKeys")] + pub ad_tag_keys: Option>, + /// Whether Flash assets associated with the creative need to be automatically converted to HTML5. This flag is enabled by default and users can choose to disable it if they don't want the system to generate and use HTML5 asset for this creative. Applicable to the following creative types: ENHANCED_BANNER and FLASH_INPAGE. + #[serde(rename="convertFlashToHtml5")] + pub convert_flash_to_html5: Option, + /// Whether creative should be treated as SSL compliant even if the system scan shows it's not. Applicable to all creative types. + #[serde(rename="sslOverride")] + pub ssl_override: Option, + /// Creative last modification information. This is a read-only field. Applicable to all creative types. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Click-through URL for backup image. Applicable to the following creative types: ENHANCED_BANNER, FLASH_INPAGE, and HTML5_BANNER. + #[serde(rename="backupImageClickThroughUrl")] + pub backup_image_click_through_url: Option, + /// Studio creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID. + #[serde(rename="studioCreativeId")] + pub studio_creative_id: Option, + /// Authoring tool for HTML5 banner creatives. This is a read-only field. Applicable to the following creative types: HTML5_BANNER. + #[serde(rename="authoringTool")] + pub authoring_tool: Option, + /// Third-party URLs for tracking in-stream video creative events. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. + #[serde(rename="thirdPartyUrls")] + pub third_party_urls: Option>, + /// List of companion creatives assigned to an in-Stream videocreative. Acceptable values include IDs of existing flash and image creatives. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. + #[serde(rename="companionCreatives")] + pub companion_creatives: Option>, + /// HTML code for the creative. This is a required field when applicable. This field is ignored if htmlCodeLocked is false. Applicable to the following creative types: all CUSTOM, FLASH_INPAGE, and HTML5_BANNER, and all RICH_MEDIA. + #[serde(rename="htmlCode")] + pub html_code: Option, + /// Whether the creative is SSL-compliant. This is a read-only field. Applicable to all creative types. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Industry standard ID assigned to creative for reach and frequency. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. + #[serde(rename="commercialId")] + pub commercial_id: Option, + /// Whether the user can choose to skip the creative. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID. + pub skippable: Option, + /// Whether script access is allowed for this creative. This is a read-only and deprecated field which will automatically be set to true on update. Applicable to the following creative types: FLASH_INPAGE. + #[serde(rename="allowScriptAccess")] + pub allow_script_access: Option, +} + +impl RequestValue for Creative {} +impl Resource for Creative {} +impl ResponseResult for Creative {} + + +/// Reporting Configuration +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportsConfiguration { + /// Whether the exposure to conversion report is enabled. This report shows detailed pathway information on up to 10 of the most recent ad exposures seen by a user before converting. + #[serde(rename="exposureToConversionEnabled")] + pub exposure_to_conversion_enabled: Option, + /// Report generation time zone ID of this account. This is a required field that can only be changed by a superuser. + /// Acceptable values are: + /// + /// - "1" for "America/New_York" + /// - "2" for "Europe/London" + /// - "3" for "Europe/Paris" + /// - "4" for "Africa/Johannesburg" + /// - "5" for "Asia/Jerusalem" + /// - "6" for "Asia/Shanghai" + /// - "7" for "Asia/Hong_Kong" + /// - "8" for "Asia/Tokyo" + /// - "9" for "Australia/Sydney" + /// - "10" for "Asia/Dubai" + /// - "11" for "America/Los_Angeles" + /// - "12" for "Pacific/Auckland" + /// - "13" for "America/Sao_Paulo" + #[serde(rename="reportGenerationTimeZoneId")] + pub report_generation_time_zone_id: Option, + /// Default lookback windows for new advertisers in this account. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, +} + +impl Part for ReportsConfiguration {} + + +/// Campaign List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list campaigns](struct.CampaignListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CampaignsListResponse { + /// Campaign collection. + pub campaigns: Option>, + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignsListResponse". + pub kind: Option, +} + +impl ResponseResult for CampaignsListResponse {} + + +/// User Role Permission List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user role permissions](struct.UserRolePermissionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermissionsListResponse { + /// User role permission collection. + #[serde(rename="userRolePermissions")] + pub user_role_permissions: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionsListResponse". + pub kind: Option, +} + +impl ResponseResult for UserRolePermissionsListResponse {} + + +/// Represents a UserProfile resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user profiles](struct.UserProfileListCall.html) (none) +/// * [get user profiles](struct.UserProfileGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserProfile { + /// The user name. + #[serde(rename="userName")] + pub user_name: Option, + /// The kind of resource this is, in this case dfareporting#userProfile. + pub kind: Option, + /// The sub account ID this profile belongs to if applicable. + #[serde(rename="subAccountId")] + pub sub_account_id: Option, + /// The account name this profile belongs to. + #[serde(rename="accountName")] + pub account_name: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// The sub account name this profile belongs to if applicable. + #[serde(rename="subAccountName")] + pub sub_account_name: Option, + /// The unique ID of the user profile. + #[serde(rename="profileId")] + pub profile_id: Option, + /// The account ID to which this profile belongs. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl Resource for UserProfile {} +impl ResponseResult for UserProfile {} + + +/// Creative Group Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeGroupAssignment { + /// ID of the creative group to be assigned. + #[serde(rename="creativeGroupId")] + pub creative_group_id: Option, + /// Creative group number of the creative group assignment. + #[serde(rename="creativeGroupNumber")] + pub creative_group_number: Option, +} + +impl Part for CreativeGroupAssignment {} + + +/// The report criteria for a report of type "PATH_TO_CONVERSION". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportPathToConversionCriteria { + /// The list of conversion dimensions the report should include. + #[serde(rename="conversionDimensions")] + pub conversion_dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of custom floodlight variables the report should include. + #[serde(rename="customFloodlightVariables")] + pub custom_floodlight_variables: Option>, + /// The list of 'dfa:activity' values to filter on. + #[serde(rename="activityFilters")] + pub activity_filters: Option>, + /// The list of custom rich media events to include. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option>, + /// The list of per interaction dimensions the report should include. + #[serde(rename="perInteractionDimensions")] + pub per_interaction_dimensions: Option>, + /// The properties of the report. + #[serde(rename="reportProperties")] + pub report_properties: Option, + /// The floodlight ID for which to show data in this report. All advertisers associated with that ID will automatically be added. The dimension of the value needs to be 'dfa:floodlightConfigId'. + #[serde(rename="floodlightConfigId")] + pub floodlight_config_id: Option, +} + +impl NestedType for ReportPathToConversionCriteria {} +impl Part for ReportPathToConversionCriteria {} + + +/// Creative Field List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative fields](struct.CreativeFieldListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Creative field collection. + #[serde(rename="creativeFields")] + pub creative_fields: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldsListResponse". + pub kind: Option, +} + +impl ResponseResult for CreativeFieldsListResponse {} + + +/// The report's email delivery settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportDelivery { + /// The message to be sent with each email. + pub message: Option, + /// The type of delivery for the owner to receive, if enabled. + #[serde(rename="emailOwnerDeliveryType")] + pub email_owner_delivery_type: Option, + /// The list of recipients to which to email the report. + pub recipients: Option>, + /// Whether the report should be emailed to the report owner. + #[serde(rename="emailOwner")] + pub email_owner: Option, +} + +impl NestedType for ReportDelivery {} +impl Part for ReportDelivery {} + + +/// Project List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list projects](struct.ProjectListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ProjectsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#projectsListResponse". + pub kind: Option, + /// Project collection. + pub projects: Option>, +} + +impl ResponseResult for ProjectsListResponse {} + + +/// Geographical Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GeoTargeting { + /// Regions to be targeted. For each region only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a region, do not target or exclude the country of the region. + pub regions: Option>, + /// Countries to be targeted or excluded from targeting, depending on the setting of the excludeCountries field. For each country only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting or excluding a country, do not target regions, cities, metros, or postal codes in the same country. + pub countries: Option>, + /// Metros to be targeted. For each metro only dmaId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a metro, do not target or exclude the country of the metro. + pub metros: Option>, + /// Cities to be targeted. For each city only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a city, do not target or exclude the country of the city, and do not target the metro or region of the city. + pub cities: Option>, + /// Whether or not to exclude the countries in the countries field from targeting. If false, the countries field refers to countries which will be targeted by the ad. + #[serde(rename="excludeCountries")] + pub exclude_countries: Option, + /// Postal codes to be targeted. For each postal code only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a postal code, do not target or exclude the country of the postal code. + #[serde(rename="postalCodes")] + pub postal_codes: Option>, +} + +impl Part for GeoTargeting {} + + +/// Delivery Schedule. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DeliverySchedule { + /// Serving priority of an ad, with respect to other ads. The lower the priority number, the greater the priority with which it is served. + pub priority: Option, + /// Whether or not hard cutoff is enabled. If true, the ad will not serve after the end date and time. Otherwise the ad will continue to be served until it has reached its delivery goals. + #[serde(rename="hardCutoff")] + pub hard_cutoff: Option, + /// Limit on the number of times an individual user can be served the ad within a specified period of time. + #[serde(rename="frequencyCap")] + pub frequency_cap: Option, + /// Impression ratio for this ad. This ratio determines how often each ad is served relative to the others. For example, if ad A has an impression ratio of 1 and ad B has an impression ratio of 3, then DCM will serve ad B three times as often as ad A. Must be between 1 and 10. + #[serde(rename="impressionRatio")] + pub impression_ratio: Option, +} + +impl Part for DeliverySchedule {} + + +/// The report's schedule. Can only be set if the report's 'dateRange' is a relative date range and the relative date range is not "TODAY". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportSchedule { + /// Start date of date range for which scheduled reports should be run. + #[serde(rename="startDate")] + pub start_date: Option, + /// Enum to define for "MONTHLY" scheduled reports whether reports should be repeated on the same day of the month as "startDate" or the same day of the week of the month. + /// Example: If 'startDate' is Monday, April 2nd 2012 (2012-04-02), "DAY_OF_MONTH" would run subsequent reports on the 2nd of every Month, and "WEEK_OF_MONTH" would run subsequent reports on the first Monday of the month. + #[serde(rename="runsOnDayOfMonth")] + pub runs_on_day_of_month: Option, + /// The expiration date when the scheduled report stops running. + #[serde(rename="expirationDate")] + pub expiration_date: Option, + /// Whether the schedule is active or not. Must be set to either true or false. + pub active: Option, + /// Defines every how many days, weeks or months the report should be run. Needs to be set when "repeats" is either "DAILY", "WEEKLY" or "MONTHLY". + pub every: Option, + /// The interval for which the report is repeated. Note: + /// - "DAILY" also requires field "every" to be set. + /// - "WEEKLY" also requires fields "every" and "repeatsOnWeekDays" to be set. + /// - "MONTHLY" also requires fields "every" and "runsOnDayOfMonth" to be set. + pub repeats: Option, + /// List of week days "WEEKLY" on which scheduled reports should run. + #[serde(rename="repeatsOnWeekDays")] + pub repeats_on_week_days: Option>, +} + +impl NestedType for ReportSchedule {} +impl Part for ReportSchedule {} + + +/// Represents a recipient. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Recipient { + /// The kind of resource this is, in this case dfareporting#recipient. + pub kind: Option, + /// The delivery type for the recipient. + #[serde(rename="deliveryType")] + pub delivery_type: Option, + /// The email address of the recipient. + pub email: Option, +} + +impl Part for Recipient {} + + +/// Represents fields that are compatible to be selected for a report of type "STANDARD". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#reportCompatibleFields. + pub kind: Option, + /// Metrics which are compatible to be selected as activity metrics to pivot on in the "activities" section of the report. + #[serde(rename="pivotedActivityMetrics")] + pub pivoted_activity_metrics: Option>, + /// Dimensions which are compatible to be selected in the "dimensions" section of the report. + pub dimensions: Option>, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, +} + +impl Part for ReportCompatibleFields {} + + +/// Advertiser Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list advertiser groups](struct.AdvertiserGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdvertiserGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiserGroupsListResponse". + pub kind: Option, + /// Advertiser group collection. + #[serde(rename="advertiserGroups")] + pub advertiser_groups: Option>, +} + +impl ResponseResult for AdvertiserGroupsListResponse {} + + +/// Placement Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list placement groups](struct.PlacementGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementGroupsListResponse". + pub kind: Option, + /// Placement group collection. + #[serde(rename="placementGroups")] + pub placement_groups: Option>, +} + +impl ResponseResult for PlacementGroupsListResponse {} + + +/// The properties of the report. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportPathToConversionCriteriaReportProperties { + /// DFA checks to see if a click interaction occurred within the specified period of time before a conversion. By default the value is pulled from Floodlight or you can manually enter a custom value. Valid values: 1-90. + #[serde(rename="clicksLookbackWindow")] + pub clicks_lookback_window: Option, + /// Enable pivoting on interaction path. + #[serde(rename="pivotOnInteractionPath")] + pub pivot_on_interaction_path: Option, + /// DFA checks to see if an impression interaction occurred within the specified period of time before a conversion. By default the value is pulled from Floodlight or you can manually enter a custom value. Valid values: 1-90. + #[serde(rename="impressionsLookbackWindow")] + pub impressions_lookback_window: Option, + /// Include conversions that have no associated cookies and no exposures. It’s therefore impossible to know how the user was exposed to your ads during the lookback window prior to a conversion. + #[serde(rename="includeUnattributedIPConversions")] + pub include_unattributed_ip_conversions: Option, + /// Include conversions of users with a DoubleClick cookie but without an exposure. That means the user did not click or see an ad from the advertiser within the Floodlight group, or that the interaction happened outside the lookback window. + #[serde(rename="includeUnattributedCookieConversions")] + pub include_unattributed_cookie_conversions: Option, + /// The maximum amount of time that can take place between interactions (clicks or impressions) by the same user. Valid values: 1-90. + #[serde(rename="maximumInteractionGap")] + pub maximum_interaction_gap: Option, + /// Deprecated: has no effect. + #[serde(rename="includeAttributedIPConversions")] + pub include_attributed_ip_conversions: Option, + /// The maximum number of click interactions to include in the report. Advertisers currently paying for E2C reports get up to 200 (100 clicks, 100 impressions). If another advertiser in your network is paying for E2C, you can have up to 5 total exposures per report. + #[serde(rename="maximumClickInteractions")] + pub maximum_click_interactions: Option, + /// The maximum number of click interactions to include in the report. Advertisers currently paying for E2C reports get up to 200 (100 clicks, 100 impressions). If another advertiser in your network is paying for E2C, you can have up to 5 total exposures per report. + #[serde(rename="maximumImpressionInteractions")] + pub maximum_impression_interactions: Option, +} + +impl NestedType for ReportPathToConversionCriteriaReportProperties {} +impl Part for ReportPathToConversionCriteriaReportProperties {} + + +/// Technology Targeting. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TechnologyTargeting { + /// Browsers that this ad targets. For each browser either set browserVersionId or dartId along with the version numbers. If both are specified, only browserVersionId will be used.The other fields are populated automatically when the ad is inserted or updated. + pub browsers: Option>, + /// Operating systems that this ad targets. To target specific versions, use operatingSystemVersions. For each operating system only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system, do not set targeting for operating system versions for the same operating system. + #[serde(rename="operatingSystems")] + pub operating_systems: Option>, + /// Mobile carriers that this ad targets. For each mobile carrier only id is required, and the other fields are populated automatically when the ad is inserted or updated. If targeting a mobile carrier, do not set targeting for any zip codes. + #[serde(rename="mobileCarriers")] + pub mobile_carriers: Option>, + /// Connection types that this ad targets. For each connection type only id is required.The other fields are populated automatically when the ad is inserted or updated. + #[serde(rename="connectionTypes")] + pub connection_types: Option>, + /// Platform types that this ad targets. For example, desktop, mobile, or tablet. For each platform type, only id is required, and the other fields are populated automatically when the ad is inserted or updated. + #[serde(rename="platformTypes")] + pub platform_types: Option>, + /// Operating system versions that this ad targets. To target all versions, use operatingSystems. For each operating system version, only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system version, do not set targeting for the corresponding operating system in operatingSystems. + #[serde(rename="operatingSystemVersions")] + pub operating_system_versions: Option>, +} + +impl Part for TechnologyTargeting {} + + +/// Represents the list of reports. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list reports](struct.ReportListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportList { + /// Continuation token used to page through reports. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The reports returned in this response. + pub items: Option>, + /// The kind of list this is, in this case dfareporting#reportList. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, +} + +impl ResponseResult for ReportList {} + + +/// Remarketing List Targeting Expression. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListTargetingExpression { + /// Expression describing which lists are being targeted by the ad. + pub expression: Option, +} + +impl Part for ListTargetingExpression {} + + +/// CreativeAssets contains properties of a creative asset file which will be uploaded or has already been uploaded. Refer to the creative sample code for how to upload assets and insert a creative. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert creative assets](struct.CreativeAssetInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeAssetMetadata { + /// Rules validated during code generation that generated a warning. This is a read-only, auto-generated field. + /// + /// Possible values are: + /// - "CLICK_TAG_NON_TOP_LEVEL" + /// - "CLICK_TAG_MISSING" + /// - "CLICK_TAG_MORE_THAN_ONE" + /// - "CLICK_TAG_INVALID" + /// - "ORPHANED_ASSET" + /// - "PRIMARY_HTML_MISSING" + /// - "EXTERNAL_FILE_REFERENCED" + /// - "MRAID_REFERENCED" + /// - "ADMOB_REFERENCED" + /// - "FILE_TYPE_INVALID" + /// - "ZIP_INVALID" + /// - "LINKED_FILE_NOT_FOUND" + /// - "MAX_FLASH_VERSION_11" + /// - "NOT_SSL_COMPLIANT" + /// - "FILE_DETAIL_EMPTY" + /// - "ASSET_INVALID" + /// - "GWD_PROPERTIES_INVALID" + /// - "ENABLER_UNSUPPORTED_METHOD_DCM" + /// - "ASSET_FORMAT_UNSUPPORTED_DCM" + /// - "COMPONENT_UNSUPPORTED_DCM" + /// - "HTML5_FEATURE_UNSUPPORTED' " + #[serde(rename="warnedValidationRules")] + pub warned_validation_rules: Option>, + /// List of feature dependencies for the creative asset that are detected by DCM. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative correctly. This is a read-only, auto-generated field. + #[serde(rename="detectedFeatures")] + pub detected_features: Option>, + /// List of detected click tags for assets. This is a read-only auto-generated field. + #[serde(rename="clickTags")] + pub click_tags: Option>, + /// ID of the creative asset. This is a required field. + #[serde(rename="assetIdentifier")] + pub asset_identifier: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeAssetMetadata". + pub kind: Option, +} + +impl RequestValue for CreativeAssetMetadata {} +impl ResponseResult for CreativeAssetMetadata {} + + +/// Placement Tag Data +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TagData { + /// Tag string to record a click. + #[serde(rename="clickTag")] + pub click_tag: Option, + /// Tag string for serving an ad. + #[serde(rename="impressionTag")] + pub impression_tag: Option, + /// Creative associated with this placement tag. + #[serde(rename="creativeId")] + pub creative_id: Option, + /// Ad associated with this placement tag. + #[serde(rename="adId")] + pub ad_id: Option, + /// TagData tag format of this tag. + pub format: Option, +} + +impl Part for TagData {} + + +/// The report criteria for a report of type "FLOODLIGHT". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportFloodlightCriteria { + /// The floodlight ID for which to show data in this report. All advertisers associated with that ID will automatically be added. The dimension of the value needs to be 'dfa:floodlightConfigId'. + #[serde(rename="floodlightConfigId")] + pub floodlight_config_id: Option, + /// The list of dimensions the report should include. + pub dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of custom rich media events to include. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option>, + /// The list of filters on which dimensions are filtered. + /// Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// The properties of the report. + #[serde(rename="reportProperties")] + pub report_properties: Option, +} + +impl NestedType for ReportFloodlightCriteria {} +impl Part for ReportFloodlightCriteria {} + + +/// Landing Page List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list landing pages](struct.LandingPageListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LandingPagesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#landingPagesListResponse". + pub kind: Option, + /// Landing page collection + #[serde(rename="landingPages")] + pub landing_pages: Option>, +} + +impl ResponseResult for LandingPagesListResponse {} + + +/// Site List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list sites](struct.SiteListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SitesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#sitesListResponse". + pub kind: Option, + /// Site collection. + pub sites: Option>, +} + +impl ResponseResult for SitesListResponse {} + + +/// Represents a dimension filter. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionFilter { + /// The name of the dimension to filter. + #[serde(rename="dimensionName")] + pub dimension_name: Option, + /// The kind of resource this is, in this case dfareporting#dimensionFilter. + pub kind: Option, + /// The value of the dimension to filter. + pub value: Option, +} + +impl Part for DimensionFilter {} + + +/// Contains information about a postal code that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get postal codes](struct.PostalCodeGetCall.html) (response) +/// * [list postal codes](struct.PostalCodeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PostalCode { + /// Postal code. This is equivalent to the id field. + pub code: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#postalCode". + pub kind: Option, + /// DART ID of the country to which this postal code belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// ID of this postal code. + pub id: Option, + /// Country code of the country to which this postal code belongs. + #[serde(rename="countryCode")] + pub country_code: Option, +} + +impl Resource for PostalCode {} +impl ResponseResult for PostalCode {} + + +/// Contains properties of a remarketing list. Remarketing enables you to create lists of users who have performed specific actions on a site, then target ads to members of those lists. This resource can be used to manage remarketing lists that are owned by your advertisers. To see all remarketing lists that are visible to your advertisers, including those that are shared to your advertiser or account, use the TargetableRemarketingLists resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert remarketing lists](struct.RemarketingListInsertCall.html) (request|response) +/// * [get remarketing lists](struct.RemarketingListGetCall.html) (response) +/// * [update remarketing lists](struct.RemarketingListUpdateCall.html) (request|response) +/// * [list remarketing lists](struct.RemarketingListListCall.html) (none) +/// * [patch remarketing lists](struct.RemarketingListPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RemarketingList { + /// Rule used to populate the remarketing list with users. + #[serde(rename="listPopulationRule")] + pub list_population_rule: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingList". + pub kind: Option, + /// Subaccount ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Remarketing list description. + pub description: Option, + /// Number of users currently in the list. This is a read-only field. + #[serde(rename="listSize")] + pub list_size: Option, + /// Number of days that a user should remain in the remarketing list without an impression. + #[serde(rename="lifeSpan")] + pub life_span: Option, + /// Dimension value for the advertiser ID that owns this remarketing list. This is a required field. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Product from which this remarketing list was originated. + #[serde(rename="listSource")] + pub list_source: Option, + /// Whether this remarketing list is active. + pub active: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Account ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests. + #[serde(rename="accountId")] + pub account_id: Option, + /// Remarketing list ID. This is a read-only, auto-generated field. + pub id: Option, + /// Name of the remarketing list. This is a required field. Must be no greater than 128 characters long. + pub name: Option, +} + +impl RequestValue for RemarketingList {} +impl Resource for RemarketingList {} +impl ResponseResult for RemarketingList {} + + +/// Contains properties of a Floodlight activity. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get floodlight activities](struct.FloodlightActivityGetCall.html) (response) +/// * [insert floodlight activities](struct.FloodlightActivityInsertCall.html) (request|response) +/// * [patch floodlight activities](struct.FloodlightActivityPatchCall.html) (request|response) +/// * [update floodlight activities](struct.FloodlightActivityUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivity { + /// Whether this tag should use SSL. + pub secure: Option, + /// Dimension value for the ID of this floodlight activity. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Name of the associated floodlight activity group. This is a read-only field. + #[serde(rename="floodlightActivityGroupName")] + pub floodlight_activity_group_name: Option, + /// Whether the image tag is enabled for this activity. + #[serde(rename="imageTagEnabled")] + pub image_tag_enabled: Option, + /// Advertiser ID of this floodlight activity. If this field is left blank, the value will be copied over either from the activity group's advertiser or the existing activity's advertiser. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Code type used for cache busting in the generated tag. + #[serde(rename="cacheBustingType")] + pub cache_busting_type: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Floodlight activity group ID of this floodlight activity. This is a required field. + #[serde(rename="floodlightActivityGroupId")] + pub floodlight_activity_group_id: Option, + /// List of the user-defined variables used by this conversion tag. These map to the "u[1-20]=" in the tags. Each of these can have a user defined type. + /// Acceptable values are: + /// - "U1" + /// - "U2" + /// - "U3" + /// - "U4" + /// - "U5" + /// - "U6" + /// - "U7" + /// - "U8" + /// - "U9" + /// - "U10" + /// - "U11" + /// - "U12" + /// - "U13" + /// - "U14" + /// - "U15" + /// - "U16" + /// - "U17" + /// - "U18" + /// - "U19" + /// - "U20" + #[serde(rename="userDefinedVariableTypes")] + pub user_defined_variable_types: Option>, + /// Value of the cat= paramter in the floodlight tag, which the ad servers use to identify the activity. This is optional: if empty, a new tag string will be generated for you. This string must be 1 to 8 characters long, with valid characters being [a-z][A-Z][0-9][-][ _ ]. This tag string must also be unique among activities of the same activity group. This field is read-only after insertion. + #[serde(rename="tagString")] + pub tag_string: Option, + /// Tag string of the associated floodlight activity group. This is a read-only field. + #[serde(rename="floodlightActivityGroupTagString")] + pub floodlight_activity_group_tag_string: Option, + /// URL where this tag will be deployed. If specified, must be less than 256 characters long. + #[serde(rename="expectedUrl")] + pub expected_url: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivity". + pub kind: Option, + /// Subaccount ID of this floodlight activity. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this floodlight activity. This is a required field. Must be less than 129 characters long and cannot contain quotes. + pub name: Option, + /// Publisher dynamic floodlight tags. + #[serde(rename="publisherTags")] + pub publisher_tags: Option>, + /// Whether the floodlight activity is SSL-compliant. This is a read-only field, its value detected by the system from the floodlight tags. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// General notes or implementation instructions for the tag. + pub notes: Option, + /// Floodlight configuration ID of this floodlight activity. If this field is left blank, the value will be copied over either from the activity group's floodlight configuration or from the existing activity's floodlight configuration. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// ID of this floodlight activity. This is a read-only, auto-generated field. + pub id: Option, + /// Counting method for conversions for this floodlight activity. This is a required field. + #[serde(rename="countingMethod")] + pub counting_method: Option, + /// Dynamic floodlight tags. + #[serde(rename="defaultTags")] + pub default_tags: Option>, + /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="floodlightConfigurationIdDimensionValue")] + pub floodlight_configuration_id_dimension_value: Option, + /// Tag format type for the floodlight activity. If left blank, the tag format will default to HTML. + #[serde(rename="tagFormat")] + pub tag_format: Option, + /// Whether this activity is archived. + pub hidden: Option, + /// Account ID of this floodlight activity. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Whether this floodlight activity must be SSL-compliant. + #[serde(rename="sslRequired")] + pub ssl_required: Option, + /// Type of the associated floodlight activity group. This is a read-only field. + #[serde(rename="floodlightActivityGroupType")] + pub floodlight_activity_group_type: Option, +} + +impl RequestValue for FloodlightActivity {} +impl ResponseResult for FloodlightActivity {} + + +/// Contains information about a browser that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list browsers](struct.BrowserListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Browser { + /// Major version number (leftmost number) of this browser. For example, for Chrome 5.0.376.86 beta, this field should be set to 5. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is. + #[serde(rename="majorVersion")] + pub major_version: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#browser". + pub kind: Option, + /// ID referring to this grouping of browser and version numbers. This is the ID used for targeting. + #[serde(rename="browserVersionId")] + pub browser_version_id: Option, + /// Name of this browser. + pub name: Option, + /// DART ID of this browser. This is the ID used when generating reports. + #[serde(rename="dartId")] + pub dart_id: Option, + /// Minor version number (number after first dot on left) of this browser. For example, for Chrome 5.0.375.86 beta, this field should be set to 0. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is. + #[serde(rename="minorVersion")] + pub minor_version: Option, +} + +impl Resource for Browser {} + + +/// Account User Profile List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account user profiles](struct.AccountUserProfileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountUserProfilesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Account user profile collection. + #[serde(rename="accountUserProfiles")] + pub account_user_profiles: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountUserProfilesListResponse". + pub kind: Option, +} + +impl ResponseResult for AccountUserProfilesListResponse {} + + +/// Contains properties of a DCM advertiser. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get advertisers](struct.AdvertiserGetCall.html) (response) +/// * [update advertisers](struct.AdvertiserUpdateCall.html) (request|response) +/// * [patch advertisers](struct.AdvertiserPatchCall.html) (request|response) +/// * [list advertisers](struct.AdvertiserListCall.html) (none) +/// * [insert advertisers](struct.AdvertiserInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Advertiser { + /// Status of this advertiser. + pub status: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiser". + pub kind: Option, + /// Subaccount ID of this advertiser.This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this advertiser. This is a required field and must be less than 256 characters long and unique among advertisers of the same account. + pub name: Option, + /// ID of the click-through event tag to apply by default to the landing pages of this advertiser's campaigns. + #[serde(rename="defaultClickThroughEventTagId")] + pub default_click_through_event_tag_id: Option, + /// Original floodlight configuration before any sharing occurred. Set the floodlightConfigurationId of this advertiser to originalFloodlightConfigurationId to unshare the advertiser's current floodlight configuration. You cannot unshare an advertiser's floodlight configuration if the shared configuration has activities associated with any campaign or placement. + #[serde(rename="originalFloodlightConfigurationId")] + pub original_floodlight_configuration_id: Option, + /// Suffix added to click-through URL of ad creative associations under this advertiser. Must be less than 129 characters long. + #[serde(rename="clickThroughUrlSuffix")] + pub click_through_url_suffix: Option, + /// Floodlight configuration ID of this advertiser. The floodlight configuration ID will be created automatically, so on insert this field should be left blank. This field can be set to another advertiser's floodlight configuration ID in order to share that advertiser's floodlight configuration with this advertiser, so long as: + /// - This advertiser's original floodlight configuration is not already associated with floodlight activities or floodlight activity groups. + /// - This advertiser's original floodlight configuration is not already shared with another advertiser. + #[serde(rename="floodlightConfigurationId")] + pub floodlight_configuration_id: Option, + /// ID of the advertiser group this advertiser belongs to. You can group advertisers for reporting purposes, allowing you to see aggregated information for all advertisers in each group. + #[serde(rename="advertiserGroupId")] + pub advertiser_group_id: Option, + /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="floodlightConfigurationIdDimensionValue")] + pub floodlight_configuration_id_dimension_value: Option, + /// Suspension status of this advertiser. + pub suspended: Option, + /// Dimension value for the ID of this advertiser. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Default email address used in sender field for tag emails. + #[serde(rename="defaultEmail")] + pub default_email: Option, + /// ID of this advertiser. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this advertiser.This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for Advertiser {} +impl Resource for Advertiser {} +impl ResponseResult for Advertiser {} + + +/// Platform Type List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list platform types](struct.PlatformTypeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlatformTypesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#platformTypesListResponse". + pub kind: Option, + /// Platform type collection. + #[serde(rename="platformTypes")] + pub platform_types: Option>, +} + +impl ResponseResult for PlatformTypesListResponse {} + + +/// Change Log List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list change logs](struct.ChangeLogListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChangeLogsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#changeLogsListResponse". + pub kind: Option, + /// Change log collection. + #[serde(rename="changeLogs")] + pub change_logs: Option>, +} + +impl ResponseResult for ChangeLogsListResponse {} + + +/// Placement List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list placements](struct.PlacementListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementsListResponse". + pub kind: Option, + /// Placement collection. + pub placements: Option>, +} + +impl ResponseResult for PlacementsListResponse {} + + +/// Ad List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list ads](struct.AdListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#adsListResponse". + pub kind: Option, + /// Ad collection. + pub ads: Option>, +} + +impl ResponseResult for AdsListResponse {} + + +/// The report criteria for a report of type "REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportReachCriteria { + /// Activity group. + pub activities: Option, + /// The list of dimensions the report should include. + pub dimensions: Option>, + /// The list of names of metrics the report should include. + #[serde(rename="metricNames")] + pub metric_names: Option>, + /// The date range this report should be run for. + #[serde(rename="dateRange")] + pub date_range: Option, + /// The list of filters on which dimensions are filtered. + /// Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// The list of names of Reach By Frequency metrics the report should include. + #[serde(rename="reachByFrequencyMetricNames")] + pub reach_by_frequency_metric_names: Option>, + /// Custom Rich Media Events group. + #[serde(rename="customRichMediaEvents")] + pub custom_rich_media_events: Option, + /// Whether to enable all reach dimension combinations in the report. Defaults to false. If enabled, the date range of the report should be within the last three months. + #[serde(rename="enableAllDimensionCombinations")] + pub enable_all_dimension_combinations: Option, +} + +impl NestedType for ReportReachCriteria {} +impl Part for ReportReachCriteria {} + + +/// The URLs where the completed report file can be downloaded. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileUrls { + /// The URL for downloading the report data through a browser. + #[serde(rename="browserUrl")] + pub browser_url: Option, + /// The URL for downloading the report data through the API. + #[serde(rename="apiUrl")] + pub api_url: Option, +} + +impl NestedType for FileUrls {} +impl Part for FileUrls {} + + +/// Order document List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list order documents](struct.OrderDocumentListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OrderDocumentsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#orderDocumentsListResponse". + pub kind: Option, + /// Order document collection + #[serde(rename="orderDocuments")] + pub order_documents: Option>, +} + +impl ResponseResult for OrderDocumentsListResponse {} + + +/// User Defined Variable configuration. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserDefinedVariableConfiguration { + /// Data type for the variable. This is a required field. + #[serde(rename="dataType")] + pub data_type: Option, + /// User-friendly name for the variable which will appear in reports. This is a required field, must be less than 64 characters long, and cannot contain the following characters: ""<>". + #[serde(rename="reportName")] + pub report_name: Option, + /// Variable name in the tag. This is a required field. + #[serde(rename="variableType")] + pub variable_type: Option, +} + +impl Part for UserDefinedVariableConfiguration {} + + +/// Pricing Information +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Pricing { + /// Group type of this inventory item if it represents a placement group. Is null otherwise. There are two type of placement groups: PLANNING_PLACEMENT_GROUP_TYPE_PACKAGE is a simple group of inventory items that acts as a single pricing point for a group of tags. PLANNING_PLACEMENT_GROUP_TYPE_ROADBLOCK is a group of inventory items that not only acts as a single pricing point, but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned inventory items to be marked as primary. + #[serde(rename="groupType")] + pub group_type: Option, + /// Start date of this inventory item. + #[serde(rename="startDate")] + pub start_date: Option, + /// Flights of this inventory item. A flight (a.k.a. pricing period) represents the inventory item pricing information for a specific period of time. + pub flights: Option>, + /// End date of this inventory item. + #[serde(rename="endDate")] + pub end_date: Option, + /// Pricing type of this inventory item. + #[serde(rename="pricingType")] + pub pricing_type: Option, + /// Cap cost type of this inventory item. + #[serde(rename="capCostType")] + pub cap_cost_type: Option, +} + +impl Part for Pricing {} + + +/// Publisher Dynamic Tag +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightActivityPublisherDynamicTag { + /// Whether this tag is applicable only for view-throughs. + #[serde(rename="viewThrough")] + pub view_through: Option, + /// Site ID of this dynamic tag. + #[serde(rename="siteId")] + pub site_id: Option, + /// Whether this tag is applicable only for click-throughs. + #[serde(rename="clickThrough")] + pub click_through: Option, + /// Directory site ID of this dynamic tag. This is a write-only field that can be used as an alternative to the siteId field. When this resource is retrieved, only the siteId field will be populated. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Dimension value for the ID of the site. This is a read-only, auto-generated field. + #[serde(rename="siteIdDimensionValue")] + pub site_id_dimension_value: Option, + /// Dynamic floodlight tag. + #[serde(rename="dynamicTag")] + pub dynamic_tag: Option, +} + +impl Part for FloodlightActivityPublisherDynamicTag {} + + +/// Contains information about where a user's browser is taken after the user clicks an ad. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update landing pages](struct.LandingPageUpdateCall.html) (request|response) +/// * [list landing pages](struct.LandingPageListCall.html) (none) +/// * [patch landing pages](struct.LandingPagePatchCall.html) (request|response) +/// * [insert landing pages](struct.LandingPageInsertCall.html) (request|response) +/// * [delete landing pages](struct.LandingPageDeleteCall.html) (none) +/// * [get landing pages](struct.LandingPageGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LandingPage { + /// Whether or not this landing page will be assigned to any ads or creatives that do not have a landing page assigned explicitly. Only one default landing page is allowed per campaign. + pub default: Option, + /// URL of this landing page. This is a required field. + pub url: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#landingPage". + pub kind: Option, + /// ID of this landing page. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this landing page. This is a required field. It must be less than 256 characters long, and must be unique among landing pages of the same campaign. + pub name: Option, +} + +impl RequestValue for LandingPage {} +impl Resource for LandingPage {} +impl ResponseResult for LandingPage {} + + +/// Represents the dimensions of ads, placements, creatives, or creative assets. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert sizes](struct.SizeInsertCall.html) (request|response) +/// * [get sizes](struct.SizeGetCall.html) (response) +/// * [list sizes](struct.SizeListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Size { + /// Width of this size. + pub width: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#size". + pub kind: Option, + /// Height of this size. + pub height: Option, + /// ID of this size. This is a read-only, auto-generated field. + pub id: Option, + /// IAB standard size. This is a read-only, auto-generated field. + pub iab: Option, +} + +impl RequestValue for Size {} +impl Resource for Size {} +impl ResponseResult for Size {} + + +/// Contains information about a city that can be targeted by ads. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct City { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#city". + pub kind: Option, + /// DART ID of the country to which this city belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// Name of this city. + pub name: Option, + /// Country code of the country to which this city belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Metro region code of the metro region (DMA) to which this city belongs. + #[serde(rename="metroCode")] + pub metro_code: Option, + /// Region code of the region to which this city belongs. + #[serde(rename="regionCode")] + pub region_code: Option, + /// ID of the metro region (DMA) to which this city belongs. + #[serde(rename="metroDmaId")] + pub metro_dma_id: Option, + /// DART ID of this city. This is the ID used for targeting and generating reports. + #[serde(rename="dartId")] + pub dart_id: Option, + /// DART ID of the region to which this city belongs. + #[serde(rename="regionDartId")] + pub region_dart_id: Option, +} + +impl Part for City {} + + +/// Click Through URL Suffix settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ClickThroughUrlSuffixProperties { + /// Click-through URL suffix to apply to all ads in this entity's scope. Must be less than 128 characters long. + #[serde(rename="clickThroughUrlSuffix")] + pub click_through_url_suffix: Option, + /// Whether this entity should override the inherited click-through URL suffix with its own defined value. + #[serde(rename="overrideInheritedSuffix")] + pub override_inherited_suffix: Option, +} + +impl Part for ClickThroughUrlSuffixProperties {} + + +/// Contains properties of a package or roadblock. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update placement groups](struct.PlacementGroupUpdateCall.html) (request|response) +/// * [patch placement groups](struct.PlacementGroupPatchCall.html) (request|response) +/// * [get placement groups](struct.PlacementGroupGetCall.html) (response) +/// * [insert placement groups](struct.PlacementGroupInsertCall.html) (request|response) +/// * [list placement groups](struct.PlacementGroupListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementGroup { + /// Comments for this placement group. + pub comment: Option, + /// ID of the primary placement, used to calculate the media cost of a roadblock (placement group). Modifying this field will automatically modify the primary field on all affected roadblock child placements. + #[serde(rename="primaryPlacementId")] + pub primary_placement_id: Option, + /// Campaign ID of this placement group. This field is required on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Dimension value for the ID of the primary placement. This is a read-only, auto-generated field. + #[serde(rename="primaryPlacementIdDimensionValue")] + pub primary_placement_id_dimension_value: Option, + /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field. + #[serde(rename="directorySiteIdDimensionValue")] + pub directory_site_id_dimension_value: Option, + /// Advertiser ID of this placement group. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Directory site ID associated with this placement group. On insert, you must set either this field or the site_id field to specify the site associated with this placement group. This is a required field that is read-only after insertion. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Information about the creation of this placement group. This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Site ID associated with this placement group. On insert, you must set either this field or the directorySiteId field to specify the site associated with this placement group. This is a required field that is read-only after insertion. + #[serde(rename="siteId")] + pub site_id: Option, + /// Pricing schedule of this placement group. This field is required on insertion. + #[serde(rename="pricingSchedule")] + pub pricing_schedule: Option, + /// Dimension value for the ID of the site. This is a read-only, auto-generated field. + #[serde(rename="siteIdDimensionValue")] + pub site_id_dimension_value: Option, + /// Type of this placement group. A package is a simple group of placements that acts as a single pricing point for a group of tags. A roadblock is a group of placements that not only acts as a single pricing point, but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned placements to be marked as primary for reporting. This field is required on insertion. + #[serde(rename="placementGroupType")] + pub placement_group_type: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Whether this placement group is archived. + pub archived: Option, + /// ID of this placement group. This is a read-only, auto-generated field. + pub id: Option, + /// ID of the placement strategy assigned to this placement group. + #[serde(rename="placementStrategyId")] + pub placement_strategy_id: Option, + /// Account ID of this placement group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Subaccount ID of this placement group. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this placement group. This is a required field and must be less than 256 characters long. + pub name: Option, + /// IDs of placements which are assigned to this placement group. This is a read-only, auto-generated field. + #[serde(rename="childPlacementIds")] + pub child_placement_ids: Option>, + /// Information about the most recent modification of this placement group. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementGroup". + pub kind: Option, + /// ID of the content category assigned to this placement group. + #[serde(rename="contentCategoryId")] + pub content_category_id: Option, + /// External ID for this placement. + #[serde(rename="externalId")] + pub external_id: Option, + /// Dimension value for the ID of this placement group. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, +} + +impl RequestValue for PlacementGroup {} +impl Resource for PlacementGroup {} +impl ResponseResult for PlacementGroup {} + + +/// Third-party Tracking URL. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ThirdPartyTrackingUrl { + /// URL for the specified third-party URL type. + pub url: Option, + /// Third-party URL type for in-stream video creatives. + #[serde(rename="thirdPartyUrlType")] + pub third_party_url_type: Option, +} + +impl Part for ThirdPartyTrackingUrl {} + + +/// Contains properties of a user role permission. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get user role permissions](struct.UserRolePermissionGetCall.html) (response) +/// * [list user role permissions](struct.UserRolePermissionListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolePermission { + /// ID of the permission group that this user role permission belongs to. + #[serde(rename="permissionGroupId")] + pub permission_group_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermission". + pub kind: Option, + /// Levels of availability for a user role permission. + pub availability: Option, + /// ID of this user role permission. + pub id: Option, + /// Name of this user role permission. + pub name: Option, +} + +impl Resource for UserRolePermission {} +impl ResponseResult for UserRolePermission {} + + +/// Metro List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list metros](struct.MetroListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MetrosListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#metrosListResponse". + pub kind: Option, + /// Metro collection. + pub metros: Option>, +} + +impl ResponseResult for MetrosListResponse {} + + +/// Pricing Schedule +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PricingSchedule { + /// Placement start date. This date must be later than, or the same day as, the campaign start date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. This field is required on insertion. + #[serde(rename="startDate")] + pub start_date: Option, + /// Placement end date. This date must be later than, or the same day as, the placement start date, but not later than the campaign end date. If, for example, you set 6/25/2015 as both the start and end dates, the effective placement date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. This field is required on insertion. + #[serde(rename="endDate")] + pub end_date: Option, + /// Whether this placement is flighted. If true, pricing periods will be computed automatically. + pub flighted: Option, + /// Whether cap costs are ignored by ad serving. + #[serde(rename="disregardOverdelivery")] + pub disregard_overdelivery: Option, + /// Placement cap cost option. + #[serde(rename="capCostOption")] + pub cap_cost_option: Option, + /// Pricing periods for this placement. + #[serde(rename="pricingPeriods")] + pub pricing_periods: Option>, + /// Placement pricing type. This field is required on insertion. + #[serde(rename="pricingType")] + pub pricing_type: Option, + /// Testing start date of this placement. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. + #[serde(rename="testingStartDate")] + pub testing_start_date: Option, + /// Floodlight activity ID associated with this placement. This field should be set when placement pricing type is set to PRICING_TYPE_CPA. + #[serde(rename="floodlightActivityId")] + pub floodlight_activity_id: Option, +} + +impl Part for PricingSchedule {} + + +/// Account List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list accounts](struct.AccountListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountsListResponse". + pub kind: Option, + /// Account collection. + pub accounts: Option>, +} + +impl ResponseResult for AccountsListResponse {} + + +/// Contains information about an operating system that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get operating systems](struct.OperatingSystemGetCall.html) (response) +/// * [list operating systems](struct.OperatingSystemListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperatingSystem { + /// Whether this operating system is for mobile. + pub mobile: Option, + /// DART ID of this operating system. This is the ID used for targeting. + #[serde(rename="dartId")] + pub dart_id: Option, + /// Whether this operating system is for desktop. + pub desktop: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystem". + pub kind: Option, + /// Name of this operating system. + pub name: Option, +} + +impl Resource for OperatingSystem {} +impl ResponseResult for OperatingSystem {} + + +/// Represents an activity group. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Activities { + /// The kind of resource this is, in this case dfareporting#activities. + pub kind: Option, + /// List of activity filters. The dimension values need to be all either of type "dfa:activity" or "dfa:activityGroup". + pub filters: Option>, + /// List of names of floodlight activity metrics. + #[serde(rename="metricNames")] + pub metric_names: Option>, +} + +impl Part for Activities {} + + +/// A group clause made up of list population terms representing constraints joined by ORs. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListPopulationClause { + /// Terms of this list population clause. Each clause is made up of list population terms representing constraints and are joined by ORs. + pub terms: Option>, +} + +impl Part for ListPopulationClause {} + + +/// Flight +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Flight { + /// Rate or cost of this flight. + #[serde(rename="rateOrCost")] + pub rate_or_cost: Option, + /// Inventory item flight start date. + #[serde(rename="startDate")] + pub start_date: Option, + /// Units of this flight. + pub units: Option, + /// Inventory item flight end date. + #[serde(rename="endDate")] + pub end_date: Option, +} + +impl Part for Flight {} + + +/// Represents a sorted dimension. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SortedDimension { + /// The kind of resource this is, in this case dfareporting#sortedDimension. + pub kind: Option, + /// The name of the dimension. + pub name: Option, + /// An optional sort order for the dimension column. + #[serde(rename="sortOrder")] + pub sort_order: Option, +} + +impl Part for SortedDimension {} + + +/// Placement Strategy List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list placement strategies](struct.PlacementStrategyListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementStrategiesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementStrategiesListResponse". + pub kind: Option, + /// Placement strategy collection. + #[serde(rename="placementStrategies")] + pub placement_strategies: Option>, +} + +impl ResponseResult for PlacementStrategiesListResponse {} + + +/// Third Party Authentication Token +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ThirdPartyAuthenticationToken { + /// Name of the third-party authentication token. + pub name: Option, + /// Value of the third-party authentication token. This is a read-only, auto-generated field. + pub value: Option, +} + +impl Part for ThirdPartyAuthenticationToken {} + + +/// Groups advertisers together so that reports can be generated for the entire group at once. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete advertiser groups](struct.AdvertiserGroupDeleteCall.html) (none) +/// * [get advertiser groups](struct.AdvertiserGroupGetCall.html) (response) +/// * [update advertiser groups](struct.AdvertiserGroupUpdateCall.html) (request|response) +/// * [list advertiser groups](struct.AdvertiserGroupListCall.html) (none) +/// * [patch advertiser groups](struct.AdvertiserGroupPatchCall.html) (request|response) +/// * [insert advertiser groups](struct.AdvertiserGroupInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AdvertiserGroup { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiserGroup". + pub kind: Option, + /// Account ID of this advertiser group. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// ID of this advertiser group. This is a read-only, auto-generated field. + pub id: Option, + /// Name of this advertiser group. This is a required field and must be less than 256 characters long and unique among advertiser groups of the same account. + pub name: Option, +} + +impl RequestValue for AdvertiserGroup {} +impl Resource for AdvertiserGroup {} +impl ResponseResult for AdvertiserGroup {} + + +/// FsCommand. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FsCommand { + /// Height of the window. + #[serde(rename="windowHeight")] + pub window_height: Option, + /// Distance from the top of the browser. Applicable when positionOption is DISTANCE_FROM_TOP_LEFT_CORNER. + pub top: Option, + /// Width of the window. + #[serde(rename="windowWidth")] + pub window_width: Option, + /// Position in the browser where the window will open. + #[serde(rename="positionOption")] + pub position_option: Option, + /// Distance from the left of the browser.Applicable when positionOption is DISTANCE_FROM_TOP_LEFT_CORNER. + pub left: Option, +} + +impl Part for FsCommand {} + + +/// Creative optimization settings. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeOptimizationConfiguration { + /// List of optimization activities associated with this configuration. + #[serde(rename="optimizationActivitys")] + pub optimization_activitys: Option>, + /// ID of this creative optimization config. This field is auto-generated when the campaign is inserted or updated. It can be null for existing campaigns. + pub id: Option, + /// Name of this creative optimization config. This is a required field and must be less than 129 characters long. + pub name: Option, + /// Optimization model for this configuration. + #[serde(rename="optimizationModel")] + pub optimization_model: Option, +} + +impl Part for CreativeOptimizationConfiguration {} + + +/// Creative Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative groups](struct.CreativeGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeGroupsListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Creative group collection. + #[serde(rename="creativeGroups")] + pub creative_groups: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeGroupsListResponse". + pub kind: Option, +} + +impl ResponseResult for CreativeGroupsListResponse {} + + +/// Offset Position. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OffsetPosition { + /// Offset distance from top side of an asset or a window. + pub top: Option, + /// Offset distance from left side of an asset or a window. + pub left: Option, +} + +impl Part for OffsetPosition {} + + +/// Target Window. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TargetWindow { + /// User-entered value. + #[serde(rename="customHtml")] + pub custom_html: Option, + /// Type of browser window for which the backup image of the flash creative can be displayed. + #[serde(rename="targetWindowOption")] + pub target_window_option: Option, +} + +impl Part for TargetWindow {} + + +/// Site Contact +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SiteContact { + /// First name of this site contact. + #[serde(rename="firstName")] + pub first_name: Option, + /// Title or designation of this site contact. + pub title: Option, + /// Last name of this site contact. + #[serde(rename="lastName")] + pub last_name: Option, + /// Site contact type. + #[serde(rename="contactType")] + pub contact_type: Option, + /// ID of this site contact. This is a read-only, auto-generated field. + pub id: Option, + /// Primary phone number of this site contact. + pub phone: Option, + /// Address of this site contact. + pub address: Option, + /// Email address of this site contact. This is a required field. + pub email: Option, +} + +impl Part for SiteContact {} + + +/// Creative Rotation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeRotation { + /// Creative assignments in this creative rotation. + #[serde(rename="creativeAssignments")] + pub creative_assignments: Option>, + /// Strategy for calculating weights. Used with CREATIVE_ROTATION_TYPE_RANDOM. + #[serde(rename="weightCalculationStrategy")] + pub weight_calculation_strategy: Option, + /// Creative optimization configuration that is used by this ad. It should refer to one of the existing optimization configurations in the ad's campaign. If it is unset or set to 0, then the campaign's default optimization configuration will be used for this ad. + #[serde(rename="creativeOptimizationConfigurationId")] + pub creative_optimization_configuration_id: Option, + /// Type of creative rotation. Can be used to specify whether to use sequential or random rotation. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for CreativeRotation {} + + +/// Contains information about a metro region that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list metros](struct.MetroListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Metro { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#metro". + pub kind: Option, + /// DART ID of the country to which this metro region belongs. + #[serde(rename="countryDartId")] + pub country_dart_id: Option, + /// Name of this metro region. + pub name: Option, + /// Country code of the country to which this metro region belongs. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Metro code of this metro region. This is equivalent to dma_id. + #[serde(rename="metroCode")] + pub metro_code: Option, + /// DART ID of this metro region. + #[serde(rename="dartId")] + pub dart_id: Option, + /// DMA ID of this metro region. This is the ID used for targeting and generating reports, and is equivalent to metro_code. + #[serde(rename="dmaId")] + pub dma_id: Option, +} + +impl Resource for Metro {} + + +/// Contains information about a country that can be targeted by ads. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get countries](struct.CountryGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Country { + /// DART ID of this country. This is the ID used for targeting and generating reports. + #[serde(rename="dartId")] + pub dart_id: Option, + /// Whether ad serving supports secure servers in this country. + #[serde(rename="sslEnabled")] + pub ssl_enabled: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#country". + pub kind: Option, + /// Country code. + #[serde(rename="countryCode")] + pub country_code: Option, + /// Name of this country. + pub name: Option, +} + +impl ResponseResult for Country {} + + +/// Postal Code List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list postal codes](struct.PostalCodeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PostalCodesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#postalCodesListResponse". + pub kind: Option, + /// Postal code collection. + #[serde(rename="postalCodes")] + pub postal_codes: Option>, +} + +impl ResponseResult for PostalCodesListResponse {} + + +/// Tag Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TagSetting { + /// Whether static landing page URLs should be included in the tags. This setting applies only to placements. + #[serde(rename="includeClickThroughUrls")] + pub include_click_through_urls: Option, + /// Whether click-tracking string should be included in the tags. + #[serde(rename="includeClickTracking")] + pub include_click_tracking: Option, + /// Additional key-values to be included in tags. Each key-value pair must be of the form key=value, and pairs must be separated by a semicolon (;). Keys and values must not contain commas. For example, id=2;color=red is a valid value for this field. + #[serde(rename="additionalKeyValues")] + pub additional_key_values: Option, + /// Option specifying how keywords are embedded in ad tags. This setting can be used to specify whether keyword placeholders are inserted in placement tags for this site. Publishers can then add keywords to those placeholders. + #[serde(rename="keywordOption")] + pub keyword_option: Option, +} + +impl Part for TagSetting {} + + +/// Contains properties of a creative field. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative fields](struct.CreativeFieldListCall.html) (none) +/// * [update creative fields](struct.CreativeFieldUpdateCall.html) (request|response) +/// * [get creative fields](struct.CreativeFieldGetCall.html) (response) +/// * [insert creative fields](struct.CreativeFieldInsertCall.html) (request|response) +/// * [delete creative fields](struct.CreativeFieldDeleteCall.html) (none) +/// * [patch creative fields](struct.CreativeFieldPatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeField { + /// Advertiser ID of this creative field. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeField". + pub kind: Option, + /// Subaccount ID of this creative field. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this creative field. This is a required field and must be less than 256 characters long and unique among creative fields of the same advertiser. + pub name: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of this creative field. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this creative field. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for CreativeField {} +impl Resource for CreativeField {} +impl ResponseResult for CreativeField {} + + +/// Creative Field Value List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list creative field values](struct.CreativeFieldValueListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreativeFieldValuesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldValuesListResponse". + pub kind: Option, + /// Creative field value collection. + #[serde(rename="creativeFieldValues")] + pub creative_field_values: Option>, +} + +impl ResponseResult for CreativeFieldValuesListResponse {} + + +/// The properties of the report. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReportFloodlightCriteriaReportProperties { + /// Include conversions that have no associated cookies and no exposures. It’s therefore impossible to know how the user was exposed to your ads during the lookback window prior to a conversion. + #[serde(rename="includeUnattributedIPConversions")] + pub include_unattributed_ip_conversions: Option, + /// Include conversions of users with a DoubleClick cookie but without an exposure. That means the user did not click or see an ad from the advertiser within the Floodlight group, or that the interaction happened outside the lookback window. + #[serde(rename="includeUnattributedCookieConversions")] + pub include_unattributed_cookie_conversions: Option, + /// Include conversions that have no cookie, but do have an exposure path. + #[serde(rename="includeAttributedIPConversions")] + pub include_attributed_ip_conversions: Option, +} + +impl NestedType for ReportFloodlightCriteriaReportProperties {} +impl Part for ReportFloodlightCriteriaReportProperties {} + + +/// Contains properties of a Site Directory contact. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get directory site contacts](struct.DirectorySiteContactGetCall.html) (response) +/// * [list directory site contacts](struct.DirectorySiteContactListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DirectorySiteContact { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySiteContact". + pub kind: Option, + /// First name of this directory site contact. + #[serde(rename="firstName")] + pub first_name: Option, + /// Title or designation of this directory site contact. + pub title: Option, + /// Last name of this directory site contact. + #[serde(rename="lastName")] + pub last_name: Option, + /// ID of this directory site contact. This is a read-only, auto-generated field. + pub id: Option, + /// Phone number of this directory site contact. + pub phone: Option, + /// Directory site contact role. + pub role: Option, + /// Address of this directory site contact. + pub address: Option, + /// Directory site contact type. + #[serde(rename="type")] + pub type_: Option, + /// Email address of this directory site contact. + pub email: Option, +} + +impl Resource for DirectorySiteContact {} +impl ResponseResult for DirectorySiteContact {} + + +/// Represents a DimensionValue resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [query dimension values](struct.DimensionValueQueryCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DimensionValue { + /// The name of the dimension. + #[serde(rename="dimensionName")] + pub dimension_name: Option, + /// The kind of resource this is, in this case dfareporting#dimensionValue. + pub kind: Option, + /// The eTag of this response for caching purposes. + pub etag: Option, + /// Determines how the 'value' field is matched when filtering. If not specified, defaults to EXACT. If set to WILDCARD_EXPRESSION, '*' is allowed as a placeholder for variable length character sequences, and it can be escaped with a backslash. Note, only paid search dimensions ('dfa:paidSearch*') allow a matchType other than EXACT. + #[serde(rename="matchType")] + pub match_type: Option, + /// The ID associated with the value if available. + pub id: Option, + /// The value of the dimension. + pub value: Option, +} + +impl Resource for DimensionValue {} + + +/// Content Category List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list content categories](struct.ContentCategoryListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ContentCategoriesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#contentCategoriesListResponse". + pub kind: Option, + /// Content category collection. + #[serde(rename="contentCategories")] + pub content_categories: Option>, +} + +impl ResponseResult for ContentCategoriesListResponse {} + + +/// Floodlight Configuration List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list floodlight configurations](struct.FloodlightConfigurationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightConfigurationsListResponse { + /// Floodlight configuration collection. + #[serde(rename="floodlightConfigurations")] + pub floodlight_configurations: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightConfigurationsListResponse". + pub kind: Option, +} + +impl ResponseResult for FloodlightConfigurationsListResponse {} + + +/// Describes properties of a DoubleClick Planning order. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list orders](struct.OrderListCall.html) (none) +/// * [get orders](struct.OrderGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Order { + /// Terms and conditions of this order. + #[serde(rename="termsAndConditions")] + pub terms_and_conditions: Option, + /// Name of the buyer organization. + #[serde(rename="buyerOrganizationName")] + pub buyer_organization_name: Option, + /// Advertiser ID of this order. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Site IDs this order is associated with. + #[serde(rename="siteId")] + pub site_id: Option>, + /// Buyer invoice ID associated with this order. + #[serde(rename="buyerInvoiceId")] + pub buyer_invoice_id: Option, + /// ID of the terms and conditions template used in this order. + #[serde(rename="planningTermId")] + pub planning_term_id: Option, + /// ID of this order. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this order. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#order". + pub kind: Option, + /// Subaccount ID of this order. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this order. + pub name: Option, + /// Contacts for this order. + pub contacts: Option>, + /// Information about the most recent modification of this order. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Notes of this order. + pub notes: Option, + /// Name of the seller organization. + #[serde(rename="sellerOrganizationName")] + pub seller_organization_name: Option, + /// Comments in this order. + pub comments: Option, + /// IDs for users that have to approve documents created for this order. + #[serde(rename="approverUserProfileIds")] + pub approver_user_profile_ids: Option>, + /// Seller order ID associated with this order. + #[serde(rename="sellerOrderId")] + pub seller_order_id: Option, + /// Project ID of this order. + #[serde(rename="projectId")] + pub project_id: Option, + /// Free-form site names this order is associated with. + #[serde(rename="siteNames")] + pub site_names: Option>, +} + +impl Resource for Order {} +impl ResponseResult for Order {} + + +/// Popup Window Properties. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PopupWindowProperties { + /// Whether to display the browser status bar. + #[serde(rename="showStatusBar")] + pub show_status_bar: Option, + /// Whether to display the browser scroll bar. + #[serde(rename="showScrollBar")] + pub show_scroll_bar: Option, + /// Whether to display the browser address bar. + #[serde(rename="showAddressBar")] + pub show_address_bar: Option, + /// Whether to display the browser menu bar. + #[serde(rename="showMenuBar")] + pub show_menu_bar: Option, + /// Title of popup window. + pub title: Option, + /// Upper-left corner coordinates of the popup window. Applicable if positionType is COORDINATES. + pub offset: Option, + /// Popup window position either centered or at specific coordinate. + #[serde(rename="positionType")] + pub position_type: Option, + /// Whether to display the browser tool bar. + #[serde(rename="showToolBar")] + pub show_tool_bar: Option, + /// Popup dimension for a creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID + pub dimension: Option, +} + +impl Part for PopupWindowProperties {} + + +/// AccountPermissions contains information about a particular account permission. Some features of DCM require an account permission to be present in the account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permissions](struct.AccountPermissionListCall.html) (none) +/// * [get account permissions](struct.AccountPermissionGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermission { + /// Permission group of this account permission. + #[serde(rename="permissionGroupId")] + pub permission_group_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermission". + pub kind: Option, + /// Name of this account permission. + pub name: Option, + /// Administrative level required to enable this account permission. + pub level: Option, + /// Account profiles associated with this account permission. + /// + /// Possible values are: + /// - "ACCOUNT_PROFILE_BASIC" + /// - "ACCOUNT_PROFILE_STANDARD" + #[serde(rename="accountProfiles")] + pub account_profiles: Option>, + /// ID of this account permission. + pub id: Option, +} + +impl Resource for AccountPermission {} +impl ResponseResult for AccountPermission {} + + +/// Contains properties of a DoubleClick Planning project. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get projects](struct.ProjectGetCall.html) (response) +/// * [list projects](struct.ProjectListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Project { + /// Start date of the project. + #[serde(rename="startDate")] + pub start_date: Option, + /// CPM that the advertiser is targeting. + #[serde(rename="targetCpmNanos")] + pub target_cpm_nanos: Option, + /// End date of the project. + #[serde(rename="endDate")] + pub end_date: Option, + /// Client billing code of this project. + #[serde(rename="clientBillingCode")] + pub client_billing_code: Option, + /// Overview of this project. + pub overview: Option, + /// Number of clicks that the advertiser is targeting. + #[serde(rename="targetClicks")] + pub target_clicks: Option, + /// CPA that the advertiser is targeting. + #[serde(rename="targetCpaNanos")] + pub target_cpa_nanos: Option, + /// Advertiser ID of this project. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Number of impressions that the advertiser is targeting. + #[serde(rename="targetImpressions")] + pub target_impressions: Option, + /// Subaccount ID of this project. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Audience gender of this project. + #[serde(rename="audienceGender")] + pub audience_gender: Option, + /// ID of this project. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this project. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#project". + pub kind: Option, + /// CPC that the advertiser is targeting. + #[serde(rename="targetCpcNanos")] + pub target_cpc_nanos: Option, + /// Name of this project. + pub name: Option, + /// Information about the most recent modification of this project. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Budget of this project in the currency specified by the current account. The value stored in this field represents only the non-fractional amount. For example, for USD, the smallest value that can be represented by this field is 1 US dollar. + pub budget: Option, + /// Audience age group of this project. + #[serde(rename="audienceAgeGroup")] + pub audience_age_group: Option, + /// Number of conversions that the advertiser is targeting. + #[serde(rename="targetConversions")] + pub target_conversions: Option, + /// Name of the project client. + #[serde(rename="clientName")] + pub client_name: Option, +} + +impl Resource for Project {} +impl ResponseResult for Project {} + + +/// Contains properties of a DCM ad. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [patch ads](struct.AdPatchCall.html) (request|response) +/// * [list ads](struct.AdListCall.html) (none) +/// * [insert ads](struct.AdInsertCall.html) (request|response) +/// * [get ads](struct.AdGetCall.html) (response) +/// * [update ads](struct.AdUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Ad { + /// Click-through URL suffix properties for this ad. Applies to the URL in the ad or (if overriding ad properties) the URL in the creative. + #[serde(rename="clickThroughUrlSuffixProperties")] + pub click_through_url_suffix_properties: Option, + /// Campaign ID of this ad. This is a required field on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Advertiser ID of this ad. This is a required field on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Geographical targeting information for this ad.Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="geoTargeting")] + pub geo_targeting: Option, + /// Comments for this ad. + pub comments: Option, + /// Delivery schedule information for this ad. Applicable when type is AD_SERVING_STANDARD_AD or AD_SERVING_TRACKING. This field along with subfields priority and impressionRatio are required on insertion when type is AD_SERVING_STANDARD_AD. + #[serde(rename="deliverySchedule")] + pub delivery_schedule: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Event tag overrides for this ad. + #[serde(rename="eventTagOverrides")] + pub event_tag_overrides: Option>, + /// ID of this ad. This is a read-only, auto-generated field. + pub id: Option, + /// Size of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. + pub size: Option, + /// Whether this ad is archived. + pub archived: Option, + /// Technology platform targeting information for this ad. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="technologyTargeting")] + pub technology_targeting: Option, + /// Creative rotation for this ad. Applicable when type is AD_SERVING_DEFAULT_AD, AD_SERVING_STANDARD_AD, or AD_SERVING_TRACKING. When type is AD_SERVING_DEFAULT_AD, this field should have exactly one creativeAssignment. + #[serde(rename="creativeRotation")] + pub creative_rotation: Option, + /// Click-through URL for this ad. This is a required field on insertion. Applicable when type is AD_SERVING_CLICK_TRACKER. + #[serde(rename="clickThroughUrl")] + pub click_through_url: Option, + /// Creative group assignments for this ad. Applicable when type is AD_SERVING_CLICK_TRACKER. Only one assignment per creative group number is allowed for a maximum of two assignments. + #[serde(rename="creativeGroupAssignments")] + pub creative_group_assignments: Option>, + /// Applicable when type is AD_SERVING_STANDARD_AD. Remarketing list targeting expression for this ad. + #[serde(rename="remarketingListExpression")] + pub remarketing_list_expression: Option, + /// Dimension value for the ID of this ad. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Account ID of this ad. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Type of ad. This is a required field on insertion. Note that default ads (AD_SERVING_DEFAULT_AD) cannot be created directly (see Creative resource). + #[serde(rename="type")] + pub type_: Option, + /// Whether this ad requires ssl. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslRequired")] + pub ssl_required: Option, + /// Audience segment ID that is being targeted for this ad. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="audienceSegmentId")] + pub audience_segment_id: Option, + /// Key-value targeting information for this ad. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="keyValueTargetingExpression")] + pub key_value_targeting_expression: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Default click-through event tag properties for this ad. + #[serde(rename="defaultClickThroughEventTagProperties")] + pub default_click_through_event_tag_properties: Option, + /// Information about the creation of this ad.This is a read-only field. + #[serde(rename="createInfo")] + pub create_info: Option, + /// Date and time that this ad should start serving. If creating an ad, this field must be a time in the future. This is a required field on insertion. + #[serde(rename="startTime")] + pub start_time: Option, + /// Whether this ad is active. + pub active: Option, + /// Compatibility of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. WEB and WEB_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering an in-stream video ads developed with the VAST standard. + pub compatibility: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#ad". + pub kind: Option, + /// Subaccount ID of this ad. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this ad. This is a required field and must be less than 256 characters long. + pub name: Option, + /// Time and day targeting information for this ad. Applicable when type is AD_SERVING_STANDARD_AD. + #[serde(rename="dayPartTargeting")] + pub day_part_targeting: Option, + /// Information about the most recent modification of this ad. This is a read-only field. + #[serde(rename="lastModifiedInfo")] + pub last_modified_info: Option, + /// Whether this ad is ssl compliant. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Date and time that this ad should stop serving. Must be later than the start time. This is a required field on insertion. + #[serde(rename="endTime")] + pub end_time: Option, + /// Whether this ad is a dynamic click tracker. Applicable when type is AD_SERVING_CLICK_TRACKER. This is a required field on insert, and is read-only after insert. + #[serde(rename="dynamicClickTracker")] + pub dynamic_click_tracker: Option, + /// Placement assignments for this ad. + #[serde(rename="placementAssignments")] + pub placement_assignments: Option>, +} + +impl RequestValue for Ad {} +impl Resource for Ad {} +impl ResponseResult for Ad {} + + +/// Pricing Period +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PricingSchedulePricingPeriod { + /// Units of this pricing period. + pub units: Option, + /// Pricing period start date. This date must be later than, or the same day as, the placement start date. The hours, minutes, and seconds of the start date should not be set, as doing so will result in an error. + #[serde(rename="startDate")] + pub start_date: Option, + /// Rate or cost of this pricing period. + #[serde(rename="rateOrCostNanos")] + pub rate_or_cost_nanos: Option, + /// Pricing period end date. This date must be later than, or the same day as, the pricing period start date, but not later than the placement end date. The period end date can be the same date as the period start date. If, for example, you set 6/25/2015 as both the start and end dates, the effective pricing period date is just that day only, 6/25/2015. The hours, minutes, and seconds of the end date should not be set, as doing so will result in an error. + #[serde(rename="endDate")] + pub end_date: Option, + /// Comments for this pricing period. + #[serde(rename="pricingComment")] + pub pricing_comment: Option, +} + +impl Part for PricingSchedulePricingPeriod {} + + +/// Contains properties of an event tag. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete event tags](struct.EventTagDeleteCall.html) (none) +/// * [patch event tags](struct.EventTagPatchCall.html) (request|response) +/// * [list event tags](struct.EventTagListCall.html) (none) +/// * [update event tags](struct.EventTagUpdateCall.html) (request|response) +/// * [insert event tags](struct.EventTagInsertCall.html) (request|response) +/// * [get event tags](struct.EventTagGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EventTag { + /// Status of this event tag. Must be ENABLED for this event tag to fire. This is a required field. + pub status: Option, + /// Filter list of site IDs associated with this event tag. The siteFilterType determines whether this is a whitelist or blacklist filter. + #[serde(rename="siteIds")] + pub site_ids: Option>, + /// Campaign ID of this event tag. This field or the advertiserId field is required on insertion. + #[serde(rename="campaignId")] + pub campaign_id: Option, + /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field. + #[serde(rename="campaignIdDimensionValue")] + pub campaign_id_dimension_value: Option, + /// Whether this event tag should be automatically enabled for all of the advertiser's campaigns and ads. + #[serde(rename="enabledByDefault")] + pub enabled_by_default: Option, + /// Advertiser ID of this event tag. This field or the campaignId field is required on insertion. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Site filter type for this event tag. If no type is specified then the event tag will be applied to all sites. + #[serde(rename="siteFilterType")] + pub site_filter_type: Option, + /// Event tag type. Can be used to specify whether to use a third-party pixel, a third-party JavaScript URL, or a third-party click-through URL for either impression or click tracking. This is a required field. + #[serde(rename="type")] + pub type_: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// ID of this event tag. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this event tag. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#eventTag". + pub kind: Option, + /// Subaccount ID of this event tag. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this event tag. This is a required field and must be less than 256 characters long. + pub name: Option, + /// Payload URL for this event tag. The URL on a click-through event tag should have a landing page URL appended to the end of it. This field is required on insertion. + pub url: Option, + /// Whether this tag is SSL-compliant or not. This is a read-only field. + #[serde(rename="sslCompliant")] + pub ssl_compliant: Option, + /// Whether to remove this event tag from ads that are trafficked through DoubleClick Bid Manager to Ad Exchange. This may be useful if the event tag uses a pixel that is unapproved for Ad Exchange bids on one or more networks, such as the Google Display Network. + #[serde(rename="excludeFromAdxRequests")] + pub exclude_from_adx_requests: Option, + /// Number of times the landing page URL should be URL-escaped before being appended to the click-through event tag URL. Only applies to click-through event tags as specified by the event tag type. + #[serde(rename="urlEscapeLevels")] + pub url_escape_levels: Option, +} + +impl RequestValue for EventTag {} +impl Resource for EventTag {} +impl ResponseResult for EventTag {} + + +/// Placement Assignment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PlacementAssignment { + /// Whether this placement assignment is active. When true, the placement will be included in the ad's rotation. + pub active: Option, + /// Dimension value for the ID of the placement. This is a read-only, auto-generated field. + #[serde(rename="placementIdDimensionValue")] + pub placement_id_dimension_value: Option, + /// ID of the placement to be assigned. This is a required field. + #[serde(rename="placementId")] + pub placement_id: Option, + /// Whether the placement to be assigned requires SSL. This is a read-only field that is auto-generated when the ad is inserted or updated. + #[serde(rename="sslRequired")] + pub ssl_required: Option, +} + +impl Part for PlacementAssignment {} + + +/// Represents fields that are compatible to be selected for a report of type "REACH". +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReachReportCompatibleFields { + /// Metrics which are compatible to be selected in the "metricNames" section of the report. + pub metrics: Option>, + /// The kind of resource this is, in this case dfareporting#reachReportCompatibleFields. + pub kind: Option, + /// Dimensions which are compatible to be selected in the "dimensions" section of the report. + pub dimensions: Option>, + /// Metrics which are compatible to be selected in the "reachByFrequencyMetricNames" section of the report. + #[serde(rename="reachByFrequencyMetrics")] + pub reach_by_frequency_metrics: Option>, + /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report. + #[serde(rename="dimensionFilters")] + pub dimension_filters: Option>, + /// Metrics which are compatible to be selected as activity metrics to pivot on in the "activities" section of the report. + #[serde(rename="pivotedActivityMetrics")] + pub pivoted_activity_metrics: Option>, +} + +impl Part for ReachReportCompatibleFields {} + + +/// Contains properties of a site. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update sites](struct.SiteUpdateCall.html) (request|response) +/// * [list sites](struct.SiteListCall.html) (none) +/// * [insert sites](struct.SiteInsertCall.html) (request|response) +/// * [get sites](struct.SiteGetCall.html) (response) +/// * [patch sites](struct.SitePatchCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Site { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#site". + pub kind: Option, + /// Subaccount ID of this site. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// Name of this site.This is a required field. Must be less than 128 characters long. If this site is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this site is a top-level site, and the name must be unique among top-level sites of the same account. + pub name: Option, + /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field. + #[serde(rename="directorySiteIdDimensionValue")] + pub directory_site_id_dimension_value: Option, + /// Site-wide settings. + #[serde(rename="siteSettings")] + pub site_settings: Option, + /// ID of this site. This is a read-only, auto-generated field. + pub id: Option, + /// Directory site associated with this site. This is a required field that is read-only after insertion. + #[serde(rename="directorySiteId")] + pub directory_site_id: Option, + /// Site contacts. + #[serde(rename="siteContacts")] + pub site_contacts: Option>, + /// Key name of this site. This is a read-only, auto-generated field. + #[serde(rename="keyName")] + pub key_name: Option, + /// Dimension value for the ID of this site. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, + /// Whether this site is approved. + pub approved: Option, + /// Account ID of this site. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for Site {} +impl Resource for Site {} +impl ResponseResult for Site {} + + +/// DFP Settings +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DfpSettings { + /// DFP network name for this directory site. + pub dfp_network_name: Option, + /// DFP network code for this directory site. + pub dfp_network_code: Option, + /// Whether this directory site is available only via DoubleClick Publisher Portal. + #[serde(rename="publisherPortalOnly")] + pub publisher_portal_only: Option, + /// Whether this directory site accepts programmatic placements. + #[serde(rename="programmaticPlacementAccepted")] + pub programmatic_placement_accepted: Option, + /// Whether this directory site accepts publisher-paid tags. + #[serde(rename="pubPaidPlacementAccepted")] + pub pub_paid_placement_accepted: Option, +} + +impl Part for DfpSettings {} + + +/// Connection Type List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list connection types](struct.ConnectionTypeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ConnectionTypesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#connectionTypesListResponse". + pub kind: Option, + /// Collection of connection types such as broadband and mobile. + #[serde(rename="connectionTypes")] + pub connection_types: Option>, +} + +impl ResponseResult for ConnectionTypesListResponse {} + + +/// Contains properties of a Floodlight configuration. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get floodlight configurations](struct.FloodlightConfigurationGetCall.html) (response) +/// * [update floodlight configurations](struct.FloodlightConfigurationUpdateCall.html) (request|response) +/// * [patch floodlight configurations](struct.FloodlightConfigurationPatchCall.html) (request|response) +/// * [list floodlight configurations](struct.FloodlightConfigurationListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FloodlightConfiguration { + /// List of user defined variables enabled for this configuration. + #[serde(rename="userDefinedVariableConfigurations")] + pub user_defined_variable_configurations: Option>, + /// List of third-party authentication tokens enabled for this configuration. + #[serde(rename="thirdPartyAuthenticationTokens")] + pub third_party_authentication_tokens: Option>, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightConfiguration". + pub kind: Option, + /// Advertiser ID of the parent advertiser of this floodlight configuration. + #[serde(rename="advertiserId")] + pub advertiser_id: Option, + /// Configuration settings for dynamic and image floodlight tags. + #[serde(rename="tagSettings")] + pub tag_settings: Option, + /// Whether in-app attribution tracking is enabled. + #[serde(rename="inAppAttributionTrackingEnabled")] + pub in_app_attribution_tracking_enabled: Option, + /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field. + #[serde(rename="advertiserIdDimensionValue")] + pub advertiser_id_dimension_value: Option, + /// Subaccount ID of this floodlight configuration. This is a read-only field that can be left blank. + #[serde(rename="subaccountId")] + pub subaccount_id: Option, + /// ID of this floodlight configuration. This is a read-only, auto-generated field. + pub id: Option, + /// Account ID of this floodlight configuration. This is a read-only field that can be left blank. + #[serde(rename="accountId")] + pub account_id: Option, + /// Types of attribution options for natural search conversions. + #[serde(rename="naturalSearchConversionAttributionOption")] + pub natural_search_conversion_attribution_option: Option, + /// Settings for DCM Omniture integration. + #[serde(rename="omnitureSettings")] + pub omniture_settings: Option, + /// Whether the exposure-to-conversion report is enabled. This report shows detailed pathway information on up to 10 of the most recent ad exposures seen by a user before converting. + #[serde(rename="exposureToConversionEnabled")] + pub exposure_to_conversion_enabled: Option, + /// Lookback window settings for this floodlight configuration. + #[serde(rename="lookbackConfiguration")] + pub lookback_configuration: Option, + /// Day that will be counted as the first day of the week in reports. This is a required field. + #[serde(rename="firstDayOfWeek")] + pub first_day_of_week: Option, + /// List of standard variables enabled for this configuration. + /// + /// Acceptable values are: + /// - "ORD" + /// - "NUM" + #[serde(rename="standardVariableTypes")] + pub standard_variable_types: Option>, + /// Whether advertiser data is shared with Google Analytics. + #[serde(rename="analyticsDataSharingEnabled")] + pub analytics_data_sharing_enabled: Option, + /// Dimension value for the ID of this floodlight configuration. This is a read-only, auto-generated field. + #[serde(rename="idDimensionValue")] + pub id_dimension_value: Option, +} + +impl RequestValue for FloodlightConfiguration {} +impl Resource for FloodlightConfiguration {} +impl ResponseResult for FloodlightConfiguration {} + + +/// Represents a date range. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DateRange { + /// The start date of the date range, inclusive. A string of the format: "yyyy-MM-dd". + #[serde(rename="startDate")] + pub start_date: Option, + /// The kind of resource this is, in this case dfareporting#dateRange. + pub kind: Option, + /// The end date of the date range, inclusive. A string of the format: "yyyy-MM-dd". + #[serde(rename="endDate")] + pub end_date: Option, + /// The date range relative to the date of when the report is run. + #[serde(rename="relativeDateRange")] + pub relative_date_range: Option, +} + +impl Part for DateRange {} + + +/// Account Permission Group List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list account permission groups](struct.AccountPermissionGroupListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AccountPermissionGroupsListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionGroupsListResponse". + pub kind: Option, + /// Account permission group collection. + #[serde(rename="accountPermissionGroups")] + pub account_permission_groups: Option>, +} + +impl ResponseResult for AccountPermissionGroupsListResponse {} + + +/// Size List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list sizes](struct.SizeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SizesListResponse { + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#sizesListResponse". + pub kind: Option, + /// Size collection. + pub sizes: Option>, +} + +impl ResponseResult for SizesListResponse {} + + +/// User Role List Response +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list user roles](struct.UserRoleListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UserRolesListResponse { + /// Pagination token to be used for the next list operation. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolesListResponse". + pub kind: Option, + /// User role collection. + #[serde(rename="userRoles")] + pub user_roles: Option>, +} + +impl ResponseResult for UserRolesListResponse {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *userRolePermissionGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.user_role_permission_groups(); +/// # } +/// ``` +pub struct UserRolePermissionGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserRolePermissionGroupMethods<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one user role permission group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role permission group ID. + pub fn get(&self, profile_id: &str, id: &str) -> UserRolePermissionGroupGetCall<'a, C, A> { + UserRolePermissionGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a list of all supported user role permission groups. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> UserRolePermissionGroupListCall<'a, C, A> { + UserRolePermissionGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *platformType* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.platform_types(); +/// # } +/// ``` +pub struct PlatformTypeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlatformTypeMethods<'a, C, A> {} + +impl<'a, C, A> PlatformTypeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one platform type by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Platform type ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlatformTypeGetCall<'a, C, A> { + PlatformTypeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of platform types. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlatformTypeListCall<'a, C, A> { + PlatformTypeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeFieldValue* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creative_field_values(); +/// # } +/// ``` +pub struct CreativeFieldValueMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeFieldValueMethods<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field value. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + /// * `id` - Creative Field Value ID + pub fn patch(&self, request: CreativeFieldValue, profile_id: &str, creative_field_id: &str, id: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + CreativeFieldValuePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative field value by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + /// * `id` - Creative Field Value ID + pub fn get(&self, profile_id: &str, creative_field_id: &str, id: &str) -> CreativeFieldValueGetCall<'a, C, A> { + CreativeFieldValueGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing creative field value. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + /// * `id` - Creative Field Value ID + pub fn delete(&self, profile_id: &str, creative_field_id: &str, id: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + CreativeFieldValueDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative field value. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + pub fn insert(&self, request: CreativeFieldValue, profile_id: &str, creative_field_id: &str) -> CreativeFieldValueInsertCall<'a, C, A> { + CreativeFieldValueInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field value. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + pub fn update(&self, request: CreativeFieldValue, profile_id: &str, creative_field_id: &str) -> CreativeFieldValueUpdateCall<'a, C, A> { + CreativeFieldValueUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creative field values, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `creativeFieldId` - Creative field ID for this creative field value. + pub fn list(&self, profile_id: &str, creative_field_id: &str) -> CreativeFieldValueListCall<'a, C, A> { + CreativeFieldValueListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _creative_field_id: creative_field_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeField* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creative_fields(); +/// # } +/// ``` +pub struct CreativeFieldMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeFieldMethods<'a, C, A> {} + +impl<'a, C, A> CreativeFieldMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: CreativeField, profile_id: &str) -> CreativeFieldUpdateCall<'a, C, A> { + CreativeFieldUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creative fields, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CreativeFieldListCall<'a, C, A> { + CreativeFieldListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing creative field. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative Field ID + pub fn delete(&self, profile_id: &str, id: &str) -> CreativeFieldDeleteCall<'a, C, A> { + CreativeFieldDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative field by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative Field ID + pub fn get(&self, profile_id: &str, id: &str) -> CreativeFieldGetCall<'a, C, A> { + CreativeFieldGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative field. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: CreativeField, profile_id: &str) -> CreativeFieldInsertCall<'a, C, A> { + CreativeFieldInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative field. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative Field ID + pub fn patch(&self, request: CreativeField, profile_id: &str, id: &str) -> CreativeFieldPatchCall<'a, C, A> { + CreativeFieldPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userRole* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.user_roles(); +/// # } +/// ``` +pub struct UserRoleMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserRoleMethods<'a, C, A> {} + +impl<'a, C, A> UserRoleMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new user role. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: UserRole, profile_id: &str) -> UserRoleInsertCall<'a, C, A> { + UserRoleInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one user role by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role ID. + pub fn get(&self, profile_id: &str, id: &str) -> UserRoleGetCall<'a, C, A> { + UserRoleGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing user role. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: UserRole, profile_id: &str) -> UserRoleUpdateCall<'a, C, A> { + UserRoleUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing user role. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role ID. + pub fn delete(&self, profile_id: &str, id: &str) -> UserRoleDeleteCall<'a, C, A> { + UserRoleDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing user role. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role ID. + pub fn patch(&self, request: UserRole, profile_id: &str, id: &str) -> UserRolePatchCall<'a, C, A> { + UserRolePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of user roles, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> UserRoleListCall<'a, C, A> { + UserRoleListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _account_user_role_only: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *operatingSystemVersion* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.operating_system_versions(); +/// # } +/// ``` +pub struct OperatingSystemVersionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OperatingSystemVersionMethods<'a, C, A> {} + +impl<'a, C, A> OperatingSystemVersionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one operating system version by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Operating system version ID. + pub fn get(&self, profile_id: &str, id: &str) -> OperatingSystemVersionGetCall<'a, C, A> { + OperatingSystemVersionGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of operating system versions. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> OperatingSystemVersionListCall<'a, C, A> { + OperatingSystemVersionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *landingPage* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.landing_pages(); +/// # } +/// ``` +pub struct LandingPageMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for LandingPageMethods<'a, C, A> {} + +impl<'a, C, A> LandingPageMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one campaign landing page by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + /// * `id` - Landing page ID. + pub fn get(&self, profile_id: &str, campaign_id: &str, id: &str) -> LandingPageGetCall<'a, C, A> { + LandingPageGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing campaign landing page. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + pub fn update(&self, request: LandingPage, profile_id: &str, campaign_id: &str) -> LandingPageUpdateCall<'a, C, A> { + LandingPageUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of landing pages for the specified campaign. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + pub fn list(&self, profile_id: &str, campaign_id: &str) -> LandingPageListCall<'a, C, A> { + LandingPageListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new landing page for the specified campaign. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + pub fn insert(&self, request: LandingPage, profile_id: &str, campaign_id: &str) -> LandingPageInsertCall<'a, C, A> { + LandingPageInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing campaign landing page. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + /// * `id` - Landing page ID. + pub fn patch(&self, request: LandingPage, profile_id: &str, campaign_id: &str, id: &str) -> LandingPagePatchCall<'a, C, A> { + LandingPagePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing campaign landing page. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Landing page campaign ID. + /// * `id` - Landing page ID. + pub fn delete(&self, profile_id: &str, campaign_id: &str, id: &str) -> LandingPageDeleteCall<'a, C, A> { + LandingPageDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeAsset* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `insert(...)` +/// // to build up your call. +/// let rb = hub.creative_assets(); +/// # } +/// ``` +pub struct CreativeAssetMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeAssetMethods<'a, C, A> {} + +impl<'a, C, A> CreativeAssetMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative asset. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `advertiserId` - Advertiser ID of this creative. This is a required field. + pub fn insert(&self, request: CreativeAssetMetadata, profile_id: &str, advertiser_id: &str) -> CreativeAssetInsertCall<'a, C, A> { + CreativeAssetInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _advertiser_id: advertiser_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *campaignCreativeAssociation* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.campaign_creative_associations(); +/// # } +/// ``` +pub struct CampaignCreativeAssociationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CampaignCreativeAssociationMethods<'a, C, A> {} + +impl<'a, C, A> CampaignCreativeAssociationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Campaign ID in this association. + pub fn insert(&self, request: CampaignCreativeAssociation, profile_id: &str, campaign_id: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + CampaignCreativeAssociationInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of creative IDs associated with the specified campaign. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `campaignId` - Campaign ID in this association. + pub fn list(&self, profile_id: &str, campaign_id: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + CampaignCreativeAssociationListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _campaign_id: campaign_id.to_string(), + _sort_order: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *changeLog* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.change_logs(); +/// # } +/// ``` +pub struct ChangeLogMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ChangeLogMethods<'a, C, A> {} + +impl<'a, C, A> ChangeLogMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of change logs. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ChangeLogListCall<'a, C, A> { + ChangeLogListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _user_profile_ids: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _object_type: Default::default(), + _object_ids: Default::default(), + _min_change_time: Default::default(), + _max_results: Default::default(), + _max_change_time: Default::default(), + _ids: Default::default(), + _action: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one change log by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Change log ID. + pub fn get(&self, profile_id: &str, id: &str) -> ChangeLogGetCall<'a, C, A> { + ChangeLogGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *remarketingListShare* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.remarketing_list_shares(); +/// # } +/// ``` +pub struct RemarketingListShareMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for RemarketingListShareMethods<'a, C, A> {} + +impl<'a, C, A> RemarketingListShareMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one remarketing list share by remarketing list ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `remarketingListId` - Remarketing list ID. + pub fn get(&self, profile_id: &str, remarketing_list_id: &str) -> RemarketingListShareGetCall<'a, C, A> { + RemarketingListShareGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _remarketing_list_id: remarketing_list_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list share. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `remarketingListId` - Remarketing list ID. + pub fn patch(&self, request: RemarketingListShare, profile_id: &str, remarketing_list_id: &str) -> RemarketingListSharePatchCall<'a, C, A> { + RemarketingListSharePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _remarketing_list_id: remarketing_list_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list share. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: RemarketingListShare, profile_id: &str) -> RemarketingListShareUpdateCall<'a, C, A> { + RemarketingListShareUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *report* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `compatible_fields_query(...)`, `delete(...)`, `files_get(...)`, `files_list(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)`, `run(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.reports(); +/// # } +/// ``` +pub struct ReportMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ReportMethods<'a, C, A> {} + +impl<'a, C, A> ReportMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Runs a report. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + /// * `reportId` - The ID of the report. + pub fn run(&self, profile_id: &str, report_id: &str) -> ReportRunCall<'a, C, A> { + ReportRunCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _synchronous: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a report. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn patch(&self, request: Report, profile_id: &str, report_id: &str) -> ReportPatchCall<'a, C, A> { + ReportPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists files for a report. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + /// * `reportId` - The ID of the parent report. + pub fn files_list(&self, profile_id: &str, report_id: &str) -> ReportFileListCall<'a, C, A> { + ReportFileListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a report. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + pub fn insert(&self, request: Report, profile_id: &str) -> ReportInsertCall<'a, C, A> { + ReportInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a report. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn update(&self, request: Report, profile_id: &str, report_id: &str) -> ReportUpdateCall<'a, C, A> { + ReportUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + pub fn compatible_fields_query(&self, request: Report, profile_id: &str) -> ReportCompatibleFieldQueryCall<'a, C, A> { + ReportCompatibleFieldQueryCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a report by its ID. + /// + /// # Arguments + /// + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn get(&self, profile_id: &str, report_id: &str) -> ReportGetCall<'a, C, A> { + ReportGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a report file. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + /// * `reportId` - The ID of the report. + /// * `fileId` - The ID of the report file. + pub fn files_get(&self, profile_id: &str, report_id: &str, file_id: &str) -> ReportFileGetCall<'a, C, A> { + ReportFileGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _file_id: file_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a report by its ID. + /// + /// # Arguments + /// + /// * `profileId` - The DFA user profile ID. + /// * `reportId` - The ID of the report. + pub fn delete(&self, profile_id: &str, report_id: &str) -> ReportDeleteCall<'a, C, A> { + ReportDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _report_id: report_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves list of reports. + /// + /// # Arguments + /// + /// * `profileId` - The DFA user profile ID. + pub fn list(&self, profile_id: &str) -> ReportListCall<'a, C, A> { + ReportListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _scope: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *advertiser* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.advertisers(); +/// # } +/// ``` +pub struct AdvertiserMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AdvertiserMethods<'a, C, A> {} + +impl<'a, C, A> AdvertiserMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new advertiser. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Advertiser, profile_id: &str) -> AdvertiserInsertCall<'a, C, A> { + AdvertiserInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser ID. + pub fn patch(&self, request: Advertiser, profile_id: &str, id: &str) -> AdvertiserPatchCall<'a, C, A> { + AdvertiserPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of advertisers, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AdvertiserListCall<'a, C, A> { + AdvertiserListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _subaccount_id: Default::default(), + _status: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _only_parent: Default::default(), + _max_results: Default::default(), + _include_advertisers_without_groups_only: Default::default(), + _ids: Default::default(), + _floodlight_configuration_ids: Default::default(), + _advertiser_group_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Advertiser, profile_id: &str) -> AdvertiserUpdateCall<'a, C, A> { + AdvertiserUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one advertiser by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser ID. + pub fn get(&self, profile_id: &str, id: &str) -> AdvertiserGetCall<'a, C, A> { + AdvertiserGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *dimensionValue* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `query(...)` +/// // to build up your call. +/// let rb = hub.dimension_values(); +/// # } +/// ``` +pub struct DimensionValueMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for DimensionValueMethods<'a, C, A> {} + +impl<'a, C, A> DimensionValueMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves list of report dimension values for a list of filters. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - The DFA user profile ID. + pub fn query(&self, request: DimensionValueRequest, profile_id: &str) -> DimensionValueQueryCall<'a, C, A> { + DimensionValueQueryCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *floodlightActivityGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.floodlight_activity_groups(); +/// # } +/// ``` +pub struct FloodlightActivityGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FloodlightActivityGroupMethods<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one floodlight activity group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity Group ID. + pub fn get(&self, profile_id: &str, id: &str) -> FloodlightActivityGroupGetCall<'a, C, A> { + FloodlightActivityGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity Group ID. + pub fn patch(&self, request: FloodlightActivityGroup, profile_id: &str, id: &str) -> FloodlightActivityGroupPatchCall<'a, C, A> { + FloodlightActivityGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of floodlight activity groups, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + FloodlightActivityGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _type_: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _floodlight_configuration_id: Default::default(), + _advertiser_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new floodlight activity group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: FloodlightActivityGroup, profile_id: &str) -> FloodlightActivityGroupInsertCall<'a, C, A> { + FloodlightActivityGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: FloodlightActivityGroup, profile_id: &str) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + FloodlightActivityGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *metro* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.metros(); +/// # } +/// ``` +pub struct MetroMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for MetroMethods<'a, C, A> {} + +impl<'a, C, A> MetroMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of metros. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> MetroListCall<'a, C, A> { + MetroListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *order* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.orders(); +/// # } +/// ``` +pub struct OrderMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OrderMethods<'a, C, A> {} + +impl<'a, C, A> OrderMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of orders, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for orders. + pub fn list(&self, profile_id: &str, project_id: &str) -> OrderListCall<'a, C, A> { + OrderListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_id: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one order by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for orders. + /// * `id` - Order ID. + pub fn get(&self, profile_id: &str, project_id: &str, id: &str) -> OrderGetCall<'a, C, A> { + OrderGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *directorySiteContact* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.directory_site_contacts(); +/// # } +/// ``` +pub struct DirectorySiteContactMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for DirectorySiteContactMethods<'a, C, A> {} + +impl<'a, C, A> DirectorySiteContactMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one directory site contact by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Directory site contact ID. + pub fn get(&self, profile_id: &str, id: &str) -> DirectorySiteContactGetCall<'a, C, A> { + DirectorySiteContactGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of directory site contacts, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> DirectorySiteContactListCall<'a, C, A> { + DirectorySiteContactListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _directory_site_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userProfile* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.user_profiles(); +/// # } +/// ``` +pub struct UserProfileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserProfileMethods<'a, C, A> {} + +impl<'a, C, A> UserProfileMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves list of user profiles for a user. + pub fn list(&self) -> UserProfileListCall<'a, C, A> { + UserProfileListCall { + hub: self.hub, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one user profile by ID. + /// + /// # Arguments + /// + /// * `profileId` - The user profile ID. + pub fn get(&self, profile_id: &str) -> UserProfileGetCall<'a, C, A> { + UserProfileGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *ad* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.ads(); +/// # } +/// ``` +pub struct AdMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AdMethods<'a, C, A> {} + +impl<'a, C, A> AdMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing ad. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Ad ID. + pub fn patch(&self, request: Ad, profile_id: &str, id: &str) -> AdPatchCall<'a, C, A> { + AdPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new ad. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Ad, profile_id: &str) -> AdInsertCall<'a, C, A> { + AdInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of ads, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AdListCall<'a, C, A> { + AdListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _type_: Default::default(), + _ssl_required: Default::default(), + _ssl_compliant: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _size_ids: Default::default(), + _search_string: Default::default(), + _remarketing_list_ids: Default::default(), + _placement_ids: Default::default(), + _page_token: Default::default(), + _overridden_event_tag_id: Default::default(), + _max_results: Default::default(), + _landing_page_ids: Default::default(), + _ids: Default::default(), + _dynamic_click_tracker: Default::default(), + _creative_type: Default::default(), + _creative_optimization_configuration_ids: Default::default(), + _creative_ids: Default::default(), + _compatibility: Default::default(), + _campaign_ids: Default::default(), + _audience_segment_ids: Default::default(), + _archived: Default::default(), + _advertiser_id: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one ad by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Ad ID. + pub fn get(&self, profile_id: &str, id: &str) -> AdGetCall<'a, C, A> { + AdGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing ad. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Ad, profile_id: &str) -> AdUpdateCall<'a, C, A> { + AdUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountPermission* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.account_permissions(); +/// # } +/// ``` +pub struct AccountPermissionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountPermissionMethods<'a, C, A> {} + +impl<'a, C, A> AccountPermissionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one account permission by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account permission ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountPermissionGetCall<'a, C, A> { + AccountPermissionGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of account permissions. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountPermissionListCall<'a, C, A> { + AccountPermissionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *connectionType* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.connection_types(); +/// # } +/// ``` +pub struct ConnectionTypeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ConnectionTypeMethods<'a, C, A> {} + +impl<'a, C, A> ConnectionTypeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of connection types. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ConnectionTypeListCall<'a, C, A> { + ConnectionTypeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one connection type by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Connection type ID. + pub fn get(&self, profile_id: &str, id: &str) -> ConnectionTypeGetCall<'a, C, A> { + ConnectionTypeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *advertiserGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.advertiser_groups(); +/// # } +/// ``` +pub struct AdvertiserGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AdvertiserGroupMethods<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one advertiser group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser group ID. + pub fn get(&self, profile_id: &str, id: &str) -> AdvertiserGroupGetCall<'a, C, A> { + AdvertiserGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of advertiser groups, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AdvertiserGroupListCall<'a, C, A> { + AdvertiserGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new advertiser group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: AdvertiserGroup, profile_id: &str) -> AdvertiserGroupInsertCall<'a, C, A> { + AdvertiserGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: AdvertiserGroup, profile_id: &str) -> AdvertiserGroupUpdateCall<'a, C, A> { + AdvertiserGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing advertiser group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser group ID. + pub fn patch(&self, request: AdvertiserGroup, profile_id: &str, id: &str) -> AdvertiserGroupPatchCall<'a, C, A> { + AdvertiserGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing advertiser group. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Advertiser group ID. + pub fn delete(&self, profile_id: &str, id: &str) -> AdvertiserGroupDeleteCall<'a, C, A> { + AdvertiserGroupDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *site* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.sites(); +/// # } +/// ``` +pub struct SiteMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for SiteMethods<'a, C, A> {} + +impl<'a, C, A> SiteMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new site. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Site, profile_id: &str) -> SiteInsertCall<'a, C, A> { + SiteInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one site by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Site ID. + pub fn get(&self, profile_id: &str, id: &str) -> SiteGetCall<'a, C, A> { + SiteGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of sites, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> SiteListCall<'a, C, A> { + SiteListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _unmapped_site: Default::default(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _directory_site_ids: Default::default(), + _campaign_ids: Default::default(), + _approved: Default::default(), + _ad_words_site: Default::default(), + _accepts_publisher_paid_placements: Default::default(), + _accepts_interstitial_placements: Default::default(), + _accepts_in_stream_video_placements: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing site. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Site, profile_id: &str) -> SiteUpdateCall<'a, C, A> { + SiteUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing site. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Site ID. + pub fn patch(&self, request: Site, profile_id: &str, id: &str) -> SitePatchCall<'a, C, A> { + SitePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *floodlightActivity* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `generatetag(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.floodlight_activities(); +/// # } +/// ``` +pub struct FloodlightActivityMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FloodlightActivityMethods<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one floodlight activity by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity ID. + pub fn get(&self, profile_id: &str, id: &str) -> FloodlightActivityGetCall<'a, C, A> { + FloodlightActivityGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of floodlight activities, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> FloodlightActivityListCall<'a, C, A> { + FloodlightActivityListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _tag_string: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _floodlight_configuration_id: Default::default(), + _floodlight_activity_group_type: Default::default(), + _floodlight_activity_group_tag_string: Default::default(), + _floodlight_activity_group_name: Default::default(), + _floodlight_activity_group_ids: Default::default(), + _advertiser_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new floodlight activity. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: FloodlightActivity, profile_id: &str) -> FloodlightActivityInsertCall<'a, C, A> { + FloodlightActivityInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing floodlight activity. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity ID. + pub fn delete(&self, profile_id: &str, id: &str) -> FloodlightActivityDeleteCall<'a, C, A> { + FloodlightActivityDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight activity ID. + pub fn patch(&self, request: FloodlightActivity, profile_id: &str, id: &str) -> FloodlightActivityPatchCall<'a, C, A> { + FloodlightActivityPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Generates a tag for a floodlight activity. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn generatetag(&self, profile_id: &str) -> FloodlightActivityGeneratetagCall<'a, C, A> { + FloodlightActivityGeneratetagCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _floodlight_activity_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight activity. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: FloodlightActivity, profile_id: &str) -> FloodlightActivityUpdateCall<'a, C, A> { + FloodlightActivityUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *region* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.regions(); +/// # } +/// ``` +pub struct RegionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for RegionMethods<'a, C, A> {} + +impl<'a, C, A> RegionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of regions. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> RegionListCall<'a, C, A> { + RegionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creativeGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creative_groups(); +/// # } +/// ``` +pub struct CreativeGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeGroupMethods<'a, C, A> {} + +impl<'a, C, A> CreativeGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: CreativeGroup, profile_id: &str) -> CreativeGroupInsertCall<'a, C, A> { + CreativeGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative group ID. + pub fn get(&self, profile_id: &str, id: &str) -> CreativeGroupGetCall<'a, C, A> { + CreativeGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: CreativeGroup, profile_id: &str) -> CreativeGroupUpdateCall<'a, C, A> { + CreativeGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creative groups, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CreativeGroupListCall<'a, C, A> { + CreativeGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _group_number: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative group ID. + pub fn patch(&self, request: CreativeGroup, profile_id: &str, id: &str) -> CreativeGroupPatchCall<'a, C, A> { + CreativeGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *targetableRemarketingList* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.targetable_remarketing_lists(); +/// # } +/// ``` +pub struct TargetableRemarketingListMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for TargetableRemarketingListMethods<'a, C, A> {} + +impl<'a, C, A> TargetableRemarketingListMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of targetable remarketing lists, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `advertiserId` - Select only targetable remarketing lists targetable by these advertisers. + pub fn list(&self, profile_id: &str, advertiser_id: &str) -> TargetableRemarketingListListCall<'a, C, A> { + TargetableRemarketingListListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _advertiser_id: advertiser_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _page_token: Default::default(), + _name: Default::default(), + _max_results: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one remarketing list by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Remarketing list ID. + pub fn get(&self, profile_id: &str, id: &str) -> TargetableRemarketingListGetCall<'a, C, A> { + TargetableRemarketingListGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *subaccount* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.subaccounts(); +/// # } +/// ``` +pub struct SubaccountMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for SubaccountMethods<'a, C, A> {} + +impl<'a, C, A> SubaccountMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing subaccount. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Subaccount ID. + pub fn patch(&self, request: Subaccount, profile_id: &str, id: &str) -> SubaccountPatchCall<'a, C, A> { + SubaccountPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new subaccount. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Subaccount, profile_id: &str) -> SubaccountInsertCall<'a, C, A> { + SubaccountInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a list of subaccounts, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> SubaccountListCall<'a, C, A> { + SubaccountListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing subaccount. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Subaccount, profile_id: &str) -> SubaccountUpdateCall<'a, C, A> { + SubaccountUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one subaccount by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Subaccount ID. + pub fn get(&self, profile_id: &str, id: &str) -> SubaccountGetCall<'a, C, A> { + SubaccountGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *mobileCarrier* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.mobile_carriers(); +/// # } +/// ``` +pub struct MobileCarrierMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for MobileCarrierMethods<'a, C, A> {} + +impl<'a, C, A> MobileCarrierMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one mobile carrier by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Mobile carrier ID. + pub fn get(&self, profile_id: &str, id: &str) -> MobileCarrierGetCall<'a, C, A> { + MobileCarrierGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of mobile carriers. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> MobileCarrierListCall<'a, C, A> { + MobileCarrierListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *floodlightConfiguration* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.floodlight_configurations(); +/// # } +/// ``` +pub struct FloodlightConfigurationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FloodlightConfigurationMethods<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one floodlight configuration by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight configuration ID. + pub fn get(&self, profile_id: &str, id: &str) -> FloodlightConfigurationGetCall<'a, C, A> { + FloodlightConfigurationGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight configuration. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: FloodlightConfiguration, profile_id: &str) -> FloodlightConfigurationUpdateCall<'a, C, A> { + FloodlightConfigurationUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing floodlight configuration. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Floodlight configuration ID. + pub fn patch(&self, request: FloodlightConfiguration, profile_id: &str, id: &str) -> FloodlightConfigurationPatchCall<'a, C, A> { + FloodlightConfigurationPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of floodlight configurations, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> FloodlightConfigurationListCall<'a, C, A> { + FloodlightConfigurationListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *operatingSystem* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.operating_systems(); +/// # } +/// ``` +pub struct OperatingSystemMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OperatingSystemMethods<'a, C, A> {} + +impl<'a, C, A> OperatingSystemMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of operating systems. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> OperatingSystemListCall<'a, C, A> { + OperatingSystemListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one operating system by DART ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `dartId` - Operating system DART ID. + pub fn get(&self, profile_id: &str, dart_id: &str) -> OperatingSystemGetCall<'a, C, A> { + OperatingSystemGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _dart_id: dart_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *file* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.files(); +/// # } +/// ``` +pub struct FileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for FileMethods<'a, C, A> {} + +impl<'a, C, A> FileMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists files for a user profile. + /// + /// # Arguments + /// + /// * `profileId` - The DFA profile ID. + pub fn list(&self, profile_id: &str) -> FileListCall<'a, C, A> { + FileListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _scope: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a report file by its report ID and file ID. + /// + /// # Arguments + /// + /// * `reportId` - The ID of the report. + /// * `fileId` - The ID of the report file. + pub fn get(&self, report_id: &str, file_id: &str) -> FileGetCall<'a, C, A> { + FileGetCall { + hub: self.hub, + _report_id: report_id.to_string(), + _file_id: file_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *placementGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.placement_groups(); +/// # } +/// ``` +pub struct PlacementGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlacementGroupMethods<'a, C, A> {} + +impl<'a, C, A> PlacementGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of placement groups, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlacementGroupListCall<'a, C, A> { + PlacementGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_ids: Default::default(), + _search_string: Default::default(), + _pricing_types: Default::default(), + _placement_strategy_ids: Default::default(), + _placement_group_type: Default::default(), + _page_token: Default::default(), + _min_start_date: Default::default(), + _min_end_date: Default::default(), + _max_start_date: Default::default(), + _max_results: Default::default(), + _max_end_date: Default::default(), + _ids: Default::default(), + _directory_site_ids: Default::default(), + _content_category_ids: Default::default(), + _campaign_ids: Default::default(), + _archived: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: PlacementGroup, profile_id: &str) -> PlacementGroupUpdateCall<'a, C, A> { + PlacementGroupUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new placement group. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: PlacementGroup, profile_id: &str) -> PlacementGroupInsertCall<'a, C, A> { + PlacementGroupInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one placement group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement group ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlacementGroupGetCall<'a, C, A> { + PlacementGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement group. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement group ID. + pub fn patch(&self, request: PlacementGroup, profile_id: &str, id: &str) -> PlacementGroupPatchCall<'a, C, A> { + PlacementGroupPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *inventoryItem* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.inventory_items(); +/// # } +/// ``` +pub struct InventoryItemMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for InventoryItemMethods<'a, C, A> {} + +impl<'a, C, A> InventoryItemMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of inventory items, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + pub fn list(&self, profile_id: &str, project_id: &str) -> InventoryItemListCall<'a, C, A> { + InventoryItemListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_id: Default::default(), + _page_token: Default::default(), + _order_id: Default::default(), + _max_results: Default::default(), + _in_plan: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one inventory item by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + /// * `id` - Inventory item ID. + pub fn get(&self, profile_id: &str, project_id: &str, id: &str) -> InventoryItemGetCall<'a, C, A> { + InventoryItemGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *userRolePermission* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.user_role_permissions(); +/// # } +/// ``` +pub struct UserRolePermissionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for UserRolePermissionMethods<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one user role permission by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User role permission ID. + pub fn get(&self, profile_id: &str, id: &str) -> UserRolePermissionGetCall<'a, C, A> { + UserRolePermissionGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a list of user role permissions, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> UserRolePermissionListCall<'a, C, A> { + UserRolePermissionListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountPermissionGroup* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.account_permission_groups(); +/// # } +/// ``` +pub struct AccountPermissionGroupMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountPermissionGroupMethods<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGroupMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of account permission groups. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountPermissionGroupListCall<'a, C, A> { + AccountPermissionGroupListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one account permission group by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account permission group ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountPermissionGroupGetCall<'a, C, A> { + AccountPermissionGroupGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *contentCategory* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.content_categories(); +/// # } +/// ``` +pub struct ContentCategoryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ContentCategoryMethods<'a, C, A> {} + +impl<'a, C, A> ContentCategoryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of content categories, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ContentCategoryListCall<'a, C, A> { + ContentCategoryListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing content category. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: ContentCategory, profile_id: &str) -> ContentCategoryUpdateCall<'a, C, A> { + ContentCategoryUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new content category. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: ContentCategory, profile_id: &str) -> ContentCategoryInsertCall<'a, C, A> { + ContentCategoryInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing content category. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Content category ID. + pub fn delete(&self, profile_id: &str, id: &str) -> ContentCategoryDeleteCall<'a, C, A> { + ContentCategoryDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one content category by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Content category ID. + pub fn get(&self, profile_id: &str, id: &str) -> ContentCategoryGetCall<'a, C, A> { + ContentCategoryGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing content category. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Content category ID. + pub fn patch(&self, request: ContentCategory, profile_id: &str, id: &str) -> ContentCategoryPatchCall<'a, C, A> { + ContentCategoryPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *creative* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.creatives(); +/// # } +/// ``` +pub struct CreativeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CreativeMethods<'a, C, A> {} + +impl<'a, C, A> CreativeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Creative, profile_id: &str) -> CreativeUpdateCall<'a, C, A> { + CreativeUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new creative. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Creative, profile_id: &str) -> CreativeInsertCall<'a, C, A> { + CreativeInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one creative by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative ID. + pub fn get(&self, profile_id: &str, id: &str) -> CreativeGetCall<'a, C, A> { + CreativeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of creatives, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CreativeListCall<'a, C, A> { + CreativeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _types: Default::default(), + _studio_creative_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _size_ids: Default::default(), + _search_string: Default::default(), + _rendering_ids: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _creative_field_ids: Default::default(), + _companion_creative_ids: Default::default(), + _campaign_id: Default::default(), + _archived: Default::default(), + _advertiser_id: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing creative. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Creative ID. + pub fn patch(&self, request: Creative, profile_id: &str, id: &str) -> CreativePatchCall<'a, C, A> { + CreativePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *campaign* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.campaigns(); +/// # } +/// ``` +pub struct CampaignMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CampaignMethods<'a, C, A> {} + +impl<'a, C, A> CampaignMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one campaign by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Campaign ID. + pub fn get(&self, profile_id: &str, id: &str) -> CampaignGetCall<'a, C, A> { + CampaignGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new campaign. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `defaultLandingPageName` - Default landing page name for this new campaign. Must be less than 256 characters long. + /// * `defaultLandingPageUrl` - Default landing page URL for this new campaign. + pub fn insert(&self, request: Campaign, profile_id: &str, default_landing_page_name: &str, default_landing_page_url: &str) -> CampaignInsertCall<'a, C, A> { + CampaignInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _default_landing_page_name: default_landing_page_name.to_string(), + _default_landing_page_url: default_landing_page_url.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing campaign. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Campaign ID. + pub fn patch(&self, request: Campaign, profile_id: &str, id: &str) -> CampaignPatchCall<'a, C, A> { + CampaignPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing campaign. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Campaign, profile_id: &str) -> CampaignUpdateCall<'a, C, A> { + CampaignUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of campaigns, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CampaignListCall<'a, C, A> { + CampaignListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _overridden_event_tag_id: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _excluded_ids: Default::default(), + _at_least_one_optimization_activity: Default::default(), + _archived: Default::default(), + _advertiser_ids: Default::default(), + _advertiser_group_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *eventTag* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.event_tags(); +/// # } +/// ``` +pub struct EventTagMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for EventTagMethods<'a, C, A> {} + +impl<'a, C, A> EventTagMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing event tag. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Event tag ID. + pub fn delete(&self, profile_id: &str, id: &str) -> EventTagDeleteCall<'a, C, A> { + EventTagDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of event tags, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> EventTagListCall<'a, C, A> { + EventTagListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _ids: Default::default(), + _event_tag_types: Default::default(), + _enabled: Default::default(), + _definitions_only: Default::default(), + _campaign_id: Default::default(), + _advertiser_id: Default::default(), + _ad_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new event tag. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: EventTag, profile_id: &str) -> EventTagInsertCall<'a, C, A> { + EventTagInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing event tag. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Event tag ID. + pub fn patch(&self, request: EventTag, profile_id: &str, id: &str) -> EventTagPatchCall<'a, C, A> { + EventTagPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing event tag. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: EventTag, profile_id: &str) -> EventTagUpdateCall<'a, C, A> { + EventTagUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one event tag by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Event tag ID. + pub fn get(&self, profile_id: &str, id: &str) -> EventTagGetCall<'a, C, A> { + EventTagGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *remarketingList* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.remarketing_lists(); +/// # } +/// ``` +pub struct RemarketingListMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for RemarketingListMethods<'a, C, A> {} + +impl<'a, C, A> RemarketingListMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one remarketing list by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Remarketing list ID. + pub fn get(&self, profile_id: &str, id: &str) -> RemarketingListGetCall<'a, C, A> { + RemarketingListGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: RemarketingList, profile_id: &str) -> RemarketingListUpdateCall<'a, C, A> { + RemarketingListUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of remarketing lists, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `advertiserId` - Select only remarketing lists owned by this advertiser. + pub fn list(&self, profile_id: &str, advertiser_id: &str) -> RemarketingListListCall<'a, C, A> { + RemarketingListListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _advertiser_id: advertiser_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _page_token: Default::default(), + _name: Default::default(), + _max_results: Default::default(), + _floodlight_activity_id: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing remarketing list. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Remarketing list ID. + pub fn patch(&self, request: RemarketingList, profile_id: &str, id: &str) -> RemarketingListPatchCall<'a, C, A> { + RemarketingListPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new remarketing list. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: RemarketingList, profile_id: &str) -> RemarketingListInsertCall<'a, C, A> { + RemarketingListInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *city* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.cities(); +/// # } +/// ``` +pub struct CityMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CityMethods<'a, C, A> {} + +impl<'a, C, A> CityMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of cities, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CityListCall<'a, C, A> { + CityListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _region_dart_ids: Default::default(), + _name_prefix: Default::default(), + _dart_ids: Default::default(), + _country_dart_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *placementStrategy* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.placement_strategies(); +/// # } +/// ``` +pub struct PlacementStrategyMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlacementStrategyMethods<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement strategy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: PlacementStrategy, profile_id: &str) -> PlacementStrategyUpdateCall<'a, C, A> { + PlacementStrategyUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one placement strategy by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement strategy ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlacementStrategyGetCall<'a, C, A> { + PlacementStrategyGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of placement strategies, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlacementStrategyListCall<'a, C, A> { + PlacementStrategyListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an existing placement strategy. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement strategy ID. + pub fn delete(&self, profile_id: &str, id: &str) -> PlacementStrategyDeleteCall<'a, C, A> { + PlacementStrategyDeleteCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new placement strategy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: PlacementStrategy, profile_id: &str) -> PlacementStrategyInsertCall<'a, C, A> { + PlacementStrategyInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement strategy. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement strategy ID. + pub fn patch(&self, request: PlacementStrategy, profile_id: &str, id: &str) -> PlacementStrategyPatchCall<'a, C, A> { + PlacementStrategyPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of projects, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> ProjectListCall<'a, C, A> { + ProjectListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one project by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Project ID. + pub fn get(&self, profile_id: &str, id: &str) -> ProjectGetCall<'a, C, A> { + ProjectGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *directorySite* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.directory_sites(); +/// # } +/// ``` +pub struct DirectorySiteMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for DirectorySiteMethods<'a, C, A> {} + +impl<'a, C, A> DirectorySiteMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new directory site. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: DirectorySite, profile_id: &str) -> DirectorySiteInsertCall<'a, C, A> { + DirectorySiteInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of directory sites, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> DirectorySiteListCall<'a, C, A> { + DirectorySiteListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _parent_id: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _dfp_network_code: Default::default(), + _country_id: Default::default(), + _active: Default::default(), + _accepts_publisher_paid_placements: Default::default(), + _accepts_interstitial_placements: Default::default(), + _accepts_in_stream_video_placements: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one directory site by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Directory site ID. + pub fn get(&self, profile_id: &str, id: &str) -> DirectorySiteGetCall<'a, C, A> { + DirectorySiteGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *size* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.sizes(); +/// # } +/// ``` +pub struct SizeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for SizeMethods<'a, C, A> {} + +impl<'a, C, A> SizeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new size. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Size, profile_id: &str) -> SizeInsertCall<'a, C, A> { + SizeInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of sizes, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> SizeListCall<'a, C, A> { + SizeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _width: Default::default(), + _ids: Default::default(), + _iab_standard: Default::default(), + _height: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one size by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Size ID. + pub fn get(&self, profile_id: &str, id: &str) -> SizeGetCall<'a, C, A> { + SizeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountActiveAdSummary* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` +/// // to build up your call. +/// let rb = hub.account_active_ad_summaries(); +/// # } +/// ``` +pub struct AccountActiveAdSummaryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountActiveAdSummaryMethods<'a, C, A> {} + +impl<'a, C, A> AccountActiveAdSummaryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets the account's active ad summary by account ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `summaryAccountId` - Account ID. + pub fn get(&self, profile_id: &str, summary_account_id: &str) -> AccountActiveAdSummaryGetCall<'a, C, A> { + AccountActiveAdSummaryGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _summary_account_id: summary_account_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *accountUserProfile* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.account_user_profiles(); +/// # } +/// ``` +pub struct AccountUserProfileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountUserProfileMethods<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account user profile. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: AccountUserProfile, profile_id: &str) -> AccountUserProfileUpdateCall<'a, C, A> { + AccountUserProfileUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of account user profiles, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountUserProfileListCall<'a, C, A> { + AccountUserProfileListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _user_role_id: Default::default(), + _subaccount_id: Default::default(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new account user profile. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: AccountUserProfile, profile_id: &str) -> AccountUserProfileInsertCall<'a, C, A> { + AccountUserProfileInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account user profile. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User profile ID. + pub fn patch(&self, request: AccountUserProfile, profile_id: &str, id: &str) -> AccountUserProfilePatchCall<'a, C, A> { + AccountUserProfilePatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one account user profile by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - User profile ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountUserProfileGetCall<'a, C, A> { + AccountUserProfileGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *country* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.countries(); +/// # } +/// ``` +pub struct CountryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for CountryMethods<'a, C, A> {} + +impl<'a, C, A> CountryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of countries. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> CountryListCall<'a, C, A> { + CountryListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one country by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `dartId` - Country DART ID. + pub fn get(&self, profile_id: &str, dart_id: &str) -> CountryGetCall<'a, C, A> { + CountryGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _dart_id: dart_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *orderDocument* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.order_documents(); +/// # } +/// ``` +pub struct OrderDocumentMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for OrderDocumentMethods<'a, C, A> {} + +impl<'a, C, A> OrderDocumentMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one order document by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + /// * `id` - Order document ID. + pub fn get(&self, profile_id: &str, project_id: &str, id: &str) -> OrderDocumentGetCall<'a, C, A> { + OrderDocumentGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of order documents, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `projectId` - Project ID for order documents. + pub fn list(&self, profile_id: &str, project_id: &str) -> OrderDocumentListCall<'a, C, A> { + OrderDocumentListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _project_id: project_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _site_id: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _order_id: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _approved: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *postalCode* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.postal_codes(); +/// # } +/// ``` +pub struct PostalCodeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PostalCodeMethods<'a, C, A> {} + +impl<'a, C, A> PostalCodeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one postal code by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `code` - Postal code ID. + pub fn get(&self, profile_id: &str, code: &str) -> PostalCodeGetCall<'a, C, A> { + PostalCodeGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _code: code.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of postal codes. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PostalCodeListCall<'a, C, A> { + PostalCodeListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *browser* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.browsers(); +/// # } +/// ``` +pub struct BrowserMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for BrowserMethods<'a, C, A> {} + +impl<'a, C, A> BrowserMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of browsers. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> BrowserListCall<'a, C, A> { + BrowserListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *account* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.accounts(); +/// # } +/// ``` +pub struct AccountMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for AccountMethods<'a, C, A> {} + +impl<'a, C, A> AccountMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets one account by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account ID. + pub fn get(&self, profile_id: &str, id: &str) -> AccountGetCall<'a, C, A> { + AccountGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves the list of accounts, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> AccountListCall<'a, C, A> { + AccountListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _search_string: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _ids: Default::default(), + _active: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Account, profile_id: &str) -> AccountUpdateCall<'a, C, A> { + AccountUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing account. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Account ID. + pub fn patch(&self, request: Account, profile_id: &str, id: &str) -> AccountPatchCall<'a, C, A> { + AccountPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *placement* resources. +/// It is not used directly, but through the `Dfareporting` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_dfareporting2d3 as dfareporting2d3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use dfareporting2d3::Dfareporting; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Dfareporting::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `generatetags(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.placements(); +/// # } +/// ``` +pub struct PlacementMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, +} + +impl<'a, C, A> MethodsBuilder for PlacementMethods<'a, C, A> {} + +impl<'a, C, A> PlacementMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement ID. + pub fn patch(&self, request: Placement, profile_id: &str, id: &str) -> PlacementPatchCall<'a, C, A> { + PlacementPatchCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Retrieves a list of placements, possibly filtered. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn list(&self, profile_id: &str) -> PlacementListCall<'a, C, A> { + PlacementListCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _sort_order: Default::default(), + _sort_field: Default::default(), + _size_ids: Default::default(), + _site_ids: Default::default(), + _search_string: Default::default(), + _pricing_types: Default::default(), + _placement_strategy_ids: Default::default(), + _payment_source: Default::default(), + _page_token: Default::default(), + _min_start_date: Default::default(), + _min_end_date: Default::default(), + _max_start_date: Default::default(), + _max_results: Default::default(), + _max_end_date: Default::default(), + _ids: Default::default(), + _group_ids: Default::default(), + _directory_site_ids: Default::default(), + _content_category_ids: Default::default(), + _compatibilities: Default::default(), + _campaign_ids: Default::default(), + _archived: Default::default(), + _advertiser_ids: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Inserts a new placement. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn insert(&self, request: Placement, profile_id: &str) -> PlacementInsertCall<'a, C, A> { + PlacementInsertCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing placement. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `profileId` - User profile ID associated with this request. + pub fn update(&self, request: Placement, profile_id: &str) -> PlacementUpdateCall<'a, C, A> { + PlacementUpdateCall { + hub: self.hub, + _request: request, + _profile_id: profile_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Generates tags for a placement. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + pub fn generatetags(&self, profile_id: &str) -> PlacementGeneratetagCall<'a, C, A> { + PlacementGeneratetagCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _tag_formats: Default::default(), + _placement_ids: Default::default(), + _campaign_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets one placement by ID. + /// + /// # Arguments + /// + /// * `profileId` - User profile ID associated with this request. + /// * `id` - Placement ID. + pub fn get(&self, profile_id: &str, id: &str) -> PlacementGetCall<'a, C, A> { + PlacementGetCall { + hub: self.hub, + _profile_id: profile_id.to_string(), + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Gets one user role permission group by ID. +/// +/// A builder for the *get* method supported by a *userRolePermissionGroup* resource. +/// It is not used directly, but through a `UserRolePermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.user_role_permission_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionGroupGetCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermissionGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/userRolePermissionGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role permission group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRolePermissionGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserRolePermissionGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserRolePermissionGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a list of all supported user role permission groups. +/// +/// A builder for the *list* method supported by a *userRolePermissionGroup* resource. +/// It is not used directly, but through a `UserRolePermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.user_role_permission_groups().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionGroupListCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermissionGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissionGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/userRolePermissionGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserRolePermissionGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserRolePermissionGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one platform type by ID. +/// +/// A builder for the *get* method supported by a *platformType* resource. +/// It is not used directly, but through a `PlatformTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.platform_types().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlatformTypeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlatformTypeGetCall<'a, C, A> {} + +impl<'a, C, A> PlatformTypeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlatformType)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.platformTypes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/platformTypes/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlatformTypeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Platform type ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlatformTypeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlatformTypeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlatformTypeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlatformTypeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of platform types. +/// +/// A builder for the *list* method supported by a *platformType* resource. +/// It is not used directly, but through a `PlatformTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.platform_types().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlatformTypeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlatformTypeListCall<'a, C, A> {} + +impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlatformTypesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.platformTypes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/platformTypes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlatformTypeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlatformTypeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlatformTypeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlatformTypeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative field value. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CreativeFieldValue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CreativeFieldValue::default(); +/// +/// // 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 ! +/// let result = hub.creative_field_values().patch(req, "profileId", "creativeFieldId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValuePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeFieldValue, + _profile_id: String, + _creative_field_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValuePatchCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreativeFieldValue) -> CreativeFieldValuePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Creative Field Value ID + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldValuePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldValuePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValuePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldValuePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one creative field value by ID. +/// +/// A builder for the *get* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.creative_field_values().get("profileId", "creativeFieldId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _creative_field_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueGetCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Creative Field Value ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldValueGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldValueGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldValueGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing creative field value. +/// +/// A builder for the *delete* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.creative_field_values().delete("profileId", "creativeFieldId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _creative_field_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueDeleteCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "creativeFieldId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Creative Field Value ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldValueDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldValueDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new creative field value. +/// +/// A builder for the *insert* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CreativeFieldValue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CreativeFieldValue::default(); +/// +/// // 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 ! +/// let result = hub.creative_field_values().insert(req, "profileId", "creativeFieldId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeFieldValue, + _profile_id: String, + _creative_field_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreativeFieldValue) -> CreativeFieldValueInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueInsertCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldValueInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldValueInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative field value. +/// +/// A builder for the *update* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CreativeFieldValue; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CreativeFieldValue::default(); +/// +/// // 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 ! +/// let result = hub.creative_field_values().update(req, "profileId", "creativeFieldId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeFieldValue, + _profile_id: String, + _creative_field_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValue)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + for &field in ["alt", "profileId", "creativeFieldId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreativeFieldValue) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldValueUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldValueUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of creative field values, possibly filtered. +/// +/// A builder for the *list* method supported by a *creativeFieldValue* resource. +/// It is not used directly, but through a `CreativeFieldValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.creative_field_values().list("profileId", "creativeFieldId") +/// .sort_order("eos") +/// .sort_field("erat") +/// .search_string("sadipscing") +/// .page_token("dolor") +/// .max_results(-39) +/// .add_ids("elitr") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldValueListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _creative_field_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldValueListCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldValueListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldValuesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFieldValues.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("creativeFieldId", self._creative_field_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + for &field in ["alt", "profileId", "creativeFieldId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{creativeFieldId}", "creativeFieldId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["creativeFieldId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative field ID for this creative field value. + /// + /// Sets the *creative field id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn creative_field_id(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._creative_field_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for creative field values by their values. Wildcards (e.g. *) are not allowed. + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeFieldValueListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creative field values with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldValueListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldValueListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldValueListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative field. +/// +/// A builder for the *update* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CreativeField; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CreativeField::default(); +/// +/// // 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 ! +/// let result = hub.creative_fields().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeField, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreativeField) -> CreativeFieldUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of creative fields, possibly filtered. +/// +/// A builder for the *list* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.creative_fields().list("profileId") +/// .sort_order("labore") +/// .sort_field("eirmod") +/// .search_string("dolore") +/// .page_token("invidunt") +/// .max_results(-82) +/// .add_ids("accusam") +/// .add_advertiser_ids("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldListCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeFieldsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if self._advertiser_ids.len() > 0 { + let mut s = String::new(); + for f in self._advertiser_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("advertiserIds", s)); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for creative fields by name or ID. Wildcards (*) are allowed. For example, "creativefield*2015" will return creative fields with names like "creativefield June 2015", "creativefield April 2015", or simply "creativefield 2015". Most of the searches also add wild-cards implicitly at the start and the end of the search string. For example, a search string of "creativefield" will match creative fields with the name "my creativefield", "creativefield 2015", or simply "creativefield". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeFieldListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creative fields with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only creative fields that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> CreativeFieldListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing creative field. +/// +/// A builder for the *delete* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.creative_fields().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldDeleteCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative Field ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one creative field by ID. +/// +/// A builder for the *get* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.creative_fields().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative Field ID + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new creative field. +/// +/// A builder for the *insert* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CreativeField; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CreativeField::default(); +/// +/// // 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 ! +/// let result = hub.creative_fields().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeField, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreativeField) -> CreativeFieldInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative field. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creativeField* resource. +/// It is not used directly, but through a `CreativeFieldMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CreativeField; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CreativeField::default(); +/// +/// // 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 ! +/// let result = hub.creative_fields().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeFieldPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeField, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeFieldPatchCall<'a, C, A> {} + +impl<'a, C, A> CreativeFieldPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeField)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeFields.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeFields".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreativeField) -> CreativeFieldPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeFieldPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative Field ID + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeFieldPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeFieldPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeFieldPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeFieldPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new user role. +/// +/// A builder for the *insert* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::UserRole; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = UserRole::default(); +/// +/// // 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 ! +/// let result = hub.user_roles().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: UserRole, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleInsertCall<'a, C, A> {} + +impl<'a, C, A> UserRoleInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/userRoles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: UserRole) -> UserRoleInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserRoleInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserRoleInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one user role by ID. +/// +/// A builder for the *get* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.user_roles().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleGetCall<'a, C, A> {} + +impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/userRoles/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRoleGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserRoleGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserRoleGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing user role. +/// +/// A builder for the *update* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::UserRole; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = UserRole::default(); +/// +/// // 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 ! +/// let result = hub.user_roles().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: UserRole, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleUpdateCall<'a, C, A> {} + +impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/userRoles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: UserRole) -> UserRoleUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserRoleUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserRoleUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing user role. +/// +/// A builder for the *delete* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.user_roles().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRoleDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleDeleteCall<'a, C, A> {} + +impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/userRoles/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRoleDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserRoleDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserRoleDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing user role. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::UserRole; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = UserRole::default(); +/// +/// // 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 ! +/// let result = hub.user_roles().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: UserRole, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePatchCall<'a, C, A> {} + +impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRole)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/userRoles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: UserRole) -> UserRolePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRolePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserRolePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserRolePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of user roles, possibly filtered. +/// +/// A builder for the *list* method supported by a *userRole* resource. +/// It is not used directly, but through a `UserRoleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.user_roles().list("profileId") +/// .subaccount_id("et") +/// .sort_order("consetetur") +/// .sort_field("amet.") +/// .search_string("voluptua.") +/// .page_token("Lorem") +/// .max_results(-11) +/// .add_ids("justo") +/// .account_user_role_only(false) +/// .doit(); +/// # } +/// ``` +pub struct UserRoleListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _account_user_role_only: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRoleListCall<'a, C, A> {} + +impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRoles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._account_user_role_only { + params.push(("accountUserRoleOnly", value.to_string())); + } + for &field in ["alt", "profileId", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "accountUserRoleOnly"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/userRoles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only user roles that belong to this subaccount. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "userrole*2015" will return objects with names like "userrole June 2015", "userrole April 2015", or simply "userrole 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "userrole" will match objects with name "my userrole", "userrole 2015", or simply "userrole". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> UserRoleListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only user roles with the specified IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> UserRoleListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only account level user roles not associated with any specific subaccount. + /// + /// Sets the *account user role only* query property to the given value. + pub fn account_user_role_only(mut self, new_value: bool) -> UserRoleListCall<'a, C, A> { + self._account_user_role_only = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserRoleListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRoleListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserRoleListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one operating system version by ID. +/// +/// A builder for the *get* method supported by a *operatingSystemVersion* resource. +/// It is not used directly, but through a `OperatingSystemVersionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.operating_system_versions().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemVersionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemVersionGetCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystemVersion)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/operatingSystemVersions/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemVersionGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Operating system version ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> OperatingSystemVersionGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OperatingSystemVersionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemVersionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OperatingSystemVersionGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of operating system versions. +/// +/// A builder for the *list* method supported by a *operatingSystemVersion* resource. +/// It is not used directly, but through a `OperatingSystemVersionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.operating_system_versions().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemVersionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemVersionListCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystemVersionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystemVersions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/operatingSystemVersions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemVersionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OperatingSystemVersionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemVersionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OperatingSystemVersionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one campaign landing page by ID. +/// +/// A builder for the *get* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.landing_pages().get("profileId", "campaignId", "id") +/// .doit(); +/// # } +/// ``` +pub struct LandingPageGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _campaign_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPageGetCall<'a, C, A> {} + +impl<'a, C, A> LandingPageGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "campaignId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns/{campaignId}/landingPages/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// Landing page ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LandingPageGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LandingPageGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPageGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LandingPageGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing campaign landing page. +/// +/// A builder for the *update* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::LandingPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = LandingPage::default(); +/// +/// // 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 ! +/// let result = hub.landing_pages().update(req, "profileId", "campaignId") +/// .doit(); +/// # } +/// ``` +pub struct LandingPageUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: LandingPage, + _profile_id: String, + _campaign_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPageUpdateCall<'a, C, A> {} + +impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + for &field in ["alt", "profileId", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns/{campaignId}/landingPages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: LandingPage) -> LandingPageUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPageUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPageUpdateCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LandingPageUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPageUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LandingPageUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the list of landing pages for the specified campaign. +/// +/// A builder for the *list* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.landing_pages().list("profileId", "campaignId") +/// .doit(); +/// # } +/// ``` +pub struct LandingPageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _campaign_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPageListCall<'a, C, A> {} + +impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPagesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + for &field in ["alt", "profileId", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns/{campaignId}/landingPages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPageListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPageListCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LandingPageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LandingPageListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new landing page for the specified campaign. +/// +/// A builder for the *insert* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::LandingPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = LandingPage::default(); +/// +/// // 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 ! +/// let result = hub.landing_pages().insert(req, "profileId", "campaignId") +/// .doit(); +/// # } +/// ``` +pub struct LandingPageInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: LandingPage, + _profile_id: String, + _campaign_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPageInsertCall<'a, C, A> {} + +impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + for &field in ["alt", "profileId", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns/{campaignId}/landingPages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: LandingPage) -> LandingPageInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPageInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPageInsertCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LandingPageInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPageInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LandingPageInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing campaign landing page. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::LandingPage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = LandingPage::default(); +/// +/// // 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 ! +/// let result = hub.landing_pages().patch(req, "profileId", "campaignId", "id") +/// .doit(); +/// # } +/// ``` +pub struct LandingPagePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: LandingPage, + _profile_id: String, + _campaign_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPagePatchCall<'a, C, A> {} + +impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LandingPage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "campaignId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns/{campaignId}/landingPages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: LandingPage) -> LandingPagePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// Landing page ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LandingPagePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LandingPagePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPagePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LandingPagePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing campaign landing page. +/// +/// A builder for the *delete* method supported by a *landingPage* resource. +/// It is not used directly, but through a `LandingPageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.landing_pages().delete("profileId", "campaignId", "id") +/// .doit(); +/// # } +/// ``` +pub struct LandingPageDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _campaign_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LandingPageDeleteCall<'a, C, A> {} + +impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.landingPages.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "campaignId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns/{campaignId}/landingPages/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Landing page campaign ID. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// Landing page ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LandingPageDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LandingPageDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LandingPageDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LandingPageDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new creative asset. +/// +/// A builder for the *insert* method supported by a *creativeAsset* resource. +/// It is not used directly, but through a `CreativeAssetMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CreativeAssetMetadata; +/// use std::fs; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CreativeAssetMetadata::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload_resumable(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.creative_assets().insert(req, "profileId", "advertiserId") +/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct CreativeAssetInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeAssetMetadata, + _profile_id: String, + _advertiser_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeAssetInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, CreativeAssetMetadata)> + where RS: ReadSeek { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeAssets.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("advertiserId", self._advertiser_id.to_string())); + for &field in ["alt", "profileId", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let (mut url, upload_type) = + if protocol == "simple" { + ("https://www.googleapis.com/upload/dfareporting/v2.3/userprofiles/{profileId}/creativeAssets/{advertiserId}/creativeAssets".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://www.googleapis.com/resumable/upload/dfareporting/v2.3/userprofiles/{profileId}/creativeAssets/{advertiserId}/creativeAssets".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{advertiserId}", "advertiserId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["advertiserId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut mp_reader: MultiPartReader = Default::default(); + let (mut body_reader, content_type) = match protocol { + "simple" => { + mp_reader.reserve_exact(2); + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 104857600 { + return Err(Error::UploadSizeLimitExceeded(size, 104857600)) + } + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) + .add_part(&mut reader, size, reader_mime_type.clone()); + let mime_type = mp_reader.mime_type(); + (&mut mp_reader as &mut io::Read, ContentType(mime_type)) + }, + _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), + }; + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(content_type) + .body(&mut body_reader); + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 104857600 { + return Err(Error::UploadSizeLimitExceeded(size, 104857600)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 100MB + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, CreativeAssetMetadata)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 100MB + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, CreativeAssetMetadata)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreativeAssetMetadata) -> CreativeAssetInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeAssetInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser ID of this creative. This is a required field. + /// + /// Sets the *advertiser id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn advertiser_id(mut self, new_value: &str) -> CreativeAssetInsertCall<'a, C, A> { + self._advertiser_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeAssetInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeAssetInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeAssetInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already. +/// +/// A builder for the *insert* method supported by a *campaignCreativeAssociation* resource. +/// It is not used directly, but through a `CampaignCreativeAssociationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CampaignCreativeAssociation; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CampaignCreativeAssociation::default(); +/// +/// // 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 ! +/// let result = hub.campaign_creative_associations().insert(req, "profileId", "campaignId") +/// .doit(); +/// # } +/// ``` +pub struct CampaignCreativeAssociationInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CampaignCreativeAssociation, + _profile_id: String, + _campaign_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignCreativeAssociationInsertCall<'a, C, A> {} + +impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CampaignCreativeAssociation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + for &field in ["alt", "profileId", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CampaignCreativeAssociation) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID in this association. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CampaignCreativeAssociationInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignCreativeAssociationInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CampaignCreativeAssociationInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the list of creative IDs associated with the specified campaign. +/// +/// A builder for the *list* method supported by a *campaignCreativeAssociation* resource. +/// It is not used directly, but through a `CampaignCreativeAssociationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.campaign_creative_associations().list("profileId", "campaignId") +/// .sort_order("ea") +/// .page_token("sadipscing") +/// .max_results(-66) +/// .doit(); +/// # } +/// ``` +pub struct CampaignCreativeAssociationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _campaign_id: String, + _sort_order: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignCreativeAssociationListCall<'a, C, A> {} + +impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CampaignCreativeAssociationsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaignCreativeAssociations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("campaignId", self._campaign_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "campaignId", "sortOrder", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["campaignId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID in this association. + /// + /// Sets the *campaign id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn campaign_id(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._campaign_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CampaignCreativeAssociationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignCreativeAssociationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CampaignCreativeAssociationListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of change logs. +/// +/// A builder for the *list* method supported by a *changeLog* resource. +/// It is not used directly, but through a `ChangeLogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.change_logs().list("profileId") +/// .add_user_profile_ids("nonumy") +/// .search_string("sed") +/// .page_token("aliquyam") +/// .object_type("sit") +/// .add_object_ids("eirmod") +/// .min_change_time("consetetur") +/// .max_results(-85) +/// .max_change_time("sed") +/// .add_ids("ea") +/// .action("gubergren") +/// .doit(); +/// # } +/// ``` +pub struct ChangeLogListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _user_profile_ids: Vec, + _search_string: Option, + _page_token: Option, + _object_type: Option, + _object_ids: Vec, + _min_change_time: Option, + _max_results: Option, + _max_change_time: Option, + _ids: Vec, + _action: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChangeLogListCall<'a, C, A> {} + +impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChangeLogsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.changeLogs.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._user_profile_ids.len() > 0 { + let mut s = String::new(); + for f in self._user_profile_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("userProfileIds", s)); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._object_type { + params.push(("objectType", value.to_string())); + } + if self._object_ids.len() > 0 { + let mut s = String::new(); + for f in self._object_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("objectIds", s)); + } + if let Some(value) = self._min_change_time { + params.push(("minChangeTime", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._max_change_time { + params.push(("maxChangeTime", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._action { + params.push(("action", value.to_string())); + } + for &field in ["alt", "profileId", "userProfileIds", "searchString", "pageToken", "objectType", "objectIds", "minChangeTime", "maxResults", "maxChangeTime", "ids", "action"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/changeLogs".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only change logs with these user profile IDs. + /// + /// Append the given value to the *user profile ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_user_profile_ids(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._user_profile_ids.push(new_value.to_string()); + self + } + /// Select only change logs whose object ID, user name, old or new values match the search string. + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only change logs with the specified object type. + /// + /// Sets the *object type* query property to the given value. + pub fn object_type(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._object_type = Some(new_value.to_string()); + self + } + /// Select only change logs with these object IDs. + /// + /// Append the given value to the *object ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_object_ids(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._object_ids.push(new_value.to_string()); + self + } + /// Select only change logs whose change time is before the specified minChangeTime.The time should be formatted as an RFC3339 date/time string. For example, for 10:54 PM on July 18th, 2015, in the America/New York time zone, the format is "2015-07-18T22:54:00-04:00". In other words, the year, month, day, the letter T, the hour (24-hour clock system), minute, second, and then the time zone offset. + /// + /// Sets the *min change time* query property to the given value. + pub fn min_change_time(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._min_change_time = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ChangeLogListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only change logs whose change time is before the specified maxChangeTime.The time should be formatted as an RFC3339 date/time string. For example, for 10:54 PM on July 18th, 2015, in the America/New York time zone, the format is "2015-07-18T22:54:00-04:00". In other words, the year, month, day, the letter T, the hour (24-hour clock system), minute, second, and then the time zone offset. + /// + /// Sets the *max change time* query property to the given value. + pub fn max_change_time(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._max_change_time = Some(new_value.to_string()); + self + } + /// Select only change logs with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only change logs with the specified action. + /// + /// Sets the *action* query property to the given value. + pub fn action(mut self, new_value: &str) -> ChangeLogListCall<'a, C, A> { + self._action = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChangeLogListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChangeLogListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChangeLogListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one change log by ID. +/// +/// A builder for the *get* method supported by a *changeLog* resource. +/// It is not used directly, but through a `ChangeLogMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.change_logs().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ChangeLogGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChangeLogGetCall<'a, C, A> {} + +impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChangeLog)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.changeLogs.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/changeLogs/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ChangeLogGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Change log ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ChangeLogGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChangeLogGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChangeLogGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChangeLogGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one remarketing list share by remarketing list ID. +/// +/// A builder for the *get* method supported by a *remarketingListShare* resource. +/// It is not used directly, but through a `RemarketingListShareMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.remarketing_list_shares().get("profileId", "remarketingListId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListShareGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _remarketing_list_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListShareGetCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListShare)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("remarketingListId", self._remarketing_list_id.to_string())); + for &field in ["alt", "profileId", "remarketingListId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/remarketingListShares/{remarketingListId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{remarketingListId}", "remarketingListId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["remarketingListId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListShareGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *remarketing list id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn remarketing_list_id(mut self, new_value: &str) -> RemarketingListShareGetCall<'a, C, A> { + self._remarketing_list_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RemarketingListShareGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListShareGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RemarketingListShareGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing remarketing list share. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *remarketingListShare* resource. +/// It is not used directly, but through a `RemarketingListShareMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::RemarketingListShare; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = RemarketingListShare::default(); +/// +/// // 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 ! +/// let result = hub.remarketing_list_shares().patch(req, "profileId", "remarketingListId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListSharePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingListShare, + _profile_id: String, + _remarketing_list_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListSharePatchCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListShare)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("remarketingListId", self._remarketing_list_id.to_string())); + for &field in ["alt", "profileId", "remarketingListId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/remarketingListShares".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: RemarketingListShare) -> RemarketingListSharePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListSharePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *remarketing list id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn remarketing_list_id(mut self, new_value: &str) -> RemarketingListSharePatchCall<'a, C, A> { + self._remarketing_list_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RemarketingListSharePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListSharePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RemarketingListSharePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing remarketing list share. +/// +/// A builder for the *update* method supported by a *remarketingListShare* resource. +/// It is not used directly, but through a `RemarketingListShareMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::RemarketingListShare; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = RemarketingListShare::default(); +/// +/// // 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 ! +/// let result = hub.remarketing_list_shares().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListShareUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingListShare, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListShareUpdateCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListShare)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingListShares.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/remarketingListShares".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: RemarketingListShare) -> RemarketingListShareUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListShareUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RemarketingListShareUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListShareUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RemarketingListShareUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Runs a report. +/// +/// A builder for the *run* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.reports().run("profileId", "reportId") +/// .synchronous(true) +/// .doit(); +/// # } +/// ``` +pub struct ReportRunCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _synchronous: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportRunCall<'a, C, A> {} + +impl<'a, C, A> ReportRunCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.run", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + if let Some(value) = self._synchronous { + params.push(("synchronous", value.to_string())); + } + for &field in ["alt", "profileId", "reportId", "synchronous"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/reports/{reportId}/run".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportRunCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportRunCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// If set and true, tries to run the report synchronously. + /// + /// Sets the *synchronous* query property to the given value. + pub fn synchronous(mut self, new_value: bool) -> ReportRunCall<'a, C, A> { + self._synchronous = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReportRunCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportRunCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReportRunCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a report. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Report::default(); +/// +/// // 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 ! +/// let result = hub.reports().patch(req, "profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportPatchCall<'a, C, A> {} + +impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["alt", "profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/reports/{reportId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Report) -> ReportPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportPatchCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReportPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReportPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists files for a report. +/// +/// A builder for the *files.list* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.reports().files_list("profileId", "reportId") +/// .sort_order("accusam") +/// .sort_field("clita") +/// .page_token("diam") +/// .max_results(-71) +/// .doit(); +/// # } +/// ``` +pub struct ReportFileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _sort_order: Option, + _sort_field: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportFileListCall<'a, C, A> {} + +impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FileList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.files.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "reportId", "sortOrder", "sortField", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/reports/{reportId}/files".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the parent report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// Order of sorted results, default is 'DESCENDING'. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// The field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ReportFileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ReportFileListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReportFileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportFileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReportFileListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a report. +/// +/// A builder for the *insert* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Report::default(); +/// +/// // 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 ! +/// let result = hub.reports().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ReportInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportInsertCall<'a, C, A> {} + +impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/reports".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Report) -> ReportInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReportInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReportInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a report. +/// +/// A builder for the *update* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Report::default(); +/// +/// // 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 ! +/// let result = hub.reports().update(req, "profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportUpdateCall<'a, C, A> {} + +impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["alt", "profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/reports/{reportId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Report) -> ReportUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportUpdateCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReportUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReportUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions. +/// +/// A builder for the *compatibleFields.query* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Report; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Report::default(); +/// +/// // 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 ! +/// let result = hub.reports().compatible_fields_query(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ReportCompatibleFieldQueryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Report, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportCompatibleFieldQueryCall<'a, C, A> {} + +impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CompatibleFields)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.compatibleFields.query", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/reports/compatiblefields/query".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Report) -> ReportCompatibleFieldQueryCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportCompatibleFieldQueryCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReportCompatibleFieldQueryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportCompatibleFieldQueryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReportCompatibleFieldQueryCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a report by its ID. +/// +/// A builder for the *get* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.reports().get("profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportGetCall<'a, C, A> {} + +impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Report)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["alt", "profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/reports/{reportId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReportGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReportGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a report file. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `File` structure that you would usually get. The latter will be a default value. +/// +/// A builder for the *files.get* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.reports().files_get("profileId", "reportId", "fileId") +/// .doit(); +/// # } +/// ``` +pub struct ReportFileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _file_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportFileGetCall<'a, C, A> {} + +impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.files.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + params.push(("fileId", self._file_id.to_string())); + for &field in ["profileId", "reportId", "fileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if >::as_ref(&value) != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/reports/{reportId}/files/{fileId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId"), ("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["fileId", "reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = if enable_resource_parsing { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + } else { (res, Default::default()) }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The ID of the report file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> ReportFileGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReportFileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportFileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReportFileGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a report by its ID. +/// +/// A builder for the *delete* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.reports().delete("profileId", "reportId") +/// .doit(); +/// # } +/// ``` +pub struct ReportDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _report_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportDeleteCall<'a, C, A> {} + +impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("reportId", self._report_id.to_string())); + for &field in ["profileId", "reportId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/reports/{reportId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["reportId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> ReportDeleteCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReportDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReportDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves list of reports. +/// +/// A builder for the *list* method supported by a *report* resource. +/// It is not used directly, but through a `ReportMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.reports().list("profileId") +/// .sort_order("et") +/// .sort_field("dolor") +/// .scope("diam") +/// .page_token("kasd") +/// .max_results(-87) +/// .doit(); +/// # } +/// ``` +pub struct ReportListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _scope: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReportListCall<'a, C, A> {} + +impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ReportList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.reports.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._scope { + params.push(("scope", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "scope", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/reports".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is 'DESCENDING'. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// The field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// The scope that defines which results are returned, default is 'MINE'. + /// + /// Sets the *scope* query property to the given value. + pub fn scope(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._scope = Some(new_value.to_string()); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ReportListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ReportListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReportListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReportListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReportListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new advertiser. +/// +/// A builder for the *insert* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Advertiser; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Advertiser::default(); +/// +/// // 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 ! +/// let result = hub.advertisers().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Advertiser, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserInsertCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertisers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Advertiser) -> AdvertiserInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing advertiser. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Advertiser; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Advertiser::default(); +/// +/// // 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 ! +/// let result = hub.advertisers().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Advertiser, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserPatchCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertisers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Advertiser) -> AdvertiserPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of advertisers, possibly filtered. +/// +/// A builder for the *list* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.advertisers().list("profileId") +/// .subaccount_id("eirmod") +/// .status("At") +/// .sort_order("consetetur") +/// .sort_field("et") +/// .search_string("sed") +/// .page_token("sit") +/// .only_parent(true) +/// .max_results(-43) +/// .include_advertisers_without_groups_only(false) +/// .add_ids("rebum.") +/// .add_floodlight_configuration_ids("Lorem") +/// .add_advertiser_group_ids("Lorem") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _subaccount_id: Option, + _status: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _only_parent: Option, + _max_results: Option, + _include_advertisers_without_groups_only: Option, + _ids: Vec, + _floodlight_configuration_ids: Vec, + _advertiser_group_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserListCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertisersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._status { + params.push(("status", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._only_parent { + params.push(("onlyParent", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._include_advertisers_without_groups_only { + params.push(("includeAdvertisersWithoutGroupsOnly", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if self._floodlight_configuration_ids.len() > 0 { + let mut s = String::new(); + for f in self._floodlight_configuration_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("floodlightConfigurationIds", s)); + } + if self._advertiser_group_ids.len() > 0 { + let mut s = String::new(); + for f in self._advertiser_group_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("advertiserGroupIds", s)); + } + for &field in ["alt", "profileId", "subaccountId", "status", "sortOrder", "sortField", "searchString", "pageToken", "onlyParent", "maxResults", "includeAdvertisersWithoutGroupsOnly", "ids", "floodlightConfigurationIds", "advertiserGroupIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertisers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only advertisers with these subaccount IDs. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Select only advertisers with the specified status. + /// + /// Sets the *status* query property to the given value. + pub fn status(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._status = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "advertiser*2015" will return objects with names like "advertiser June 2015", "advertiser April 2015", or simply "advertiser 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "advertiser" will match objects with name "my advertiser", "advertiser 2015", or simply "advertiser". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only advertisers which use another advertiser's floodlight configuration. + /// + /// Sets the *only parent* query property to the given value. + pub fn only_parent(mut self, new_value: bool) -> AdvertiserListCall<'a, C, A> { + self._only_parent = Some(new_value); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AdvertiserListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only advertisers which do not belong to any advertiser group. + /// + /// Sets the *include advertisers without groups only* query property to the given value. + pub fn include_advertisers_without_groups_only(mut self, new_value: bool) -> AdvertiserListCall<'a, C, A> { + self._include_advertisers_without_groups_only = Some(new_value); + self + } + /// Select only advertisers with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only advertisers with these floodlight configuration IDs. + /// + /// Append the given value to the *floodlight configuration ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_floodlight_configuration_ids(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._floodlight_configuration_ids.push(new_value.to_string()); + self + } + /// Select only advertisers with these advertiser group IDs. + /// + /// Append the given value to the *advertiser group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_group_ids(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { + self._advertiser_group_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing advertiser. +/// +/// A builder for the *update* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Advertiser; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Advertiser::default(); +/// +/// // 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 ! +/// let result = hub.advertisers().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Advertiser, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserUpdateCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertisers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Advertiser) -> AdvertiserUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one advertiser by ID. +/// +/// A builder for the *get* method supported by a *advertiser* resource. +/// It is not used directly, but through a `AdvertiserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.advertisers().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGetCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Advertiser)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertisers.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertisers/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves list of report dimension values for a list of filters. +/// +/// A builder for the *query* method supported by a *dimensionValue* resource. +/// It is not used directly, but through a `DimensionValueMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::DimensionValueRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = DimensionValueRequest::default(); +/// +/// // 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 ! +/// let result = hub.dimension_values().query(req, "profileId") +/// .page_token("ipsum") +/// .max_results(-87) +/// .doit(); +/// # } +/// ``` +pub struct DimensionValueQueryCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: DimensionValueRequest, + _profile_id: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DimensionValueQueryCall<'a, C, A> {} + +impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DimensionValueList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.dimensionValues.query", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/dimensionvalues/query".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: DimensionValueRequest) -> DimensionValueQueryCall<'a, C, A> { + self._request = new_value; + self + } + /// The DFA user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DimensionValueQueryCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> DimensionValueQueryCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> DimensionValueQueryCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DimensionValueQueryCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DimensionValueQueryCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DimensionValueQueryCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one floodlight activity group by ID. +/// +/// A builder for the *get* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.floodlight_activity_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupGetCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivityGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity Group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight activity group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::FloodlightActivityGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = FloodlightActivityGroup::default(); +/// +/// // 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 ! +/// let result = hub.floodlight_activity_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivityGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivityGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: FloodlightActivityGroup) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity Group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityGroupPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of floodlight activity groups, possibly filtered. +/// +/// A builder for the *list* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.floodlight_activity_groups().list("profileId") +/// .type_("voluptua.") +/// .sort_order("dolor") +/// .sort_field("et") +/// .search_string("et") +/// .page_token("vero") +/// .max_results(-36) +/// .add_ids("sed") +/// .floodlight_configuration_id("et") +/// .advertiser_id("ipsum") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _type_: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _floodlight_configuration_id: Option, + _advertiser_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupListCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._type_ { + params.push(("type", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._floodlight_configuration_id { + params.push(("floodlightConfigurationId", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + for &field in ["alt", "profileId", "type", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "floodlightConfigurationId", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivityGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only floodlight activity groups with the specified floodlight activity group type. + /// + /// Sets the *type* query property to the given value. + pub fn type_(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._type_ = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "floodlightactivitygroup*2015" will return objects with names like "floodlightactivitygroup June 2015", "floodlightactivitygroup April 2015", or simply "floodlightactivitygroup 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "floodlightactivitygroup" will match objects with name "my floodlightactivitygroup activity", "floodlightactivitygroup 2015", or simply "floodlightactivitygroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> FloodlightActivityGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only floodlight activity groups with the specified IDs. Must specify either advertiserId or floodlightConfigurationId for a non-empty result. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only floodlight activity groups with the specified floodlight configuration ID. Must specify either advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *floodlight configuration id* query property to the given value. + pub fn floodlight_configuration_id(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._floodlight_configuration_id = Some(new_value.to_string()); + self + } + /// Select only floodlight activity groups with the specified advertiser ID. Must specify either advertiserId or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new floodlight activity group. +/// +/// A builder for the *insert* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::FloodlightActivityGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = FloodlightActivityGroup::default(); +/// +/// // 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 ! +/// let result = hub.floodlight_activity_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivityGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivityGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: FloodlightActivityGroup) -> FloodlightActivityGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityGroupInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight activity group. +/// +/// A builder for the *update* method supported by a *floodlightActivityGroup* resource. +/// It is not used directly, but through a `FloodlightActivityGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::FloodlightActivityGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = FloodlightActivityGroup::default(); +/// +/// // 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 ! +/// let result = hub.floodlight_activity_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivityGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivityGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivityGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivityGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: FloodlightActivityGroup) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityGroupUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of metros. +/// +/// A builder for the *list* method supported by a *metro* resource. +/// It is not used directly, but through a `MetroMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.metros().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct MetroListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MetroListCall<'a, C, A> {} + +impl<'a, C, A> MetroListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MetrosListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.metros.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/metros".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MetroListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MetroListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MetroListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MetroListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of orders, possibly filtered. +/// +/// A builder for the *list* method supported by a *order* resource. +/// It is not used directly, but through a `OrderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.orders().list("profileId", "projectId") +/// .sort_order("et") +/// .sort_field("nonumy") +/// .add_site_id("et") +/// .search_string("sed") +/// .page_token("no") +/// .max_results(-38) +/// .add_ids("rebum.") +/// .doit(); +/// # } +/// ``` +pub struct OrderListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _sort_order: Option, + _sort_field: Option, + _site_id: Vec, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderListCall<'a, C, A> {} + +impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrdersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orders.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_id.len() > 0 { + let mut s = String::new(); + for f in self._site_id.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("siteId", s)); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + for &field in ["alt", "profileId", "projectId", "sortOrder", "sortField", "siteId", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/projects/{projectId}/orders".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for orders. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only orders that are associated with these site IDs. + /// + /// Append the given value to the *site id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_id(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._site_id.push(new_value.to_string()); + self + } + /// Allows searching for orders by name or ID. Wildcards (*) are allowed. For example, "order*2015" will return orders with names like "order June 2015", "order April 2015", or simply "order 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "order" will match orders with name "my order", "order 2015", or simply "order". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> OrderListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only orders with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> OrderListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OrderListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OrderListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one order by ID. +/// +/// A builder for the *get* method supported by a *order* resource. +/// It is not used directly, but through a `OrderMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.orders().get("profileId", "projectId", "id") +/// .doit(); +/// # } +/// ``` +pub struct OrderGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderGetCall<'a, C, A> {} + +impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Order)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orders.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "projectId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/projects/{projectId}/orders/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for orders. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> OrderGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OrderGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OrderGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one directory site contact by ID. +/// +/// A builder for the *get* method supported by a *directorySiteContact* resource. +/// It is not used directly, but through a `DirectorySiteContactMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.directory_site_contacts().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteContactGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteContactGetCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySiteContact)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/directorySiteContacts/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteContactGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Directory site contact ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> DirectorySiteContactGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DirectorySiteContactGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteContactGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DirectorySiteContactGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of directory site contacts, possibly filtered. +/// +/// A builder for the *list* method supported by a *directorySiteContact* resource. +/// It is not used directly, but through a `DirectorySiteContactMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.directory_site_contacts().list("profileId") +/// .sort_order("At") +/// .sort_field("sea") +/// .search_string("consetetur") +/// .page_token("diam") +/// .max_results(-22) +/// .add_ids("dolores") +/// .add_directory_site_ids("consetetur") +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteContactListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _directory_site_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteContactListCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteContactListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySiteContactsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySiteContacts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if self._directory_site_ids.len() > 0 { + let mut s = String::new(); + for f in self._directory_site_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("directorySiteIds", s)); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "directorySiteIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/directorySiteContacts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or email. Wildcards (*) are allowed. For example, "directory site contact*2015" will return objects with names like "directory site contact June 2015", "directory site contact April 2015", or simply "directory site contact 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "directory site contact" will match objects with name "my directory site contact", "directory site contact 2015", or simply "directory site contact". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> DirectorySiteContactListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only directory site contacts with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only directory site contacts with these directory site IDs. This is a required field. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> DirectorySiteContactListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DirectorySiteContactListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteContactListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DirectorySiteContactListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves list of user profiles for a user. +/// +/// A builder for the *list* method supported by a *userProfile* resource. +/// It is not used directly, but through a `UserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.user_profiles().list() +/// .doit(); +/// # } +/// ``` +pub struct UserProfileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserProfileListCall<'a, C, A> {} + +impl<'a, C, A> UserProfileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserProfileList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userProfiles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserProfileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserProfileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserProfileListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one user profile by ID. +/// +/// A builder for the *get* method supported by a *userProfile* resource. +/// It is not used directly, but through a `UserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.user_profiles().get("profileId") +/// .doit(); +/// # } +/// ``` +pub struct UserProfileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserProfileGetCall<'a, C, A> {} + +impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userProfiles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The user profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserProfileGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserProfileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserProfileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserProfileGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing ad. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Ad; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Ad::default(); +/// +/// // 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 ! +/// let result = hub.ads().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Ad, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdPatchCall<'a, C, A> {} + +impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/ads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Ad) -> AdPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Ad ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new ad. +/// +/// A builder for the *insert* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Ad; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Ad::default(); +/// +/// // 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 ! +/// let result = hub.ads().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Ad, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdInsertCall<'a, C, A> {} + +impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/ads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Ad) -> AdInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of ads, possibly filtered. +/// +/// A builder for the *list* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.ads().list("profileId") +/// .add_type("Stet") +/// .ssl_required(true) +/// .ssl_compliant(false) +/// .sort_order("sanctus") +/// .sort_field("dolore") +/// .add_size_ids("Lorem") +/// .search_string("consetetur") +/// .add_remarketing_list_ids("consetetur") +/// .add_placement_ids("eirmod") +/// .page_token("labore") +/// .overridden_event_tag_id("gubergren") +/// .max_results(-73) +/// .add_landing_page_ids("sadipscing") +/// .add_ids("accusam") +/// .dynamic_click_tracker(true) +/// .creative_type("Lorem") +/// .add_creative_optimization_configuration_ids("rebum.") +/// .add_creative_ids("et") +/// .compatibility("clita") +/// .add_campaign_ids("eos") +/// .add_audience_segment_ids("dolores") +/// .archived(true) +/// .advertiser_id("consetetur") +/// .active(true) +/// .doit(); +/// # } +/// ``` +pub struct AdListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _type_: Vec, + _ssl_required: Option, + _ssl_compliant: Option, + _sort_order: Option, + _sort_field: Option, + _size_ids: Vec, + _search_string: Option, + _remarketing_list_ids: Vec, + _placement_ids: Vec, + _page_token: Option, + _overridden_event_tag_id: Option, + _max_results: Option, + _landing_page_ids: Vec, + _ids: Vec, + _dynamic_click_tracker: Option, + _creative_type: Option, + _creative_optimization_configuration_ids: Vec, + _creative_ids: Vec, + _compatibility: Option, + _campaign_ids: Vec, + _audience_segment_ids: Vec, + _archived: Option, + _advertiser_id: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdListCall<'a, C, A> {} + +impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((27 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._type_.len() > 0 { + let mut s = String::new(); + for f in self._type_.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("type", s)); + } + if let Some(value) = self._ssl_required { + params.push(("sslRequired", value.to_string())); + } + if let Some(value) = self._ssl_compliant { + params.push(("sslCompliant", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._size_ids.len() > 0 { + let mut s = String::new(); + for f in self._size_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("sizeIds", s)); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._remarketing_list_ids.len() > 0 { + let mut s = String::new(); + for f in self._remarketing_list_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("remarketingListIds", s)); + } + if self._placement_ids.len() > 0 { + let mut s = String::new(); + for f in self._placement_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("placementIds", s)); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._overridden_event_tag_id { + params.push(("overriddenEventTagId", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._landing_page_ids.len() > 0 { + let mut s = String::new(); + for f in self._landing_page_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("landingPageIds", s)); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._dynamic_click_tracker { + params.push(("dynamicClickTracker", value.to_string())); + } + if let Some(value) = self._creative_type { + params.push(("creativeType", value.to_string())); + } + if self._creative_optimization_configuration_ids.len() > 0 { + let mut s = String::new(); + for f in self._creative_optimization_configuration_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("creativeOptimizationConfigurationIds", s)); + } + if self._creative_ids.len() > 0 { + let mut s = String::new(); + for f in self._creative_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("creativeIds", s)); + } + if let Some(value) = self._compatibility { + params.push(("compatibility", value.to_string())); + } + if self._campaign_ids.len() > 0 { + let mut s = String::new(); + for f in self._campaign_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("campaignIds", s)); + } + if self._audience_segment_ids.len() > 0 { + let mut s = String::new(); + for f in self._audience_segment_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("audienceSegmentIds", s)); + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "type", "sslRequired", "sslCompliant", "sortOrder", "sortField", "sizeIds", "searchString", "remarketingListIds", "placementIds", "pageToken", "overriddenEventTagId", "maxResults", "landingPageIds", "ids", "dynamicClickTracker", "creativeType", "creativeOptimizationConfigurationIds", "creativeIds", "compatibility", "campaignIds", "audienceSegmentIds", "archived", "advertiserId", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/ads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only ads with these types. + /// + /// Append the given value to the *type* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_type(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._type_.push(new_value.to_string()); + self + } + /// Select only ads that require SSL. + /// + /// Sets the *ssl required* query property to the given value. + pub fn ssl_required(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._ssl_required = Some(new_value); + self + } + /// Select only ads that are SSL-compliant. + /// + /// Sets the *ssl compliant* query property to the given value. + pub fn ssl_compliant(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._ssl_compliant = Some(new_value); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only ads with these size IDs. + /// + /// Append the given value to the *size ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_size_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._size_ids.push(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "ad*2015" will return objects with names like "ad June 2015", "ad April 2015", or simply "ad 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "ad" will match objects with name "my ad", "ad 2015", or simply "ad". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only ads whose list targeting expression use these remarketing list IDs. + /// + /// Append the given value to the *remarketing list ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_remarketing_list_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._remarketing_list_ids.push(new_value.to_string()); + self + } + /// Select only ads with these placement IDs assigned. + /// + /// Append the given value to the *placement ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._placement_ids.push(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only ads with this event tag override ID. + /// + /// Sets the *overridden event tag id* query property to the given value. + pub fn overridden_event_tag_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._overridden_event_tag_id = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AdListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only ads with these landing page IDs. + /// + /// Append the given value to the *landing page ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_landing_page_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._landing_page_ids.push(new_value.to_string()); + self + } + /// Select only ads with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only dynamic click trackers. Applicable when type is AD_SERVING_CLICK_TRACKER. If true, select dynamic click trackers. If false, select static click trackers. Leave unset to select both. + /// + /// Sets the *dynamic click tracker* query property to the given value. + pub fn dynamic_click_tracker(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._dynamic_click_tracker = Some(new_value); + self + } + /// Select only ads with the specified creativeType. + /// + /// Sets the *creative type* query property to the given value. + pub fn creative_type(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._creative_type = Some(new_value.to_string()); + self + } + /// Select only ads with these creative optimization configuration IDs. + /// + /// Append the given value to the *creative optimization configuration ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_creative_optimization_configuration_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._creative_optimization_configuration_ids.push(new_value.to_string()); + self + } + /// Select only ads with these creative IDs assigned. + /// + /// Append the given value to the *creative ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_creative_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._creative_ids.push(new_value.to_string()); + self + } + /// Select default ads with the specified compatibility. Applicable when type is AD_SERVING_DEFAULT_AD. WEB and WEB_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering an in-stream video ads developed with the VAST standard. + /// + /// Sets the *compatibility* query property to the given value. + pub fn compatibility(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._compatibility = Some(new_value.to_string()); + self + } + /// Select only ads with these campaign IDs. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only ads with these audience segment IDs. + /// + /// Append the given value to the *audience segment ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_audience_segment_ids(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._audience_segment_ids.push(new_value.to_string()); + self + } + /// Select only archived ads. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only ads with this advertiser ID. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> AdListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// Select only active ads. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> AdListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one ad by ID. +/// +/// A builder for the *get* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.ads().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdGetCall<'a, C, A> {} + +impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/ads/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Ad ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing ad. +/// +/// A builder for the *update* method supported by a *ad* resource. +/// It is not used directly, but through a `AdMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Ad; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Ad::default(); +/// +/// // 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 ! +/// let result = hub.ads().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Ad, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdUpdateCall<'a, C, A> {} + +impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Ad)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.ads.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/ads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Ad) -> AdUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one account permission by ID. +/// +/// A builder for the *get* method supported by a *accountPermission* resource. +/// It is not used directly, but through a `AccountPermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.account_permissions().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionGetCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermission)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accountPermissions/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account permission ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountPermissionGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountPermissionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountPermissionGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the list of account permissions. +/// +/// A builder for the *list* method supported by a *accountPermission* resource. +/// It is not used directly, but through a `AccountPermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.account_permissions().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionListCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermissionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accountPermissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountPermissionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountPermissionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of connection types. +/// +/// A builder for the *list* method supported by a *connectionType* resource. +/// It is not used directly, but through a `ConnectionTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.connection_types().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct ConnectionTypeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ConnectionTypeListCall<'a, C, A> {} + +impl<'a, C, A> ConnectionTypeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ConnectionTypesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/connectionTypes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ConnectionTypeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ConnectionTypeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ConnectionTypeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ConnectionTypeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one connection type by ID. +/// +/// A builder for the *get* method supported by a *connectionType* resource. +/// It is not used directly, but through a `ConnectionTypeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.connection_types().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ConnectionTypeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ConnectionTypeGetCall<'a, C, A> {} + +impl<'a, C, A> ConnectionTypeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ConnectionType)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.connectionTypes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/connectionTypes/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ConnectionTypeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Connection type ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ConnectionTypeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ConnectionTypeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ConnectionTypeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ConnectionTypeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one advertiser group by ID. +/// +/// A builder for the *get* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.advertiser_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupGetCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertiserGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of advertiser groups, possibly filtered. +/// +/// A builder for the *list* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.advertiser_groups().list("profileId") +/// .sort_order("invidunt") +/// .sort_field("accusam") +/// .search_string("labore") +/// .page_token("diam") +/// .max_results(-41) +/// .add_ids("sed") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupListCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertiserGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "advertiser*2015" will return objects with names like "advertiser group June 2015", "advertiser group April 2015", or simply "advertiser group 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "advertisergroup" will match objects with name "my advertisergroup", "advertisergroup 2015", or simply "advertisergroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AdvertiserGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only advertiser groups with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new advertiser group. +/// +/// A builder for the *insert* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::AdvertiserGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = AdvertiserGroup::default(); +/// +/// // 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 ! +/// let result = hub.advertiser_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AdvertiserGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertiserGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: AdvertiserGroup) -> AdvertiserGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserGroupInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing advertiser group. +/// +/// A builder for the *update* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::AdvertiserGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = AdvertiserGroup::default(); +/// +/// // 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 ! +/// let result = hub.advertiser_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AdvertiserGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertiserGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: AdvertiserGroup) -> AdvertiserGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserGroupUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing advertiser group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::AdvertiserGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = AdvertiserGroup::default(); +/// +/// // 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 ! +/// let result = hub.advertiser_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AdvertiserGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AdvertiserGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertiserGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: AdvertiserGroup) -> AdvertiserGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserGroupPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing advertiser group. +/// +/// A builder for the *delete* method supported by a *advertiserGroup* resource. +/// It is not used directly, but through a `AdvertiserGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.advertiser_groups().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AdvertiserGroupDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AdvertiserGroupDeleteCall<'a, C, A> {} + +impl<'a, C, A> AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.advertiserGroups.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/advertiserGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AdvertiserGroupDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Advertiser group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AdvertiserGroupDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AdvertiserGroupDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AdvertiserGroupDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AdvertiserGroupDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new site. +/// +/// A builder for the *insert* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Site; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Site::default(); +/// +/// // 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 ! +/// let result = hub.sites().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SiteInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Site, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteInsertCall<'a, C, A> {} + +impl<'a, C, A> SiteInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/sites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Site) -> SiteInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SiteInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SiteInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one site by ID. +/// +/// A builder for the *get* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.sites().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SiteGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteGetCall<'a, C, A> {} + +impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/sites/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Site ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SiteGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SiteGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of sites, possibly filtered. +/// +/// A builder for the *list* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.sites().list("profileId") +/// .unmapped_site(true) +/// .subaccount_id("amet.") +/// .sort_order("dolores") +/// .sort_field("dolores") +/// .search_string("et") +/// .page_token("sed") +/// .max_results(-68) +/// .add_ids("aliquyam") +/// .add_directory_site_ids("nonumy") +/// .add_campaign_ids("sit") +/// .approved(true) +/// .ad_words_site(false) +/// .accepts_publisher_paid_placements(true) +/// .accepts_interstitial_placements(false) +/// .accepts_in_stream_video_placements(false) +/// .doit(); +/// # } +/// ``` +pub struct SiteListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _unmapped_site: Option, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _directory_site_ids: Vec, + _campaign_ids: Vec, + _approved: Option, + _ad_words_site: Option, + _accepts_publisher_paid_placements: Option, + _accepts_interstitial_placements: Option, + _accepts_in_stream_video_placements: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteListCall<'a, C, A> {} + +impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SitesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((18 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._unmapped_site { + params.push(("unmappedSite", value.to_string())); + } + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if self._directory_site_ids.len() > 0 { + let mut s = String::new(); + for f in self._directory_site_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("directorySiteIds", s)); + } + if self._campaign_ids.len() > 0 { + let mut s = String::new(); + for f in self._campaign_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("campaignIds", s)); + } + if let Some(value) = self._approved { + params.push(("approved", value.to_string())); + } + if let Some(value) = self._ad_words_site { + params.push(("adWordsSite", value.to_string())); + } + if let Some(value) = self._accepts_publisher_paid_placements { + params.push(("acceptsPublisherPaidPlacements", value.to_string())); + } + if let Some(value) = self._accepts_interstitial_placements { + params.push(("acceptsInterstitialPlacements", value.to_string())); + } + if let Some(value) = self._accepts_in_stream_video_placements { + params.push(("acceptsInStreamVideoPlacements", value.to_string())); + } + for &field in ["alt", "profileId", "unmappedSite", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "directorySiteIds", "campaignIds", "approved", "adWordsSite", "acceptsPublisherPaidPlacements", "acceptsInterstitialPlacements", "acceptsInStreamVideoPlacements"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/sites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only sites that have not been mapped to a directory site. + /// + /// Sets the *unmapped site* query property to the given value. + pub fn unmapped_site(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._unmapped_site = Some(new_value); + self + } + /// Select only sites with this subaccount ID. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or keyName. Wildcards (*) are allowed. For example, "site*2015" will return objects with names like "site June 2015", "site April 2015", or simply "site 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "site" will match objects with name "my site", "site 2015", or simply "site". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> SiteListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only sites with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only sites with these directory site IDs. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// Select only sites with these campaign IDs. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> SiteListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only approved sites. + /// + /// Sets the *approved* query property to the given value. + pub fn approved(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._approved = Some(new_value); + self + } + /// Select only AdWords sites. + /// + /// Sets the *ad words site* query property to the given value. + pub fn ad_words_site(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._ad_words_site = Some(new_value); + self + } + /// Select only sites that accept publisher paid placements. + /// + /// Sets the *accepts publisher paid placements* query property to the given value. + pub fn accepts_publisher_paid_placements(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._accepts_publisher_paid_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts interstitial placements* query property to the given value. + pub fn accepts_interstitial_placements(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._accepts_interstitial_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts in stream video placements* query property to the given value. + pub fn accepts_in_stream_video_placements(mut self, new_value: bool) -> SiteListCall<'a, C, A> { + self._accepts_in_stream_video_placements = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SiteListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SiteListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing site. +/// +/// A builder for the *update* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Site; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Site::default(); +/// +/// // 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 ! +/// let result = hub.sites().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SiteUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Site, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SiteUpdateCall<'a, C, A> {} + +impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/sites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Site) -> SiteUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SiteUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SiteUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SiteUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SiteUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing site. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *site* resource. +/// It is not used directly, but through a `SiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Site; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Site::default(); +/// +/// // 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 ! +/// let result = hub.sites().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SitePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Site, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SitePatchCall<'a, C, A> {} + +impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Site)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sites.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/sites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Site) -> SitePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SitePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Site ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SitePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SitePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SitePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SitePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one floodlight activity by ID. +/// +/// A builder for the *get* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.floodlight_activities().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGetCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivities/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of floodlight activities, possibly filtered. +/// +/// A builder for the *list* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.floodlight_activities().list("profileId") +/// .tag_string("amet.") +/// .sort_order("diam") +/// .sort_field("eirmod") +/// .search_string("sadipscing") +/// .page_token("Lorem") +/// .max_results(-92) +/// .add_ids("sit") +/// .floodlight_configuration_id("dolore") +/// .floodlight_activity_group_type("et") +/// .floodlight_activity_group_tag_string("At") +/// .floodlight_activity_group_name("sit") +/// .add_floodlight_activity_group_ids("ut") +/// .advertiser_id("diam") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _tag_string: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _floodlight_configuration_id: Option, + _floodlight_activity_group_type: Option, + _floodlight_activity_group_tag_string: Option, + _floodlight_activity_group_name: Option, + _floodlight_activity_group_ids: Vec, + _advertiser_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityListCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivitiesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._tag_string { + params.push(("tagString", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._floodlight_configuration_id { + params.push(("floodlightConfigurationId", value.to_string())); + } + if let Some(value) = self._floodlight_activity_group_type { + params.push(("floodlightActivityGroupType", value.to_string())); + } + if let Some(value) = self._floodlight_activity_group_tag_string { + params.push(("floodlightActivityGroupTagString", value.to_string())); + } + if let Some(value) = self._floodlight_activity_group_name { + params.push(("floodlightActivityGroupName", value.to_string())); + } + if self._floodlight_activity_group_ids.len() > 0 { + let mut s = String::new(); + for f in self._floodlight_activity_group_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("floodlightActivityGroupIds", s)); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + for &field in ["alt", "profileId", "tagString", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "floodlightConfigurationId", "floodlightActivityGroupType", "floodlightActivityGroupTagString", "floodlightActivityGroupName", "floodlightActivityGroupIds", "advertiserId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only floodlight activities with the specified tag string. + /// + /// Sets the *tag string* query property to the given value. + pub fn tag_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._tag_string = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "floodlightactivity*2015" will return objects with names like "floodlightactivity June 2015", "floodlightactivity April 2015", or simply "floodlightactivity 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "floodlightactivity" will match objects with name "my floodlightactivity activity", "floodlightactivity 2015", or simply "floodlightactivity". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> FloodlightActivityListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only floodlight activities with the specified IDs. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only floodlight activities for the specified floodlight configuration ID. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *floodlight configuration id* query property to the given value. + pub fn floodlight_configuration_id(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_configuration_id = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group type. + /// + /// Sets the *floodlight activity group type* query property to the given value. + pub fn floodlight_activity_group_type(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_type = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group tag string. + /// + /// Sets the *floodlight activity group tag string* query property to the given value. + pub fn floodlight_activity_group_tag_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_tag_string = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group name. + /// + /// Sets the *floodlight activity group name* query property to the given value. + pub fn floodlight_activity_group_name(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_name = Some(new_value.to_string()); + self + } + /// Select only floodlight activities with the specified floodlight activity group IDs. + /// + /// Append the given value to the *floodlight activity group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_floodlight_activity_group_ids(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._floodlight_activity_group_ids.push(new_value.to_string()); + self + } + /// Select only floodlight activities for the specified advertiser ID. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new floodlight activity. +/// +/// A builder for the *insert* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::FloodlightActivity; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = FloodlightActivity::default(); +/// +/// // 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 ! +/// let result = hub.floodlight_activities().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivity, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityInsertCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: FloodlightActivity) -> FloodlightActivityInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing floodlight activity. +/// +/// A builder for the *delete* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.floodlight_activities().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityDeleteCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivities/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight activity. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::FloodlightActivity; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = FloodlightActivity::default(); +/// +/// // 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 ! +/// let result = hub.floodlight_activities().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivity, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityPatchCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: FloodlightActivity) -> FloodlightActivityPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightActivityPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Generates a tag for a floodlight activity. +/// +/// A builder for the *generatetag* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.floodlight_activities().generatetag("profileId") +/// .floodlight_activity_id("clita") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityGeneratetagCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _floodlight_activity_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityGeneratetagCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivitiesGenerateTagResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.generatetag", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._floodlight_activity_id { + params.push(("floodlightActivityId", value.to_string())); + } + for &field in ["alt", "profileId", "floodlightActivityId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivities/generatetag".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityGeneratetagCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight activity ID for which we want to generate a tag. + /// + /// Sets the *floodlight activity id* query property to the given value. + pub fn floodlight_activity_id(mut self, new_value: &str) -> FloodlightActivityGeneratetagCall<'a, C, A> { + self._floodlight_activity_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityGeneratetagCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityGeneratetagCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityGeneratetagCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight activity. +/// +/// A builder for the *update* method supported by a *floodlightActivity* resource. +/// It is not used directly, but through a `FloodlightActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::FloodlightActivity; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = FloodlightActivity::default(); +/// +/// // 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 ! +/// let result = hub.floodlight_activities().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightActivityUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightActivity, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightActivityUpdateCall<'a, C, A> {} + +impl<'a, C, A> FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightActivity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightActivities.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightActivities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: FloodlightActivity) -> FloodlightActivityUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightActivityUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightActivityUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightActivityUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightActivityUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of regions. +/// +/// A builder for the *list* method supported by a *region* resource. +/// It is not used directly, but through a `RegionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.regions().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct RegionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RegionListCall<'a, C, A> {} + +impl<'a, C, A> RegionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RegionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.regions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/regions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RegionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RegionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RegionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RegionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new creative group. +/// +/// A builder for the *insert* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CreativeGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CreativeGroup::default(); +/// +/// // 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 ! +/// let result = hub.creative_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreativeGroup) -> CreativeGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeGroupInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one creative group by ID. +/// +/// A builder for the *get* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.creative_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative group. +/// +/// A builder for the *update* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CreativeGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CreativeGroup::default(); +/// +/// // 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 ! +/// let result = hub.creative_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreativeGroup) -> CreativeGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeGroupUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of creative groups, possibly filtered. +/// +/// A builder for the *list* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.creative_groups().list("profileId") +/// .sort_order("sit") +/// .sort_field("labore") +/// .search_string("nonumy") +/// .page_token("erat") +/// .max_results(-11) +/// .add_ids("erat") +/// .group_number(-85) +/// .add_advertiser_ids("amet") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _group_number: Option, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupListCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._group_number { + params.push(("groupNumber", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + let mut s = String::new(); + for f in self._advertiser_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("advertiserIds", s)); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "groupNumber", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for creative groups by name or ID. Wildcards (*) are allowed. For example, "creativegroup*2015" will return creative groups with names like "creativegroup June 2015", "creativegroup April 2015", or simply "creativegroup 2015". Most of the searches also add wild-cards implicitly at the start and the end of the search string. For example, a search string of "creativegroup" will match creative groups with the name "my creativegroup", "creativegroup 2015", or simply "creativegroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creative groups with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only creative groups that belong to this subgroup. + /// + /// Sets the *group number* query property to the given value. + pub fn group_number(mut self, new_value: i32) -> CreativeGroupListCall<'a, C, A> { + self._group_number = Some(new_value); + self + } + /// Select only creative groups that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> CreativeGroupListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creativeGroup* resource. +/// It is not used directly, but through a `CreativeGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::CreativeGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = CreativeGroup::default(); +/// +/// // 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 ! +/// let result = hub.creative_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: CreativeGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativeGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creativeGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creativeGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreativeGroup) -> CreativeGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeGroupPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of targetable remarketing lists, possibly filtered. +/// +/// A builder for the *list* method supported by a *targetableRemarketingList* resource. +/// It is not used directly, but through a `TargetableRemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.targetable_remarketing_lists().list("profileId", "advertiserId") +/// .sort_order("labore") +/// .sort_field("voluptua.") +/// .page_token("takimata") +/// .name("dolor") +/// .max_results(-8) +/// .active(true) +/// .doit(); +/// # } +/// ``` +pub struct TargetableRemarketingListListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _advertiser_id: String, + _sort_order: Option, + _sort_field: Option, + _page_token: Option, + _name: Option, + _max_results: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetableRemarketingListListCall<'a, C, A> {} + +impl<'a, C, A> TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetableRemarketingListsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("advertiserId", self._advertiser_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._name { + params.push(("name", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "advertiserId", "sortOrder", "sortField", "pageToken", "name", "maxResults", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/targetableRemarketingLists".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only targetable remarketing lists targetable by these advertisers. + /// + /// Sets the *advertiser id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn advertiser_id(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._advertiser_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "remarketing list*2015" will return objects with names like "remarketing list June 2015", "remarketing list April 2015", or simply "remarketing list 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "remarketing list" will match objects with name "my remarketing list", "remarketing list 2015", or simply "remarketing list". + /// + /// Sets the *name* query property to the given value. + pub fn name(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C, A> { + self._name = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> TargetableRemarketingListListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only active or only inactive targetable remarketing lists. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> TargetableRemarketingListListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> TargetableRemarketingListListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetableRemarketingListListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> TargetableRemarketingListListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one remarketing list by ID. +/// +/// A builder for the *get* method supported by a *targetableRemarketingList* resource. +/// It is not used directly, but through a `TargetableRemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.targetable_remarketing_lists().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct TargetableRemarketingListGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for TargetableRemarketingListGetCall<'a, C, A> {} + +impl<'a, C, A> TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TargetableRemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.targetableRemarketingLists.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/targetableRemarketingLists/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> TargetableRemarketingListGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> TargetableRemarketingListGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> TargetableRemarketingListGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> TargetableRemarketingListGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> TargetableRemarketingListGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing subaccount. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Subaccount; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Subaccount::default(); +/// +/// // 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 ! +/// let result = hub.subaccounts().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Subaccount, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountPatchCall<'a, C, A> {} + +impl<'a, C, A> SubaccountPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/subaccounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Subaccount) -> SubaccountPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Subaccount ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SubaccountPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubaccountPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubaccountPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new subaccount. +/// +/// A builder for the *insert* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Subaccount; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Subaccount::default(); +/// +/// // 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 ! +/// let result = hub.subaccounts().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Subaccount, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountInsertCall<'a, C, A> {} + +impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/subaccounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Subaccount) -> SubaccountInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubaccountInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubaccountInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a list of subaccounts, possibly filtered. +/// +/// A builder for the *list* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.subaccounts().list("profileId") +/// .sort_order("sit") +/// .sort_field("et") +/// .search_string("consetetur") +/// .page_token("sea") +/// .max_results(-91) +/// .add_ids("consetetur") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountListCall<'a, C, A> {} + +impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SubaccountsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/subaccounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "subaccount*2015" will return objects with names like "subaccount June 2015", "subaccount April 2015", or simply "subaccount 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "subaccount" will match objects with name "my subaccount", "subaccount 2015", or simply "subaccount". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> SubaccountListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only subaccounts with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> SubaccountListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubaccountListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubaccountListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing subaccount. +/// +/// A builder for the *update* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Subaccount; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Subaccount::default(); +/// +/// // 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 ! +/// let result = hub.subaccounts().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Subaccount, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountUpdateCall<'a, C, A> {} + +impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/subaccounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Subaccount) -> SubaccountUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubaccountUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubaccountUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one subaccount by ID. +/// +/// A builder for the *get* method supported by a *subaccount* resource. +/// It is not used directly, but through a `SubaccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.subaccounts().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SubaccountGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubaccountGetCall<'a, C, A> {} + +impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Subaccount)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.subaccounts.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/subaccounts/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SubaccountGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Subaccount ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SubaccountGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubaccountGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubaccountGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubaccountGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one mobile carrier by ID. +/// +/// A builder for the *get* method supported by a *mobileCarrier* resource. +/// It is not used directly, but through a `MobileCarrierMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.mobile_carriers().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct MobileCarrierGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobileCarrierGetCall<'a, C, A> {} + +impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MobileCarrier)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/mobileCarriers/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MobileCarrierGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Mobile carrier ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> MobileCarrierGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MobileCarrierGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobileCarrierGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MobileCarrierGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of mobile carriers. +/// +/// A builder for the *list* method supported by a *mobileCarrier* resource. +/// It is not used directly, but through a `MobileCarrierMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.mobile_carriers().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct MobileCarrierListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MobileCarrierListCall<'a, C, A> {} + +impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, MobileCarriersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.mobileCarriers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/mobileCarriers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> MobileCarrierListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MobileCarrierListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> MobileCarrierListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MobileCarrierListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one floodlight configuration by ID. +/// +/// A builder for the *get* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.floodlight_configurations().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationGetCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfiguration)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightConfigurations/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight configuration ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightConfigurationGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightConfigurationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightConfigurationGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight configuration. +/// +/// A builder for the *update* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::FloodlightConfiguration; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = FloodlightConfiguration::default(); +/// +/// // 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 ! +/// let result = hub.floodlight_configurations().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightConfiguration, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationUpdateCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfiguration)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightConfigurations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: FloodlightConfiguration) -> FloodlightConfigurationUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightConfigurationUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightConfigurationUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing floodlight configuration. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::FloodlightConfiguration; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = FloodlightConfiguration::default(); +/// +/// // 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 ! +/// let result = hub.floodlight_configurations().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: FloodlightConfiguration, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationPatchCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfiguration)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightConfigurations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: FloodlightConfiguration) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Floodlight configuration ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightConfigurationPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightConfigurationPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of floodlight configurations, possibly filtered. +/// +/// A builder for the *list* method supported by a *floodlightConfiguration* resource. +/// It is not used directly, but through a `FloodlightConfigurationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.floodlight_configurations().list("profileId") +/// .add_ids("et") +/// .doit(); +/// # } +/// ``` +pub struct FloodlightConfigurationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FloodlightConfigurationListCall<'a, C, A> {} + +impl<'a, C, A> FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FloodlightConfigurationsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.floodlightConfigurations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + for &field in ["alt", "profileId", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/floodlightConfigurations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FloodlightConfigurationListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Set of IDs of floodlight configurations to retrieve. Required field; otherwise an empty list will be returned. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> FloodlightConfigurationListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FloodlightConfigurationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FloodlightConfigurationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FloodlightConfigurationListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of operating systems. +/// +/// A builder for the *list* method supported by a *operatingSystem* resource. +/// It is not used directly, but through a `OperatingSystemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.operating_systems().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemListCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystemsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/operatingSystems".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OperatingSystemListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OperatingSystemListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one operating system by DART ID. +/// +/// A builder for the *get* method supported by a *operatingSystem* resource. +/// It is not used directly, but through a `OperatingSystemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.operating_systems().get("profileId", "dartId") +/// .doit(); +/// # } +/// ``` +pub struct OperatingSystemGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _dart_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperatingSystemGetCall<'a, C, A> {} + +impl<'a, C, A> OperatingSystemGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperatingSystem)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.operatingSystems.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("dartId", self._dart_id.to_string())); + for &field in ["alt", "profileId", "dartId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/operatingSystems/{dartId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{dartId}", "dartId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dartId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OperatingSystemGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Operating system DART ID. + /// + /// Sets the *dart id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dart_id(mut self, new_value: &str) -> OperatingSystemGetCall<'a, C, A> { + self._dart_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OperatingSystemGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperatingSystemGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OperatingSystemGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists files for a user profile. +/// +/// A builder for the *list* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.files().list("profileId") +/// .sort_order("sadipscing") +/// .sort_field("et") +/// .scope("clita") +/// .page_token("ipsum") +/// .max_results(-99) +/// .doit(); +/// # } +/// ``` +pub struct FileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _scope: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileListCall<'a, C, A> {} + +impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FileList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.files.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._scope { + params.push(("scope", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "scope", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/files".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The DFA profile ID. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is 'DESCENDING'. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// The field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// The scope that defines which results are returned, default is 'MINE'. + /// + /// Sets the *scope* query property to the given value. + pub fn scope(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._scope = Some(new_value.to_string()); + self + } + /// The value of the nextToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> FileListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a report file by its report ID and file ID. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `File` structure that you would usually get. The latter will be a default value. +/// +/// A builder for the *get* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.files().get("reportId", "fileId") +/// .doit(); +/// # } +/// ``` +pub struct FileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _report_id: String, + _file_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileGetCall<'a, C, A> {} + +impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.files.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("reportId", self._report_id.to_string())); + params.push(("fileId", self._file_id.to_string())); + for &field in ["reportId", "fileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if >::as_ref(&value) != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/reports/{reportId}/files/{fileId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{reportId}", "reportId"), ("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["fileId", "reportId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = if enable_resource_parsing { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + } else { (res, Default::default()) }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the report. + /// + /// Sets the *report id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn report_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { + self._report_id = new_value.to_string(); + self + } + /// The ID of the report file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of placement groups, possibly filtered. +/// +/// A builder for the *list* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.placement_groups().list("profileId") +/// .sort_order("kasd") +/// .sort_field("duo") +/// .add_site_ids("et") +/// .search_string("sit") +/// .add_pricing_types("eirmod") +/// .add_placement_strategy_ids("no") +/// .placement_group_type("Lorem") +/// .page_token("sed") +/// .min_start_date("tempor") +/// .min_end_date("clita") +/// .max_start_date("kasd") +/// .max_results(-94) +/// .max_end_date("et") +/// .add_ids("vero") +/// .add_directory_site_ids("sadipscing") +/// .add_content_category_ids("sed") +/// .add_campaign_ids("vero") +/// .archived(false) +/// .add_advertiser_ids("magna") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _site_ids: Vec, + _search_string: Option, + _pricing_types: Vec, + _placement_strategy_ids: Vec, + _placement_group_type: Option, + _page_token: Option, + _min_start_date: Option, + _min_end_date: Option, + _max_start_date: Option, + _max_results: Option, + _max_end_date: Option, + _ids: Vec, + _directory_site_ids: Vec, + _content_category_ids: Vec, + _campaign_ids: Vec, + _archived: Option, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupListCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((22 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_ids.len() > 0 { + let mut s = String::new(); + for f in self._site_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("siteIds", s)); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._pricing_types.len() > 0 { + let mut s = String::new(); + for f in self._pricing_types.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("pricingTypes", s)); + } + if self._placement_strategy_ids.len() > 0 { + let mut s = String::new(); + for f in self._placement_strategy_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("placementStrategyIds", s)); + } + if let Some(value) = self._placement_group_type { + params.push(("placementGroupType", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._min_start_date { + params.push(("minStartDate", value.to_string())); + } + if let Some(value) = self._min_end_date { + params.push(("minEndDate", value.to_string())); + } + if let Some(value) = self._max_start_date { + params.push(("maxStartDate", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._max_end_date { + params.push(("maxEndDate", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if self._directory_site_ids.len() > 0 { + let mut s = String::new(); + for f in self._directory_site_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("directorySiteIds", s)); + } + if self._content_category_ids.len() > 0 { + let mut s = String::new(); + for f in self._content_category_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("contentCategoryIds", s)); + } + if self._campaign_ids.len() > 0 { + let mut s = String::new(); + for f in self._campaign_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("campaignIds", s)); + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + let mut s = String::new(); + for f in self._advertiser_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("advertiserIds", s)); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "siteIds", "searchString", "pricingTypes", "placementStrategyIds", "placementGroupType", "pageToken", "minStartDate", "minEndDate", "maxStartDate", "maxResults", "maxEndDate", "ids", "directorySiteIds", "contentCategoryIds", "campaignIds", "archived", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these sites. + /// + /// Append the given value to the *site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._site_ids.push(new_value.to_string()); + self + } + /// Allows searching for placement groups by name or ID. Wildcards (*) are allowed. For example, "placement*2015" will return placement groups with names like "placement group June 2015", "placement group May 2015", or simply "placements 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placementgroup" will match placement groups with name "my placementgroup", "placementgroup 2015", or simply "placementgroup". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only placement groups with these pricing types. + /// + /// Append the given value to the *pricing types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_pricing_types(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._pricing_types.push(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these placement strategies. + /// + /// Append the given value to the *placement strategy ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_strategy_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._placement_strategy_ids.push(new_value.to_string()); + self + } + /// Select only placement groups belonging with this group type. A package is a simple group of placements that acts as a single pricing point for a group of tags. A roadblock is a group of placements that not only acts as a single pricing point but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned placements to be marked as primary for reporting. + /// + /// Sets the *placement group type* query property to the given value. + pub fn placement_group_type(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._placement_group_type = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or after the specified minStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min start date* query property to the given value. + pub fn min_start_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._min_start_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose end date is on or after the specified minEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min end date* query property to the given value. + pub fn min_end_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._min_end_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or before the specified maxStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max start date* query property to the given value. + pub fn max_start_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._max_start_date = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> PlacementGroupListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only placements or placement groups whose end date is on or before the specified maxEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max end date* query property to the given value. + pub fn max_end_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._max_end_date = Some(new_value.to_string()); + self + } + /// Select only placement groups with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these directory sites. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// Select only placement groups that are associated with these content categories. + /// + /// Append the given value to the *content category ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_content_category_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._content_category_ids.push(new_value.to_string()); + self + } + /// Select only placement groups that belong to these campaigns. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only archived placements. Don't set this field to select both archived and non-archived placements. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> PlacementGroupListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only placement groups that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> PlacementGroupListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement group. +/// +/// A builder for the *update* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::PlacementGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = PlacementGroup::default(); +/// +/// // 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 ! +/// let result = hub.placement_groups().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupUpdateCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: PlacementGroup) -> PlacementGroupUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementGroupUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementGroupUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new placement group. +/// +/// A builder for the *insert* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::PlacementGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = PlacementGroup::default(); +/// +/// // 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 ! +/// let result = hub.placement_groups().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementGroup, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupInsertCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: PlacementGroup) -> PlacementGroupInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementGroupInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementGroupInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one placement group by ID. +/// +/// A builder for the *get* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.placement_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupGetCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement group. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *placementGroup* resource. +/// It is not used directly, but through a `PlacementGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::PlacementGroup; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = PlacementGroup::default(); +/// +/// // 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 ! +/// let result = hub.placement_groups().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGroupPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementGroup, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGroupPatchCall<'a, C, A> {} + +impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementGroups.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: PlacementGroup) -> PlacementGroupPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGroupPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement group ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementGroupPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementGroupPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGroupPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementGroupPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of inventory items, possibly filtered. +/// +/// A builder for the *list* method supported by a *inventoryItem* resource. +/// It is not used directly, but through a `InventoryItemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.inventory_items().list("profileId", "projectId") +/// .sort_order("consetetur") +/// .sort_field("et") +/// .add_site_id("justo") +/// .page_token("kasd") +/// .add_order_id("kasd") +/// .max_results(-50) +/// .in_plan(true) +/// .add_ids("nonumy") +/// .doit(); +/// # } +/// ``` +pub struct InventoryItemListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _sort_order: Option, + _sort_field: Option, + _site_id: Vec, + _page_token: Option, + _order_id: Vec, + _max_results: Option, + _in_plan: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InventoryItemListCall<'a, C, A> {} + +impl<'a, C, A> InventoryItemListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, InventoryItemsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_id.len() > 0 { + let mut s = String::new(); + for f in self._site_id.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("siteId", s)); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if self._order_id.len() > 0 { + let mut s = String::new(); + for f in self._order_id.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("orderId", s)); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._in_plan { + params.push(("inPlan", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + for &field in ["alt", "profileId", "projectId", "sortOrder", "sortField", "siteId", "pageToken", "orderId", "maxResults", "inPlan", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/projects/{projectId}/inventoryItems".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only inventory items that are associated with these sites. + /// + /// Append the given value to the *site id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._site_id.push(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only inventory items that belong to specified orders. + /// + /// Append the given value to the *order id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_order_id(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._order_id.push(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> InventoryItemListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only inventory items that are in plan. + /// + /// Sets the *in plan* query property to the given value. + pub fn in_plan(mut self, new_value: bool) -> InventoryItemListCall<'a, C, A> { + self._in_plan = Some(new_value); + self + } + /// Select only inventory items with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> InventoryItemListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> InventoryItemListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InventoryItemListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> InventoryItemListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one inventory item by ID. +/// +/// A builder for the *get* method supported by a *inventoryItem* resource. +/// It is not used directly, but through a `InventoryItemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.inventory_items().get("profileId", "projectId", "id") +/// .doit(); +/// # } +/// ``` +pub struct InventoryItemGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for InventoryItemGetCall<'a, C, A> {} + +impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, InventoryItem)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.inventoryItems.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "projectId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/projects/{projectId}/inventoryItems/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Inventory item ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> InventoryItemGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> InventoryItemGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> InventoryItemGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> InventoryItemGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one user role permission by ID. +/// +/// A builder for the *get* method supported by a *userRolePermission* resource. +/// It is not used directly, but through a `UserRolePermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.user_role_permissions().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionGetCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermission)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/userRolePermissions/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User role permission ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> UserRolePermissionGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserRolePermissionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserRolePermissionGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a list of user role permissions, possibly filtered. +/// +/// A builder for the *list* method supported by a *userRolePermission* resource. +/// It is not used directly, but through a `UserRolePermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.user_role_permissions().list("profileId") +/// .add_ids("est") +/// .doit(); +/// # } +/// ``` +pub struct UserRolePermissionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for UserRolePermissionListCall<'a, C, A> {} + +impl<'a, C, A> UserRolePermissionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, UserRolePermissionsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.userRolePermissions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + for &field in ["alt", "profileId", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/userRolePermissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> UserRolePermissionListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only user role permissions with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> UserRolePermissionListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> UserRolePermissionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> UserRolePermissionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> UserRolePermissionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the list of account permission groups. +/// +/// A builder for the *list* method supported by a *accountPermissionGroup* resource. +/// It is not used directly, but through a `AccountPermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.account_permission_groups().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionGroupListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionGroupListCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermissionGroupsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accountPermissionGroups".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionGroupListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountPermissionGroupListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionGroupListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountPermissionGroupListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one account permission group by ID. +/// +/// A builder for the *get* method supported by a *accountPermissionGroup* resource. +/// It is not used directly, but through a `AccountPermissionGroupMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.account_permission_groups().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountPermissionGroupGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPermissionGroupGetCall<'a, C, A> {} + +impl<'a, C, A> AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountPermissionGroup)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountPermissionGroups.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accountPermissionGroups/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPermissionGroupGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account permission group ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountPermissionGroupGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountPermissionGroupGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPermissionGroupGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountPermissionGroupGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of content categories, possibly filtered. +/// +/// A builder for the *list* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.content_categories().list("profileId") +/// .sort_order("eirmod") +/// .sort_field("elitr") +/// .search_string("clita") +/// .page_token("et") +/// .max_results(-39) +/// .add_ids("ea") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryListCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategoriesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/contentCategories".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "contentcategory*2015" will return objects with names like "contentcategory June 2015", "contentcategory April 2015", or simply "contentcategory 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "contentcategory" will match objects with name "my contentcategory", "contentcategory 2015", or simply "contentcategory". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ContentCategoryListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only content categories with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> ContentCategoryListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ContentCategoryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ContentCategoryListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing content category. +/// +/// A builder for the *update* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::ContentCategory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = ContentCategory::default(); +/// +/// // 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 ! +/// let result = hub.content_categories().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ContentCategory, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryUpdateCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/contentCategories".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: ContentCategory) -> ContentCategoryUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ContentCategoryUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ContentCategoryUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new content category. +/// +/// A builder for the *insert* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::ContentCategory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = ContentCategory::default(); +/// +/// // 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 ! +/// let result = hub.content_categories().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ContentCategory, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryInsertCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/contentCategories".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: ContentCategory) -> ContentCategoryInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ContentCategoryInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ContentCategoryInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing content category. +/// +/// A builder for the *delete* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.content_categories().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryDeleteCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/contentCategories/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Content category ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ContentCategoryDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ContentCategoryDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ContentCategoryDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one content category by ID. +/// +/// A builder for the *get* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.content_categories().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryGetCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/contentCategories/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Content category ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ContentCategoryGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ContentCategoryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ContentCategoryGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing content category. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *contentCategory* resource. +/// It is not used directly, but through a `ContentCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::ContentCategory; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = ContentCategory::default(); +/// +/// // 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 ! +/// let result = hub.content_categories().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ContentCategoryPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: ContentCategory, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ContentCategoryPatchCall<'a, C, A> {} + +impl<'a, C, A> ContentCategoryPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ContentCategory)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.contentCategories.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/contentCategories".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: ContentCategory) -> ContentCategoryPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ContentCategoryPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Content category ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ContentCategoryPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ContentCategoryPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ContentCategoryPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ContentCategoryPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative. +/// +/// A builder for the *update* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Creative; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Creative::default(); +/// +/// // 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 ! +/// let result = hub.creatives().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Creative, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeUpdateCall<'a, C, A> {} + +impl<'a, C, A> CreativeUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creatives".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Creative) -> CreativeUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new creative. +/// +/// A builder for the *insert* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Creative; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Creative::default(); +/// +/// // 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 ! +/// let result = hub.creatives().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CreativeInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Creative, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeInsertCall<'a, C, A> {} + +impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creatives".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Creative) -> CreativeInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one creative by ID. +/// +/// A builder for the *get* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.creatives().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeGetCall<'a, C, A> {} + +impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creatives/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of creatives, possibly filtered. +/// +/// A builder for the *list* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.creatives().list("profileId") +/// .add_types("gubergren") +/// .studio_creative_id("est") +/// .sort_order("invidunt") +/// .sort_field("voluptua.") +/// .add_size_ids("erat") +/// .search_string("ipsum") +/// .add_rendering_ids("no") +/// .page_token("vero") +/// .max_results(-42) +/// .add_ids("vero") +/// .add_creative_field_ids("dolore") +/// .add_companion_creative_ids("Lorem") +/// .campaign_id("invidunt") +/// .archived(false) +/// .advertiser_id("dolor") +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct CreativeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _types: Vec, + _studio_creative_id: Option, + _sort_order: Option, + _sort_field: Option, + _size_ids: Vec, + _search_string: Option, + _rendering_ids: Vec, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _creative_field_ids: Vec, + _companion_creative_ids: Vec, + _campaign_id: Option, + _archived: Option, + _advertiser_id: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativeListCall<'a, C, A> {} + +impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CreativesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((19 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._types.len() > 0 { + let mut s = String::new(); + for f in self._types.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("types", s)); + } + if let Some(value) = self._studio_creative_id { + params.push(("studioCreativeId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._size_ids.len() > 0 { + let mut s = String::new(); + for f in self._size_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("sizeIds", s)); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._rendering_ids.len() > 0 { + let mut s = String::new(); + for f in self._rendering_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("renderingIds", s)); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if self._creative_field_ids.len() > 0 { + let mut s = String::new(); + for f in self._creative_field_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("creativeFieldIds", s)); + } + if self._companion_creative_ids.len() > 0 { + let mut s = String::new(); + for f in self._companion_creative_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("companionCreativeIds", s)); + } + if let Some(value) = self._campaign_id { + params.push(("campaignId", value.to_string())); + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "types", "studioCreativeId", "sortOrder", "sortField", "sizeIds", "searchString", "renderingIds", "pageToken", "maxResults", "ids", "creativeFieldIds", "companionCreativeIds", "campaignId", "archived", "advertiserId", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creatives".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only creatives with these creative types. + /// + /// Append the given value to the *types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_types(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._types.push(new_value.to_string()); + self + } + /// Select only creatives corresponding to this Studio creative ID. + /// + /// Sets the *studio creative id* query property to the given value. + pub fn studio_creative_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._studio_creative_id = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only creatives with these size IDs. + /// + /// Append the given value to the *size ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_size_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._size_ids.push(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "creative*2015" will return objects with names like "creative June 2015", "creative April 2015", or simply "creative 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "creative" will match objects with name "my creative", "creative 2015", or simply "creative". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only creatives with these rendering IDs. + /// + /// Append the given value to the *rendering ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_rendering_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._rendering_ids.push(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CreativeListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only creatives with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only creatives with these creative field IDs. + /// + /// Append the given value to the *creative field ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_creative_field_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._creative_field_ids.push(new_value.to_string()); + self + } + /// Select only in-stream video creatives with these companion IDs. + /// + /// Append the given value to the *companion creative ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_companion_creative_ids(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._companion_creative_ids.push(new_value.to_string()); + self + } + /// Select only creatives with this campaign ID. + /// + /// Sets the *campaign id* query property to the given value. + pub fn campaign_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._campaign_id = Some(new_value.to_string()); + self + } + /// Select only archived creatives. Leave blank to select archived and unarchived creatives. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> CreativeListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only creatives with this advertiser ID. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> CreativeListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// Select only active creatives. Leave blank to select active and inactive creatives. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> CreativeListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing creative. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *creative* resource. +/// It is not used directly, but through a `CreativeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Creative; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Creative::default(); +/// +/// // 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 ! +/// let result = hub.creatives().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CreativePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Creative, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CreativePatchCall<'a, C, A> {} + +impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Creative)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.creatives.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/creatives".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Creative) -> CreativePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CreativePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Creative ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CreativePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CreativePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CreativePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CreativePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one campaign by ID. +/// +/// A builder for the *get* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.campaigns().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CampaignGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignGetCall<'a, C, A> {} + +impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CampaignGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CampaignGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CampaignGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new campaign. +/// +/// A builder for the *insert* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Campaign; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Campaign::default(); +/// +/// // 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 ! +/// let result = hub.campaigns().insert(req, "profileId", "defaultLandingPageName", "defaultLandingPageUrl") +/// .doit(); +/// # } +/// ``` +pub struct CampaignInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Campaign, + _profile_id: String, + _default_landing_page_name: String, + _default_landing_page_url: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignInsertCall<'a, C, A> {} + +impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("defaultLandingPageName", self._default_landing_page_name.to_string())); + params.push(("defaultLandingPageUrl", self._default_landing_page_url.to_string())); + for &field in ["alt", "profileId", "defaultLandingPageName", "defaultLandingPageUrl"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Campaign) -> CampaignInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Default landing page name for this new campaign. Must be less than 256 characters long. + /// + /// Sets the *default landing page name* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn default_landing_page_name(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { + self._default_landing_page_name = new_value.to_string(); + self + } + /// Default landing page URL for this new campaign. + /// + /// Sets the *default landing page url* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn default_landing_page_url(mut self, new_value: &str) -> CampaignInsertCall<'a, C, A> { + self._default_landing_page_url = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CampaignInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CampaignInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing campaign. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Campaign; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Campaign::default(); +/// +/// // 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 ! +/// let result = hub.campaigns().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct CampaignPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Campaign, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignPatchCall<'a, C, A> {} + +impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Campaign) -> CampaignPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Campaign ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CampaignPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CampaignPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CampaignPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing campaign. +/// +/// A builder for the *update* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Campaign; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Campaign::default(); +/// +/// // 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 ! +/// let result = hub.campaigns().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct CampaignUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Campaign, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignUpdateCall<'a, C, A> {} + +impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Campaign)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Campaign) -> CampaignUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CampaignUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CampaignUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of campaigns, possibly filtered. +/// +/// A builder for the *list* method supported by a *campaign* resource. +/// It is not used directly, but through a `CampaignMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.campaigns().list("profileId") +/// .subaccount_id("dolor") +/// .sort_order("dolore") +/// .sort_field("duo") +/// .search_string("ipsum") +/// .page_token("diam") +/// .overridden_event_tag_id("sed") +/// .max_results(-17) +/// .add_ids("tempor") +/// .add_excluded_ids("justo") +/// .at_least_one_optimization_activity(true) +/// .archived(true) +/// .add_advertiser_ids("amet") +/// .add_advertiser_group_ids("dolor") +/// .doit(); +/// # } +/// ``` +pub struct CampaignListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _overridden_event_tag_id: Option, + _max_results: Option, + _ids: Vec, + _excluded_ids: Vec, + _at_least_one_optimization_activity: Option, + _archived: Option, + _advertiser_ids: Vec, + _advertiser_group_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CampaignListCall<'a, C, A> {} + +impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CampaignsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.campaigns.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._overridden_event_tag_id { + params.push(("overriddenEventTagId", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if self._excluded_ids.len() > 0 { + let mut s = String::new(); + for f in self._excluded_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("excludedIds", s)); + } + if let Some(value) = self._at_least_one_optimization_activity { + params.push(("atLeastOneOptimizationActivity", value.to_string())); + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + let mut s = String::new(); + for f in self._advertiser_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("advertiserIds", s)); + } + if self._advertiser_group_ids.len() > 0 { + let mut s = String::new(); + for f in self._advertiser_group_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("advertiserGroupIds", s)); + } + for &field in ["alt", "profileId", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "overriddenEventTagId", "maxResults", "ids", "excludedIds", "atLeastOneOptimizationActivity", "archived", "advertiserIds", "advertiserGroupIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/campaigns".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only campaigns that belong to this subaccount. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for campaigns by name or ID. Wildcards (*) are allowed. For example, "campaign*2015" will return campaigns with names like "campaign June 2015", "campaign April 2015", or simply "campaign 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "campaign" will match campaigns with name "my campaign", "campaign 2015", or simply "campaign". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only campaigns that have overridden this event tag ID. + /// + /// Sets the *overridden event tag id* query property to the given value. + pub fn overridden_event_tag_id(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._overridden_event_tag_id = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> CampaignListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only campaigns with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Exclude campaigns with these IDs. + /// + /// Append the given value to the *excluded ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_excluded_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._excluded_ids.push(new_value.to_string()); + self + } + /// Select only campaigns that have at least one optimization activity. + /// + /// Sets the *at least one optimization activity* query property to the given value. + pub fn at_least_one_optimization_activity(mut self, new_value: bool) -> CampaignListCall<'a, C, A> { + self._at_least_one_optimization_activity = Some(new_value); + self + } + /// Select only archived campaigns. Don't set this field to select both archived and non-archived campaigns. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> CampaignListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only campaigns that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// Select only campaigns whose advertisers belong to these advertiser groups. + /// + /// Append the given value to the *advertiser group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_group_ids(mut self, new_value: &str) -> CampaignListCall<'a, C, A> { + self._advertiser_group_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CampaignListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CampaignListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CampaignListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing event tag. +/// +/// A builder for the *delete* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.event_tags().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct EventTagDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagDeleteCall<'a, C, A> {} + +impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/eventTags/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Event tag ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> EventTagDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EventTagDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EventTagDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of event tags, possibly filtered. +/// +/// A builder for the *list* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.event_tags().list("profileId") +/// .sort_order("kasd") +/// .sort_field("sit") +/// .search_string("justo") +/// .add_ids("gubergren") +/// .add_event_tag_types("ipsum") +/// .enabled(true) +/// .definitions_only(true) +/// .campaign_id("sanctus") +/// .advertiser_id("ut") +/// .ad_id("magna") +/// .doit(); +/// # } +/// ``` +pub struct EventTagListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _ids: Vec, + _event_tag_types: Vec, + _enabled: Option, + _definitions_only: Option, + _campaign_id: Option, + _advertiser_id: Option, + _ad_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagListCall<'a, C, A> {} + +impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTagsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if self._event_tag_types.len() > 0 { + let mut s = String::new(); + for f in self._event_tag_types.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("eventTagTypes", s)); + } + if let Some(value) = self._enabled { + params.push(("enabled", value.to_string())); + } + if let Some(value) = self._definitions_only { + params.push(("definitionsOnly", value.to_string())); + } + if let Some(value) = self._campaign_id { + params.push(("campaignId", value.to_string())); + } + if let Some(value) = self._advertiser_id { + params.push(("advertiserId", value.to_string())); + } + if let Some(value) = self._ad_id { + params.push(("adId", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "ids", "eventTagTypes", "enabled", "definitionsOnly", "campaignId", "advertiserId", "adId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/eventTags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "eventtag*2015" will return objects with names like "eventtag June 2015", "eventtag April 2015", or simply "eventtag 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "eventtag" will match objects with name "my eventtag", "eventtag 2015", or simply "eventtag". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only event tags with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only event tags with the specified event tag types. Event tag types can be used to specify whether to use a third-party pixel, a third-party JavaScript URL, or a third-party click-through URL for either impression or click tracking. + /// + /// Append the given value to the *event tag types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_event_tag_types(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._event_tag_types.push(new_value.to_string()); + self + } + /// Select only enabled event tags. What is considered enabled or disabled depends on the definitionsOnly parameter. When definitionsOnly is set to true, only the specified advertiser or campaign's event tags' enabledByDefault field is examined. When definitionsOnly is set to false, the specified ad or specified campaign's parent advertiser's or parent campaign's event tags' enabledByDefault and status fields are examined as well. + /// + /// Sets the *enabled* query property to the given value. + pub fn enabled(mut self, new_value: bool) -> EventTagListCall<'a, C, A> { + self._enabled = Some(new_value); + self + } + /// Examine only the specified campaign or advertiser's event tags for matching selector criteria. When set to false, the parent advertiser and parent campaign of the specified ad or campaign is examined as well. In addition, when set to false, the status field is examined as well, along with the enabledByDefault field. This parameter can not be set to true when adId is specified as ads do not define their own even tags. + /// + /// Sets the *definitions only* query property to the given value. + pub fn definitions_only(mut self, new_value: bool) -> EventTagListCall<'a, C, A> { + self._definitions_only = Some(new_value); + self + } + /// Select only event tags that belong to this campaign. + /// + /// Sets the *campaign id* query property to the given value. + pub fn campaign_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._campaign_id = Some(new_value.to_string()); + self + } + /// Select only event tags that belong to this advertiser. + /// + /// Sets the *advertiser id* query property to the given value. + pub fn advertiser_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._advertiser_id = Some(new_value.to_string()); + self + } + /// Select only event tags that belong to this ad. + /// + /// Sets the *ad id* query property to the given value. + pub fn ad_id(mut self, new_value: &str) -> EventTagListCall<'a, C, A> { + self._ad_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EventTagListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EventTagListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new event tag. +/// +/// A builder for the *insert* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::EventTag; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = EventTag::default(); +/// +/// // 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 ! +/// let result = hub.event_tags().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct EventTagInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: EventTag, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagInsertCall<'a, C, A> {} + +impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/eventTags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: EventTag) -> EventTagInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EventTagInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EventTagInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing event tag. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::EventTag; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = EventTag::default(); +/// +/// // 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 ! +/// let result = hub.event_tags().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct EventTagPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: EventTag, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagPatchCall<'a, C, A> {} + +impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/eventTags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: EventTag) -> EventTagPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Event tag ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> EventTagPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EventTagPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EventTagPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing event tag. +/// +/// A builder for the *update* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::EventTag; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = EventTag::default(); +/// +/// // 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 ! +/// let result = hub.event_tags().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct EventTagUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: EventTag, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagUpdateCall<'a, C, A> {} + +impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/eventTags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: EventTag) -> EventTagUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EventTagUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EventTagUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one event tag by ID. +/// +/// A builder for the *get* method supported by a *eventTag* resource. +/// It is not used directly, but through a `EventTagMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.event_tags().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct EventTagGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EventTagGetCall<'a, C, A> {} + +impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EventTag)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.eventTags.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/eventTags/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> EventTagGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Event tag ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> EventTagGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EventTagGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EventTagGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EventTagGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one remarketing list by ID. +/// +/// A builder for the *get* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.remarketing_lists().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListGetCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/remarketingLists/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> RemarketingListGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RemarketingListGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RemarketingListGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing remarketing list. +/// +/// A builder for the *update* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::RemarketingList; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = RemarketingList::default(); +/// +/// // 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 ! +/// let result = hub.remarketing_lists().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingList, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListUpdateCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/remarketingLists".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: RemarketingList) -> RemarketingListUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RemarketingListUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RemarketingListUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of remarketing lists, possibly filtered. +/// +/// A builder for the *list* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.remarketing_lists().list("profileId", "advertiserId") +/// .sort_order("nonumy") +/// .sort_field("duo") +/// .page_token("tempor") +/// .name("consetetur") +/// .max_results(-90) +/// .floodlight_activity_id("aliquyam") +/// .active(true) +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _advertiser_id: String, + _sort_order: Option, + _sort_field: Option, + _page_token: Option, + _name: Option, + _max_results: Option, + _floodlight_activity_id: Option, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListListCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingListsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("advertiserId", self._advertiser_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._name { + params.push(("name", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._floodlight_activity_id { + params.push(("floodlightActivityId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "advertiserId", "sortOrder", "sortField", "pageToken", "name", "maxResults", "floodlightActivityId", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/remarketingLists".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only remarketing lists owned by this advertiser. + /// + /// Sets the *advertiser id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn advertiser_id(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._advertiser_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "remarketing list*2015" will return objects with names like "remarketing list June 2015", "remarketing list April 2015", or simply "remarketing list 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "remarketing list" will match objects with name "my remarketing list", "remarketing list 2015", or simply "remarketing list". + /// + /// Sets the *name* query property to the given value. + pub fn name(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._name = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> RemarketingListListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only remarketing lists that have this floodlight activity ID. + /// + /// Sets the *floodlight activity id* query property to the given value. + pub fn floodlight_activity_id(mut self, new_value: &str) -> RemarketingListListCall<'a, C, A> { + self._floodlight_activity_id = Some(new_value.to_string()); + self + } + /// Select only active or only inactive remarketing lists. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> RemarketingListListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RemarketingListListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RemarketingListListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing remarketing list. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::RemarketingList; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = RemarketingList::default(); +/// +/// // 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 ! +/// let result = hub.remarketing_lists().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingList, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListPatchCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/remarketingLists".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: RemarketingList) -> RemarketingListPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Remarketing list ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> RemarketingListPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RemarketingListPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RemarketingListPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new remarketing list. +/// +/// A builder for the *insert* method supported by a *remarketingList* resource. +/// It is not used directly, but through a `RemarketingListMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::RemarketingList; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = RemarketingList::default(); +/// +/// // 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 ! +/// let result = hub.remarketing_lists().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct RemarketingListInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: RemarketingList, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RemarketingListInsertCall<'a, C, A> {} + +impl<'a, C, A> RemarketingListInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RemarketingList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.remarketingLists.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/remarketingLists".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: RemarketingList) -> RemarketingListInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> RemarketingListInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RemarketingListInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RemarketingListInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RemarketingListInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of cities, possibly filtered. +/// +/// A builder for the *list* method supported by a *city* resource. +/// It is not used directly, but through a `CityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.cities().list("profileId") +/// .add_region_dart_ids("amet.") +/// .name_prefix("clita") +/// .add_dart_ids("clita") +/// .add_country_dart_ids("est") +/// .doit(); +/// # } +/// ``` +pub struct CityListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _region_dart_ids: Vec, + _name_prefix: Option, + _dart_ids: Vec, + _country_dart_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CityListCall<'a, C, A> {} + +impl<'a, C, A> CityListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CitiesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.cities.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._region_dart_ids.len() > 0 { + let mut s = String::new(); + for f in self._region_dart_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("regionDartIds", s)); + } + if let Some(value) = self._name_prefix { + params.push(("namePrefix", value.to_string())); + } + if self._dart_ids.len() > 0 { + let mut s = String::new(); + for f in self._dart_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("dartIds", s)); + } + if self._country_dart_ids.len() > 0 { + let mut s = String::new(); + for f in self._country_dart_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("countryDartIds", s)); + } + for &field in ["alt", "profileId", "regionDartIds", "namePrefix", "dartIds", "countryDartIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/cities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only cities from these regions. + /// + /// Append the given value to the *region dart ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_region_dart_ids(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._region_dart_ids.push(new_value.to_string()); + self + } + /// Select only cities with names starting with this prefix. + /// + /// Sets the *name prefix* query property to the given value. + pub fn name_prefix(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._name_prefix = Some(new_value.to_string()); + self + } + /// Select only cities with these DART IDs. + /// + /// Append the given value to the *dart ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_dart_ids(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._dart_ids.push(new_value.to_string()); + self + } + /// Select only cities from these countries. + /// + /// Append the given value to the *country dart ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_country_dart_ids(mut self, new_value: &str) -> CityListCall<'a, C, A> { + self._country_dart_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CityListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CityListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CityListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement strategy. +/// +/// A builder for the *update* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::PlacementStrategy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = PlacementStrategy::default(); +/// +/// // 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 ! +/// let result = hub.placement_strategies().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementStrategy, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyUpdateCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementStrategies".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: PlacementStrategy) -> PlacementStrategyUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementStrategyUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementStrategyUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one placement strategy by ID. +/// +/// A builder for the *get* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.placement_strategies().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyGetCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementStrategies/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement strategy ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementStrategyGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementStrategyGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementStrategyGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of placement strategies, possibly filtered. +/// +/// A builder for the *list* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.placement_strategies().list("profileId") +/// .sort_order("ipsum") +/// .sort_field("sadipscing") +/// .search_string("ea") +/// .page_token("dolor") +/// .max_results(-96) +/// .add_ids("sadipscing") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyListCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategiesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementStrategies".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "placementstrategy*2015" will return objects with names like "placementstrategy June 2015", "placementstrategy April 2015", or simply "placementstrategy 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placementstrategy" will match objects with name "my placementstrategy", "placementstrategy 2015", or simply "placementstrategy". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> PlacementStrategyListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only placement strategies with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementStrategyListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementStrategyListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an existing placement strategy. +/// +/// A builder for the *delete* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.placement_strategies().delete("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyDeleteCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementStrategies/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyDeleteCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement strategy ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementStrategyDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementStrategyDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementStrategyDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new placement strategy. +/// +/// A builder for the *insert* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::PlacementStrategy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = PlacementStrategy::default(); +/// +/// // 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 ! +/// let result = hub.placement_strategies().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementStrategy, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyInsertCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementStrategies".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: PlacementStrategy) -> PlacementStrategyInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementStrategyInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementStrategyInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement strategy. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *placementStrategy* resource. +/// It is not used directly, but through a `PlacementStrategyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::PlacementStrategy; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = PlacementStrategy::default(); +/// +/// // 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 ! +/// let result = hub.placement_strategies().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementStrategyPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: PlacementStrategy, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementStrategyPatchCall<'a, C, A> {} + +impl<'a, C, A> PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementStrategy)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placementStrategies.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placementStrategies".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: PlacementStrategy) -> PlacementStrategyPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementStrategyPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement strategy ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementStrategyPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementStrategyPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementStrategyPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementStrategyPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of projects, possibly filtered. +/// +/// A builder for the *list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().list("profileId") +/// .sort_order("et") +/// .sort_field("amet") +/// .search_string("sit") +/// .page_token("vero") +/// .max_results(-91) +/// .add_ids("accusam") +/// .add_advertiser_ids("est") +/// .doit(); +/// # } +/// ``` +pub struct ProjectListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectListCall<'a, C, A> {} + +impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ProjectsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.projects.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if self._advertiser_ids.len() > 0 { + let mut s = String::new(); + for f in self._advertiser_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("advertiserIds", s)); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/projects".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for projects by name or ID. Wildcards (*) are allowed. For example, "project*2015" will return projects with names like "project June 2015", "project April 2015", or simply "project 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "project" will match projects with name "my project", "project 2015", or simply "project". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ProjectListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only projects with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only projects with these advertiser IDs. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> ProjectListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProjectListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one project by ID. +/// +/// A builder for the *get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct ProjectGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Project)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.projects.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/projects/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ProjectGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new directory site. +/// +/// A builder for the *insert* method supported by a *directorySite* resource. +/// It is not used directly, but through a `DirectorySiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::DirectorySite; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = DirectorySite::default(); +/// +/// // 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 ! +/// let result = hub.directory_sites().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: DirectorySite, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteInsertCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySite)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySites.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/directorySites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: DirectorySite) -> DirectorySiteInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DirectorySiteInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DirectorySiteInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of directory sites, possibly filtered. +/// +/// A builder for the *list* method supported by a *directorySite* resource. +/// It is not used directly, but through a `DirectorySiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.directory_sites().list("profileId") +/// .sort_order("et") +/// .sort_field("clita") +/// .search_string("tempor") +/// .parent_id("ut") +/// .page_token("kasd") +/// .max_results(-92) +/// .add_ids("ut") +/// .dfp_network_code("diam") +/// .country_id("eos") +/// .active(false) +/// .accepts_publisher_paid_placements(true) +/// .accepts_interstitial_placements(true) +/// .accepts_in_stream_video_placements(false) +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _parent_id: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _dfp_network_code: Option, + _country_id: Option, + _active: Option, + _accepts_publisher_paid_placements: Option, + _accepts_interstitial_placements: Option, + _accepts_in_stream_video_placements: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteListCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySitesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySites.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._parent_id { + params.push(("parentId", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._dfp_network_code { + params.push(("dfp_network_code", value.to_string())); + } + if let Some(value) = self._country_id { + params.push(("countryId", value.to_string())); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + if let Some(value) = self._accepts_publisher_paid_placements { + params.push(("acceptsPublisherPaidPlacements", value.to_string())); + } + if let Some(value) = self._accepts_interstitial_placements { + params.push(("acceptsInterstitialPlacements", value.to_string())); + } + if let Some(value) = self._accepts_in_stream_video_placements { + params.push(("acceptsInStreamVideoPlacements", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "parentId", "pageToken", "maxResults", "ids", "dfp_network_code", "countryId", "active", "acceptsPublisherPaidPlacements", "acceptsInterstitialPlacements", "acceptsInStreamVideoPlacements"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/directorySites".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or URL. Wildcards (*) are allowed. For example, "directory site*2015" will return objects with names like "directory site June 2015", "directory site April 2015", or simply "directory site 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "directory site" will match objects with name "my directory site", "directory site 2015" or simply, "directory site". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only directory sites with this parent ID. + /// + /// Sets the *parent id* query property to the given value. + pub fn parent_id(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._parent_id = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> DirectorySiteListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only directory sites with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only directory sites with this DFP network code. + /// + /// Sets the *dfp_network_code* query property to the given value. + pub fn dfp_network_code(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._dfp_network_code = Some(new_value.to_string()); + self + } + /// Select only directory sites with this country ID. + /// + /// Sets the *country id* query property to the given value. + pub fn country_id(mut self, new_value: &str) -> DirectorySiteListCall<'a, C, A> { + self._country_id = Some(new_value.to_string()); + self + } + /// Select only active directory sites. Leave blank to retrieve both active and inactive directory sites. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// Select only directory sites that accept publisher paid placements. This field can be left blank. + /// + /// Sets the *accepts publisher paid placements* query property to the given value. + pub fn accepts_publisher_paid_placements(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._accepts_publisher_paid_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts interstitial placements* query property to the given value. + pub fn accepts_interstitial_placements(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._accepts_interstitial_placements = Some(new_value); + self + } + /// This search filter is no longer supported and will have no effect on the results returned. + /// + /// Sets the *accepts in stream video placements* query property to the given value. + pub fn accepts_in_stream_video_placements(mut self, new_value: bool) -> DirectorySiteListCall<'a, C, A> { + self._accepts_in_stream_video_placements = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DirectorySiteListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DirectorySiteListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one directory site by ID. +/// +/// A builder for the *get* method supported by a *directorySite* resource. +/// It is not used directly, but through a `DirectorySiteMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.directory_sites().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct DirectorySiteGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for DirectorySiteGetCall<'a, C, A> {} + +impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, DirectorySite)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.directorySites.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/directorySites/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> DirectorySiteGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Directory site ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> DirectorySiteGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> DirectorySiteGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> DirectorySiteGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> DirectorySiteGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new size. +/// +/// A builder for the *insert* method supported by a *size* resource. +/// It is not used directly, but through a `SizeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Size; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Size::default(); +/// +/// // 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 ! +/// let result = hub.sizes().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct SizeInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Size, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SizeInsertCall<'a, C, A> {} + +impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Size)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sizes.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/sizes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Size) -> SizeInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SizeInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SizeInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SizeInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SizeInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of sizes, possibly filtered. +/// +/// A builder for the *list* method supported by a *size* resource. +/// It is not used directly, but through a `SizeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.sizes().list("profileId") +/// .width(-74) +/// .add_ids("justo") +/// .iab_standard(true) +/// .height(-75) +/// .doit(); +/// # } +/// ``` +pub struct SizeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _width: Option, + _ids: Vec, + _iab_standard: Option, + _height: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SizeListCall<'a, C, A> {} + +impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SizesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sizes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._width { + params.push(("width", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._iab_standard { + params.push(("iabStandard", value.to_string())); + } + if let Some(value) = self._height { + params.push(("height", value.to_string())); + } + for &field in ["alt", "profileId", "width", "ids", "iabStandard", "height"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/sizes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SizeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only sizes with this width. + /// + /// Sets the *width* query property to the given value. + pub fn width(mut self, new_value: i32) -> SizeListCall<'a, C, A> { + self._width = Some(new_value); + self + } + /// Select only sizes with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> SizeListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only IAB standard sizes. + /// + /// Sets the *iab standard* query property to the given value. + pub fn iab_standard(mut self, new_value: bool) -> SizeListCall<'a, C, A> { + self._iab_standard = Some(new_value); + self + } + /// Select only sizes with this height. + /// + /// Sets the *height* query property to the given value. + pub fn height(mut self, new_value: i32) -> SizeListCall<'a, C, A> { + self._height = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SizeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SizeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SizeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one size by ID. +/// +/// A builder for the *get* method supported by a *size* resource. +/// It is not used directly, but through a `SizeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.sizes().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct SizeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SizeGetCall<'a, C, A> {} + +impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Size)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.sizes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/sizes/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> SizeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Size ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SizeGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SizeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SizeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SizeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the account's active ad summary by account ID. +/// +/// A builder for the *get* method supported by a *accountActiveAdSummary* resource. +/// It is not used directly, but through a `AccountActiveAdSummaryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.account_active_ad_summaries().get("profileId", "summaryAccountId") +/// .doit(); +/// # } +/// ``` +pub struct AccountActiveAdSummaryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _summary_account_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountActiveAdSummaryGetCall<'a, C, A> {} + +impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountActiveAdSummary)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountActiveAdSummaries.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("summaryAccountId", self._summary_account_id.to_string())); + for &field in ["alt", "profileId", "summaryAccountId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accountActiveAdSummaries/{summaryAccountId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{summaryAccountId}", "summaryAccountId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["summaryAccountId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountActiveAdSummaryGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account ID. + /// + /// Sets the *summary account id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn summary_account_id(mut self, new_value: &str) -> AccountActiveAdSummaryGetCall<'a, C, A> { + self._summary_account_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountActiveAdSummaryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountActiveAdSummaryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountActiveAdSummaryGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing account user profile. +/// +/// A builder for the *update* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::AccountUserProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = AccountUserProfile::default(); +/// +/// // 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 ! +/// let result = hub.account_user_profiles().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AccountUserProfile, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileUpdateCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accountUserProfiles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: AccountUserProfile) -> AccountUserProfileUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountUserProfileUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountUserProfileUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of account user profiles, possibly filtered. +/// +/// A builder for the *list* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.account_user_profiles().list("profileId") +/// .user_role_id("magna") +/// .subaccount_id("Lorem") +/// .sort_order("et") +/// .sort_field("amet.") +/// .search_string("rebum.") +/// .page_token("sit") +/// .max_results(-55) +/// .add_ids("sanctus") +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _user_role_id: Option, + _subaccount_id: Option, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileListCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfilesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._user_role_id { + params.push(("userRoleId", value.to_string())); + } + if let Some(value) = self._subaccount_id { + params.push(("subaccountId", value.to_string())); + } + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "userRoleId", "subaccountId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accountUserProfiles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Select only user profiles with the specified user role ID. + /// + /// Sets the *user role id* query property to the given value. + pub fn user_role_id(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._user_role_id = Some(new_value.to_string()); + self + } + /// Select only user profiles with the specified subaccount ID. + /// + /// Sets the *subaccount id* query property to the given value. + pub fn subaccount_id(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._subaccount_id = Some(new_value.to_string()); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name, ID or email. Wildcards (*) are allowed. For example, "user profile*2015" will return objects with names like "user profile June 2015", "user profile April 2015", or simply "user profile 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "user profile" will match objects with name "my user profile", "user profile 2015", or simply "user profile". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AccountUserProfileListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only user profiles with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only active user profiles. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> AccountUserProfileListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountUserProfileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountUserProfileListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new account user profile. +/// +/// A builder for the *insert* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::AccountUserProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = AccountUserProfile::default(); +/// +/// // 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 ! +/// let result = hub.account_user_profiles().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AccountUserProfile, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileInsertCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accountUserProfiles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: AccountUserProfile) -> AccountUserProfileInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountUserProfileInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountUserProfileInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing account user profile. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::AccountUserProfile; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = AccountUserProfile::default(); +/// +/// // 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 ! +/// let result = hub.account_user_profiles().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfilePatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: AccountUserProfile, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfilePatchCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accountUserProfiles".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: AccountUserProfile) -> AccountUserProfilePatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfilePatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User profile ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountUserProfilePatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountUserProfilePatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfilePatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountUserProfilePatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one account user profile by ID. +/// +/// A builder for the *get* method supported by a *accountUserProfile* resource. +/// It is not used directly, but through a `AccountUserProfileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.account_user_profiles().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountUserProfileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUserProfileGetCall<'a, C, A> {} + +impl<'a, C, A> AccountUserProfileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountUserProfile)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accountUserProfiles.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accountUserProfiles/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUserProfileGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// User profile ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountUserProfileGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountUserProfileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUserProfileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountUserProfileGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of countries. +/// +/// A builder for the *list* method supported by a *country* resource. +/// It is not used directly, but through a `CountryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.countries().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct CountryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CountryListCall<'a, C, A> {} + +impl<'a, C, A> CountryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CountriesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.countries.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/countries".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CountryListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CountryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CountryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CountryListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one country by ID. +/// +/// A builder for the *get* method supported by a *country* resource. +/// It is not used directly, but through a `CountryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.countries().get("profileId", "dartId") +/// .doit(); +/// # } +/// ``` +pub struct CountryGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _dart_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CountryGetCall<'a, C, A> {} + +impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Country)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.countries.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("dartId", self._dart_id.to_string())); + for &field in ["alt", "profileId", "dartId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/countries/{dartId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{dartId}", "dartId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["dartId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> CountryGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Country DART ID. + /// + /// Sets the *dart id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn dart_id(mut self, new_value: &str) -> CountryGetCall<'a, C, A> { + self._dart_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CountryGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CountryGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CountryGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one order document by ID. +/// +/// A builder for the *get* method supported by a *orderDocument* resource. +/// It is not used directly, but through a `OrderDocumentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.order_documents().get("profileId", "projectId", "id") +/// .doit(); +/// # } +/// ``` +pub struct OrderDocumentGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderDocumentGetCall<'a, C, A> {} + +impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrderDocument)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "projectId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/projects/{projectId}/orderDocuments/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["id", "projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order document ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> OrderDocumentGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OrderDocumentGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderDocumentGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OrderDocumentGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of order documents, possibly filtered. +/// +/// A builder for the *list* method supported by a *orderDocument* resource. +/// It is not used directly, but through a `OrderDocumentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.order_documents().list("profileId", "projectId") +/// .sort_order("est") +/// .sort_field("et") +/// .add_site_id("et") +/// .search_string("clita") +/// .page_token("consetetur") +/// .add_order_id("magna") +/// .max_results(-38) +/// .add_ids("At") +/// .approved(true) +/// .doit(); +/// # } +/// ``` +pub struct OrderDocumentListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _project_id: String, + _sort_order: Option, + _sort_field: Option, + _site_id: Vec, + _search_string: Option, + _page_token: Option, + _order_id: Vec, + _max_results: Option, + _ids: Vec, + _approved: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OrderDocumentListCall<'a, C, A> {} + +impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OrderDocumentsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.orderDocuments.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("projectId", self._project_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._site_id.len() > 0 { + let mut s = String::new(); + for f in self._site_id.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("siteId", s)); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if self._order_id.len() > 0 { + let mut s = String::new(); + for f in self._order_id.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("orderId", s)); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._approved { + params.push(("approved", value.to_string())); + } + for &field in ["alt", "profileId", "projectId", "sortOrder", "sortField", "siteId", "searchString", "pageToken", "orderId", "maxResults", "ids", "approved"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/projects/{projectId}/orderDocuments".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["projectId", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Project ID for order documents. + /// + /// Sets the *project id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._project_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only order documents that are associated with these sites. + /// + /// Append the given value to the *site id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._site_id.push(new_value.to_string()); + self + } + /// Allows searching for order documents by name or ID. Wildcards (*) are allowed. For example, "orderdocument*2015" will return order documents with names like "orderdocument June 2015", "orderdocument April 2015", or simply "orderdocument 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "orderdocument" will match order documents with name "my orderdocument", "orderdocument 2015", or simply "orderdocument". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only order documents for specified orders. + /// + /// Append the given value to the *order id* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_order_id(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._order_id.push(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> OrderDocumentListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only order documents with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> OrderDocumentListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only order documents that have been approved by at least one user. + /// + /// Sets the *approved* query property to the given value. + pub fn approved(mut self, new_value: bool) -> OrderDocumentListCall<'a, C, A> { + self._approved = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OrderDocumentListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OrderDocumentListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OrderDocumentListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one postal code by ID. +/// +/// A builder for the *get* method supported by a *postalCode* resource. +/// It is not used directly, but through a `PostalCodeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.postal_codes().get("profileId", "code") +/// .doit(); +/// # } +/// ``` +pub struct PostalCodeGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _code: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PostalCodeGetCall<'a, C, A> {} + +impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PostalCode)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.postalCodes.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("code", self._code.to_string())); + for &field in ["alt", "profileId", "code"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/postalCodes/{code}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{code}", "code")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["code", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PostalCodeGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Postal code ID. + /// + /// Sets the *code* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn code(mut self, new_value: &str) -> PostalCodeGetCall<'a, C, A> { + self._code = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PostalCodeGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PostalCodeGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PostalCodeGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of postal codes. +/// +/// A builder for the *list* method supported by a *postalCode* resource. +/// It is not used directly, but through a `PostalCodeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.postal_codes().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct PostalCodeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PostalCodeListCall<'a, C, A> {} + +impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PostalCodesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.postalCodes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/postalCodes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PostalCodeListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PostalCodeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PostalCodeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PostalCodeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of browsers. +/// +/// A builder for the *list* method supported by a *browser* resource. +/// It is not used directly, but through a `BrowserMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.browsers().list("profileId") +/// .doit(); +/// # } +/// ``` +pub struct BrowserListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for BrowserListCall<'a, C, A> {} + +impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, BrowsersListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.browsers.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/browsers".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> BrowserListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> BrowserListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> BrowserListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> BrowserListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one account by ID. +/// +/// A builder for the *get* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.accounts().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountGetCall<'a, C, A> {} + +impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accounts/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves the list of accounts, possibly filtered. +/// +/// A builder for the *list* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.accounts().list("profileId") +/// .sort_order("tempor") +/// .sort_field("sed") +/// .search_string("voluptua.") +/// .page_token("At") +/// .max_results(-3) +/// .add_ids("vero") +/// .active(false) +/// .doit(); +/// # } +/// ``` +pub struct AccountListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _search_string: Option, + _page_token: Option, + _max_results: Option, + _ids: Vec, + _active: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountListCall<'a, C, A> {} + +impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, AccountsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if let Some(value) = self._active { + params.push(("active", value.to_string())); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "searchString", "pageToken", "maxResults", "ids", "active"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "account*2015" will return objects with names like "account June 2015", "account April 2015", or simply "account 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "account" will match objects with name "my account", "account 2015", or simply "account". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> AccountListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only accounts with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> AccountListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only active accounts. Don't set this field to select both active and non-active accounts. + /// + /// Sets the *active* query property to the given value. + pub fn active(mut self, new_value: bool) -> AccountListCall<'a, C, A> { + self._active = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing account. +/// +/// A builder for the *update* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Account; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Account::default(); +/// +/// // 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 ! +/// let result = hub.accounts().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct AccountUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Account, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountUpdateCall<'a, C, A> {} + +impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Account) -> AccountUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing account. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *account* resource. +/// It is not used directly, but through a `AccountMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Account; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Account::default(); +/// +/// // 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 ! +/// let result = hub.accounts().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct AccountPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Account, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AccountPatchCall<'a, C, A> {} + +impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Account)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.accounts.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/accounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Account) -> AccountPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Account ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> AccountPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AccountPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AccountPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AccountPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Placement; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Placement::default(); +/// +/// // 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 ! +/// let result = hub.placements().patch(req, "profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Placement, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementPatchCall<'a, C, A> {} + +impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placements".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Placement) -> PlacementPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementPatchCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementPatchCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Retrieves a list of placements, possibly filtered. +/// +/// A builder for the *list* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.placements().list("profileId") +/// .sort_order("invidunt") +/// .sort_field("dolore") +/// .add_size_ids("dolor") +/// .add_site_ids("ipsum") +/// .search_string("et") +/// .add_pricing_types("kasd") +/// .add_placement_strategy_ids("sed") +/// .payment_source("tempor") +/// .page_token("diam") +/// .min_start_date("takimata") +/// .min_end_date("Lorem") +/// .max_start_date("dolor") +/// .max_results(-51) +/// .max_end_date("sed") +/// .add_ids("sea") +/// .add_group_ids("consetetur") +/// .add_directory_site_ids("sea") +/// .add_content_category_ids("voluptua.") +/// .add_compatibilities("At") +/// .add_campaign_ids("sanctus") +/// .archived(true) +/// .add_advertiser_ids("sit") +/// .doit(); +/// # } +/// ``` +pub struct PlacementListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _sort_order: Option, + _sort_field: Option, + _size_ids: Vec, + _site_ids: Vec, + _search_string: Option, + _pricing_types: Vec, + _placement_strategy_ids: Vec, + _payment_source: Option, + _page_token: Option, + _min_start_date: Option, + _min_end_date: Option, + _max_start_date: Option, + _max_results: Option, + _max_end_date: Option, + _ids: Vec, + _group_ids: Vec, + _directory_site_ids: Vec, + _content_category_ids: Vec, + _compatibilities: Vec, + _campaign_ids: Vec, + _archived: Option, + _advertiser_ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementListCall<'a, C, A> {} + +impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((25 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_field { + params.push(("sortField", value.to_string())); + } + if self._size_ids.len() > 0 { + let mut s = String::new(); + for f in self._size_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("sizeIds", s)); + } + if self._site_ids.len() > 0 { + let mut s = String::new(); + for f in self._site_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("siteIds", s)); + } + if let Some(value) = self._search_string { + params.push(("searchString", value.to_string())); + } + if self._pricing_types.len() > 0 { + let mut s = String::new(); + for f in self._pricing_types.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("pricingTypes", s)); + } + if self._placement_strategy_ids.len() > 0 { + let mut s = String::new(); + for f in self._placement_strategy_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("placementStrategyIds", s)); + } + if let Some(value) = self._payment_source { + params.push(("paymentSource", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._min_start_date { + params.push(("minStartDate", value.to_string())); + } + if let Some(value) = self._min_end_date { + params.push(("minEndDate", value.to_string())); + } + if let Some(value) = self._max_start_date { + params.push(("maxStartDate", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._max_end_date { + params.push(("maxEndDate", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + if self._group_ids.len() > 0 { + let mut s = String::new(); + for f in self._group_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("groupIds", s)); + } + if self._directory_site_ids.len() > 0 { + let mut s = String::new(); + for f in self._directory_site_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("directorySiteIds", s)); + } + if self._content_category_ids.len() > 0 { + let mut s = String::new(); + for f in self._content_category_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("contentCategoryIds", s)); + } + if self._compatibilities.len() > 0 { + let mut s = String::new(); + for f in self._compatibilities.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("compatibilities", s)); + } + if self._campaign_ids.len() > 0 { + let mut s = String::new(); + for f in self._campaign_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("campaignIds", s)); + } + if let Some(value) = self._archived { + params.push(("archived", value.to_string())); + } + if self._advertiser_ids.len() > 0 { + let mut s = String::new(); + for f in self._advertiser_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("advertiserIds", s)); + } + for &field in ["alt", "profileId", "sortOrder", "sortField", "sizeIds", "siteIds", "searchString", "pricingTypes", "placementStrategyIds", "paymentSource", "pageToken", "minStartDate", "minEndDate", "maxStartDate", "maxResults", "maxEndDate", "ids", "groupIds", "directorySiteIds", "contentCategoryIds", "compatibilities", "campaignIds", "archived", "advertiserIds"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placements".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Order of sorted results, default is ASCENDING. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Field by which to sort the list. + /// + /// Sets the *sort field* query property to the given value. + pub fn sort_field(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._sort_field = Some(new_value.to_string()); + self + } + /// Select only placements that are associated with these sizes. + /// + /// Append the given value to the *size ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_size_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._size_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these sites. + /// + /// Append the given value to the *site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_site_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._site_ids.push(new_value.to_string()); + self + } + /// Allows searching for placements by name or ID. Wildcards (*) are allowed. For example, "placement*2015" will return placements with names like "placement June 2015", "placement May 2015", or simply "placements 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placement" will match placements with name "my placement", "placement 2015", or simply "placement". + /// + /// Sets the *search string* query property to the given value. + pub fn search_string(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._search_string = Some(new_value.to_string()); + self + } + /// Select only placements with these pricing types. + /// + /// Append the given value to the *pricing types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_pricing_types(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._pricing_types.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these placement strategies. + /// + /// Append the given value to the *placement strategy ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_strategy_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._placement_strategy_ids.push(new_value.to_string()); + self + } + /// Select only placements with this payment source. + /// + /// Sets the *payment source* query property to the given value. + pub fn payment_source(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._payment_source = Some(new_value.to_string()); + self + } + /// Value of the nextPageToken from the previous result page. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or after the specified minStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min start date* query property to the given value. + pub fn min_start_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._min_start_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose end date is on or after the specified minEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *min end date* query property to the given value. + pub fn min_end_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._min_end_date = Some(new_value.to_string()); + self + } + /// Select only placements or placement groups whose start date is on or before the specified maxStartDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max start date* query property to the given value. + pub fn max_start_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._max_start_date = Some(new_value.to_string()); + self + } + /// Maximum number of results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> PlacementListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Select only placements or placement groups whose end date is on or before the specified maxEndDate. The date should be formatted as "yyyy-MM-dd". + /// + /// Sets the *max end date* query property to the given value. + pub fn max_end_date(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._max_end_date = Some(new_value.to_string()); + self + } + /// Select only placements with these IDs. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// Select only placements that belong to these placement groups. + /// + /// Append the given value to the *group ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_group_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._group_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these directory sites. + /// + /// Append the given value to the *directory site ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_directory_site_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._directory_site_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these content categories. + /// + /// Append the given value to the *content category ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_content_category_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._content_category_ids.push(new_value.to_string()); + self + } + /// Select only placements that are associated with these compatibilities. WEB and WEB_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps.IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. + /// + /// Append the given value to the *compatibilities* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_compatibilities(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._compatibilities.push(new_value.to_string()); + self + } + /// Select only placements that belong to these campaigns. + /// + /// Append the given value to the *campaign ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_campaign_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._campaign_ids.push(new_value.to_string()); + self + } + /// Select only archived placements. Don't set this field to select both archived and non-archived placements. + /// + /// Sets the *archived* query property to the given value. + pub fn archived(mut self, new_value: bool) -> PlacementListCall<'a, C, A> { + self._archived = Some(new_value); + self + } + /// Select only placements that belong to these advertisers. + /// + /// Append the given value to the *advertiser ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_advertiser_ids(mut self, new_value: &str) -> PlacementListCall<'a, C, A> { + self._advertiser_ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Inserts a new placement. +/// +/// A builder for the *insert* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Placement; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Placement::default(); +/// +/// // 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 ! +/// let result = hub.placements().insert(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Placement, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementInsertCall<'a, C, A> {} + +impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placements".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Placement) -> PlacementInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementInsertCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an existing placement. +/// +/// A builder for the *update* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// use dfareporting2d3::Placement; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let mut req = Placement::default(); +/// +/// // 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 ! +/// let result = hub.placements().update(req, "profileId") +/// .doit(); +/// # } +/// ``` +pub struct PlacementUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _request: Placement, + _profile_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementUpdateCall<'a, C, A> {} + +impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + for &field in ["alt", "profileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placements".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Placement) -> PlacementUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementUpdateCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Generates tags for a placement. +/// +/// A builder for the *generatetags* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.placements().generatetags("profileId") +/// .add_tag_formats("Stet") +/// .add_placement_ids("sed") +/// .campaign_id("eirmod") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGeneratetagCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _tag_formats: Vec, + _placement_ids: Vec, + _campaign_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGeneratetagCall<'a, C, A> {} + +impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlacementsGenerateTagsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.generatetags", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + if self._tag_formats.len() > 0 { + let mut s = String::new(); + for f in self._tag_formats.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("tagFormats", s)); + } + if self._placement_ids.len() > 0 { + let mut s = String::new(); + for f in self._placement_ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("placementIds", s)); + } + if let Some(value) = self._campaign_id { + params.push(("campaignId", value.to_string())); + } + for &field in ["alt", "profileId", "tagFormats", "placementIds", "campaignId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placements/generatetags".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Tag formats to generate for these placements. + /// + /// Append the given value to the *tag formats* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_tag_formats(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._tag_formats.push(new_value.to_string()); + self + } + /// Generate tags for these placements. + /// + /// Append the given value to the *placement ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_placement_ids(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._placement_ids.push(new_value.to_string()); + self + } + /// Generate placements belonging to this campaign. This is a required field. + /// + /// Sets the *campaign id* query property to the given value. + pub fn campaign_id(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C, A> { + self._campaign_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementGeneratetagCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGeneratetagCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementGeneratetagCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets one placement by ID. +/// +/// A builder for the *get* method supported by a *placement* resource. +/// It is not used directly, but through a `PlacementMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_dfareporting2d3 as dfareporting2d3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use dfareporting2d3::Dfareporting; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Dfareporting::new(hyper::Client::new(), 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 ! +/// let result = hub.placements().get("profileId", "id") +/// .doit(); +/// # } +/// ``` +pub struct PlacementGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Dfareporting, + _profile_id: String, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlacementGetCall<'a, C, A> {} + +impl<'a, C, A> PlacementGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Placement)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "dfareporting.placements.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("profileId", self._profile_id.to_string())); + params.push(("id", self._id.to_string())); + for &field in ["alt", "profileId", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/dfareporting/v2.3/userprofiles/{profileId}/placements/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Dfatrafficking.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["id", "profileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// User profile ID associated with this request. + /// + /// Sets the *profile id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn profile_id(mut self, new_value: &str) -> PlacementGetCall<'a, C, A> { + self._profile_id = new_value.to_string(); + self + } + /// Placement ID. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlacementGetCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlacementGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlacementGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Dfatrafficking`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlacementGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/discovery1-cli/Cargo.toml b/gen/discovery1-cli/Cargo.toml index c9cba29f8e..af65f58843 100644 --- a/gen/discovery1-cli/Cargo.toml +++ b/gen/discovery1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-discovery1-cli" -version = "0.3.2+00000000" +version = "0.3.3+00000000" authors = ["Sebastian Thiel "] description = "A complete library to interact with discovery (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/discovery1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/discovery1-cli/LICENSE.md b/gen/discovery1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/discovery1-cli/LICENSE.md +++ b/gen/discovery1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/discovery1-cli/README.md b/gen/discovery1-cli/README.md index 5882f55b33..200fd523a7 100644 --- a/gen/discovery1-cli/README.md +++ b/gen/discovery1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *discovery* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/discovery1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/discovery1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/discovery1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/discovery1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/discovery1-cli). # Usage -This documentation was generated from the *discovery* API at revision *00000000*. The CLI is at version *0.3.2*. +This documentation was generated from the *discovery* API at revision *00000000*. The CLI is at version *0.3.3*. ```bash discovery1 [options] @@ -35,14 +35,14 @@ discovery1 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/discovery1-cli/mkdocs.yml b/gen/discovery1-cli/mkdocs.yml index 982e04fa3c..fa06cb50f7 100644 --- a/gen/discovery1-cli/mkdocs.yml +++ b/gen/discovery1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: discovery v0.3.2+00000000 +site_name: discovery v0.3.3+00000000 site_url: http://byron.github.io/google-apis-rs/google-discovery1-cli site_description: Write integrating applications with bcore @@ -14,5 +14,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/discovery1-cli/src/main.rs b/gen/discovery1-cli/src/main.rs index 895cadd16c..11209dfa54 100644 --- a/gen/discovery1-cli/src/main.rs +++ b/gen/discovery1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Discovery>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _apis_get_rest(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _apis_get_rest(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apis().get_rest(opt.value_of("api").unwrap_or(""), opt.value_of("version").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -94,10 +94,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apis_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apis_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apis().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "preferred" => { @@ -116,7 +116,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["name", "preferred"].iter().map(|v|*v)); @@ -186,14 +186,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "discovery1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "discovery1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -213,7 +213,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -252,7 +252,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("apis", "methods: 'get-rest' and 'list'", vec![ - ("get-rest", + ("get-rest", Some(r##"Retrieve the description of a particular version of an api."##), "Details at http://byron.github.io/google-apis-rs/google_discovery1_cli/apis_get-rest", vec![ @@ -280,7 +280,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieve the list of APIs supported at this endpoint."##), "Details at http://byron.github.io/google-apis-rs/google_discovery1_cli/apis_list", vec![ @@ -302,7 +302,7 @@ fn main() { let mut app = App::new("discovery1") .author("Sebastian Thiel ") - .version("0.3.2+00000000") + .version("0.3.3+00000000") .about("Lets you discover information about other Google APIs, such as what APIs are available, the resource and method details for each API.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_discovery1_cli") .arg(Arg::with_name("folder") @@ -321,7 +321,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -332,7 +332,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/discovery1/Cargo.toml b/gen/discovery1/Cargo.toml index 061b54b686..13a79fdcfc 100644 --- a/gen/discovery1/Cargo.toml +++ b/gen/discovery1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-discovery1" -version = "0.1.10+00000000" +version = "0.1.11+00000000" authors = ["Sebastian Thiel "] description = "A complete library to interact with discovery (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/discovery1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/discovery1/LICENSE.md b/gen/discovery1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/discovery1/LICENSE.md +++ b/gen/discovery1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/discovery1/README.md b/gen/discovery1/README.md index ab56089c8a..fad11a1fee 100644 --- a/gen/discovery1/README.md +++ b/gen/discovery1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-discovery1` library allows access to all features of the *Google discovery* service. -This documentation was generated from *discovery* crate version *0.1.10+00000000*, where *00000000* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *discovery* crate version *0.1.11+00000000*, where *00000000* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *discovery* *v1* API can be found at the [official documentation site](https://developers.google.com/discovery/). diff --git a/gen/discovery1/src/cmn.rs b/gen/discovery1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/discovery1/src/cmn.rs +++ b/gen/discovery1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/discovery1/src/lib.rs b/gen/discovery1/src/lib.rs index 0306a2883c..991f86ea34 100644 --- a/gen/discovery1/src/lib.rs +++ b/gen/discovery1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *discovery* crate version *0.1.10+00000000*, where *00000000* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *discovery* crate version *0.1.11+00000000*, where *00000000* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *discovery* *v1* API can be found at the //! [official documentation site](https://developers.google.com/discovery/). diff --git a/gen/discovery1/src/lib.rs.in b/gen/discovery1/src/lib.rs.in index af313a270f..a6f55c1eb1 100644 --- a/gen/discovery1/src/lib.rs.in +++ b/gen/discovery1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -104,7 +105,7 @@ impl<'a, C, A> Discovery Discovery { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -113,7 +114,7 @@ impl<'a, C, A> Discovery } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -350,6 +351,8 @@ pub struct RestDescription { pub parameters: Option>, /// Links to 16x16 and 32x32 icons representing the API. pub icons: Option, + /// no description provided + pub version_module: Option, /// The description of this API. pub description: Option, /// The title of this API. @@ -360,16 +363,16 @@ pub struct RestDescription { /// [DEPRECATED] The base URL for REST requests. #[serde(rename="baseUrl")] pub base_url: Option, + /// The ETag for this response. + pub etag: Option, /// The version of this API. pub version: Option, - /// Indicate the version of the Discovery API used to generate this doc. - #[serde(rename="discoveryVersion")] - pub discovery_version: Option, /// The base path for all REST requests. #[serde(rename="servicePath")] pub service_path: Option, - /// The ETag for this response. - pub etag: Option, + /// Indicate the version of the Discovery API used to generate this doc. + #[serde(rename="discoveryVersion")] + pub discovery_version: Option, /// The schemas for this API. pub schemas: Option>, /// Authentication information. @@ -754,7 +757,7 @@ impl<'a, C, A> ApiGetRestCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "discovery.apis.getRest", + dlg.begin(MethodInfo { id: "discovery.apis.getRest", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("api", self._api.to_string())); @@ -794,7 +797,7 @@ impl<'a, C, A> ApiGetRestCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -815,7 +818,7 @@ impl<'a, C, A> ApiGetRestCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -825,10 +828,10 @@ impl<'a, C, A> ApiGetRestCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -861,7 +864,7 @@ impl<'a, C, A> ApiGetRestCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *api* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn api(mut self, new_value: &str) -> ApiGetRestCall<'a, C, A> { self._api = new_value.to_string(); @@ -871,7 +874,7 @@ impl<'a, C, A> ApiGetRestCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *version* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn version(mut self, new_value: &str) -> ApiGetRestCall<'a, C, A> { self._version = new_value.to_string(); @@ -889,12 +892,12 @@ impl<'a, C, A> ApiGetRestCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -969,7 +972,7 @@ impl<'a, C, A> ApiListCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "discovery.apis.list", + dlg.begin(MethodInfo { id: "discovery.apis.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._preferred { @@ -992,7 +995,7 @@ impl<'a, C, A> ApiListCall<'a, C, A> where C: BorrowMut, A: oauth let mut url = "https://www.googleapis.com/discovery/v1/apis".to_string(); - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1013,7 +1016,7 @@ impl<'a, C, A> ApiListCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1023,10 +1026,10 @@ impl<'a, C, A> ApiListCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1081,12 +1084,12 @@ impl<'a, C, A> ApiListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/dns1-cli/Cargo.toml b/gen/dns1-cli/Cargo.toml index 391baebe4e..49865504eb 100644 --- a/gen/dns1-cli/Cargo.toml +++ b/gen/dns1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dns1-cli" -version = "0.3.2+20150729" +version = "0.3.3+20151028" authors = ["Sebastian Thiel "] description = "A complete library to interact with dns (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dns1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/dns1-cli/LICENSE.md b/gen/dns1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/dns1-cli/LICENSE.md +++ b/gen/dns1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/dns1-cli/README.md b/gen/dns1-cli/README.md index 345237b3ea..953f46ef9e 100644 --- a/gen/dns1-cli/README.md +++ b/gen/dns1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *dns* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/dns1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/dns1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/dns1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/dns1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/dns1-cli). # Usage -This documentation was generated from the *dns* API at revision *20150729*. The CLI is at version *0.3.2*. +This documentation was generated from the *dns* API at revision *20151028*. The CLI is at version *0.3.3*. ```bash dns1 [options] @@ -45,18 +45,18 @@ dns1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/dns1-cli/mkdocs.yml b/gen/dns1-cli/mkdocs.yml index 276a01faef..7f045b6923 100644 --- a/gen/dns1-cli/mkdocs.yml +++ b/gen/dns1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dns v0.3.2+20150729 +site_name: dns v0.3.3+20151028 site_url: http://byron.github.io/google-apis-rs/google-dns1-cli site_description: Write integrating applications with bcore @@ -21,5 +21,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/dns1-cli/src/main.rs b/gen/dns1-cli/src/main.rs index e59f725a08..97935bdff2 100644 --- a/gen/dns1-cli/src/main.rs +++ b/gen/dns1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Dns>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _changes_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _changes_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -84,7 +84,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Change = json::value::from_value(object).unwrap(); let mut call = self.hub.changes().create(request, opt.value_of("project").unwrap_or(""), opt.value_of("managed-zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -97,7 +97,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -110,7 +110,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -133,10 +133,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _changes_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _changes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.changes().get(opt.value_of("project").unwrap_or(""), opt.value_of("managed-zone").unwrap_or(""), opt.value_of("change-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -149,7 +149,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -162,7 +162,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -185,10 +185,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _changes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _changes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.changes().list(opt.value_of("project").unwrap_or(""), opt.value_of("managed-zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -213,7 +213,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "sort-order", "max-results", "sort-by"].iter().map(|v|*v)); @@ -227,7 +227,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -250,13 +250,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _managed_zones_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _managed_zones_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -270,8 +270,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -293,7 +293,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ManagedZone = json::value::from_value(object).unwrap(); let mut call = self.hub.managed_zones().create(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -306,7 +306,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -319,7 +319,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -342,10 +342,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _managed_zones_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _managed_zones_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.managed_zones().delete(opt.value_of("project").unwrap_or(""), opt.value_of("managed-zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -358,7 +358,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -371,7 +371,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -386,10 +386,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _managed_zones_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _managed_zones_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.managed_zones().get(opt.value_of("project").unwrap_or(""), opt.value_of("managed-zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -402,7 +402,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -415,7 +415,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -438,10 +438,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _managed_zones_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _managed_zones_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.managed_zones().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -463,7 +463,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "dns-name", "max-results"].iter().map(|v|*v)); @@ -477,7 +477,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -500,10 +500,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().get(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -516,7 +516,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -529,7 +529,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -552,10 +552,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _resource_record_sets_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _resource_record_sets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.resource_record_sets().list(opt.value_of("project").unwrap_or(""), opt.value_of("managed-zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "type" => { @@ -580,7 +580,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "type", "name", "max-results"].iter().map(|v|*v)); @@ -594,7 +594,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -698,14 +698,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "dns1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "dns1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -725,7 +725,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -764,7 +764,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("changes", "methods: 'create', 'get' and 'list'", vec![ - ("create", + ("create", Some(r##"Atomically update the ResourceRecordSet collection."##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/changes_create", vec![ @@ -798,7 +798,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Fetch the representation of an existing Change."##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/changes_get", vec![ @@ -832,7 +832,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Enumerate Changes to a ResourceRecordSet collection."##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/changes_list", vec![ @@ -863,7 +863,7 @@ fn main() { ]), ("managed-zones", "methods: 'create', 'delete', 'get' and 'list'", vec![ - ("create", + ("create", Some(r##"Create a new ManagedZone."##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zones_create", vec![ @@ -891,7 +891,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete a previously created ManagedZone."##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zones_delete", vec![ @@ -913,7 +913,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Fetch the representation of an existing ManagedZone."##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zones_get", vec![ @@ -941,7 +941,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Enumerate ManagedZones that have been created but not yet deleted."##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/managed-zones_list", vec![ @@ -966,7 +966,7 @@ fn main() { ]), ("projects", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Fetch the representation of an existing Project."##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/projects_get", vec![ @@ -991,7 +991,7 @@ fn main() { ]), ("resource-record-sets", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Enumerate ResourceRecordSets that have been created but not yet deleted."##), "Details at http://byron.github.io/google-apis-rs/google_dns1_cli/resource-record-sets_list", vec![ @@ -1025,7 +1025,7 @@ fn main() { let mut app = App::new("dns1") .author("Sebastian Thiel ") - .version("0.3.2+20150729") + .version("0.3.3+20151028") .about("The Google Cloud DNS API provides services for configuring and serving authoritative DNS records.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dns1_cli") .arg(Arg::with_name("url") @@ -1049,7 +1049,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1060,7 +1060,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/dns1/Cargo.toml b/gen/dns1/Cargo.toml index 2d22180698..b81dcb214d 100644 --- a/gen/dns1/Cargo.toml +++ b/gen/dns1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dns1" -version = "0.1.10+20150729" +version = "0.1.11+20151028" authors = ["Sebastian Thiel "] description = "A complete library to interact with dns (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dns1" diff --git a/gen/dns1/LICENSE.md b/gen/dns1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/dns1/LICENSE.md +++ b/gen/dns1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/dns1/README.md b/gen/dns1/README.md index 2237a3407d..b8a4cc97eb 100644 --- a/gen/dns1/README.md +++ b/gen/dns1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-dns1` library allows access to all features of the *Google dns* service. -This documentation was generated from *dns* crate version *0.1.10+20150729*, where *20150729* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *dns* crate version *0.1.11+20151028*, where *20151028* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *dns* *v1* API can be found at the [official documentation site](https://developers.google.com/cloud-dns). diff --git a/gen/dns1/src/cmn.rs b/gen/dns1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/dns1/src/cmn.rs +++ b/gen/dns1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/dns1/src/lib.rs b/gen/dns1/src/lib.rs index 06a9948aa0..2bcc759cf3 100644 --- a/gen/dns1/src/lib.rs +++ b/gen/dns1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *dns* crate version *0.1.10+20150729*, where *20150729* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *dns* crate version *0.1.11+20151028*, where *20151028* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *dns* *v1* API can be found at the //! [official documentation site](https://developers.google.com/cloud-dns). diff --git a/gen/dns1/src/lib.rs.in b/gen/dns1/src/lib.rs.in index 3eb5f5a24b..969808ff03 100644 --- a/gen/dns1/src/lib.rs.in +++ b/gen/dns1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -141,7 +142,7 @@ impl<'a, C, A> Dns Dns { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -159,7 +160,7 @@ impl<'a, C, A> Dns } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -825,7 +826,7 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dns.changes.create", + dlg.begin(MethodInfo { id: "dns.changes.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -868,14 +869,14 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -919,7 +920,7 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -929,10 +930,10 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -964,7 +965,7 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Change) -> ChangeCreateCall<'a, C, A> { self._request = new_value; @@ -974,7 +975,7 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ChangeCreateCall<'a, C, A> { self._project = new_value.to_string(); @@ -984,7 +985,7 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *managed zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn managed_zone(mut self, new_value: &str) -> ChangeCreateCall<'a, C, A> { self._managed_zone = new_value.to_string(); @@ -1002,12 +1003,12 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1024,17 +1025,17 @@ impl<'a, C, A> ChangeCreateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChangeCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChangeCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1105,7 +1106,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dns.changes.list", + dlg.begin(MethodInfo { id: "dns.changes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1160,7 +1161,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1196,7 +1197,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1206,10 +1207,10 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1242,7 +1243,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ChangeListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1252,7 +1253,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *managed zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn managed_zone(mut self, new_value: &str) -> ChangeListCall<'a, C, A> { self._managed_zone = new_value.to_string(); @@ -1298,12 +1299,12 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1320,17 +1321,17 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevClouddnReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChangeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChangeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1394,7 +1395,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dns.changes.get", + dlg.begin(MethodInfo { id: "dns.changes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1438,7 +1439,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1474,7 +1475,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1484,10 +1485,10 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1520,7 +1521,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ChangeGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -1530,7 +1531,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *managed zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn managed_zone(mut self, new_value: &str) -> ChangeGetCall<'a, C, A> { self._managed_zone = new_value.to_string(); @@ -1540,7 +1541,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *change id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn change_id(mut self, new_value: &str) -> ChangeGetCall<'a, C, A> { self._change_id = new_value.to_string(); @@ -1558,12 +1559,12 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1580,17 +1581,17 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevClouddnReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChangeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChangeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1659,7 +1660,7 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dns.managedZones.create", + dlg.begin(MethodInfo { id: "dns.managedZones.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1701,14 +1702,14 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1752,7 +1753,7 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1762,10 +1763,10 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1797,7 +1798,7 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ManagedZone) -> ManagedZoneCreateCall<'a, C, A> { self._request = new_value; @@ -1807,7 +1808,7 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ManagedZoneCreateCall<'a, C, A> { self._project = new_value.to_string(); @@ -1825,12 +1826,12 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1847,17 +1848,17 @@ impl<'a, C, A> ManagedZoneCreateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagedZoneCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagedZoneCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1920,7 +1921,7 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dns.managedZones.delete", + dlg.begin(MethodInfo { id: "dns.managedZones.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1962,7 +1963,7 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1998,7 +1999,7 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2008,10 +2009,10 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2034,7 +2035,7 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ManagedZoneDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -2044,7 +2045,7 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *managed zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn managed_zone(mut self, new_value: &str) -> ManagedZoneDeleteCall<'a, C, A> { self._managed_zone = new_value.to_string(); @@ -2062,12 +2063,12 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2084,17 +2085,17 @@ impl<'a, C, A> ManagedZoneDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagedZoneDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagedZoneDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2157,7 +2158,7 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dns.managedZones.get", + dlg.begin(MethodInfo { id: "dns.managedZones.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2200,7 +2201,7 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2236,7 +2237,7 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2246,10 +2247,10 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2282,7 +2283,7 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ManagedZoneGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -2292,7 +2293,7 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *managed zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn managed_zone(mut self, new_value: &str) -> ManagedZoneGetCall<'a, C, A> { self._managed_zone = new_value.to_string(); @@ -2310,12 +2311,12 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2332,17 +2333,17 @@ impl<'a, C, A> ManagedZoneGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevClouddnReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagedZoneGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagedZoneGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2410,7 +2411,7 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dns.managedZones.list", + dlg.begin(MethodInfo { id: "dns.managedZones.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2461,7 +2462,7 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2497,7 +2498,7 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2507,10 +2508,10 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2543,7 +2544,7 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ManagedZoneListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2582,12 +2583,12 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2604,17 +2605,17 @@ impl<'a, C, A> ManagedZoneListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevClouddnReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ManagedZoneListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ManagedZoneListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2685,7 +2686,7 @@ impl<'a, C, A> ResourceRecordSetListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dns.resourceRecordSets.list", + dlg.begin(MethodInfo { id: "dns.resourceRecordSets.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2740,7 +2741,7 @@ impl<'a, C, A> ResourceRecordSetListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2776,7 +2777,7 @@ impl<'a, C, A> ResourceRecordSetListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2786,10 +2787,10 @@ impl<'a, C, A> ResourceRecordSetListCall<'a, C, A> where C: BorrowMut ResourceRecordSetListCall<'a, C, A> where C: BorrowMut ResourceRecordSetListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2832,7 +2833,7 @@ impl<'a, C, A> ResourceRecordSetListCall<'a, C, A> where C: BorrowMut ResourceRecordSetListCall<'a, C, A> { self._managed_zone = new_value.to_string(); @@ -2878,12 +2879,12 @@ impl<'a, C, A> ResourceRecordSetListCall<'a, C, A> where C: BorrowMut ResourceRecordSetListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ResourceRecordSetListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ResourceRecordSetListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2972,7 +2973,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "dns.projects.get", + dlg.begin(MethodInfo { id: "dns.projects.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3014,7 +3015,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3050,7 +3051,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3060,10 +3061,10 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3096,7 +3097,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ProjectGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -3114,12 +3115,12 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3136,17 +3137,17 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevClouddnReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/doubleclickbidmanager1-cli/Cargo.toml b/gen/doubleclickbidmanager1-cli/Cargo.toml index 50799af40d..5cf88a8ee5 100644 --- a/gen/doubleclickbidmanager1-cli/Cargo.toml +++ b/gen/doubleclickbidmanager1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclickbidmanager1-cli" -version = "0.3.2+20150925" +version = "0.3.3+20160120" authors = ["Sebastian Thiel "] description = "A complete library to interact with DoubleClick Bid Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclickbidmanager1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/doubleclickbidmanager1-cli/LICENSE.md b/gen/doubleclickbidmanager1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/doubleclickbidmanager1-cli/LICENSE.md +++ b/gen/doubleclickbidmanager1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/doubleclickbidmanager1-cli/README.md b/gen/doubleclickbidmanager1-cli/README.md index 8a35b08dd3..21fbe63cba 100644 --- a/gen/doubleclickbidmanager1-cli/README.md +++ b/gen/doubleclickbidmanager1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *DoubleClick Bid Manager* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/doubleclickbidmanager1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/doubleclickbidmanager1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/doubleclickbidmanager1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/doubleclickbidmanager1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclickbidmanager1-cli). # Usage -This documentation was generated from the *DoubleClick Bid Manager* API at revision *20150925*. The CLI is at version *0.3.2*. +This documentation was generated from the *DoubleClick Bid Manager* API at revision *20160120*. The CLI is at version *0.3.3*. ```bash doubleclickbidmanager1 [options] @@ -39,18 +39,20 @@ doubleclickbidmanager1 [options] runquery (-r )... [-p ]... reports listreports [-p ]... [-o ] + rubicon + notifyproposalchange (-r )... [-p ]... doubleclickbidmanager1 --help Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/doubleclickbidmanager1-cli/mkdocs.yml b/gen/doubleclickbidmanager1-cli/mkdocs.yml index 479270220b..32f642309d 100644 --- a/gen/doubleclickbidmanager1-cli/mkdocs.yml +++ b/gen/doubleclickbidmanager1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: DoubleClick Bid Manager v0.3.2+20150925 +site_name: DoubleClick Bid Manager v0.3.3+20160120 site_url: http://byron.github.io/google-apis-rs/google-doubleclickbidmanager1-cli site_description: Write integrating applications with bcore @@ -17,8 +17,9 @@ pages: - ['queries_listqueries.md', 'Queries', 'Listqueries'] - ['queries_runquery.md', 'Queries', 'Runquery'] - ['reports_listreports.md', 'Reports', 'Listreports'] +- ['rubicon_notifyproposalchange.md', 'Rubicon', 'Notifyproposalchange'] theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/doubleclickbidmanager1-cli/src/main.rs b/gen/doubleclickbidmanager1-cli/src/main.rs index 1059493816..28d12290b1 100644 --- a/gen/doubleclickbidmanager1-cli/src/main.rs +++ b/gen/doubleclickbidmanager1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::DoubleClickBidManager>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _lineitems_downloadlineitems(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _lineitems_downloadlineitems(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "file-spec" => Some(("fileSpec", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "filter-type" => Some(("filterType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -84,7 +84,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DownloadLineItemsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.lineitems().downloadlineitems(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -97,7 +97,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -130,13 +130,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _lineitems_uploadlineitems(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _lineitems_uploadlineitems(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -150,8 +150,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "line-items" => Some(("lineItems", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dry-run" => Some(("dryRun", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -168,7 +168,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UploadLineItemsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.lineitems().uploadlineitems(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -181,7 +181,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -214,13 +214,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _queries_createquery(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _queries_createquery(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -234,8 +234,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "schedule.end-time-ms" => Some(("schedule.endTimeMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -273,7 +273,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Query = json::value::from_value(object).unwrap(); let mut call = self.hub.queries().createquery(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -286,7 +286,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -319,10 +319,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _queries_deletequery(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _queries_deletequery(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.queries().deletequery(opt.value_of("query-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -335,7 +335,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -360,10 +360,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _queries_getquery(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _queries_getquery(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.queries().getquery(opt.value_of("query-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -376,7 +376,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -409,10 +409,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _queries_listqueries(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _queries_listqueries(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.queries().listqueries(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -425,7 +425,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -458,13 +458,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _queries_runquery(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _queries_runquery(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -478,8 +478,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "report-data-end-time-ms" => Some(("reportDataEndTimeMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "timezone-code" => Some(("timezoneCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -497,7 +497,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RunQueryRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.queries().runquery(request, opt.value_of("query-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -510,7 +510,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -535,10 +535,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_listreports(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_listreports(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().listreports(opt.value_of("query-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -551,7 +551,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -584,6 +584,83 @@ impl<'n, 'a> Engine<'n, 'a> { } } + fn _rubicon_notifyproposalchange(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "action" => Some(("action", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "token" => Some(("token", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "href" => Some(("href", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["action", "href", "id", "token"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::NotifyProposalChangeRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.rubicon().notifyproposalchange(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); @@ -637,6 +714,17 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, + ("rubicon", Some(opt)) => { + match opt.subcommand() { + ("notifyproposalchange", Some(opt)) => { + call_result = self._rubicon_notifyproposalchange(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("rubicon".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, _ => { err.issues.push(CLIError::MissingCommandError); writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); @@ -654,14 +742,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "doubleclickbidmanager1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "doubleclickbidmanager1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -681,7 +769,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -720,7 +808,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("lineitems", "methods: 'downloadlineitems' and 'uploadlineitems'", vec![ - ("downloadlineitems", + ("downloadlineitems", Some(r##"Retrieves line items in CSV format."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/lineitems_downloadlineitems", vec![ @@ -742,7 +830,7 @@ fn main() { Some(false), Some(false)), ]), - ("uploadlineitems", + ("uploadlineitems", Some(r##"Uploads line items in CSV format."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/lineitems_uploadlineitems", vec![ @@ -767,7 +855,7 @@ fn main() { ]), ("queries", "methods: 'createquery', 'deletequery', 'getquery', 'listqueries' and 'runquery'", vec![ - ("createquery", + ("createquery", Some(r##"Creates a query."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/queries_createquery", vec![ @@ -789,7 +877,7 @@ fn main() { Some(false), Some(false)), ]), - ("deletequery", + ("deletequery", Some(r##"Deletes a stored query as well as the associated stored reports."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/queries_deletequery", vec![ @@ -805,7 +893,7 @@ fn main() { Some(false), Some(true)), ]), - ("getquery", + ("getquery", Some(r##"Retrieves a stored query."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/queries_getquery", vec![ @@ -827,7 +915,7 @@ fn main() { Some(false), Some(false)), ]), - ("listqueries", + ("listqueries", Some(r##"Retrieves stored queries."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/queries_listqueries", vec![ @@ -843,7 +931,7 @@ fn main() { Some(false), Some(false)), ]), - ("runquery", + ("runquery", Some(r##"Runs a stored query to generate a report."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/queries_runquery", vec![ @@ -868,7 +956,7 @@ fn main() { ]), ("reports", "methods: 'listreports'", vec![ - ("listreports", + ("listreports", Some(r##"Retrieves stored reports."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/reports_listreports", vec![ @@ -892,11 +980,30 @@ fn main() { ]), ]), + ("rubicon", "methods: 'notifyproposalchange'", vec![ + ("notifyproposalchange", + Some(r##"Update proposal upon actions of Rubicon publisher."##), + "Details at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli/rubicon_notifyproposalchange", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ]), + ]; let mut app = App::new("doubleclickbidmanager1") .author("Sebastian Thiel ") - .version("0.3.2+20150925") + .version("0.3.3+20160120") .about("API for viewing and managing your reports in DoubleClick Bid Manager.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1_cli") .arg(Arg::with_name("folder") @@ -915,7 +1022,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -926,7 +1033,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/doubleclickbidmanager1/Cargo.toml b/gen/doubleclickbidmanager1/Cargo.toml index c49b76cc22..ae72d4fdc1 100644 --- a/gen/doubleclickbidmanager1/Cargo.toml +++ b/gen/doubleclickbidmanager1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclickbidmanager1" -version = "0.1.10+20150925" +version = "0.1.11+20160120" authors = ["Sebastian Thiel "] description = "A complete library to interact with DoubleClick Bid Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclickbidmanager1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/doubleclickbidmanager1/LICENSE.md b/gen/doubleclickbidmanager1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/doubleclickbidmanager1/LICENSE.md +++ b/gen/doubleclickbidmanager1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/doubleclickbidmanager1/README.md b/gen/doubleclickbidmanager1/README.md index bd3c3bf0ae..e65e68883c 100644 --- a/gen/doubleclickbidmanager1/README.md +++ b/gen/doubleclickbidmanager1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-doubleclickbidmanager1` library allows access to all features of the *Google DoubleClick Bid Manager* service. -This documentation was generated from *DoubleClick Bid Manager* crate version *0.1.10+20150925*, where *20150925* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *DoubleClick Bid Manager* crate version *0.1.11+20160120*, where *20160120* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *DoubleClick Bid Manager* *v1* API can be found at the [official documentation site](https://developers.google.com/bid-manager/). @@ -19,6 +19,8 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [*createquery*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.QueryCreatequeryCall.html), [*deletequery*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.QueryDeletequeryCall.html), [*getquery*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.QueryGetqueryCall.html), [*listqueries*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.QueryListqueryCall.html) and [*runquery*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.QueryRunqueryCall.html) * [reports](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.Report.html) * [*listreports*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.ReportListreportCall.html) +* rubicon + * [*notifyproposalchange*](http://byron.github.io/google-apis-rs/google_doubleclickbidmanager1/struct.RubiconNotifyproposalchangeCall.html) diff --git a/gen/doubleclickbidmanager1/src/cmn.rs b/gen/doubleclickbidmanager1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/doubleclickbidmanager1/src/cmn.rs +++ b/gen/doubleclickbidmanager1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/doubleclickbidmanager1/src/lib.rs b/gen/doubleclickbidmanager1/src/lib.rs index eea7e0a582..eae595255c 100644 --- a/gen/doubleclickbidmanager1/src/lib.rs +++ b/gen/doubleclickbidmanager1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *DoubleClick Bid Manager* crate version *0.1.10+20150925*, where *20150925* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *DoubleClick Bid Manager* crate version *0.1.11+20160120*, where *20160120* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *DoubleClick Bid Manager* *v1* API can be found at the //! [official documentation site](https://developers.google.com/bid-manager/). @@ -17,6 +17,8 @@ //! * [*createquery*](struct.QueryCreatequeryCall.html), [*deletequery*](struct.QueryDeletequeryCall.html), [*getquery*](struct.QueryGetqueryCall.html), [*listqueries*](struct.QueryListqueryCall.html) and [*runquery*](struct.QueryRunqueryCall.html) //! * [reports](struct.Report.html) //! * [*listreports*](struct.ReportListreportCall.html) +//! * rubicon +//! * [*notifyproposalchange*](struct.RubiconNotifyproposalchangeCall.html) //! //! //! diff --git a/gen/doubleclickbidmanager1/src/lib.rs.in b/gen/doubleclickbidmanager1/src/lib.rs.in index e937fc72c8..e6eebc3364 100644 --- a/gen/doubleclickbidmanager1/src/lib.rs.in +++ b/gen/doubleclickbidmanager1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -104,7 +105,7 @@ impl<'a, C, A> DoubleClickBidManager DoubleClickBidManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -117,9 +118,12 @@ impl<'a, C, A> DoubleClickBidManager pub fn reports(&'a self) -> ReportMethods<'a, C, A> { ReportMethods { hub: &self } } + pub fn rubicon(&'a self) -> RubiconMethods<'a, C, A> { + RubiconMethods { hub: &self } + } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -133,6 +137,32 @@ impl<'a, C, A> DoubleClickBidManager // ############ // SCHEMAS ### // ########## +/// NotifyProposalChange request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [notifyproposalchange rubicon](struct.RubiconNotifyproposalchangeCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct NotifyProposalChangeRequest { + /// Action taken by publisher. One of: Accept, Decline, Append + pub action: Option, + /// Notes from publisher + pub notes: Option>, + /// URL to access proposal detail. + pub href: Option, + /// Below are contents of notification from Rubicon. Proposal id. + pub id: Option, + /// Deal token, available when proposal is accepted by publisher. + pub token: Option, +} + +impl RequestValue for NotifyProposalChangeRequest {} + + /// Request to fetch stored line items. /// /// # Activities @@ -198,6 +228,27 @@ pub struct Parameters { impl Part for Parameters {} +/// Publisher comment from Rubicon. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Note { + /// Publisher user name. + pub username: Option, + /// Equals "publisher" for notification from Rubicon. + pub source: Option, + /// Message from publisher. + pub message: Option, + /// Note id. + pub id: Option, + /// Time when the note was added, e.g. "2015-12-16T17:25:35.000-08:00". + pub timestamp: Option, +} + +impl Part for Note {} + + /// Key used to identify a report. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -574,6 +625,63 @@ impl Part for UploadStatus {} // MethodBuilders ### // ################# +/// A builder providing access to all methods supported on *rubicon* resources. +/// It is not used directly, but through the `DoubleClickBidManager` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_doubleclickbidmanager1 as doubleclickbidmanager1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use doubleclickbidmanager1::DoubleClickBidManager; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = DoubleClickBidManager::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `notifyproposalchange(...)` +/// // to build up your call. +/// let rb = hub.rubicon(); +/// # } +/// ``` +pub struct RubiconMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a DoubleClickBidManager, +} + +impl<'a, C, A> MethodsBuilder for RubiconMethods<'a, C, A> {} + +impl<'a, C, A> RubiconMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Update proposal upon actions of Rubicon publisher. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn notifyproposalchange(&self, request: NotifyProposalChangeRequest) -> RubiconNotifyproposalchangeCall<'a, C, A> { + RubiconNotifyproposalchangeCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *lineitem* resources. /// It is not used directly, but through the `DoubleClickBidManager` hub. /// @@ -828,6 +936,206 @@ impl<'a, C, A> QueryMethods<'a, C, A> { // CallBuilders ### // ################# +/// Update proposal upon actions of Rubicon publisher. +/// +/// A builder for the *notifyproposalchange* method supported by a *rubicon* resource. +/// It is not used directly, but through a `RubiconMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_doubleclickbidmanager1 as doubleclickbidmanager1; +/// use doubleclickbidmanager1::NotifyProposalChangeRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use doubleclickbidmanager1::DoubleClickBidManager; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = DoubleClickBidManager::new(hyper::Client::new(), 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 ! +/// let mut req = NotifyProposalChangeRequest::default(); +/// +/// // 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 ! +/// let result = hub.rubicon().notifyproposalchange(req) +/// .doit(); +/// # } +/// ``` +pub struct RubiconNotifyproposalchangeCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a DoubleClickBidManager, + _request: NotifyProposalChangeRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, +} + +impl<'a, C, A> CallBuilder for RubiconNotifyproposalchangeCall<'a, C, A> {} + +impl<'a, C, A> RubiconNotifyproposalchangeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "doubleclickbidmanager.rubicon.notifyproposalchange", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + for &field in [].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/doubleclickbidmanager/v1/rubicon/notifyproposalchange".to_string(); + + let mut key = self.hub.auth.borrow_mut().api_key(); + if key.is_none() { + key = dlg.api_key(); + } + match key { + Some(value) => params.push(("key", value)), + None => { + dlg.finished(false); + return Err(Error::MissingAPIKey) + } + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: NotifyProposalChangeRequest) -> RubiconNotifyproposalchangeCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RubiconNotifyproposalchangeCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RubiconNotifyproposalchangeCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + +} + + /// Uploads line items in CSV format. /// /// A builder for the *uploadlineitems* method supported by a *lineitem* resource. @@ -887,7 +1195,7 @@ impl<'a, C, A> LineitemUploadlineitemCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclickbidmanager.lineitems.uploadlineitems", + dlg.begin(MethodInfo { id: "doubleclickbidmanager.lineitems.uploadlineitems", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -916,14 +1224,14 @@ impl<'a, C, A> LineitemUploadlineitemCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -952,7 +1260,7 @@ impl<'a, C, A> LineitemUploadlineitemCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -962,10 +1270,10 @@ impl<'a, C, A> LineitemUploadlineitemCall<'a, C, A> where C: BorrowMut LineitemUploadlineitemCall<'a, C, A> where C: BorrowMut LineitemUploadlineitemCall<'a, C, A> { self._request = new_value; @@ -1015,12 +1323,12 @@ impl<'a, C, A> LineitemUploadlineitemCall<'a, C, A> where C: BorrowMut LineitemDownloadlineitemCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclickbidmanager.lineitems.downloadlineitems", + dlg.begin(MethodInfo { id: "doubleclickbidmanager.lineitems.downloadlineitems", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1127,14 +1435,14 @@ impl<'a, C, A> LineitemDownloadlineitemCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1163,7 +1471,7 @@ impl<'a, C, A> LineitemDownloadlineitemCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1173,10 +1481,10 @@ impl<'a, C, A> LineitemDownloadlineitemCall<'a, C, A> where C: BorrowMut LineitemDownloadlineitemCall<'a, C, A> where C: BorrowMut LineitemDownloadlineitemCall<'a, C, A> { self._request = new_value; @@ -1226,12 +1534,12 @@ impl<'a, C, A> LineitemDownloadlineitemCall<'a, C, A> where C: BorrowMut ReportListreportCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclickbidmanager.reports.listreports", + dlg.begin(MethodInfo { id: "doubleclickbidmanager.reports.listreports", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("queryId", self._query_id.to_string())); @@ -1354,7 +1662,7 @@ impl<'a, C, A> ReportListreportCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1375,7 +1683,7 @@ impl<'a, C, A> ReportListreportCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1385,10 +1693,10 @@ impl<'a, C, A> ReportListreportCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1421,7 +1729,7 @@ impl<'a, C, A> ReportListreportCall<'a, C, A> where C: BorrowMut, /// /// Sets the *query id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn query_id(mut self, new_value: &str) -> ReportListreportCall<'a, C, A> { self._query_id = new_value.to_string(); @@ -1439,12 +1747,12 @@ impl<'a, C, A> ReportListreportCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1515,7 +1823,7 @@ impl<'a, C, A> QueryListqueryCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclickbidmanager.queries.listqueries", + dlg.begin(MethodInfo { id: "doubleclickbidmanager.queries.listqueries", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1544,7 +1852,7 @@ impl<'a, C, A> QueryListqueryCall<'a, C, A> where C: BorrowMut, A } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1565,7 +1873,7 @@ impl<'a, C, A> QueryListqueryCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1575,10 +1883,10 @@ impl<'a, C, A> QueryListqueryCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1619,12 +1927,12 @@ impl<'a, C, A> QueryListqueryCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1696,7 +2004,7 @@ impl<'a, C, A> QueryGetqueryCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclickbidmanager.queries.getquery", + dlg.begin(MethodInfo { id: "doubleclickbidmanager.queries.getquery", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("queryId", self._query_id.to_string())); @@ -1747,7 +2055,7 @@ impl<'a, C, A> QueryGetqueryCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1768,7 +2076,7 @@ impl<'a, C, A> QueryGetqueryCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1778,10 +2086,10 @@ impl<'a, C, A> QueryGetqueryCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1814,7 +2122,7 @@ impl<'a, C, A> QueryGetqueryCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *query id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn query_id(mut self, new_value: &str) -> QueryGetqueryCall<'a, C, A> { self._query_id = new_value.to_string(); @@ -1832,12 +2140,12 @@ impl<'a, C, A> QueryGetqueryCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1915,7 +2223,7 @@ impl<'a, C, A> QueryCreatequeryCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclickbidmanager.queries.createquery", + dlg.begin(MethodInfo { id: "doubleclickbidmanager.queries.createquery", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1944,14 +2252,14 @@ impl<'a, C, A> QueryCreatequeryCall<'a, C, A> where C: BorrowMut, } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1980,7 +2288,7 @@ impl<'a, C, A> QueryCreatequeryCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1990,10 +2298,10 @@ impl<'a, C, A> QueryCreatequeryCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2025,7 +2333,7 @@ impl<'a, C, A> QueryCreatequeryCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Query) -> QueryCreatequeryCall<'a, C, A> { self._request = new_value; @@ -2043,12 +2351,12 @@ impl<'a, C, A> QueryCreatequeryCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2120,7 +2428,7 @@ impl<'a, C, A> QueryDeletequeryCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclickbidmanager.queries.deletequery", + dlg.begin(MethodInfo { id: "doubleclickbidmanager.queries.deletequery", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("queryId", self._query_id.to_string())); @@ -2170,7 +2478,7 @@ impl<'a, C, A> QueryDeletequeryCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2191,7 +2499,7 @@ impl<'a, C, A> QueryDeletequeryCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2201,10 +2509,10 @@ impl<'a, C, A> QueryDeletequeryCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2227,7 +2535,7 @@ impl<'a, C, A> QueryDeletequeryCall<'a, C, A> where C: BorrowMut, /// /// Sets the *query id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn query_id(mut self, new_value: &str) -> QueryDeletequeryCall<'a, C, A> { self._query_id = new_value.to_string(); @@ -2245,12 +2553,12 @@ impl<'a, C, A> QueryDeletequeryCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2329,7 +2637,7 @@ impl<'a, C, A> QueryRunqueryCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclickbidmanager.queries.runquery", + dlg.begin(MethodInfo { id: "doubleclickbidmanager.queries.runquery", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("queryId", self._query_id.to_string())); @@ -2379,14 +2687,14 @@ impl<'a, C, A> QueryRunqueryCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2415,7 +2723,7 @@ impl<'a, C, A> QueryRunqueryCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2425,10 +2733,10 @@ impl<'a, C, A> QueryRunqueryCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2450,7 +2758,7 @@ impl<'a, C, A> QueryRunqueryCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: RunQueryRequest) -> QueryRunqueryCall<'a, C, A> { self._request = new_value; @@ -2460,7 +2768,7 @@ impl<'a, C, A> QueryRunqueryCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *query id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn query_id(mut self, new_value: &str) -> QueryRunqueryCall<'a, C, A> { self._query_id = new_value.to_string(); @@ -2478,12 +2786,12 @@ impl<'a, C, A> QueryRunqueryCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/doubleclicksearch2-cli/Cargo.toml b/gen/doubleclicksearch2-cli/Cargo.toml index de5931355a..ab7a2ce4fc 100644 --- a/gen/doubleclicksearch2-cli/Cargo.toml +++ b/gen/doubleclicksearch2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclicksearch2-cli" -version = "0.3.2+20151006" +version = "0.3.3+20160120" authors = ["Sebastian Thiel "] description = "A complete library to interact with doubleclicksearch (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclicksearch2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/doubleclicksearch2-cli/LICENSE.md b/gen/doubleclicksearch2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/doubleclicksearch2-cli/LICENSE.md +++ b/gen/doubleclicksearch2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/doubleclicksearch2-cli/README.md b/gen/doubleclicksearch2-cli/README.md index 3e2b95acfb..ec223a3890 100644 --- a/gen/doubleclicksearch2-cli/README.md +++ b/gen/doubleclicksearch2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *doubleclicksearch* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/doubleclicksearch2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/doubleclicksearch2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/doubleclicksearch2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/doubleclicksearch2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclicksearch2-cli). # Usage -This documentation was generated from the *doubleclicksearch* API at revision *20151006*. The CLI is at version *0.3.2*. +This documentation was generated from the *doubleclicksearch* API at revision *20160120*. The CLI is at version *0.3.3*. ```bash doubleclicksearch2 [options] @@ -45,18 +45,18 @@ doubleclicksearch2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/doubleclicksearch2-cli/mkdocs.yml b/gen/doubleclicksearch2-cli/mkdocs.yml index 9d8cbe9b7b..f07f71cdcd 100644 --- a/gen/doubleclicksearch2-cli/mkdocs.yml +++ b/gen/doubleclicksearch2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: doubleclicksearch v0.3.2+20151006 +site_name: doubleclicksearch v0.3.3+20160120 site_url: http://byron.github.io/google-apis-rs/google-doubleclicksearch2-cli site_description: Write integrating applications with bcore @@ -22,5 +22,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/doubleclicksearch2-cli/src/main.rs b/gen/doubleclicksearch2-cli/src/main.rs index d8cc91bebc..f788cee983 100644 --- a/gen/doubleclicksearch2-cli/src/main.rs +++ b/gen/doubleclicksearch2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,23 +36,23 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Doubleclicksearch>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _conversion_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _conversion_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let end_date: i32 = arg_from_str(&opt.value_of("end-date").unwrap_or(""), err, "", "integer"); let row_count: i32 = arg_from_str(&opt.value_of("row-count").unwrap_or(""), err, "", "integer"); let start_date: i32 = arg_from_str(&opt.value_of("start-date").unwrap_or(""), err, "", "integer"); let start_row: u32 = arg_from_str(&opt.value_of("start-row").unwrap_or(""), err, "", "integer"); let mut call = self.hub.conversion().get(opt.value_of("agency-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or(""), opt.value_of("engine-account-id").unwrap_or(""), end_date, row_count, start_date, start_row); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "criterion-id" => { @@ -77,7 +77,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ad-group-id", "ad-id", "criterion-id", "campaign-id"].iter().map(|v|*v)); @@ -91,7 +91,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -114,13 +114,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _conversion_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _conversion_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -134,8 +134,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -150,7 +150,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ConversionList = json::value::from_value(object).unwrap(); let mut call = self.hub.conversion().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -163,7 +163,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -176,7 +176,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -199,13 +199,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _conversion_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _conversion_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -219,8 +219,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -239,7 +239,7 @@ impl<'n, 'a> Engine<'n, 'a> { let start_date: i32 = arg_from_str(&opt.value_of("start-date").unwrap_or(""), err, "", "integer"); let start_row: u32 = arg_from_str(&opt.value_of("start-row").unwrap_or(""), err, "", "integer"); let mut call = self.hub.conversion().patch(request, opt.value_of("advertiser-id").unwrap_or(""), opt.value_of("agency-id").unwrap_or(""), end_date, opt.value_of("engine-account-id").unwrap_or(""), row_count, start_date, start_row); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -252,7 +252,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -265,7 +265,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -288,13 +288,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _conversion_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _conversion_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -308,8 +308,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -324,7 +324,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ConversionList = json::value::from_value(object).unwrap(); let mut call = self.hub.conversion().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -337,7 +337,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -350,7 +350,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -373,13 +373,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _conversion_update_availability(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _conversion_update_availability(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -393,8 +393,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -408,7 +408,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UpdateAvailabilityRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.conversion().update_availability(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -421,7 +421,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -434,7 +434,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -457,13 +457,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -477,8 +477,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "report-scope.ad-group-id" => Some(("reportScope.adGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "report-scope.agency-id" => Some(("reportScope.agencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -512,7 +512,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ReportRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.reports().generate(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -525,7 +525,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -538,7 +538,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -561,10 +561,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().get(opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -577,7 +577,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -590,7 +590,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -613,12 +613,12 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_get_file(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_get_file(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let report_fragment: i32 = arg_from_str(&opt.value_of("report-fragment").unwrap_or(""), err, "", "integer"); let mut download_mode = false; let mut call = self.hub.reports().get_file(opt.value_of("report-id").unwrap_or(""), report_fragment); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -634,7 +634,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -647,7 +647,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -671,13 +671,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_request(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_request(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -691,8 +691,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "report-scope.ad-group-id" => Some(("reportScope.adGroupId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "report-scope.agency-id" => Some(("reportScope.agencyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -726,7 +726,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ReportRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.reports().request(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -739,7 +739,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -752,7 +752,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -775,10 +775,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _saved_columns_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _saved_columns_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.saved_columns().list(opt.value_of("agency-id").unwrap_or(""), opt.value_of("advertiser-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -791,7 +791,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -804,7 +804,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -903,14 +903,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "doubleclicksearch2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "doubleclicksearch2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -930,7 +930,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -969,7 +969,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("conversion", "methods: 'get', 'insert', 'patch', 'update' and 'update-availability'", vec![ - ("get", + ("get", Some(r##"Retrieves a list of conversions from a DoubleClick Search engine account."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli/conversion_get", vec![ @@ -1027,7 +1027,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a batch of new conversions into DoubleClick Search."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli/conversion_insert", vec![ @@ -1049,7 +1049,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a batch of conversions in DoubleClick Search. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli/conversion_patch", vec![ @@ -1113,7 +1113,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a batch of conversions in DoubleClick Search."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli/conversion_update", vec![ @@ -1135,7 +1135,7 @@ fn main() { Some(false), Some(false)), ]), - ("update-availability", + ("update-availability", Some(r##"Updates the availabilities of a batch of floodlight activities in DoubleClick Search."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli/conversion_update-availability", vec![ @@ -1160,7 +1160,7 @@ fn main() { ]), ("reports", "methods: 'generate', 'get', 'get-file' and 'request'", vec![ - ("generate", + ("generate", Some(r##"Generates and returns a report immediately."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli/reports_generate", vec![ @@ -1182,7 +1182,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Polls for the status of a report request."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli/reports_get", vec![ @@ -1204,7 +1204,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-file", + ("get-file", Some(r##"Downloads a report file encoded in UTF-8."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli/reports_get-file", vec![ @@ -1232,7 +1232,7 @@ fn main() { Some(false), Some(false)), ]), - ("request", + ("request", Some(r##"Inserts a report request into the reporting system."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli/reports_request", vec![ @@ -1257,7 +1257,7 @@ fn main() { ]), ("saved-columns", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieve the list of saved columns for a specified advertiser."##), "Details at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli/saved-columns_list", vec![ @@ -1291,7 +1291,7 @@ fn main() { let mut app = App::new("doubleclicksearch2") .author("Sebastian Thiel ") - .version("0.3.2+20151006") + .version("0.3.3+20160120") .about("Report and modify your advertising data in DoubleClick Search (for example, campaigns, ad groups, keywords, and conversions).") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_doubleclicksearch2_cli") .arg(Arg::with_name("url") @@ -1315,7 +1315,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1326,7 +1326,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/doubleclicksearch2/Cargo.toml b/gen/doubleclicksearch2/Cargo.toml index 5b9653c6fc..bf7f9fe387 100644 --- a/gen/doubleclicksearch2/Cargo.toml +++ b/gen/doubleclicksearch2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclicksearch2" -version = "0.1.10+20151006" +version = "0.1.11+20160120" authors = ["Sebastian Thiel "] description = "A complete library to interact with doubleclicksearch (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/doubleclicksearch2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/doubleclicksearch2/LICENSE.md b/gen/doubleclicksearch2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/doubleclicksearch2/LICENSE.md +++ b/gen/doubleclicksearch2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/doubleclicksearch2/README.md b/gen/doubleclicksearch2/README.md index 9f572bc2a7..d3dc74a439 100644 --- a/gen/doubleclicksearch2/README.md +++ b/gen/doubleclicksearch2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-doubleclicksearch2` library allows access to all features of the *Google doubleclicksearch* service. -This documentation was generated from *doubleclicksearch* crate version *0.1.10+20151006*, where *20151006* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *doubleclicksearch* crate version *0.1.11+20160120*, where *20160120* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *doubleclicksearch* *v2* API can be found at the [official documentation site](https://developers.google.com/doubleclick-search/). diff --git a/gen/doubleclicksearch2/src/cmn.rs b/gen/doubleclicksearch2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/doubleclicksearch2/src/cmn.rs +++ b/gen/doubleclicksearch2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/doubleclicksearch2/src/lib.rs b/gen/doubleclicksearch2/src/lib.rs index 8be02aba07..a9296f0667 100644 --- a/gen/doubleclicksearch2/src/lib.rs +++ b/gen/doubleclicksearch2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *doubleclicksearch* crate version *0.1.10+20151006*, where *20151006* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *doubleclicksearch* crate version *0.1.11+20160120*, where *20160120* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *doubleclicksearch* *v2* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-search/). diff --git a/gen/doubleclicksearch2/src/lib.rs.in b/gen/doubleclicksearch2/src/lib.rs.in index 2706fa082f..c7030c35d4 100644 --- a/gen/doubleclicksearch2/src/lib.rs.in +++ b/gen/doubleclicksearch2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -126,7 +127,7 @@ impl<'a, C, A> Doubleclicksearch Doubleclicksearch { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -141,7 +142,7 @@ impl<'a, C, A> Doubleclicksearch } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -203,7 +204,7 @@ pub struct Conversion { /// DS campaign ID. #[serde(rename="campaignId")] pub campaign_id: Option, - /// The revenue amount of this TRANSACTION conversion, in micros. + /// The revenue amount of this TRANSACTION conversion, in micros (value multiplied by 1000, no decimal). For example, to specify a revenue value of "10" enter "10000" in your request. #[serde(rename="revenueMicros")] pub revenue_micros: Option, /// DS advertiser ID. @@ -235,7 +236,7 @@ pub struct Conversion { /// DS ad ID. #[serde(rename="adId")] pub ad_id: Option, - /// For offline conversions, this is an ID provided by advertisers. Advertisers can use this property to specify an ID that is meaningful to them. If an advertiser doesn't specify a conversionId, DoubleClick Search generates one. For online conversions, DS copies the dsConversionId or floodlightOrderId into this property depending on the advertiser's Floodlight instructions. + /// For offline conversions, this is an ID that advertisers are required to provide. Advertisers can specify any ID that is meaningful to them. For online conversions, DS copies the dsConversionId or floodlightOrderId into this property depending on the advertiser's Floodlight instructions. #[serde(rename="conversionId")] pub conversion_id: Option, /// The time at which the conversion was last modified, in epoch millis UTC. @@ -399,7 +400,9 @@ pub struct ReportApiColumnSpec { /// Synchronous report only. Set to true to group by this column. Defaults to false. #[serde(rename="groupByColumn")] pub group_by_column: Option, - /// Provide different source for product items. Acceptable values are "advertised" and "sold". + /// Returns metrics only for a specific type of product activity. Accepted values are: + /// - "sold": returns metrics only for products that were sold + /// - "advertised": returns metrics only for products that were advertised in a Shopping campaign, and that might or might not have been sold #[serde(rename="productReportPerspective")] pub product_report_perspective: Option, /// Inclusive day in YYYY-MM-DD format. When provided, this overrides the overall time range of the report for this column only. Must be provided together with startDate. @@ -1086,7 +1089,7 @@ impl<'a, C, A> ConversionInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclicksearch.conversion.insert", + dlg.begin(MethodInfo { id: "doubleclicksearch.conversion.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1106,14 +1109,14 @@ impl<'a, C, A> ConversionInsertCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1157,7 +1160,7 @@ impl<'a, C, A> ConversionInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1167,10 +1170,10 @@ impl<'a, C, A> ConversionInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1202,7 +1205,7 @@ impl<'a, C, A> ConversionInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ConversionList) -> ConversionInsertCall<'a, C, A> { self._request = new_value; @@ -1220,12 +1223,12 @@ impl<'a, C, A> ConversionInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1242,17 +1245,17 @@ impl<'a, C, A> ConversionInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ConversionInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ConversionInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1328,7 +1331,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclicksearch.conversion.get", + dlg.begin(MethodInfo { id: "doubleclicksearch.conversion.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("agencyId", self._agency_id.to_string())); @@ -1388,7 +1391,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1424,7 +1427,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1434,10 +1437,10 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1470,7 +1473,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *agency id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn agency_id(mut self, new_value: &str) -> ConversionGetCall<'a, C, A> { self._agency_id = new_value.to_string(); @@ -1480,7 +1483,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *advertiser id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn advertiser_id(mut self, new_value: &str) -> ConversionGetCall<'a, C, A> { self._advertiser_id = new_value.to_string(); @@ -1490,7 +1493,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *engine account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn engine_account_id(mut self, new_value: &str) -> ConversionGetCall<'a, C, A> { self._engine_account_id = new_value.to_string(); @@ -1500,7 +1503,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *end date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn end_date(mut self, new_value: i32) -> ConversionGetCall<'a, C, A> { self._end_date = new_value; @@ -1510,7 +1513,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *row count* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn row_count(mut self, new_value: i32) -> ConversionGetCall<'a, C, A> { self._row_count = new_value; @@ -1520,7 +1523,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *start date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn start_date(mut self, new_value: i32) -> ConversionGetCall<'a, C, A> { self._start_date = new_value; @@ -1530,7 +1533,7 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *start row* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn start_row(mut self, new_value: u32) -> ConversionGetCall<'a, C, A> { self._start_row = new_value; @@ -1576,12 +1579,12 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1598,17 +1601,17 @@ impl<'a, C, A> ConversionGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ConversionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ConversionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1676,7 +1679,7 @@ impl<'a, C, A> ConversionUpdateAvailabilityCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclicksearch.conversion.updateAvailability", + dlg.begin(MethodInfo { id: "doubleclicksearch.conversion.updateAvailability", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1696,14 +1699,14 @@ impl<'a, C, A> ConversionUpdateAvailabilityCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1747,7 +1750,7 @@ impl<'a, C, A> ConversionUpdateAvailabilityCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1757,10 +1760,10 @@ impl<'a, C, A> ConversionUpdateAvailabilityCall<'a, C, A> where C: BorrowMut ConversionUpdateAvailabilityCall<'a, C, A> where C: BorrowMut ConversionUpdateAvailabilityCall<'a, C, A> { self._request = new_value; @@ -1810,12 +1813,12 @@ impl<'a, C, A> ConversionUpdateAvailabilityCall<'a, C, A> where C: BorrowMut ConversionUpdateAvailabilityCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ConversionUpdateAvailabilityCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ConversionUpdateAvailabilityCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1917,7 +1920,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclicksearch.conversion.patch", + dlg.begin(MethodInfo { id: "doubleclicksearch.conversion.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("advertiserId", self._advertiser_id.to_string())); @@ -1944,14 +1947,14 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1995,7 +1998,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2005,10 +2008,10 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2040,7 +2043,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ConversionList) -> ConversionPatchCall<'a, C, A> { self._request = new_value; @@ -2050,7 +2053,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *advertiser id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn advertiser_id(mut self, new_value: &str) -> ConversionPatchCall<'a, C, A> { self._advertiser_id = new_value.to_string(); @@ -2060,7 +2063,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *agency id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn agency_id(mut self, new_value: &str) -> ConversionPatchCall<'a, C, A> { self._agency_id = new_value.to_string(); @@ -2070,7 +2073,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *end date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn end_date(mut self, new_value: i32) -> ConversionPatchCall<'a, C, A> { self._end_date = new_value; @@ -2080,7 +2083,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *engine account id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn engine_account_id(mut self, new_value: &str) -> ConversionPatchCall<'a, C, A> { self._engine_account_id = new_value.to_string(); @@ -2090,7 +2093,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *row count* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn row_count(mut self, new_value: i32) -> ConversionPatchCall<'a, C, A> { self._row_count = new_value; @@ -2100,7 +2103,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *start date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn start_date(mut self, new_value: i32) -> ConversionPatchCall<'a, C, A> { self._start_date = new_value; @@ -2110,7 +2113,7 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *start row* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn start_row(mut self, new_value: u32) -> ConversionPatchCall<'a, C, A> { self._start_row = new_value; @@ -2128,12 +2131,12 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2150,17 +2153,17 @@ impl<'a, C, A> ConversionPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ConversionPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ConversionPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2228,7 +2231,7 @@ impl<'a, C, A> ConversionUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclicksearch.conversion.update", + dlg.begin(MethodInfo { id: "doubleclicksearch.conversion.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2248,14 +2251,14 @@ impl<'a, C, A> ConversionUpdateCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2299,7 +2302,7 @@ impl<'a, C, A> ConversionUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2309,10 +2312,10 @@ impl<'a, C, A> ConversionUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2344,7 +2347,7 @@ impl<'a, C, A> ConversionUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ConversionList) -> ConversionUpdateCall<'a, C, A> { self._request = new_value; @@ -2362,12 +2365,12 @@ impl<'a, C, A> ConversionUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2384,17 +2387,17 @@ impl<'a, C, A> ConversionUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ConversionUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ConversionUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2457,7 +2460,7 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclicksearch.savedColumns.list", + dlg.begin(MethodInfo { id: "doubleclicksearch.savedColumns.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("agencyId", self._agency_id.to_string())); @@ -2500,7 +2503,7 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2536,7 +2539,7 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2546,10 +2549,10 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2582,7 +2585,7 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *agency id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn agency_id(mut self, new_value: &str) -> SavedColumnListCall<'a, C, A> { self._agency_id = new_value.to_string(); @@ -2592,7 +2595,7 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *advertiser id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn advertiser_id(mut self, new_value: &str) -> SavedColumnListCall<'a, C, A> { self._advertiser_id = new_value.to_string(); @@ -2610,12 +2613,12 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2632,17 +2635,17 @@ impl<'a, C, A> SavedColumnListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SavedColumnListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SavedColumnListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2708,7 +2711,7 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclicksearch.reports.getFile", + dlg.begin(MethodInfo { id: "doubleclicksearch.reports.getFile", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("reportId", self._report_id.to_string())); @@ -2750,7 +2753,7 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2786,7 +2789,7 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2796,10 +2799,10 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2822,7 +2825,7 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportGetFileCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -2832,7 +2835,7 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *report fragment* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_fragment(mut self, new_value: i32) -> ReportGetFileCall<'a, C, A> { self._report_fragment = new_value; @@ -2850,12 +2853,12 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2872,17 +2875,17 @@ impl<'a, C, A> ReportGetFileCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportGetFileCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportGetFileCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2950,7 +2953,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclicksearch.reports.generate", + dlg.begin(MethodInfo { id: "doubleclicksearch.reports.generate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2970,14 +2973,14 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3021,7 +3024,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3031,10 +3034,10 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3066,7 +3069,7 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ReportRequest) -> ReportGenerateCall<'a, C, A> { self._request = new_value; @@ -3084,12 +3087,12 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3106,17 +3109,17 @@ impl<'a, C, A> ReportGenerateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportGenerateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportGenerateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3178,7 +3181,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclicksearch.reports.get", + dlg.begin(MethodInfo { id: "doubleclicksearch.reports.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("reportId", self._report_id.to_string())); @@ -3220,7 +3223,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3256,7 +3259,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3266,10 +3269,10 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3302,7 +3305,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -3320,12 +3323,12 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3342,17 +3345,17 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3420,7 +3423,7 @@ impl<'a, C, A> ReportRequestCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "doubleclicksearch.reports.request", + dlg.begin(MethodInfo { id: "doubleclicksearch.reports.request", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3440,14 +3443,14 @@ impl<'a, C, A> ReportRequestCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3491,7 +3494,7 @@ impl<'a, C, A> ReportRequestCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3501,10 +3504,10 @@ impl<'a, C, A> ReportRequestCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3536,7 +3539,7 @@ impl<'a, C, A> ReportRequestCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ReportRequest) -> ReportRequestCall<'a, C, A> { self._request = new_value; @@ -3554,12 +3557,12 @@ impl<'a, C, A> ReportRequestCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3576,17 +3579,17 @@ impl<'a, C, A> ReportRequestCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportRequestCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportRequestCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/drive2-cli/Cargo.toml b/gen/drive2-cli/Cargo.toml index 64a99c03cc..6bc36b7c67 100644 --- a/gen/drive2-cli/Cargo.toml +++ b/gen/drive2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive2-cli" -version = "0.3.2+20151008" +version = "0.3.3+20160126" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/drive2-cli/LICENSE.md b/gen/drive2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/drive2-cli/LICENSE.md +++ b/gen/drive2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/drive2-cli/README.md b/gen/drive2-cli/README.md index 0d47c5700d..691f95e6cd 100644 --- a/gen/drive2-cli/README.md +++ b/gen/drive2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *drive* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/drive2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/drive2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/drive2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/drive2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/drive2-cli). # Usage -This documentation was generated from the *drive* API at revision *20151008*. The CLI is at version *0.3.2*. +This documentation was generated from the *drive* API at revision *20160126*. The CLI is at version *0.3.3*. ```bash drive2 [options] @@ -105,18 +105,18 @@ drive2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/drive2-cli/mkdocs.yml b/gen/drive2-cli/mkdocs.yml index ca59cb8586..56646e04d9 100644 --- a/gen/drive2-cli/mkdocs.yml +++ b/gen/drive2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: drive v0.3.2+20151008 +site_name: drive v0.3.3+20160126 site_url: http://byron.github.io/google-apis-rs/google-drive2-cli site_description: Write integrating applications with bcore @@ -72,5 +72,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/drive2-cli/src/main.rs b/gen/drive2-cli/src/main.rs index 7b23d1248b..82179ec97c 100644 --- a/gen/drive2-cli/src/main.rs +++ b/gen/drive2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Drive>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _about_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _about_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.about().get(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-change-id" => { @@ -70,7 +70,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-subscribed", "max-change-id-count", "start-change-id"].iter().map(|v|*v)); @@ -84,7 +84,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -107,10 +107,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().get(opt.value_of("app-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -123,7 +123,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -136,7 +136,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -159,10 +159,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _apps_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _apps_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.apps().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language-code" => { @@ -184,7 +184,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language-code", "app-filter-extensions", "app-filter-mime-types"].iter().map(|v|*v)); @@ -198,7 +198,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -221,10 +221,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _changes_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _changes_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.changes().get(opt.value_of("change-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -237,7 +237,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -250,7 +250,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -273,10 +273,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _changes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _changes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.changes().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-change-id" => { @@ -307,7 +307,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-subscribed", "include-deleted", "max-results", "page-token", "spaces", "start-change-id"].iter().map(|v|*v)); @@ -321,7 +321,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -344,13 +344,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _changes_watch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _changes_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -364,8 +364,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -389,7 +389,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.changes().watch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-change-id" => { @@ -420,7 +420,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-subscribed", "include-deleted", "max-results", "page-token", "spaces", "start-change-id"].iter().map(|v|*v)); @@ -434,7 +434,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -457,13 +457,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channels_stop(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channels_stop(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -477,8 +477,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -502,7 +502,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.channels().stop(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -515,7 +515,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -528,7 +528,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -543,10 +543,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _children_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _children_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.children().delete(opt.value_of("folder-id").unwrap_or(""), opt.value_of("child-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -559,7 +559,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -572,7 +572,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -587,10 +587,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _children_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _children_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.children().get(opt.value_of("folder-id").unwrap_or(""), opt.value_of("child-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -603,7 +603,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -616,7 +616,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -639,13 +639,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _children_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _children_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -659,8 +659,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "child-link" => Some(("childLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -678,7 +678,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ChildReference = json::value::from_value(object).unwrap(); let mut call = self.hub.children().insert(request, opt.value_of("folder-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -691,7 +691,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -704,7 +704,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -727,10 +727,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _children_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _children_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.children().list(opt.value_of("folder-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "q" => { @@ -755,7 +755,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["q", "page-token", "max-results", "order-by"].iter().map(|v|*v)); @@ -769,7 +769,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -792,10 +792,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().delete(opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -808,7 +808,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -821,7 +821,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -836,10 +836,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().get(opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "include-deleted" => { @@ -855,7 +855,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-deleted"].iter().map(|v|*v)); @@ -869,7 +869,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -892,13 +892,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -912,8 +912,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -947,7 +947,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Comment = json::value::from_value(object).unwrap(); let mut call = self.hub.comments().insert(request, opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -960,7 +960,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -973,7 +973,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -996,10 +996,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().list(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "updated-min" => { @@ -1024,7 +1024,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["updated-min", "include-deleted", "max-results", "page-token"].iter().map(|v|*v)); @@ -1038,7 +1038,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1061,13 +1061,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1081,8 +1081,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1116,7 +1116,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Comment = json::value::from_value(object).unwrap(); let mut call = self.hub.comments().patch(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1129,7 +1129,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1142,7 +1142,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1165,13 +1165,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1185,8 +1185,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1220,7 +1220,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Comment = json::value::from_value(object).unwrap(); let mut call = self.hub.comments().update(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1233,7 +1233,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1246,7 +1246,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1269,13 +1269,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_copy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_copy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1289,8 +1289,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1408,7 +1408,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::File = json::value::from_value(object).unwrap(); let mut call = self.hub.files().copy(request, opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "visibility" => { @@ -1442,7 +1442,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["convert", "ocr-language", "visibility", "pinned", "ocr", "timed-text-track-name", "timed-text-language"].iter().map(|v|*v)); @@ -1456,7 +1456,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1479,10 +1479,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.files().delete(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1495,7 +1495,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1508,7 +1508,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1523,10 +1523,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_empty_trash(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_empty_trash(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.files().empty_trash(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1539,7 +1539,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1552,7 +1552,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1567,10 +1567,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_generate_ids(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_generate_ids(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.files().generate_ids(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "space" => { @@ -1589,7 +1589,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["max-results", "space"].iter().map(|v|*v)); @@ -1603,7 +1603,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1626,11 +1626,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.files().get(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "update-viewed-date" => { @@ -1658,7 +1658,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["revision-id", "update-viewed-date", "acknowledge-abuse", "projection"].iter().map(|v|*v)); @@ -1672,7 +1672,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1700,13 +1700,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1720,8 +1720,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1839,7 +1839,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::File = json::value::from_value(object).unwrap(); let mut call = self.hub.files().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "visibility" => { @@ -1876,7 +1876,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["convert", "use-content-as-indexable-text", "ocr-language", "visibility", "pinned", "ocr", "timed-text-track-name", "timed-text-language"].iter().map(|v|*v)); @@ -1885,7 +1885,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1893,7 +1893,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1917,10 +1917,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.files().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "spaces" => { @@ -1954,7 +1954,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "projection", "max-results", "q", "page-token", "spaces", "corpus"].iter().map(|v|*v)); @@ -1968,7 +1968,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1991,13 +1991,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2011,8 +2011,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2130,7 +2130,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::File = json::value::from_value(object).unwrap(); let mut call = self.hub.files().patch(request, opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "use-content-as-indexable-text" => { @@ -2182,7 +2182,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["add-parents", "convert", "ocr", "set-modified-date", "modified-date-behavior", "use-content-as-indexable-text", "ocr-language", "new-revision", "pinned", "remove-parents", "update-viewed-date", "timed-text-track-name", "timed-text-language"].iter().map(|v|*v)); @@ -2196,7 +2196,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2219,10 +2219,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_touch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_touch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.files().touch(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2235,7 +2235,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2248,7 +2248,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2271,10 +2271,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_trash(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_trash(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.files().trash(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2287,7 +2287,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2300,7 +2300,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2323,10 +2323,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_untrash(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_untrash(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.files().untrash(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2339,7 +2339,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2352,7 +2352,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2375,13 +2375,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2395,8 +2395,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "last-viewed-by-me-date" => Some(("lastViewedByMeDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2514,7 +2514,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::File = json::value::from_value(object).unwrap(); let mut call = self.hub.files().update(request, opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "use-content-as-indexable-text" => { @@ -2566,7 +2566,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["add-parents", "convert", "ocr", "set-modified-date", "modified-date-behavior", "use-content-as-indexable-text", "ocr-language", "new-revision", "pinned", "remove-parents", "update-viewed-date", "timed-text-track-name", "timed-text-language"].iter().map(|v|*v)); @@ -2575,7 +2575,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -2583,7 +2583,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2607,13 +2607,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _files_watch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _files_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2627,8 +2627,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2653,7 +2653,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut download_mode = false; let mut call = self.hub.files().watch(request, opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "update-viewed-date" => { @@ -2681,7 +2681,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["revision-id", "update-viewed-date", "acknowledge-abuse", "projection"].iter().map(|v|*v)); @@ -2695,7 +2695,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2723,10 +2723,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _parents_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _parents_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.parents().delete(opt.value_of("file-id").unwrap_or(""), opt.value_of("parent-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2739,7 +2739,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2752,7 +2752,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2767,10 +2767,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _parents_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _parents_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.parents().get(opt.value_of("file-id").unwrap_or(""), opt.value_of("parent-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2783,7 +2783,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2796,7 +2796,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2819,13 +2819,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _parents_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _parents_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2839,8 +2839,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2859,7 +2859,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ParentReference = json::value::from_value(object).unwrap(); let mut call = self.hub.parents().insert(request, opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2872,7 +2872,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2885,7 +2885,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2908,10 +2908,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _parents_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _parents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.parents().list(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2924,7 +2924,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2937,7 +2937,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2960,10 +2960,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _permissions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _permissions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.permissions().delete(opt.value_of("file-id").unwrap_or(""), opt.value_of("permission-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2976,7 +2976,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2989,7 +2989,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3004,10 +3004,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _permissions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.permissions().get(opt.value_of("file-id").unwrap_or(""), opt.value_of("permission-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3020,7 +3020,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3033,7 +3033,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3056,10 +3056,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _permissions_get_id_for_email(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _permissions_get_id_for_email(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.permissions().get_id_for_email(opt.value_of("email").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3072,7 +3072,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3085,7 +3085,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3108,13 +3108,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _permissions_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _permissions_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3128,8 +3128,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "with-link" => Some(("withLink", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3157,7 +3157,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Permission = json::value::from_value(object).unwrap(); let mut call = self.hub.permissions().insert(request, opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "send-notification-emails" => { @@ -3176,7 +3176,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["email-message", "send-notification-emails"].iter().map(|v|*v)); @@ -3190,7 +3190,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3213,10 +3213,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.permissions().list(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3229,7 +3229,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3242,7 +3242,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3265,13 +3265,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _permissions_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _permissions_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3285,8 +3285,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "with-link" => Some(("withLink", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3314,7 +3314,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Permission = json::value::from_value(object).unwrap(); let mut call = self.hub.permissions().patch(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("permission-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "transfer-ownership" => { @@ -3330,7 +3330,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["transfer-ownership"].iter().map(|v|*v)); @@ -3344,7 +3344,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3367,13 +3367,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _permissions_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _permissions_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3387,8 +3387,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "with-link" => Some(("withLink", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3416,7 +3416,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Permission = json::value::from_value(object).unwrap(); let mut call = self.hub.permissions().update(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("permission-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "transfer-ownership" => { @@ -3432,7 +3432,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["transfer-ownership"].iter().map(|v|*v)); @@ -3446,7 +3446,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3469,10 +3469,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _properties_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _properties_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.properties().delete(opt.value_of("file-id").unwrap_or(""), opt.value_of("property-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "visibility" => { @@ -3488,7 +3488,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["visibility"].iter().map(|v|*v)); @@ -3502,7 +3502,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3517,10 +3517,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _properties_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _properties_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.properties().get(opt.value_of("file-id").unwrap_or(""), opt.value_of("property-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "visibility" => { @@ -3536,7 +3536,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["visibility"].iter().map(|v|*v)); @@ -3550,7 +3550,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3573,13 +3573,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _properties_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _properties_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3593,8 +3593,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3614,7 +3614,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Property = json::value::from_value(object).unwrap(); let mut call = self.hub.properties().insert(request, opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3627,7 +3627,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3640,7 +3640,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3663,10 +3663,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _properties_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _properties_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.properties().list(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3679,7 +3679,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3692,7 +3692,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3715,13 +3715,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _properties_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _properties_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3735,8 +3735,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3756,7 +3756,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Property = json::value::from_value(object).unwrap(); let mut call = self.hub.properties().patch(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("property-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "visibility" => { @@ -3772,7 +3772,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["visibility"].iter().map(|v|*v)); @@ -3786,7 +3786,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3809,13 +3809,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _properties_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _properties_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3829,8 +3829,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "value" => Some(("value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3850,7 +3850,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Property = json::value::from_value(object).unwrap(); let mut call = self.hub.properties().update(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("property-key").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "visibility" => { @@ -3866,7 +3866,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["visibility"].iter().map(|v|*v)); @@ -3880,7 +3880,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3903,11 +3903,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _realtime_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _realtime_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.realtime().get(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "revision" => { @@ -3926,7 +3926,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["revision"].iter().map(|v|*v)); @@ -3940,7 +3940,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3964,10 +3964,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _realtime_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _realtime_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.realtime().update(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "base-revision" => { @@ -3983,7 +3983,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["base-revision"].iter().map(|v|*v)); @@ -3992,7 +3992,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -4000,7 +4000,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4016,10 +4016,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _replies_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _replies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.replies().delete(opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or(""), opt.value_of("reply-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4032,7 +4032,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4045,7 +4045,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4060,10 +4060,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _replies_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _replies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.replies().get(opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or(""), opt.value_of("reply-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "include-deleted" => { @@ -4079,7 +4079,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["include-deleted"].iter().map(|v|*v)); @@ -4093,7 +4093,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4116,13 +4116,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _replies_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _replies_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4136,8 +4136,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "author.picture.url" => Some(("author.picture.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4165,7 +4165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CommentReply = json::value::from_value(object).unwrap(); let mut call = self.hub.replies().insert(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4178,7 +4178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4191,7 +4191,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4214,10 +4214,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _replies_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _replies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.replies().list(opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -4239,7 +4239,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "include-deleted", "max-results"].iter().map(|v|*v)); @@ -4253,7 +4253,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4276,13 +4276,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _replies_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _replies_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4296,8 +4296,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "author.picture.url" => Some(("author.picture.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4325,7 +4325,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CommentReply = json::value::from_value(object).unwrap(); let mut call = self.hub.replies().patch(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or(""), opt.value_of("reply-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4338,7 +4338,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4351,7 +4351,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4374,13 +4374,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _replies_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _replies_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4394,8 +4394,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "author.picture.url" => Some(("author.picture.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4423,7 +4423,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CommentReply = json::value::from_value(object).unwrap(); let mut call = self.hub.replies().update(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or(""), opt.value_of("reply-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4436,7 +4436,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4449,7 +4449,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4472,10 +4472,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _revisions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _revisions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.revisions().delete(opt.value_of("file-id").unwrap_or(""), opt.value_of("revision-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4488,7 +4488,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4501,7 +4501,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4516,10 +4516,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _revisions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _revisions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.revisions().get(opt.value_of("file-id").unwrap_or(""), opt.value_of("revision-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4532,7 +4532,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4545,7 +4545,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4568,10 +4568,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _revisions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _revisions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.revisions().list(opt.value_of("file-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4584,7 +4584,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4597,7 +4597,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4620,13 +4620,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _revisions_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _revisions_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4640,8 +4640,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "pinned" => Some(("pinned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -4678,7 +4678,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Revision = json::value::from_value(object).unwrap(); let mut call = self.hub.revisions().patch(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("revision-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4691,7 +4691,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4704,7 +4704,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4727,13 +4727,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _revisions_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _revisions_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4747,8 +4747,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "pinned" => Some(("pinned", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -4785,7 +4785,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Revision = json::value::from_value(object).unwrap(); let mut call = self.hub.revisions().update(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("revision-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4798,7 +4798,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4811,7 +4811,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5140,14 +5140,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "drive2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "drive2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"De0ub0IbWruJbBXUyseFYvZ-\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"276875258587-5gbp23a7aqnrl6p06c0jt5fskuktactq.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -5167,7 +5167,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -5207,7 +5207,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("about", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Gets the information about the current user along with Drive API settings"##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/about_get", vec![ @@ -5226,7 +5226,7 @@ fn main() { ]), ("apps", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets a specific app."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/apps_get", vec![ @@ -5248,7 +5248,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists a user's installed apps."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/apps_list", vec![ @@ -5267,7 +5267,7 @@ fn main() { ]), ("changes", "methods: 'get', 'list' and 'watch'", vec![ - ("get", + ("get", Some(r##"Gets a specific change."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/changes_get", vec![ @@ -5289,7 +5289,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the changes for a user."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/changes_list", vec![ @@ -5305,7 +5305,7 @@ fn main() { Some(false), Some(false)), ]), - ("watch", + ("watch", Some(r##"Subscribe to changes for a user."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/changes_watch", vec![ @@ -5330,7 +5330,7 @@ fn main() { ]), ("channels", "methods: 'stop'", vec![ - ("stop", + ("stop", Some(r##"Stop watching resources through this channel"##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/channels_stop", vec![ @@ -5349,7 +5349,7 @@ fn main() { ]), ("children", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Removes a child from a folder."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/children_delete", vec![ @@ -5371,7 +5371,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a specific child reference."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/children_get", vec![ @@ -5399,7 +5399,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a file into a folder."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/children_insert", vec![ @@ -5427,7 +5427,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists a folder's children."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/children_list", vec![ @@ -5452,7 +5452,7 @@ fn main() { ]), ("comments", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a comment."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/comments_delete", vec![ @@ -5474,7 +5474,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a comment by ID."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/comments_get", vec![ @@ -5502,7 +5502,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new comment on the given file."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/comments_insert", vec![ @@ -5530,7 +5530,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists a file's comments."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/comments_list", vec![ @@ -5552,7 +5552,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing comment. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/comments_patch", vec![ @@ -5586,7 +5586,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing comment."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/comments_update", vec![ @@ -5623,7 +5623,7 @@ fn main() { ]), ("files", "methods: 'copy', 'delete', 'empty-trash', 'generate-ids', 'get', 'insert', 'list', 'patch', 'touch', 'trash', 'untrash', 'update' and 'watch'", vec![ - ("copy", + ("copy", Some(r##"Creates a copy of the specified file."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_copy", vec![ @@ -5651,7 +5651,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Permanently deletes a file by ID. Skips the trash. The currently authenticated user must own the file."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_delete", vec![ @@ -5667,7 +5667,7 @@ fn main() { Some(false), Some(true)), ]), - ("empty-trash", + ("empty-trash", Some(r##"Permanently deletes all of the user's trashed files."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_empty-trash", vec![ @@ -5677,7 +5677,7 @@ fn main() { Some(false), Some(true)), ]), - ("generate-ids", + ("generate-ids", Some(r##"Generates a set of file IDs which can be provided in insert requests."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_generate-ids", vec![ @@ -5693,7 +5693,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets a file's metadata by ID."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_get", vec![ @@ -5715,7 +5715,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Insert a new file."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_insert", vec![ @@ -5743,7 +5743,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the user's files."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_list", vec![ @@ -5759,7 +5759,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates file metadata and/or content. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_patch", vec![ @@ -5787,7 +5787,7 @@ fn main() { Some(false), Some(false)), ]), - ("touch", + ("touch", Some(r##"Set the file's updated time to the current server time."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_touch", vec![ @@ -5809,7 +5809,7 @@ fn main() { Some(false), Some(false)), ]), - ("trash", + ("trash", Some(r##"Moves a file to the trash. The currently authenticated user must own the file."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_trash", vec![ @@ -5831,7 +5831,7 @@ fn main() { Some(false), Some(false)), ]), - ("untrash", + ("untrash", Some(r##"Restores a file from the trash."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_untrash", vec![ @@ -5853,7 +5853,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates file metadata and/or content."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_update", vec![ @@ -5887,7 +5887,7 @@ fn main() { Some(false), Some(false)), ]), - ("watch", + ("watch", Some(r##"Subscribe to changes on a file"##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/files_watch", vec![ @@ -5918,7 +5918,7 @@ fn main() { ]), ("parents", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Removes a parent from a file."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/parents_delete", vec![ @@ -5940,7 +5940,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a specific parent reference."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/parents_get", vec![ @@ -5968,7 +5968,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Adds a parent folder for a file."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/parents_insert", vec![ @@ -5996,7 +5996,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists a file's parents."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/parents_list", vec![ @@ -6021,7 +6021,7 @@ fn main() { ]), ("permissions", "methods: 'delete', 'get', 'get-id-for-email', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a permission from a file."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/permissions_delete", vec![ @@ -6043,7 +6043,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a permission by ID."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/permissions_get", vec![ @@ -6071,7 +6071,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-id-for-email", + ("get-id-for-email", Some(r##"Returns the permission ID for an email address."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/permissions_get-id-for-email", vec![ @@ -6093,7 +6093,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a permission for a file."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/permissions_insert", vec![ @@ -6121,7 +6121,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists a file's permissions."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/permissions_list", vec![ @@ -6143,7 +6143,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a permission using patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/permissions_patch", vec![ @@ -6177,7 +6177,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a permission."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/permissions_update", vec![ @@ -6214,7 +6214,7 @@ fn main() { ]), ("properties", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a property."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/properties_delete", vec![ @@ -6236,7 +6236,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a property by its key."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/properties_get", vec![ @@ -6264,8 +6264,8 @@ fn main() { Some(false), Some(false)), ]), - ("insert", - Some(r##"Adds a property to a file."##), + ("insert", + Some(r##"Adds a property to a file, or updates it if it already exists."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/properties_insert", vec![ (Some(r##"file-id"##), @@ -6292,7 +6292,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists a file's properties."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/properties_list", vec![ @@ -6314,8 +6314,8 @@ fn main() { Some(false), Some(false)), ]), - ("patch", - Some(r##"Updates a property. This method supports patch semantics."##), + ("patch", + Some(r##"Updates a property, or adds it if it doesn't exist. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/properties_patch", vec![ (Some(r##"file-id"##), @@ -6348,8 +6348,8 @@ fn main() { Some(false), Some(false)), ]), - ("update", - Some(r##"Updates a property."##), + ("update", + Some(r##"Updates a property, or adds it if it doesn't exist."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/properties_update", vec![ (Some(r##"file-id"##), @@ -6385,7 +6385,7 @@ fn main() { ]), ("realtime", "methods: 'get' and 'update'", vec![ - ("get", + ("get", Some(r##"Exports the contents of the Realtime API data model associated with this file as JSON."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/realtime_get", vec![ @@ -6407,7 +6407,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Overwrites the Realtime API data model associated with this file with the provided JSON data model."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/realtime_update", vec![ @@ -6432,7 +6432,7 @@ fn main() { ]), ("replies", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a reply."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/replies_delete", vec![ @@ -6460,7 +6460,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a reply."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/replies_get", vec![ @@ -6494,7 +6494,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new reply to the given comment."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/replies_insert", vec![ @@ -6528,7 +6528,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all of the replies to a comment."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/replies_list", vec![ @@ -6556,7 +6556,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing reply. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/replies_patch", vec![ @@ -6596,7 +6596,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing reply."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/replies_update", vec![ @@ -6639,7 +6639,7 @@ fn main() { ]), ("revisions", "methods: 'delete', 'get', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Removes a revision."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/revisions_delete", vec![ @@ -6661,7 +6661,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a specific revision."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/revisions_get", vec![ @@ -6689,7 +6689,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists a file's revisions."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/revisions_list", vec![ @@ -6711,7 +6711,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a revision. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/revisions_patch", vec![ @@ -6745,7 +6745,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a revision."##), "Details at http://byron.github.io/google-apis-rs/google_drive2_cli/revisions_update", vec![ @@ -6785,7 +6785,7 @@ fn main() { let mut app = App::new("drive2") .author("Sebastian Thiel ") - .version("0.3.2+20151008") + .version("0.3.3+20160126") .about("The API to interact with Drive.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_drive2_cli") .arg(Arg::with_name("url") @@ -6809,7 +6809,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -6820,7 +6820,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/drive2/Cargo.toml b/gen/drive2/Cargo.toml index 5290a229f8..3e1db92a05 100644 --- a/gen/drive2/Cargo.toml +++ b/gen/drive2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive2" -version = "0.1.10+20151008" +version = "0.1.11+20160126" authors = ["Sebastian Thiel "] description = "A complete library to interact with drive (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/drive2/LICENSE.md b/gen/drive2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/drive2/LICENSE.md +++ b/gen/drive2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/drive2/README.md b/gen/drive2/README.md index 57aa1b3180..c92f01af50 100644 --- a/gen/drive2/README.md +++ b/gen/drive2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-drive2` library allows access to all features of the *Google drive* service. -This documentation was generated from *drive* crate version *0.1.10+20151008*, where *20151008* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *drive* crate version *0.1.11+20160126*, where *20160126* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *drive* *v2* API can be found at the [official documentation site](https://developers.google.com/drive/). diff --git a/gen/drive2/src/cmn.rs b/gen/drive2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/drive2/src/cmn.rs +++ b/gen/drive2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/drive2/src/lib.rs b/gen/drive2/src/lib.rs index 0fd3339e06..30e1f39a5e 100644 --- a/gen/drive2/src/lib.rs +++ b/gen/drive2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *drive* crate version *0.1.10+20151008*, where *20151008* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *drive* crate version *0.1.11+20160126*, where *20160126* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *drive* *v2* API can be found at the //! [official documentation site](https://developers.google.com/drive/). diff --git a/gen/drive2/src/lib.rs.in b/gen/drive2/src/lib.rs.in index 2fad27c5a1..31411034fc 100644 --- a/gen/drive2/src/lib.rs.in +++ b/gen/drive2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -177,7 +178,7 @@ impl<'a, C, A> Drive Drive { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -222,7 +223,7 @@ impl<'a, C, A> Drive } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -267,7 +268,7 @@ impl RequestValue for ParentReference {} impl ResponseResult for ParentReference {} -/// A JSON representation of a comment on a file in Google Drive. +/// A comment on a file in Google Drive. /// /// # Activities /// @@ -771,7 +772,7 @@ impl NestedType for AboutAdditionalRoleInfoRoleSets {} impl Part for AboutAdditionalRoleInfoRoleSets {} -/// A JSON representation of a list of replies to a comment on a file in Google Drive. +/// A list of replies to a comment on a file in Google Drive. /// /// # Activities /// @@ -973,7 +974,7 @@ impl RequestValue for ChildReference {} impl ResponseResult for ChildReference {} -/// A JSON representation of a list of comments on a file in Google Drive. +/// A list of comments on a file in Google Drive. /// /// # Activities /// @@ -1380,7 +1381,7 @@ pub struct ChildList { impl ResponseResult for ChildList {} -/// A JSON representation of a reply to a comment on a file in Google Drive. +/// A comment on a file in Google Drive. /// /// # Activities /// @@ -1456,7 +1457,7 @@ impl NestedType for AboutFeatures {} impl Part for AboutFeatures {} -/// The JSON template for a user. +/// Information about a Drive user. /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -3160,7 +3161,7 @@ impl<'a, C, A> PropertyMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a property. This method supports patch semantics. + /// Updates a property, or adds it if it doesn't exist. This method supports patch semantics. /// /// # Arguments /// @@ -3202,7 +3203,7 @@ impl<'a, C, A> PropertyMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Adds a property to a file. + /// Adds a property to a file, or updates it if it already exists. /// /// # Arguments /// @@ -3238,7 +3239,7 @@ impl<'a, C, A> PropertyMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a property. + /// Updates a property, or adds it if it doesn't exist. /// /// # Arguments /// @@ -3499,7 +3500,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.watch", + dlg.begin(MethodInfo { id: "drive.files.watch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -3569,14 +3570,14 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3620,7 +3621,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3630,10 +3631,10 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3665,7 +3666,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> FileWatchCall<'a, C, A> { self._request = new_value; @@ -3675,7 +3676,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FileWatchCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -3721,12 +3722,12 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3743,17 +3744,17 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileWatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileWatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3839,7 +3840,7 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.insert", + dlg.begin(MethodInfo { id: "drive.files.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); if let Some(value) = self._visibility { @@ -3878,27 +3879,27 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut, A: oa params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/drive/v2/files".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/drive/v2/files".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3975,7 +3976,7 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3985,10 +3986,10 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4091,7 +4092,7 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: File) -> FileInsertCall<'a, C, A> { self._request = new_value; @@ -4165,12 +4166,12 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4187,17 +4188,17 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4259,7 +4260,7 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.untrash", + dlg.begin(MethodInfo { id: "drive.files.untrash", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -4301,7 +4302,7 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4337,7 +4338,7 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4347,10 +4348,10 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4383,7 +4384,7 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FileUntrashCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -4401,12 +4402,12 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4423,17 +4424,17 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileUntrashCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileUntrashCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4516,7 +4517,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.copy", + dlg.begin(MethodInfo { id: "drive.files.copy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -4579,14 +4580,14 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4630,7 +4631,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4640,10 +4641,10 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4675,7 +4676,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: File) -> FileCopyCall<'a, C, A> { self._request = new_value; @@ -4685,7 +4686,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FileCopyCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -4752,12 +4753,12 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4774,17 +4775,17 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileCopyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileCopyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4846,7 +4847,7 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.trash", + dlg.begin(MethodInfo { id: "drive.files.trash", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -4888,7 +4889,7 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4924,7 +4925,7 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4934,10 +4935,10 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4970,7 +4971,7 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FileTrashCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -4988,12 +4989,12 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5010,17 +5011,17 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileTrashCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileTrashCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5081,7 +5082,7 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.emptyTrash", + dlg.begin(MethodInfo { id: "drive.files.emptyTrash", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -5100,7 +5101,7 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5136,7 +5137,7 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5146,10 +5147,10 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5180,12 +5181,12 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5202,17 +5203,17 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileEmptyTrashCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileEmptyTrashCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5287,7 +5288,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.list", + dlg.begin(MethodInfo { id: "drive.files.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); if let Some(value) = self._spaces { @@ -5328,7 +5329,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut self._scopes.insert(Scope::AppReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5364,7 +5365,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5374,10 +5375,10 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5467,12 +5468,12 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5489,17 +5490,17 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5561,7 +5562,7 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.touch", + dlg.begin(MethodInfo { id: "drive.files.touch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -5603,7 +5604,7 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5639,7 +5640,7 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5649,10 +5650,10 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5685,7 +5686,7 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FileTouchCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -5703,12 +5704,12 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5725,17 +5726,17 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileTouchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileTouchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5800,7 +5801,7 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.generateIds", + dlg.begin(MethodInfo { id: "drive.files.generateIds", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._space { @@ -5826,7 +5827,7 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5862,7 +5863,7 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5872,10 +5873,10 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5930,12 +5931,12 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5952,17 +5953,17 @@ impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileGenerateIdCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileGenerateIdCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6059,7 +6060,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.update", + dlg.begin(MethodInfo { id: "drive.files.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((17 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -6114,13 +6115,13 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/drive/v2/files/{fileId}".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/drive/v2/files/{fileId}".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -6148,14 +6149,14 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6232,7 +6233,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6242,10 +6243,10 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6348,7 +6349,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: File) -> FileUpdateCall<'a, C, A> { self._request = new_value; @@ -6358,7 +6359,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FileUpdateCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -6467,12 +6468,12 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6489,17 +6490,17 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6561,7 +6562,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.delete", + dlg.begin(MethodInfo { id: "drive.files.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -6602,7 +6603,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6638,7 +6639,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6648,10 +6649,10 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6674,7 +6675,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FileDeleteCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -6692,12 +6693,12 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6714,17 +6715,17 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6819,7 +6820,7 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.patch", + dlg.begin(MethodInfo { id: "drive.files.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((17 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -6900,14 +6901,14 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6951,7 +6952,7 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6961,10 +6962,10 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6996,7 +6997,7 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: File) -> FilePatchCall<'a, C, A> { self._request = new_value; @@ -7006,7 +7007,7 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FilePatchCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -7115,12 +7116,12 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7137,17 +7138,17 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FilePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FilePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7222,7 +7223,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.files.get", + dlg.begin(MethodInfo { id: "drive.files.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -7292,7 +7293,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7328,7 +7329,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7338,10 +7339,10 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7374,7 +7375,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -7420,12 +7421,12 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7442,17 +7443,17 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FileGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FileGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7519,7 +7520,7 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.about.get", + dlg.begin(MethodInfo { id: "drive.about.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._start_change_id { @@ -7548,7 +7549,7 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut self._scopes.insert(Scope::MetadataReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7584,7 +7585,7 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7594,10 +7595,10 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7659,12 +7660,12 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7681,17 +7682,17 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AboutGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AboutGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7757,7 +7758,7 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.realtime.update", + dlg.begin(MethodInfo { id: "drive.realtime.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -7775,13 +7776,13 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A } - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/drive/v2/files/{fileId}/realtime".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/drive/v2/files/{fileId}/realtime".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -7809,7 +7810,7 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7873,7 +7874,7 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7883,10 +7884,10 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7980,7 +7981,7 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> RealtimeUpdateCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -8005,12 +8006,12 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8027,17 +8028,17 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RealtimeUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RealtimeUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8104,7 +8105,7 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.realtime.get", + dlg.begin(MethodInfo { id: "drive.realtime.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -8148,7 +8149,7 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8184,7 +8185,7 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8194,10 +8195,10 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8220,7 +8221,7 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> RealtimeGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -8245,12 +8246,12 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8267,17 +8268,17 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RealtimeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RealtimeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8339,7 +8340,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.apps.get", + dlg.begin(MethodInfo { id: "drive.apps.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("appId", self._app_id.to_string())); @@ -8381,7 +8382,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8417,7 +8418,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8427,10 +8428,10 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8463,7 +8464,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *app id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn app_id(mut self, new_value: &str) -> AppGetCall<'a, C, A> { self._app_id = new_value.to_string(); @@ -8481,12 +8482,12 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8503,17 +8504,17 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AppGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8580,7 +8581,7 @@ impl<'a, C, A> AppListCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.apps.list", + dlg.begin(MethodInfo { id: "drive.apps.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._language_code { @@ -8609,7 +8610,7 @@ impl<'a, C, A> AppListCall<'a, C, A> where C: BorrowMut, A: oauth self._scopes.insert(Scope::AppReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8645,7 +8646,7 @@ impl<'a, C, A> AppListCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8655,10 +8656,10 @@ impl<'a, C, A> AppListCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8720,12 +8721,12 @@ impl<'a, C, A> AppListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8742,17 +8743,17 @@ impl<'a, C, A> AppListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AppListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AppListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8815,7 +8816,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.comments.delete", + dlg.begin(MethodInfo { id: "drive.comments.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -8857,7 +8858,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8893,7 +8894,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8903,10 +8904,10 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8929,7 +8930,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> CommentDeleteCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -8939,7 +8940,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> CommentDeleteCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -8957,12 +8958,12 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8979,17 +8980,17 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9054,7 +9055,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.comments.get", + dlg.begin(MethodInfo { id: "drive.comments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -9100,7 +9101,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9136,7 +9137,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9146,10 +9147,10 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9182,7 +9183,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> CommentGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -9192,7 +9193,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> CommentGetCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -9217,12 +9218,12 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9239,17 +9240,17 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9318,7 +9319,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.comments.insert", + dlg.begin(MethodInfo { id: "drive.comments.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -9360,14 +9361,14 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9411,7 +9412,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9421,10 +9422,10 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9456,7 +9457,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Comment) -> CommentInsertCall<'a, C, A> { self._request = new_value; @@ -9466,7 +9467,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> CommentInsertCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -9484,12 +9485,12 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9506,17 +9507,17 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9586,7 +9587,7 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.comments.patch", + dlg.begin(MethodInfo { id: "drive.comments.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -9629,14 +9630,14 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9680,7 +9681,7 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9690,10 +9691,10 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9725,7 +9726,7 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Comment) -> CommentPatchCall<'a, C, A> { self._request = new_value; @@ -9735,7 +9736,7 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> CommentPatchCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -9745,7 +9746,7 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> CommentPatchCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -9763,12 +9764,12 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9785,17 +9786,17 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9865,7 +9866,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.comments.update", + dlg.begin(MethodInfo { id: "drive.comments.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -9908,14 +9909,14 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9959,7 +9960,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9969,10 +9970,10 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10004,7 +10005,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Comment) -> CommentUpdateCall<'a, C, A> { self._request = new_value; @@ -10014,7 +10015,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> CommentUpdateCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -10024,7 +10025,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> CommentUpdateCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -10042,12 +10043,12 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10064,17 +10065,17 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10144,7 +10145,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.comments.list", + dlg.begin(MethodInfo { id: "drive.comments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -10198,7 +10199,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10234,7 +10235,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10244,10 +10245,10 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10280,7 +10281,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> CommentListCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -10326,12 +10327,12 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10348,17 +10349,17 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10428,7 +10429,7 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.children.list", + dlg.begin(MethodInfo { id: "drive.children.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("folderId", self._folder_id.to_string())); @@ -10482,7 +10483,7 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10518,7 +10519,7 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10528,10 +10529,10 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10564,7 +10565,7 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *folder id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn folder_id(mut self, new_value: &str) -> ChildrenListCall<'a, C, A> { self._folder_id = new_value.to_string(); @@ -10610,12 +10611,12 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10632,17 +10633,17 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChildrenListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChildrenListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10705,7 +10706,7 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.children.get", + dlg.begin(MethodInfo { id: "drive.children.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("folderId", self._folder_id.to_string())); @@ -10748,7 +10749,7 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10784,7 +10785,7 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10794,10 +10795,10 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10830,7 +10831,7 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *folder id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn folder_id(mut self, new_value: &str) -> ChildrenGetCall<'a, C, A> { self._folder_id = new_value.to_string(); @@ -10840,7 +10841,7 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *child id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn child_id(mut self, new_value: &str) -> ChildrenGetCall<'a, C, A> { self._child_id = new_value.to_string(); @@ -10858,12 +10859,12 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10880,17 +10881,17 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChildrenGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChildrenGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10953,7 +10954,7 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.children.delete", + dlg.begin(MethodInfo { id: "drive.children.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("folderId", self._folder_id.to_string())); @@ -10995,7 +10996,7 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11031,7 +11032,7 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11041,10 +11042,10 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11067,7 +11068,7 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *folder id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn folder_id(mut self, new_value: &str) -> ChildrenDeleteCall<'a, C, A> { self._folder_id = new_value.to_string(); @@ -11077,7 +11078,7 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *child id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn child_id(mut self, new_value: &str) -> ChildrenDeleteCall<'a, C, A> { self._child_id = new_value.to_string(); @@ -11095,12 +11096,12 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11117,17 +11118,17 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChildrenDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChildrenDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11196,7 +11197,7 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.children.insert", + dlg.begin(MethodInfo { id: "drive.children.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("folderId", self._folder_id.to_string())); @@ -11238,14 +11239,14 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11289,7 +11290,7 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11299,10 +11300,10 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11334,7 +11335,7 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ChildReference) -> ChildrenInsertCall<'a, C, A> { self._request = new_value; @@ -11344,7 +11345,7 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *folder id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn folder_id(mut self, new_value: &str) -> ChildrenInsertCall<'a, C, A> { self._folder_id = new_value.to_string(); @@ -11362,12 +11363,12 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11384,17 +11385,17 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChildrenInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChildrenInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11462,7 +11463,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.channels.stop", + dlg.begin(MethodInfo { id: "drive.channels.stop", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in [].iter() { @@ -11481,14 +11482,14 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11532,7 +11533,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11542,10 +11543,10 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11567,7 +11568,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> ChannelStopCall<'a, C, A> { self._request = new_value; @@ -11585,12 +11586,12 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11607,17 +11608,17 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChannelStopCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChannelStopCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11679,7 +11680,7 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.parents.list", + dlg.begin(MethodInfo { id: "drive.parents.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -11721,7 +11722,7 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11757,7 +11758,7 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11767,10 +11768,10 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11803,7 +11804,7 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ParentListCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -11821,12 +11822,12 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11843,17 +11844,17 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ParentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ParentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11916,7 +11917,7 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.parents.delete", + dlg.begin(MethodInfo { id: "drive.parents.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -11958,7 +11959,7 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11994,7 +11995,7 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12004,10 +12005,10 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12030,7 +12031,7 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ParentDeleteCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -12040,7 +12041,7 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *parent id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn parent_id(mut self, new_value: &str) -> ParentDeleteCall<'a, C, A> { self._parent_id = new_value.to_string(); @@ -12058,12 +12059,12 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12080,17 +12081,17 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ParentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ParentDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12159,7 +12160,7 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.parents.insert", + dlg.begin(MethodInfo { id: "drive.parents.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -12201,14 +12202,14 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12252,7 +12253,7 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12262,10 +12263,10 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12297,7 +12298,7 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ParentReference) -> ParentInsertCall<'a, C, A> { self._request = new_value; @@ -12307,7 +12308,7 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ParentInsertCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -12325,12 +12326,12 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12347,17 +12348,17 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ParentInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ParentInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12420,7 +12421,7 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.parents.get", + dlg.begin(MethodInfo { id: "drive.parents.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -12463,7 +12464,7 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12499,7 +12500,7 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12509,10 +12510,10 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12545,7 +12546,7 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ParentGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -12555,7 +12556,7 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *parent id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn parent_id(mut self, new_value: &str) -> ParentGetCall<'a, C, A> { self._parent_id = new_value.to_string(); @@ -12573,12 +12574,12 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12595,17 +12596,17 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ParentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ParentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12676,7 +12677,7 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.replies.patch", + dlg.begin(MethodInfo { id: "drive.replies.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -12720,14 +12721,14 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12771,7 +12772,7 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12781,10 +12782,10 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12816,7 +12817,7 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CommentReply) -> ReplyPatchCall<'a, C, A> { self._request = new_value; @@ -12826,7 +12827,7 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ReplyPatchCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -12836,7 +12837,7 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> ReplyPatchCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -12846,7 +12847,7 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *reply id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn reply_id(mut self, new_value: &str) -> ReplyPatchCall<'a, C, A> { self._reply_id = new_value.to_string(); @@ -12864,12 +12865,12 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12886,17 +12887,17 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReplyPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReplyPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12965,7 +12966,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.replies.list", + dlg.begin(MethodInfo { id: "drive.replies.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -13017,7 +13018,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13053,7 +13054,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13063,10 +13064,10 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13099,7 +13100,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ReplyListCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -13109,7 +13110,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> ReplyListCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -13148,12 +13149,12 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13170,17 +13171,17 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReplyListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReplyListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13246,7 +13247,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.replies.get", + dlg.begin(MethodInfo { id: "drive.replies.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -13293,7 +13294,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13329,7 +13330,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13339,10 +13340,10 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13375,7 +13376,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ReplyGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -13385,7 +13386,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> ReplyGetCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -13395,7 +13396,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *reply id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn reply_id(mut self, new_value: &str) -> ReplyGetCall<'a, C, A> { self._reply_id = new_value.to_string(); @@ -13420,12 +13421,12 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13442,17 +13443,17 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReplyGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReplyGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13522,7 +13523,7 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.replies.insert", + dlg.begin(MethodInfo { id: "drive.replies.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -13565,14 +13566,14 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13616,7 +13617,7 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13626,10 +13627,10 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13661,7 +13662,7 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CommentReply) -> ReplyInsertCall<'a, C, A> { self._request = new_value; @@ -13671,7 +13672,7 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ReplyInsertCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -13681,7 +13682,7 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> ReplyInsertCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -13699,12 +13700,12 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13721,17 +13722,17 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReplyInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReplyInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13795,7 +13796,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.replies.delete", + dlg.begin(MethodInfo { id: "drive.replies.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -13838,7 +13839,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13874,7 +13875,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13884,10 +13885,10 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13910,7 +13911,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ReplyDeleteCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -13920,7 +13921,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> ReplyDeleteCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -13930,7 +13931,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *reply id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn reply_id(mut self, new_value: &str) -> ReplyDeleteCall<'a, C, A> { self._reply_id = new_value.to_string(); @@ -13948,12 +13949,12 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13970,17 +13971,17 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReplyDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReplyDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14051,7 +14052,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.replies.update", + dlg.begin(MethodInfo { id: "drive.replies.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -14095,14 +14096,14 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14146,7 +14147,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14156,10 +14157,10 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14191,7 +14192,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CommentReply) -> ReplyUpdateCall<'a, C, A> { self._request = new_value; @@ -14201,7 +14202,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> ReplyUpdateCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -14211,7 +14212,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> ReplyUpdateCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -14221,7 +14222,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *reply id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn reply_id(mut self, new_value: &str) -> ReplyUpdateCall<'a, C, A> { self._reply_id = new_value.to_string(); @@ -14239,12 +14240,12 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14261,17 +14262,17 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReplyUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReplyUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14334,7 +14335,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.permissions.delete", + dlg.begin(MethodInfo { id: "drive.permissions.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -14376,7 +14377,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14412,7 +14413,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14422,10 +14423,10 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14448,7 +14449,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PermissionDeleteCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -14458,7 +14459,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *permission id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn permission_id(mut self, new_value: &str) -> PermissionDeleteCall<'a, C, A> { self._permission_id = new_value.to_string(); @@ -14476,12 +14477,12 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14498,17 +14499,17 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PermissionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PermissionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14581,7 +14582,7 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.permissions.insert", + dlg.begin(MethodInfo { id: "drive.permissions.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -14629,14 +14630,14 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14680,7 +14681,7 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14690,10 +14691,10 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14725,7 +14726,7 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Permission) -> PermissionInsertCall<'a, C, A> { self._request = new_value; @@ -14735,7 +14736,7 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PermissionInsertCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -14767,12 +14768,12 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14789,17 +14790,17 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PermissionInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PermissionInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14871,7 +14872,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.permissions.update", + dlg.begin(MethodInfo { id: "drive.permissions.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -14917,14 +14918,14 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14968,7 +14969,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14978,10 +14979,10 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15013,7 +15014,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Permission) -> PermissionUpdateCall<'a, C, A> { self._request = new_value; @@ -15023,7 +15024,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PermissionUpdateCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -15033,7 +15034,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *permission id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn permission_id(mut self, new_value: &str) -> PermissionUpdateCall<'a, C, A> { self._permission_id = new_value.to_string(); @@ -15058,12 +15059,12 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15080,17 +15081,17 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PermissionUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PermissionUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15162,7 +15163,7 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.permissions.patch", + dlg.begin(MethodInfo { id: "drive.permissions.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -15208,14 +15209,14 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15259,7 +15260,7 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15269,10 +15270,10 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15304,7 +15305,7 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Permission) -> PermissionPatchCall<'a, C, A> { self._request = new_value; @@ -15314,7 +15315,7 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PermissionPatchCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -15324,7 +15325,7 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *permission id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn permission_id(mut self, new_value: &str) -> PermissionPatchCall<'a, C, A> { self._permission_id = new_value.to_string(); @@ -15349,12 +15350,12 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15371,17 +15372,17 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PermissionPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PermissionPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15443,7 +15444,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.permissions.list", + dlg.begin(MethodInfo { id: "drive.permissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -15485,7 +15486,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15521,7 +15522,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15531,10 +15532,10 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15567,7 +15568,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PermissionListCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -15585,12 +15586,12 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15607,17 +15608,17 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15680,7 +15681,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.permissions.get", + dlg.begin(MethodInfo { id: "drive.permissions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -15723,7 +15724,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15759,7 +15760,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15769,10 +15770,10 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15805,7 +15806,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PermissionGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -15815,7 +15816,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *permission id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn permission_id(mut self, new_value: &str) -> PermissionGetCall<'a, C, A> { self._permission_id = new_value.to_string(); @@ -15833,12 +15834,12 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15855,17 +15856,17 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PermissionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PermissionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15927,7 +15928,7 @@ impl<'a, C, A> PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.permissions.getIdForEmail", + dlg.begin(MethodInfo { id: "drive.permissions.getIdForEmail", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("email", self._email.to_string())); @@ -15969,7 +15970,7 @@ impl<'a, C, A> PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16005,7 +16006,7 @@ impl<'a, C, A> PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16015,10 +16016,10 @@ impl<'a, C, A> PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut PermissionGetIdForEmailCall<'a, C, A> { self._email = new_value.to_string(); @@ -16069,12 +16070,12 @@ impl<'a, C, A> PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PermissionGetIdForEmailCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PermissionGetIdForEmailCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16181,7 +16182,7 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.changes.watch", + dlg.begin(MethodInfo { id: "drive.changes.watch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); if let Some(value) = self._start_change_id { @@ -16219,14 +16220,14 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -16270,7 +16271,7 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16280,10 +16281,10 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16315,7 +16316,7 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> ChangeWatchCall<'a, C, A> { self._request = new_value; @@ -16375,12 +16376,12 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16397,17 +16398,17 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChangeWatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChangeWatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16480,7 +16481,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.changes.list", + dlg.begin(MethodInfo { id: "drive.changes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); if let Some(value) = self._start_change_id { @@ -16518,7 +16519,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa self._scopes.insert(Scope::AppReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16554,7 +16555,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16564,10 +16565,10 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16650,12 +16651,12 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16672,17 +16673,17 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChangeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChangeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16744,7 +16745,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.changes.get", + dlg.begin(MethodInfo { id: "drive.changes.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("changeId", self._change_id.to_string())); @@ -16786,7 +16787,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16822,7 +16823,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16832,10 +16833,10 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16868,7 +16869,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *change id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn change_id(mut self, new_value: &str) -> ChangeGetCall<'a, C, A> { self._change_id = new_value.to_string(); @@ -16886,12 +16887,12 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16908,17 +16909,17 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChangeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChangeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16926,7 +16927,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut, A: oau } -/// Updates a property. This method supports patch semantics. +/// Updates a property, or adds it if it doesn't exist. This method supports patch semantics. /// /// A builder for the *patch* method supported by a *property* resource. /// It is not used directly, but through a `PropertyMethods` instance. @@ -16990,7 +16991,7 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.properties.patch", + dlg.begin(MethodInfo { id: "drive.properties.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -17036,14 +17037,14 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17087,7 +17088,7 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17097,10 +17098,10 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17132,7 +17133,7 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Property) -> PropertyPatchCall<'a, C, A> { self._request = new_value; @@ -17142,7 +17143,7 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PropertyPatchCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -17152,7 +17153,7 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *property key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn property_key(mut self, new_value: &str) -> PropertyPatchCall<'a, C, A> { self._property_key = new_value.to_string(); @@ -17177,12 +17178,12 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17199,17 +17200,17 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PropertyPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PropertyPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17274,7 +17275,7 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.properties.delete", + dlg.begin(MethodInfo { id: "drive.properties.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -17319,7 +17320,7 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17355,7 +17356,7 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17365,10 +17366,10 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17391,7 +17392,7 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PropertyDeleteCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -17401,7 +17402,7 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *property key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn property_key(mut self, new_value: &str) -> PropertyDeleteCall<'a, C, A> { self._property_key = new_value.to_string(); @@ -17426,12 +17427,12 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17448,17 +17449,17 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PropertyDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PropertyDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17466,7 +17467,7 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut, A } -/// Adds a property to a file. +/// Adds a property to a file, or updates it if it already exists. /// /// A builder for the *insert* method supported by a *property* resource. /// It is not used directly, but through a `PropertyMethods` instance. @@ -17527,7 +17528,7 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.properties.insert", + dlg.begin(MethodInfo { id: "drive.properties.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -17569,14 +17570,14 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17620,7 +17621,7 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17630,10 +17631,10 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17665,7 +17666,7 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Property) -> PropertyInsertCall<'a, C, A> { self._request = new_value; @@ -17675,7 +17676,7 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PropertyInsertCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -17693,12 +17694,12 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17715,17 +17716,17 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PropertyInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PropertyInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17787,7 +17788,7 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.properties.list", + dlg.begin(MethodInfo { id: "drive.properties.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -17829,7 +17830,7 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17865,7 +17866,7 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17875,10 +17876,10 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17911,7 +17912,7 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PropertyListCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -17929,12 +17930,12 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17951,17 +17952,17 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PropertyListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PropertyListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17969,7 +17970,7 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut, A: } -/// Updates a property. +/// Updates a property, or adds it if it doesn't exist. /// /// A builder for the *update* method supported by a *property* resource. /// It is not used directly, but through a `PropertyMethods` instance. @@ -18033,7 +18034,7 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.properties.update", + dlg.begin(MethodInfo { id: "drive.properties.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -18079,14 +18080,14 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -18130,7 +18131,7 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18140,10 +18141,10 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18175,7 +18176,7 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Property) -> PropertyUpdateCall<'a, C, A> { self._request = new_value; @@ -18185,7 +18186,7 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PropertyUpdateCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -18195,7 +18196,7 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *property key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn property_key(mut self, new_value: &str) -> PropertyUpdateCall<'a, C, A> { self._property_key = new_value.to_string(); @@ -18220,12 +18221,12 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18242,17 +18243,17 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PropertyUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PropertyUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18317,7 +18318,7 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.properties.get", + dlg.begin(MethodInfo { id: "drive.properties.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -18363,7 +18364,7 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18399,7 +18400,7 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18409,10 +18410,10 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18445,7 +18446,7 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> PropertyGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -18455,7 +18456,7 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *property key* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn property_key(mut self, new_value: &str) -> PropertyGetCall<'a, C, A> { self._property_key = new_value.to_string(); @@ -18480,12 +18481,12 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18502,17 +18503,17 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PropertyGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PropertyGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18575,7 +18576,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.revisions.get", + dlg.begin(MethodInfo { id: "drive.revisions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -18618,7 +18619,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18654,7 +18655,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18664,10 +18665,10 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18700,7 +18701,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> RevisionGetCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -18710,7 +18711,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *revision id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn revision_id(mut self, new_value: &str) -> RevisionGetCall<'a, C, A> { self._revision_id = new_value.to_string(); @@ -18728,12 +18729,12 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18750,17 +18751,17 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RevisionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RevisionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18830,7 +18831,7 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.revisions.patch", + dlg.begin(MethodInfo { id: "drive.revisions.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -18873,14 +18874,14 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -18924,7 +18925,7 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18934,10 +18935,10 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18969,7 +18970,7 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Revision) -> RevisionPatchCall<'a, C, A> { self._request = new_value; @@ -18979,7 +18980,7 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> RevisionPatchCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -18989,7 +18990,7 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *revision id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn revision_id(mut self, new_value: &str) -> RevisionPatchCall<'a, C, A> { self._revision_id = new_value.to_string(); @@ -19007,12 +19008,12 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19029,17 +19030,17 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RevisionPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RevisionPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19102,7 +19103,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.revisions.delete", + dlg.begin(MethodInfo { id: "drive.revisions.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -19144,7 +19145,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19180,7 +19181,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19190,10 +19191,10 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19216,7 +19217,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> RevisionDeleteCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -19226,7 +19227,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *revision id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn revision_id(mut self, new_value: &str) -> RevisionDeleteCall<'a, C, A> { self._revision_id = new_value.to_string(); @@ -19244,12 +19245,12 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19266,17 +19267,17 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RevisionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RevisionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19346,7 +19347,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.revisions.update", + dlg.begin(MethodInfo { id: "drive.revisions.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -19389,14 +19390,14 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19440,7 +19441,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19450,10 +19451,10 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19485,7 +19486,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Revision) -> RevisionUpdateCall<'a, C, A> { self._request = new_value; @@ -19495,7 +19496,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> RevisionUpdateCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -19505,7 +19506,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *revision id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn revision_id(mut self, new_value: &str) -> RevisionUpdateCall<'a, C, A> { self._revision_id = new_value.to_string(); @@ -19523,12 +19524,12 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19545,17 +19546,17 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RevisionUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RevisionUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19617,7 +19618,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "drive.revisions.list", + dlg.begin(MethodInfo { id: "drive.revisions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("fileId", self._file_id.to_string())); @@ -19659,7 +19660,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -19695,7 +19696,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19705,10 +19706,10 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19741,7 +19742,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *file id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn file_id(mut self, new_value: &str) -> RevisionListCall<'a, C, A> { self._file_id = new_value.to_string(); @@ -19759,12 +19760,12 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19781,17 +19782,17 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::MetadataReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RevisionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RevisionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/drive3-cli/Cargo.toml b/gen/drive3-cli/Cargo.toml new file mode 100644 index 0000000000..a372894203 --- /dev/null +++ b/gen/drive3-cli/Cargo.toml @@ -0,0 +1,35 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-drive3-cli" +version = "0.3.3+20160126" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with drive (protocol v3)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive3-cli" +homepage = "https://developers.google.com/drive/" +documentation = "http://byron.github.io/google-apis-rs/google_drive3_cli" +license = "MIT" +keywords = ["drive", "google", "cli"] + +[[bin]] +name = "drive3" + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +strsim = "0.4" +yup-hyper-mock = "1.0" +clap = "2.0" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + + +[dependencies.google-drive3] +path = "../drive3" diff --git a/gen/drive3-cli/LICENSE.md b/gen/drive3-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/drive3-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/drive3-cli/README.md b/gen/drive3-cli/README.md new file mode 100644 index 0000000000..155344402d --- /dev/null +++ b/gen/drive3-cli/README.md @@ -0,0 +1,153 @@ + +The `drive3` command-line interface *(CLI)* allows to use most features of the *Google drive* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *drive* API can be found at the +[official documentation site](https://developers.google.com/drive/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/drive3.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/drive3.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/drive3-cli). + +# Usage + +This documentation was generated from the *drive* API at revision *20160126*. The CLI is at version *0.3.3*. + +```bash +drive3 [options] + about + get [-p ]... [-o ] + changes + get-start-page-token [-p ]... [-o ] + list [-p ]... [-o ] + watch (-r )... [-p ]... [-o ] + channels + stop (-r )... [-p ]... + comments + create (-r )... [-p ]... [-o ] + delete [-p ]... + get [-p ]... [-o ] + list [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + files + copy (-r )... [-p ]... [-o ] + create (-r )... (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] + delete [-p ]... + empty-trash [-p ]... + export [-p ]... [-o ] + generate-ids [-p ]... [-o ] + get [-p ]... [-o ] + list [-p ]... [-o ] + update (-r )... (-u (simple|resumable) -f [-m ]) [-p ]... [-o ] + watch (-r )... [-p ]... [-o ] + permissions + create (-r )... [-p ]... [-o ] + delete [-p ]... + get [-p ]... [-o ] + list [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + replies + create (-r )... [-p ]... [-o ] + delete [-p ]... + get [-p ]... [-o ] + list [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + revisions + delete [-p ]... + get [-p ]... [-o ] + list [-p ]... [-o ] + update (-r )... [-p ]... [-o ] + drive3 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `drive3-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/drive3-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/drive3-secret.json`, assuming that the required *drive* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `drive3 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/drive3-cli/mkdocs.yml b/gen/drive3-cli/mkdocs.yml new file mode 100644 index 0000000000..ad085dc5e2 --- /dev/null +++ b/gen/drive3-cli/mkdocs.yml @@ -0,0 +1,50 @@ +site_name: drive v0.3.3+20160126 +site_url: http://byron.github.io/google-apis-rs/google-drive3-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/drive3-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['about_get.md', 'About', 'Get'] +- ['changes_get-start-page-token.md', 'Changes', 'Get Start Page Token'] +- ['changes_list.md', 'Changes', 'List'] +- ['changes_watch.md', 'Changes', 'Watch'] +- ['channels_stop.md', 'Channels', 'Stop'] +- ['comments_create.md', 'Comments', 'Create'] +- ['comments_delete.md', 'Comments', 'Delete'] +- ['comments_get.md', 'Comments', 'Get'] +- ['comments_list.md', 'Comments', 'List'] +- ['comments_update.md', 'Comments', 'Update'] +- ['files_copy.md', 'Files', 'Copy'] +- ['files_create.md', 'Files', 'Create'] +- ['files_delete.md', 'Files', 'Delete'] +- ['files_empty-trash.md', 'Files', 'Empty Trash'] +- ['files_export.md', 'Files', 'Export'] +- ['files_generate-ids.md', 'Files', 'Generate Ids'] +- ['files_get.md', 'Files', 'Get'] +- ['files_list.md', 'Files', 'List'] +- ['files_update.md', 'Files', 'Update'] +- ['files_watch.md', 'Files', 'Watch'] +- ['permissions_create.md', 'Permissions', 'Create'] +- ['permissions_delete.md', 'Permissions', 'Delete'] +- ['permissions_get.md', 'Permissions', 'Get'] +- ['permissions_list.md', 'Permissions', 'List'] +- ['permissions_update.md', 'Permissions', 'Update'] +- ['replies_create.md', 'Replies', 'Create'] +- ['replies_delete.md', 'Replies', 'Delete'] +- ['replies_get.md', 'Replies', 'Get'] +- ['replies_list.md', 'Replies', 'List'] +- ['replies_update.md', 'Replies', 'Update'] +- ['revisions_delete.md', 'Revisions', 'Delete'] +- ['revisions_get.md', 'Revisions', 'Get'] +- ['revisions_list.md', 'Revisions', 'List'] +- ['revisions_update.md', 'Revisions', 'Update'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/drive3-cli/src/cmn.rs b/gen/drive3-cli/src/cmn.rs new file mode 100644 index 0000000000..ae86fdef65 --- /dev/null +++ b/gen/drive3-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::IoError(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::IoError(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::IoError(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + IOError((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::IOError((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + IOError((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::IOError((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::IOError( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::IoError(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::IoError(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/drive3-cli/src/main.rs b/gen/drive3-cli/src/main.rs new file mode 100644 index 0000000000..885e8ba868 --- /dev/null +++ b/gen/drive3-cli/src/main.rs @@ -0,0 +1,3979 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_drive3 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Drive>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _about_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.about().get(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _changes_get_start_page_token(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.changes().get_start_page_token(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _changes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.changes().list(opt.value_of("page-token").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "spaces" => { + call = call.spaces(value.unwrap_or("")); + }, + "restrict-to-my-drive" => { + call = call.restrict_to_my_drive(arg_from_str(value.unwrap_or("false"), err, "restrict-to-my-drive", "boolean")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "include-removed" => { + call = call.include_removed(arg_from_str(value.unwrap_or("false"), err, "include-removed", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["spaces", "page-size", "restrict-to-my-drive", "include-removed"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _changes_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-id" => Some(("resourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payload" => Some(("payload", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "token" => Some(("token", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "params" => Some(("params", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "expiration" => Some(("expiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address" => Some(("address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "expiration", "id", "kind", "params", "payload", "resource-id", "resource-uri", "token", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Channel = json::value::from_value(object).unwrap(); + let mut call = self.hub.changes().watch(request, opt.value_of("page-token").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "spaces" => { + call = call.spaces(value.unwrap_or("")); + }, + "restrict-to-my-drive" => { + call = call.restrict_to_my_drive(arg_from_str(value.unwrap_or("false"), err, "restrict-to-my-drive", "boolean")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "include-removed" => { + call = call.include_removed(arg_from_str(value.unwrap_or("false"), err, "include-removed", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["spaces", "page-size", "restrict-to-my-drive", "include-removed"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _channels_stop(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-id" => Some(("resourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payload" => Some(("payload", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "token" => Some(("token", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "params" => Some(("params", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "expiration" => Some(("expiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address" => Some(("address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "expiration", "id", "kind", "params", "payload", "resource-id", "resource-uri", "token", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Channel = json::value::from_value(object).unwrap(); + let mut call = self.hub.channels().stop(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _comments_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "resolved" => Some(("resolved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.me" => Some(("author.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "author.kind" => Some(("author.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.display-name" => Some(("author.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.permission-id" => Some(("author.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.email-address" => Some(("author.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.photo-link" => Some(("author.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deleted" => Some(("deleted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "quoted-file-content.mime-type" => Some(("quotedFileContent.mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "quoted-file-content.value" => Some(("quotedFileContent.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-content" => Some(("htmlContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "created-time" => Some(("createdTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "anchor" => Some(("anchor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["anchor", "author", "content", "created-time", "deleted", "display-name", "email-address", "html-content", "id", "kind", "me", "mime-type", "modified-time", "permission-id", "photo-link", "quoted-file-content", "resolved", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Comment = json::value::from_value(object).unwrap(); + let mut call = self.hub.comments().create(request, opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _comments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.comments().delete(opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _comments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.comments().get(opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "include-deleted" => { + call = call.include_deleted(arg_from_str(value.unwrap_or("false"), err, "include-deleted", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["include-deleted"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _comments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.comments().list(opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "start-modified-time" => { + call = call.start_modified_time(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "include-deleted" => { + call = call.include_deleted(arg_from_str(value.unwrap_or("false"), err, "include-deleted", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "include-deleted", "page-size", "start-modified-time"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _comments_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "resolved" => Some(("resolved", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.me" => Some(("author.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "author.kind" => Some(("author.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.display-name" => Some(("author.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.permission-id" => Some(("author.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.email-address" => Some(("author.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.photo-link" => Some(("author.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deleted" => Some(("deleted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "quoted-file-content.mime-type" => Some(("quotedFileContent.mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "quoted-file-content.value" => Some(("quotedFileContent.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "html-content" => Some(("htmlContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "created-time" => Some(("createdTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "anchor" => Some(("anchor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["anchor", "author", "content", "created-time", "deleted", "display-name", "email-address", "html-content", "id", "kind", "me", "mime-type", "modified-time", "permission-id", "photo-link", "quoted-file-content", "resolved", "value"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Comment = json::value::from_value(object).unwrap(); + let mut call = self.hub.comments().update(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _files_copy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-by-me-time" => Some(("modifiedByMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "thumbnail-link" => Some(("thumbnailLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "explicitly-trashed" => Some(("explicitlyTrashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "writers-can-share" => Some(("writersCanShare", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "owned-by-me" => Some(("ownedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "viewed-by-me-time" => Some(("viewedByMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.me" => Some(("sharingUser.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "sharing-user.kind" => Some(("sharingUser.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.display-name" => Some(("sharingUser.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.permission-id" => Some(("sharingUser.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.email-address" => Some(("sharingUser.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.photo-link" => Some(("sharingUser.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size" => Some(("size", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-media-metadata.width" => Some(("videoMediaMetadata.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-media-metadata.duration-millis" => Some(("videoMediaMetadata.durationMillis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-media-metadata.height" => Some(("videoMediaMetadata.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modifying-user.me" => Some(("lastModifyingUser.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modifying-user.kind" => Some(("lastModifyingUser.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.display-name" => Some(("lastModifyingUser.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.permission-id" => Some(("lastModifyingUser.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.email-address" => Some(("lastModifyingUser.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.photo-link" => Some(("lastModifyingUser.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "folder-color-rgb" => Some(("folderColorRgb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-properties" => Some(("appProperties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "capabilities.can-copy" => Some(("capabilities.canCopy", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "capabilities.can-share" => Some(("capabilities.canShare", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "capabilities.can-edit" => Some(("capabilities.canEdit", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "capabilities.can-comment" => Some(("capabilities.canComment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "web-view-link" => Some(("webViewLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parents" => Some(("parents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "shared-with-me-time" => Some(("sharedWithMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "shared" => Some(("shared", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "full-file-extension" => Some(("fullFileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-filename" => Some(("originalFilename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "viewers-can-copy-content" => Some(("viewersCanCopyContent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "viewed-by-me" => Some(("viewedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "quota-bytes-used" => Some(("quotaBytesUsed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "file-extension" => Some(("fileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "properties" => Some(("properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "md5-checksum" => Some(("md5Checksum", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "icon-link" => Some(("iconLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.exposure-bias" => Some(("imageMediaMetadata.exposureBias", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.exposure-time" => Some(("imageMediaMetadata.exposureTime", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.max-aperture-value" => Some(("imageMediaMetadata.maxApertureValue", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.iso-speed" => Some(("imageMediaMetadata.isoSpeed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.focal-length" => Some(("imageMediaMetadata.focalLength", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.camera-make" => Some(("imageMediaMetadata.cameraMake", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.exposure-mode" => Some(("imageMediaMetadata.exposureMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.color-space" => Some(("imageMediaMetadata.colorSpace", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.location.latitude" => Some(("imageMediaMetadata.location.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.location.altitude" => Some(("imageMediaMetadata.location.altitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.location.longitude" => Some(("imageMediaMetadata.location.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.subject-distance" => Some(("imageMediaMetadata.subjectDistance", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.height" => Some(("imageMediaMetadata.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.lens" => Some(("imageMediaMetadata.lens", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.width" => Some(("imageMediaMetadata.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.metering-mode" => Some(("imageMediaMetadata.meteringMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.flash-used" => Some(("imageMediaMetadata.flashUsed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "image-media-metadata.time" => Some(("imageMediaMetadata.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.aperture" => Some(("imageMediaMetadata.aperture", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.rotation" => Some(("imageMediaMetadata.rotation", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.sensor" => Some(("imageMediaMetadata.sensor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.white-balance" => Some(("imageMediaMetadata.whiteBalance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.camera-model" => Some(("imageMediaMetadata.cameraModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "web-content-link" => Some(("webContentLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "spaces" => Some(("spaces", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "trashed" => Some(("trashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "content-hints.indexable-text" => Some(("contentHints.indexableText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-hints.thumbnail.mime-type" => Some(("contentHints.thumbnail.mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-hints.thumbnail.image" => Some(("contentHints.thumbnail.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "created-time" => Some(("createdTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "starred" => Some(("starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "head-revision-id" => Some(("headRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-comment", "can-copy", "can-edit", "can-share", "capabilities", "color-space", "content-hints", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "thumbnail", "thumbnail-link", "time", "trashed", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::File = json::value::from_value(object).unwrap(); + let mut call = self.hub.files().copy(request, opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "ocr-language" => { + call = call.ocr_language(value.unwrap_or("")); + }, + "keep-revision-forever" => { + call = call.keep_revision_forever(arg_from_str(value.unwrap_or("false"), err, "keep-revision-forever", "boolean")); + }, + "ignore-default-visibility" => { + call = call.ignore_default_visibility(arg_from_str(value.unwrap_or("false"), err, "ignore-default-visibility", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["keep-revision-forever", "ocr-language", "ignore-default-visibility"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _files_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-by-me-time" => Some(("modifiedByMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "thumbnail-link" => Some(("thumbnailLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "explicitly-trashed" => Some(("explicitlyTrashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "writers-can-share" => Some(("writersCanShare", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "owned-by-me" => Some(("ownedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "viewed-by-me-time" => Some(("viewedByMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.me" => Some(("sharingUser.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "sharing-user.kind" => Some(("sharingUser.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.display-name" => Some(("sharingUser.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.permission-id" => Some(("sharingUser.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.email-address" => Some(("sharingUser.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.photo-link" => Some(("sharingUser.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size" => Some(("size", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-media-metadata.width" => Some(("videoMediaMetadata.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-media-metadata.duration-millis" => Some(("videoMediaMetadata.durationMillis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-media-metadata.height" => Some(("videoMediaMetadata.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modifying-user.me" => Some(("lastModifyingUser.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modifying-user.kind" => Some(("lastModifyingUser.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.display-name" => Some(("lastModifyingUser.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.permission-id" => Some(("lastModifyingUser.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.email-address" => Some(("lastModifyingUser.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.photo-link" => Some(("lastModifyingUser.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "folder-color-rgb" => Some(("folderColorRgb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-properties" => Some(("appProperties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "capabilities.can-copy" => Some(("capabilities.canCopy", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "capabilities.can-share" => Some(("capabilities.canShare", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "capabilities.can-edit" => Some(("capabilities.canEdit", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "capabilities.can-comment" => Some(("capabilities.canComment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "web-view-link" => Some(("webViewLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parents" => Some(("parents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "shared-with-me-time" => Some(("sharedWithMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "shared" => Some(("shared", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "full-file-extension" => Some(("fullFileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-filename" => Some(("originalFilename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "viewers-can-copy-content" => Some(("viewersCanCopyContent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "viewed-by-me" => Some(("viewedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "quota-bytes-used" => Some(("quotaBytesUsed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "file-extension" => Some(("fileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "properties" => Some(("properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "md5-checksum" => Some(("md5Checksum", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "icon-link" => Some(("iconLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.exposure-bias" => Some(("imageMediaMetadata.exposureBias", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.exposure-time" => Some(("imageMediaMetadata.exposureTime", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.max-aperture-value" => Some(("imageMediaMetadata.maxApertureValue", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.iso-speed" => Some(("imageMediaMetadata.isoSpeed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.focal-length" => Some(("imageMediaMetadata.focalLength", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.camera-make" => Some(("imageMediaMetadata.cameraMake", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.exposure-mode" => Some(("imageMediaMetadata.exposureMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.color-space" => Some(("imageMediaMetadata.colorSpace", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.location.latitude" => Some(("imageMediaMetadata.location.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.location.altitude" => Some(("imageMediaMetadata.location.altitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.location.longitude" => Some(("imageMediaMetadata.location.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.subject-distance" => Some(("imageMediaMetadata.subjectDistance", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.height" => Some(("imageMediaMetadata.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.lens" => Some(("imageMediaMetadata.lens", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.width" => Some(("imageMediaMetadata.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.metering-mode" => Some(("imageMediaMetadata.meteringMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.flash-used" => Some(("imageMediaMetadata.flashUsed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "image-media-metadata.time" => Some(("imageMediaMetadata.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.aperture" => Some(("imageMediaMetadata.aperture", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.rotation" => Some(("imageMediaMetadata.rotation", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.sensor" => Some(("imageMediaMetadata.sensor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.white-balance" => Some(("imageMediaMetadata.whiteBalance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.camera-model" => Some(("imageMediaMetadata.cameraModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "web-content-link" => Some(("webContentLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "spaces" => Some(("spaces", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "trashed" => Some(("trashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "content-hints.indexable-text" => Some(("contentHints.indexableText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-hints.thumbnail.mime-type" => Some(("contentHints.thumbnail.mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-hints.thumbnail.image" => Some(("contentHints.thumbnail.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "created-time" => Some(("createdTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "starred" => Some(("starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "head-revision-id" => Some(("headRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-comment", "can-copy", "can-edit", "can-share", "capabilities", "color-space", "content-hints", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "thumbnail", "thumbnail-link", "time", "trashed", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::File = json::value::from_value(object).unwrap(); + let mut call = self.hub.files().create(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "use-content-as-indexable-text" => { + call = call.use_content_as_indexable_text(arg_from_str(value.unwrap_or("false"), err, "use-content-as-indexable-text", "boolean")); + }, + "ocr-language" => { + call = call.ocr_language(value.unwrap_or("")); + }, + "keep-revision-forever" => { + call = call.keep_revision_forever(arg_from_str(value.unwrap_or("false"), err, "keep-revision-forever", "boolean")); + }, + "ignore-default-visibility" => { + call = call.ignore_default_visibility(arg_from_str(value.unwrap_or("false"), err, "ignore-default-visibility", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["keep-revision-forever", "use-content-as-indexable-text", "ocr-language", "ignore-default-visibility"].iter().map(|v|*v)); + v } )); + } + } + } + } + let vals = opt.values_of("mode").unwrap().collect::>(); + let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); + let mut input_file = input_file_from_opts(vals[1], err); + let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Upload(UploadProtocol::Simple) => call.upload(input_file.unwrap(), mime_type.unwrap()), + CallType::Upload(UploadProtocol::Resumable) => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), + CallType::Standard => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _files_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.files().delete(opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _files_empty_trash(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.files().empty_trash(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _files_export(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut download_mode = false; + let mut call = self.hub.files().export(opt.value_of("file-id").unwrap_or(""), opt.value_of("mime-type").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + if !download_mode { + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _files_generate_ids(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.files().generate_ids(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "space" => { + call = call.space(value.unwrap_or("")); + }, + "count" => { + call = call.count(arg_from_str(value.unwrap_or("-0"), err, "count", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["count", "space"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _files_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut download_mode = false; + let mut call = self.hub.files().get(opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "acknowledge-abuse" => { + call = call.acknowledge_abuse(arg_from_str(value.unwrap_or("false"), err, "acknowledge-abuse", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["acknowledge-abuse"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + if !download_mode { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _files_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.files().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "spaces" => { + call = call.spaces(value.unwrap_or("")); + }, + "q" => { + call = call.q(value.unwrap_or("")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, + "corpus" => { + call = call.corpus(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["order-by", "page-size", "q", "page-token", "spaces", "corpus"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _files_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-by-me-time" => Some(("modifiedByMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "thumbnail-link" => Some(("thumbnailLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "explicitly-trashed" => Some(("explicitlyTrashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "writers-can-share" => Some(("writersCanShare", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "owned-by-me" => Some(("ownedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "viewed-by-me-time" => Some(("viewedByMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.me" => Some(("sharingUser.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "sharing-user.kind" => Some(("sharingUser.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.display-name" => Some(("sharingUser.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.permission-id" => Some(("sharingUser.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.email-address" => Some(("sharingUser.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "sharing-user.photo-link" => Some(("sharingUser.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "size" => Some(("size", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-media-metadata.width" => Some(("videoMediaMetadata.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "video-media-metadata.duration-millis" => Some(("videoMediaMetadata.durationMillis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "video-media-metadata.height" => Some(("videoMediaMetadata.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "last-modifying-user.me" => Some(("lastModifyingUser.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modifying-user.kind" => Some(("lastModifyingUser.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.display-name" => Some(("lastModifyingUser.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.permission-id" => Some(("lastModifyingUser.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.email-address" => Some(("lastModifyingUser.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.photo-link" => Some(("lastModifyingUser.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "folder-color-rgb" => Some(("folderColorRgb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "app-properties" => Some(("appProperties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "capabilities.can-copy" => Some(("capabilities.canCopy", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "capabilities.can-share" => Some(("capabilities.canShare", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "capabilities.can-edit" => Some(("capabilities.canEdit", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "capabilities.can-comment" => Some(("capabilities.canComment", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "web-view-link" => Some(("webViewLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "parents" => Some(("parents", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "shared-with-me-time" => Some(("sharedWithMeTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "shared" => Some(("shared", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "full-file-extension" => Some(("fullFileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "original-filename" => Some(("originalFilename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "viewers-can-copy-content" => Some(("viewersCanCopyContent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "viewed-by-me" => Some(("viewedByMe", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "quota-bytes-used" => Some(("quotaBytesUsed", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "file-extension" => Some(("fileExtension", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "properties" => Some(("properties", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "md5-checksum" => Some(("md5Checksum", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "icon-link" => Some(("iconLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.exposure-bias" => Some(("imageMediaMetadata.exposureBias", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.exposure-time" => Some(("imageMediaMetadata.exposureTime", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.max-aperture-value" => Some(("imageMediaMetadata.maxApertureValue", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.iso-speed" => Some(("imageMediaMetadata.isoSpeed", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.focal-length" => Some(("imageMediaMetadata.focalLength", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.camera-make" => Some(("imageMediaMetadata.cameraMake", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.exposure-mode" => Some(("imageMediaMetadata.exposureMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.color-space" => Some(("imageMediaMetadata.colorSpace", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.location.latitude" => Some(("imageMediaMetadata.location.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.location.altitude" => Some(("imageMediaMetadata.location.altitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.location.longitude" => Some(("imageMediaMetadata.location.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.subject-distance" => Some(("imageMediaMetadata.subjectDistance", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.height" => Some(("imageMediaMetadata.height", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.lens" => Some(("imageMediaMetadata.lens", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.width" => Some(("imageMediaMetadata.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.metering-mode" => Some(("imageMediaMetadata.meteringMode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.flash-used" => Some(("imageMediaMetadata.flashUsed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "image-media-metadata.time" => Some(("imageMediaMetadata.time", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.aperture" => Some(("imageMediaMetadata.aperture", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), + "image-media-metadata.rotation" => Some(("imageMediaMetadata.rotation", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "image-media-metadata.sensor" => Some(("imageMediaMetadata.sensor", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.white-balance" => Some(("imageMediaMetadata.whiteBalance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "image-media-metadata.camera-model" => Some(("imageMediaMetadata.cameraModel", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "web-content-link" => Some(("webContentLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "spaces" => Some(("spaces", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "trashed" => Some(("trashed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "content-hints.indexable-text" => Some(("contentHints.indexableText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-hints.thumbnail.mime-type" => Some(("contentHints.thumbnail.mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-hints.thumbnail.image" => Some(("contentHints.thumbnail.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "created-time" => Some(("createdTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "starred" => Some(("starred", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "head-revision-id" => Some(("headRevisionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["altitude", "aperture", "app-properties", "camera-make", "camera-model", "can-comment", "can-copy", "can-edit", "can-share", "capabilities", "color-space", "content-hints", "created-time", "description", "display-name", "duration-millis", "email-address", "explicitly-trashed", "exposure-bias", "exposure-mode", "exposure-time", "file-extension", "flash-used", "focal-length", "folder-color-rgb", "full-file-extension", "head-revision-id", "height", "icon-link", "id", "image", "image-media-metadata", "indexable-text", "iso-speed", "kind", "last-modifying-user", "latitude", "lens", "location", "longitude", "max-aperture-value", "md5-checksum", "me", "metering-mode", "mime-type", "modified-by-me-time", "modified-time", "name", "original-filename", "owned-by-me", "parents", "permission-id", "photo-link", "properties", "quota-bytes-used", "rotation", "sensor", "shared", "shared-with-me-time", "sharing-user", "size", "spaces", "starred", "subject-distance", "thumbnail", "thumbnail-link", "time", "trashed", "version", "video-media-metadata", "viewed-by-me", "viewed-by-me-time", "viewers-can-copy-content", "web-content-link", "web-view-link", "white-balance", "width", "writers-can-share"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::File = json::value::from_value(object).unwrap(); + let mut call = self.hub.files().update(request, opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "use-content-as-indexable-text" => { + call = call.use_content_as_indexable_text(arg_from_str(value.unwrap_or("false"), err, "use-content-as-indexable-text", "boolean")); + }, + "remove-parents" => { + call = call.remove_parents(value.unwrap_or("")); + }, + "ocr-language" => { + call = call.ocr_language(value.unwrap_or("")); + }, + "keep-revision-forever" => { + call = call.keep_revision_forever(arg_from_str(value.unwrap_or("false"), err, "keep-revision-forever", "boolean")); + }, + "add-parents" => { + call = call.add_parents(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["add-parents", "keep-revision-forever", "use-content-as-indexable-text", "ocr-language", "remove-parents"].iter().map(|v|*v)); + v } )); + } + } + } + } + let vals = opt.values_of("mode").unwrap().collect::>(); + let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); + let mut input_file = input_file_from_opts(vals[1], err); + let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Upload(UploadProtocol::Simple) => call.upload(input_file.unwrap(), mime_type.unwrap()), + CallType::Upload(UploadProtocol::Resumable) => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), + CallType::Standard => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _files_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "resource-id" => Some(("resourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "payload" => Some(("payload", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "token" => Some(("token", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "params" => Some(("params", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "expiration" => Some(("expiration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address" => Some(("address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "expiration", "id", "kind", "params", "payload", "resource-id", "resource-uri", "token", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Channel = json::value::from_value(object).unwrap(); + let mut download_mode = false; + let mut call = self.hub.files().watch(request, opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "acknowledge-abuse" => { + call = call.acknowledge_abuse(arg_from_str(value.unwrap_or("false"), err, "acknowledge-abuse", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["acknowledge-abuse"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + if !download_mode { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _permissions_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-file-discovery" => Some(("allowFileDiscovery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email-address" => Some(("emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "photo-link" => Some(("photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "role" => Some(("role", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-file-discovery", "display-name", "domain", "email-address", "id", "kind", "photo-link", "role", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Permission = json::value::from_value(object).unwrap(); + let mut call = self.hub.permissions().create(request, opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "transfer-ownership" => { + call = call.transfer_ownership(arg_from_str(value.unwrap_or("false"), err, "transfer-ownership", "boolean")); + }, + "send-notification-email" => { + call = call.send_notification_email(arg_from_str(value.unwrap_or("false"), err, "send-notification-email", "boolean")); + }, + "email-message" => { + call = call.email_message(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["send-notification-email", "email-message", "transfer-ownership"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _permissions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.permissions().delete(opt.value_of("file-id").unwrap_or(""), opt.value_of("permission-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.permissions().get(opt.value_of("file-id").unwrap_or(""), opt.value_of("permission-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.permissions().list(opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _permissions_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "allow-file-discovery" => Some(("allowFileDiscovery", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email-address" => Some(("emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "photo-link" => Some(("photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "role" => Some(("role", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["allow-file-discovery", "display-name", "domain", "email-address", "id", "kind", "photo-link", "role", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Permission = json::value::from_value(object).unwrap(); + let mut call = self.hub.permissions().update(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("permission-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "transfer-ownership" => { + call = call.transfer_ownership(arg_from_str(value.unwrap_or("false"), err, "transfer-ownership", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["transfer-ownership"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _replies_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.me" => Some(("author.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "author.kind" => Some(("author.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.display-name" => Some(("author.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.permission-id" => Some(("author.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.email-address" => Some(("author.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.photo-link" => Some(("author.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deleted" => Some(("deleted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "html-content" => Some(("htmlContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "created-time" => Some(("createdTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "action" => Some(("action", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["action", "author", "content", "created-time", "deleted", "display-name", "email-address", "html-content", "id", "kind", "me", "modified-time", "permission-id", "photo-link"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Reply = json::value::from_value(object).unwrap(); + let mut call = self.hub.replies().create(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _replies_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.replies().delete(opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or(""), opt.value_of("reply-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _replies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.replies().get(opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or(""), opt.value_of("reply-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "include-deleted" => { + call = call.include_deleted(arg_from_str(value.unwrap_or("false"), err, "include-deleted", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["include-deleted"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _replies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.replies().list(opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + "include-deleted" => { + call = call.include_deleted(arg_from_str(value.unwrap_or("false"), err, "include-deleted", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "include-deleted", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _replies_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.me" => Some(("author.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "author.kind" => Some(("author.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.display-name" => Some(("author.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.permission-id" => Some(("author.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.email-address" => Some(("author.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author.photo-link" => Some(("author.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "deleted" => Some(("deleted", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "html-content" => Some(("htmlContent", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content" => Some(("content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "created-time" => Some(("createdTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "action" => Some(("action", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["action", "author", "content", "created-time", "deleted", "display-name", "email-address", "html-content", "id", "kind", "me", "modified-time", "permission-id", "photo-link"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Reply = json::value::from_value(object).unwrap(); + let mut call = self.hub.replies().update(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("comment-id").unwrap_or(""), opt.value_of("reply-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _revisions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.revisions().delete(opt.value_of("file-id").unwrap_or(""), opt.value_of("revision-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _revisions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut download_mode = false; + let mut call = self.hub.revisions().get(opt.value_of("file-id").unwrap_or(""), opt.value_of("revision-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "acknowledge-abuse" => { + call = call.acknowledge_abuse(arg_from_str(value.unwrap_or("false"), err, "acknowledge-abuse", "boolean")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + if key == "alt" && value.unwrap_or("unset") == "media" { + download_mode = true; + } + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["acknowledge-abuse"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + if !download_mode { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + } else { + io::copy(&mut response, &mut ostream).unwrap(); + ostream.flush().unwrap(); + } + Ok(()) + } + } + } + } + + fn _revisions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.revisions().list(opt.value_of("file-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _revisions_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "mime-type" => Some(("mimeType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "modified-time" => Some(("modifiedTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.me" => Some(("lastModifyingUser.me", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "last-modifying-user.kind" => Some(("lastModifyingUser.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.display-name" => Some(("lastModifyingUser.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.permission-id" => Some(("lastModifyingUser.permissionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.email-address" => Some(("lastModifyingUser.emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "last-modifying-user.photo-link" => Some(("lastModifyingUser.photoLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "keep-forever" => Some(("keepForever", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "publish-auto" => Some(("publishAuto", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "original-filename" => Some(("originalFilename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "published" => Some(("published", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "size" => Some(("size", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "md5-checksum" => Some(("md5Checksum", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "published-outside-domain" => Some(("publishedOutsideDomain", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-name", "email-address", "id", "keep-forever", "kind", "last-modifying-user", "md5-checksum", "me", "mime-type", "modified-time", "original-filename", "permission-id", "photo-link", "publish-auto", "published", "published-outside-domain", "size"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Revision = json::value::from_value(object).unwrap(); + let mut call = self.hub.revisions().update(request, opt.value_of("file-id").unwrap_or(""), opt.value_of("revision-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("about", Some(opt)) => { + match opt.subcommand() { + ("get", Some(opt)) => { + call_result = self._about_get(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("about".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("changes", Some(opt)) => { + match opt.subcommand() { + ("get-start-page-token", Some(opt)) => { + call_result = self._changes_get_start_page_token(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._changes_list(opt, dry_run, &mut err); + }, + ("watch", Some(opt)) => { + call_result = self._changes_watch(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("changes".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("channels", Some(opt)) => { + match opt.subcommand() { + ("stop", Some(opt)) => { + call_result = self._channels_stop(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("channels".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("comments", Some(opt)) => { + match opt.subcommand() { + ("create", Some(opt)) => { + call_result = self._comments_create(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._comments_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._comments_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._comments_list(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._comments_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("comments".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("files", Some(opt)) => { + match opt.subcommand() { + ("copy", Some(opt)) => { + call_result = self._files_copy(opt, dry_run, &mut err); + }, + ("create", Some(opt)) => { + call_result = self._files_create(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._files_delete(opt, dry_run, &mut err); + }, + ("empty-trash", Some(opt)) => { + call_result = self._files_empty_trash(opt, dry_run, &mut err); + }, + ("export", Some(opt)) => { + call_result = self._files_export(opt, dry_run, &mut err); + }, + ("generate-ids", Some(opt)) => { + call_result = self._files_generate_ids(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._files_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._files_list(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._files_update(opt, dry_run, &mut err); + }, + ("watch", Some(opt)) => { + call_result = self._files_watch(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("files".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("permissions", Some(opt)) => { + match opt.subcommand() { + ("create", Some(opt)) => { + call_result = self._permissions_create(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._permissions_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._permissions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._permissions_list(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._permissions_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("permissions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("replies", Some(opt)) => { + match opt.subcommand() { + ("create", Some(opt)) => { + call_result = self._replies_create(opt, dry_run, &mut err); + }, + ("delete", Some(opt)) => { + call_result = self._replies_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._replies_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._replies_list(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._replies_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("replies".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("revisions", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._revisions_delete(opt, dry_run, &mut err); + }, + ("get", Some(opt)) => { + call_result = self._revisions_get(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._revisions_list(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._revisions_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("revisions".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "drive3-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "drive3", + db_dir: config_dir.clone(), + }, None); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::Drive::new(client, auth), + gp: vec!["alt", "fields", "key", "oauth-token", "pretty-print", "quota-user", "user-ip"], + gpm: vec![ + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("user-ip", "userIp"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let upload_value_names = ["mode", "file"]; + let arg_data = [ + ("about", "methods: 'get'", vec![ + ("get", + Some(r##"Gets information about the user, the user's Drive, and system capabilities."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/about_get", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("changes", "methods: 'get-start-page-token', 'list' and 'watch'", vec![ + ("get-start-page-token", + Some(r##"Gets the starting pageToken for listing future changes."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/changes_get-start-page-token", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists changes for a user."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/changes_list", + vec![ + (Some(r##"page-token"##), + None, + Some(r##"The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("watch", + Some(r##"Subscribes to changes for a user."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/changes_watch", + vec![ + (Some(r##"page-token"##), + None, + Some(r##"The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("channels", "methods: 'stop'", vec![ + ("stop", + Some(r##"Stop watching resources through this channel"##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/channels_stop", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ]), + + ("comments", "methods: 'create', 'delete', 'get', 'list' and 'update'", vec![ + ("create", + Some(r##"Creates a new comment on a file."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/comments_create", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes a comment."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/comments_delete", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"comment-id"##), + None, + Some(r##"The ID of the comment."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets a comment by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/comments_get", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"comment-id"##), + None, + Some(r##"The ID of the comment."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists a file's comments."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/comments_list", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates a comment with patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/comments_update", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"comment-id"##), + None, + Some(r##"The ID of the comment."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("files", "methods: 'copy', 'create', 'delete', 'empty-trash', 'export', 'generate-ids', 'get', 'list', 'update' and 'watch'", vec![ + ("copy", + Some(r##"Creates a copy of a file and applies any requested updates with patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/files_copy", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("create", + Some(r##"Creates a new file."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/files_create", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"mode"##), + Some(r##"u"##), + Some(r##"Specify the upload protocol (simple|resumable) and the file to upload"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Permanently deletes a file owned by the user without moving it to the trash. If the target is a folder, all descendants owned by the user are also deleted."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/files_delete", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("empty-trash", + Some(r##"Permanently deletes all of the user's trashed files."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/files_empty-trash", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("export", + Some(r##"Exports a Google Doc to the requested MIME type."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/files_export", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"mime-type"##), + None, + Some(r##"The MIME type of the format requested for this export."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("generate-ids", + Some(r##"Generates a set of file IDs which can be provided in create requests."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/files_generate-ids", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get", + Some(r##"Gets a file's metadata or content by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/files_get", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists or searches files."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/files_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates a file's metadata and/or content with patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/files_update", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"mode"##), + Some(r##"u"##), + Some(r##"Specify the upload protocol (simple|resumable) and the file to upload"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("watch", + Some(r##"Subscribes to changes to a file"##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/files_watch", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("permissions", "methods: 'create', 'delete', 'get', 'list' and 'update'", vec![ + ("create", + Some(r##"Creates a permission for a file."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/permissions_create", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes a permission."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/permissions_delete", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"permission-id"##), + None, + Some(r##"The ID of the permission."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets a permission by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/permissions_get", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"permission-id"##), + None, + Some(r##"The ID of the permission."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists a file's permissions."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/permissions_list", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates a permission with patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/permissions_update", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"permission-id"##), + None, + Some(r##"The ID of the permission."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("replies", "methods: 'create', 'delete', 'get', 'list' and 'update'", vec![ + ("create", + Some(r##"Creates a new reply to a comment."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/replies_create", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"comment-id"##), + None, + Some(r##"The ID of the comment."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("delete", + Some(r##"Deletes a reply."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/replies_delete", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"comment-id"##), + None, + Some(r##"The ID of the comment."##), + Some(true), + Some(false)), + + (Some(r##"reply-id"##), + None, + Some(r##"The ID of the reply."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets a reply by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/replies_get", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"comment-id"##), + None, + Some(r##"The ID of the comment."##), + Some(true), + Some(false)), + + (Some(r##"reply-id"##), + None, + Some(r##"The ID of the reply."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists a comment's replies."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/replies_list", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"comment-id"##), + None, + Some(r##"The ID of the comment."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates a reply with patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/replies_update", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"comment-id"##), + None, + Some(r##"The ID of the comment."##), + Some(true), + Some(false)), + + (Some(r##"reply-id"##), + None, + Some(r##"The ID of the reply."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("revisions", "methods: 'delete', 'get', 'list' and 'update'", vec![ + ("delete", + Some(r##"Permanently deletes a revision. This method is only applicable to files with binary content in Drive."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/revisions_delete", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"revision-id"##), + None, + Some(r##"The ID of the revision."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("get", + Some(r##"Gets a revision's metadata or content by ID."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/revisions_get", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"revision-id"##), + None, + Some(r##"The ID of the revision."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists a file's revisions."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/revisions_list", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("update", + Some(r##"Updates a revision with patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_drive3_cli/revisions_update", + vec![ + (Some(r##"file-id"##), + None, + Some(r##"The ID of the file."##), + Some(true), + Some(false)), + + (Some(r##"revision-id"##), + None, + Some(r##"The ID of the revision."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("drive3") + .author("Sebastian Thiel ") + .version("0.3.3+20160126") + .about("The API to interact with Drive.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_drive3_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + if arg_name_str == "mode" { + arg = arg.number_of_values(2); + arg = arg.value_names(&upload_value_names); + + scmd = scmd.arg(Arg::with_name("mime") + .short("m") + .requires("mode") + .required(false) + .help("The file's mime time, like 'application/octet-stream'") + .takes_value(true)); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/drive3/Cargo.toml b/gen/drive3/Cargo.toml new file mode 100644 index 0000000000..eb8dc26d2a --- /dev/null +++ b/gen/drive3/Cargo.toml @@ -0,0 +1,29 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-drive3" +version = "0.1.11+20160126" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with drive (protocol v3)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive3" +homepage = "https://developers.google.com/drive/" +documentation = "http://byron.github.io/google-apis-rs/google_drive3" +license = "MIT" +keywords = ["drive", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +url = ">= 0.5" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + diff --git a/gen/drive3/LICENSE.md b/gen/drive3/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/drive3/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/drive3/README.md b/gen/drive3/README.md new file mode 100644 index 0000000000..d4175b3d0c --- /dev/null +++ b/gen/drive3/README.md @@ -0,0 +1,228 @@ + +The `google-drive3` library allows access to all features of the *Google drive* service. + +This documentation was generated from *drive* crate version *0.1.11+20160126*, where *20160126* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. + +Everything else about the *drive* *v3* API can be found at the +[official documentation site](https://developers.google.com/drive/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_drive3/struct.Drive.html) ... + +* [about](http://byron.github.io/google-apis-rs/google_drive3/struct.About.html) + * [*get*](http://byron.github.io/google-apis-rs/google_drive3/struct.AboutGetCall.html) +* [changes](http://byron.github.io/google-apis-rs/google_drive3/struct.Change.html) + * [*get start page token*](http://byron.github.io/google-apis-rs/google_drive3/struct.ChangeGetStartPageTokenCall.html), [*list*](http://byron.github.io/google-apis-rs/google_drive3/struct.ChangeListCall.html) and [*watch*](http://byron.github.io/google-apis-rs/google_drive3/struct.ChangeWatchCall.html) +* [channels](http://byron.github.io/google-apis-rs/google_drive3/struct.Channel.html) + * [*stop*](http://byron.github.io/google-apis-rs/google_drive3/struct.ChannelStopCall.html) +* [comments](http://byron.github.io/google-apis-rs/google_drive3/struct.Comment.html) + * [*create*](http://byron.github.io/google-apis-rs/google_drive3/struct.CommentCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_drive3/struct.CommentDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_drive3/struct.CommentGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_drive3/struct.CommentListCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_drive3/struct.CommentUpdateCall.html) +* [files](http://byron.github.io/google-apis-rs/google_drive3/struct.File.html) + * [*copy*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileCopyCall.html), [*create*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileDeleteCall.html), [*empty trash*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileEmptyTrashCall.html), [*export*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileExportCall.html), [*generate ids*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileGenerateIdCall.html), [*get*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileListCall.html), [*update*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileUpdateCall.html) and [*watch*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileWatchCall.html) +* [permissions](http://byron.github.io/google-apis-rs/google_drive3/struct.Permission.html) + * [*create*](http://byron.github.io/google-apis-rs/google_drive3/struct.PermissionCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_drive3/struct.PermissionDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_drive3/struct.PermissionGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_drive3/struct.PermissionListCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_drive3/struct.PermissionUpdateCall.html) +* [replies](http://byron.github.io/google-apis-rs/google_drive3/struct.Reply.html) + * [*create*](http://byron.github.io/google-apis-rs/google_drive3/struct.ReplyCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_drive3/struct.ReplyDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_drive3/struct.ReplyGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_drive3/struct.ReplyListCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_drive3/struct.ReplyUpdateCall.html) +* [revisions](http://byron.github.io/google-apis-rs/google_drive3/struct.Revision.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_drive3/struct.RevisionDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_drive3/struct.RevisionGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_drive3/struct.RevisionListCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_drive3/struct.RevisionUpdateCall.html) + + +Upload supported by ... + +* [*update files*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileUpdateCall.html) +* [*create files*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileCreateCall.html) + +Download supported by ... + +* [*watch files*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileWatchCall.html) +* [*export files*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileExportCall.html) +* [*get revisions*](http://byron.github.io/google-apis-rs/google_drive3/struct.RevisionGetCall.html) +* [*get files*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileGetCall.html) + +Subscription supported by ... + +* [*watch changes*](http://byron.github.io/google-apis-rs/google_drive3/struct.ChangeWatchCall.html) +* [*watch files*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileWatchCall.html) +* [*list changes*](http://byron.github.io/google-apis-rs/google_drive3/struct.ChangeListCall.html) +* [*create files*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileCreateCall.html) +* [*get files*](http://byron.github.io/google-apis-rs/google_drive3/struct.FileGetCall.html) + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_drive3/struct.Drive.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_drive3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_drive3/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_drive3/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_drive3/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_drive3/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.files().watch(...).doit() +let r = hub.files().empty_trash(...).doit() +let r = hub.files().generate_ids(...).doit() +let r = hub.files().copy(...).doit() +let r = hub.files().create(...).doit() +let r = hub.files().list(...).doit() +let r = hub.files().delete(...).doit() +let r = hub.files().update(...).doit() +let r = hub.files().get(...).doit() +let r = hub.files().export(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-drive3 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_drive3 as drive3; +use drive3::File; +use drive3::{Result, Error}; +use std::fs; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use drive3::Drive; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = Drive::new(hyper::Client::new(), 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 ! +let mut req = File::default(); + +// You can configure optional parameters by calling the respective setters at will, and +// execute the final call using `upload_resumable(...)`. +// Values shown here are possibly random and not representative ! +let result = hub.files().update(req, "fileId") + .use_content_as_indexable_text(true) + .remove_parents("Stet") + .ocr_language("sed") + .keep_revision_forever(false) + .add_parents("dolores") + .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_drive3/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_drive3/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_drive3/../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](http://byron.github.io/google-apis-rs/google_drive3/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_drive3/trait.ResponseResult.html), 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")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_drive3/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_drive3/trait.CallBuilder.html) 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](http://byron.github.io/google-apis-rs/google_drive3/trait.Delegate.html) 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 [enocodable](http://byron.github.io/google-apis-rs/google_drive3/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_drive3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_drive3/trait.Part.html) 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](http://byron.github.io/google-apis-rs/google_drive3/trait.CallBuilder.html), 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](http://byron.github.io/google-apis-rs/google_drive3/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **drive3** 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-rs/LICENSE.md diff --git a/gen/drive3/src/build.rs b/gen/drive3/src/build.rs new file mode 100644 index 0000000000..70bd97e5a7 --- /dev/null +++ b/gen/drive3/src/build.rs @@ -0,0 +1,16 @@ +extern crate syntex; +extern crate serde_codegen; + +use std::env; +use std::path::Path; + +pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-drive3", &src, &dst).unwrap(); +} diff --git a/gen/drive3/src/cmn.rs b/gen/drive3/src/cmn.rs new file mode 100644 index 0000000000..87b91a8986 --- /dev/null +++ b/gen/drive3/src/cmn.rs @@ -0,0 +1,771 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && 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() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +// The following macro invocation needs to be expanded, as `include!` +// doens't support external macros +// header!{ +// #[doc="The `X-Upload-Content-Type` header."] +// (XUploadContentType, "X-Upload-Content-Type") => [Mime] + +// xupload_content_type { +// test_header!( +// test1, +// vec![b"text/plain"], +// Some(HeaderField( +// vec![Mime(TopLevel::Text, SubLevel::Plain, Vec::new())] +// ))); + +// } +// } + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// 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 delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + // workaround https://github.com/rust-lang/rust/issues/22252 + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/drive3/src/lib.rs b/gen/drive3/src/lib.rs new file mode 100644 index 0000000000..0411d1af9a --- /dev/null +++ b/gen/drive3/src/lib.rs @@ -0,0 +1,232 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *drive* crate version *0.1.11+20160126*, where *20160126* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. +//! +//! Everything else about the *drive* *v3* API can be found at the +//! [official documentation site](https://developers.google.com/drive/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/drive3). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Drive.html) ... +//! +//! * [about](struct.About.html) +//! * [*get*](struct.AboutGetCall.html) +//! * [changes](struct.Change.html) +//! * [*get start page token*](struct.ChangeGetStartPageTokenCall.html), [*list*](struct.ChangeListCall.html) and [*watch*](struct.ChangeWatchCall.html) +//! * [channels](struct.Channel.html) +//! * [*stop*](struct.ChannelStopCall.html) +//! * [comments](struct.Comment.html) +//! * [*create*](struct.CommentCreateCall.html), [*delete*](struct.CommentDeleteCall.html), [*get*](struct.CommentGetCall.html), [*list*](struct.CommentListCall.html) and [*update*](struct.CommentUpdateCall.html) +//! * [files](struct.File.html) +//! * [*copy*](struct.FileCopyCall.html), [*create*](struct.FileCreateCall.html), [*delete*](struct.FileDeleteCall.html), [*empty trash*](struct.FileEmptyTrashCall.html), [*export*](struct.FileExportCall.html), [*generate ids*](struct.FileGenerateIdCall.html), [*get*](struct.FileGetCall.html), [*list*](struct.FileListCall.html), [*update*](struct.FileUpdateCall.html) and [*watch*](struct.FileWatchCall.html) +//! * [permissions](struct.Permission.html) +//! * [*create*](struct.PermissionCreateCall.html), [*delete*](struct.PermissionDeleteCall.html), [*get*](struct.PermissionGetCall.html), [*list*](struct.PermissionListCall.html) and [*update*](struct.PermissionUpdateCall.html) +//! * [replies](struct.Reply.html) +//! * [*create*](struct.ReplyCreateCall.html), [*delete*](struct.ReplyDeleteCall.html), [*get*](struct.ReplyGetCall.html), [*list*](struct.ReplyListCall.html) and [*update*](struct.ReplyUpdateCall.html) +//! * [revisions](struct.Revision.html) +//! * [*delete*](struct.RevisionDeleteCall.html), [*get*](struct.RevisionGetCall.html), [*list*](struct.RevisionListCall.html) and [*update*](struct.RevisionUpdateCall.html) +//! +//! +//! Upload supported by ... +//! +//! * [*update files*](struct.FileUpdateCall.html) +//! * [*create files*](struct.FileCreateCall.html) +//! +//! Download supported by ... +//! +//! * [*watch files*](struct.FileWatchCall.html) +//! * [*export files*](struct.FileExportCall.html) +//! * [*get revisions*](struct.RevisionGetCall.html) +//! * [*get files*](struct.FileGetCall.html) +//! +//! Subscription supported by ... +//! +//! * [*watch changes*](struct.ChangeWatchCall.html) +//! * [*watch files*](struct.FileWatchCall.html) +//! * [*list changes*](struct.ChangeListCall.html) +//! * [*create files*](struct.FileCreateCall.html) +//! * [*get files*](struct.FileGetCall.html) +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Drive.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.files().watch(...).doit() +//! let r = hub.files().empty_trash(...).doit() +//! let r = hub.files().generate_ids(...).doit() +//! let r = hub.files().copy(...).doit() +//! let r = hub.files().create(...).doit() +//! let r = hub.files().list(...).doit() +//! let r = hub.files().delete(...).doit() +//! let r = hub.files().update(...).doit() +//! let r = hub.files().get(...).doit() +//! let r = hub.files().export(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-drive3 = "*" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_drive3 as drive3; +//! use drive3::File; +//! use drive3::{Result, Error}; +//! use std::fs; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use drive3::Drive; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::new(), +//! ::default(), None); +//! let mut hub = Drive::new(hyper::Client::new(), 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 ! +//! let mut req = File::default(); +//! +//! // You can configure optional parameters by calling the respective setters at will, and +//! // execute the final call using `upload_resumable(...)`. +//! // Values shown here are possibly random and not representative ! +//! let result = hub.files().update(req, "fileId") +//! .use_content_as_indexable_text(false) +//! .remove_parents("sit") +//! .ocr_language("eirmod") +//! .keep_revision_forever(true) +//! .add_parents("labore") +//! .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../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](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), 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")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) 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](trait.Delegate.html) 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 [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) 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](trait.CallBuilder.html), 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](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/drive3/src/lib.rs.in b/gen/drive3/src/lib.rs.in new file mode 100644 index 0000000000..40240cf568 --- /dev/null +++ b/gen/drive3/src/lib.rs.in @@ -0,0 +1,11178 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +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; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage the files in your Google Drive + Full, + + /// View the photos, videos and albums in your Google Photos + PhotoReadonly, + + /// View and manage metadata of files in your Google Drive + Metadata, + + /// View metadata for files in your Google Drive + MetadataReadonly, + + /// View and manage Google Drive files and folders that you have opened or created with this app + File, + + /// Modify your Google Apps Script scripts' behavior + Script, + + /// View the files in your Google Drive + Readonly, + + /// View and manage its own configuration data in your Google Drive + Appdata, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::Full => "https://www.googleapis.com/auth/drive", + Scope::PhotoReadonly => "https://www.googleapis.com/auth/drive.photos.readonly", + Scope::Metadata => "https://www.googleapis.com/auth/drive.metadata", + Scope::MetadataReadonly => "https://www.googleapis.com/auth/drive.metadata.readonly", + Scope::File => "https://www.googleapis.com/auth/drive.file", + Scope::Script => "https://www.googleapis.com/auth/drive.scripts", + Scope::Readonly => "https://www.googleapis.com/auth/drive.readonly", + Scope::Appdata => "https://www.googleapis.com/auth/drive.appdata", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::PhotoReadonly + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Drive related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_drive3 as drive3; +/// use drive3::File; +/// use drive3::{Result, Error}; +/// use std::fs; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use drive3::Drive; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = File::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload_resumable(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.files().update(req, "fileId") +/// .use_content_as_indexable_text(true) +/// .remove_parents("takimata") +/// .ocr_language("justo") +/// .keep_revision_forever(true) +/// .add_parents("erat") +/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Drive { + client: RefCell, + auth: RefCell, + _user_agent: String, +} + +impl<'a, C, A> Hub for Drive {} + +impl<'a, C, A> Drive + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Drive { + Drive { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/0.1.11".to_string(), + } + } + + pub fn about(&'a self) -> AboutMethods<'a, C, A> { + AboutMethods { hub: &self } + } + pub fn changes(&'a self) -> ChangeMethods<'a, C, A> { + ChangeMethods { hub: &self } + } + pub fn channels(&'a self) -> ChannelMethods<'a, C, A> { + ChannelMethods { hub: &self } + } + pub fn comments(&'a self) -> CommentMethods<'a, C, A> { + CommentMethods { hub: &self } + } + pub fn files(&'a self) -> FileMethods<'a, C, A> { + FileMethods { hub: &self } + } + pub fn permissions(&'a self) -> PermissionMethods<'a, C, A> { + PermissionMethods { hub: &self } + } + pub fn replies(&'a self) -> ReplyMethods<'a, C, A> { + ReplyMethods { hub: &self } + } + pub fn revisions(&'a self) -> RevisionMethods<'a, C, A> { + RevisionMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/0.1.11`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// A comment on a file. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [update comments](struct.CommentUpdateCall.html) (request|response) +/// * [create comments](struct.CommentCreateCall.html) (request|response) +/// * [get comments](struct.CommentGetCall.html) (response) +/// * [list comments](struct.CommentListCall.html) (none) +/// * [delete comments](struct.CommentDeleteCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Comment { + /// Whether the comment has been resolved by one of its replies. + pub resolved: Option, + /// This is always drive#comment. + pub kind: Option, + /// The last time the comment or any of its replies was modified (RFC 3339 date-time). + #[serde(rename="modifiedTime")] + pub modified_time: Option, + /// The user who created the comment. + pub author: Option, + /// Whether the comment has been deleted. A deleted comment has no content. + pub deleted: Option, + /// The file content to which the comment refers, typically within the anchor region. For a text file, for example, this would be the text at the location of the comment. + #[serde(rename="quotedFileContent")] + pub quoted_file_content: Option, + /// The content of the comment with HTML formatting. + #[serde(rename="htmlContent")] + pub html_content: Option, + /// A region of the document represented as a JSON string. See anchor documentation for details on how to define and interpret anchor properties. + pub anchor: Option, + /// The plain text content of the comment. This field is used for setting the content, while htmlContent should be displayed. + pub content: Option, + /// The full list of replies to the comment in chronological order. + pub replies: Option>, + /// The time at which the comment was created (RFC 3339 date-time). + #[serde(rename="createdTime")] + pub created_time: Option, + /// The ID of the comment. + pub id: Option, +} + +impl RequestValue for Comment {} +impl Resource for Comment {} +impl ResponseResult for Comment {} + + +/// Information about the user, the user's Drive, and system capabilities. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get about](struct.AboutGetCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct About { + /// This is always drive#about. + pub kind: Option, + /// A map of source MIME type to possible targets for all supported exports. + #[serde(rename="exportFormats")] + pub export_formats: Option>>, + /// A map of maximum import sizes by MIME type, in bytes. + #[serde(rename="maxImportSizes")] + pub max_import_sizes: Option>, + /// The user's storage quota limits and usage. All fields are measured in bytes. + #[serde(rename="storageQuota")] + pub storage_quota: Option, + /// A map of source MIME type to possible targets for all supported imports. + #[serde(rename="importFormats")] + pub import_formats: Option>>, + /// Whether the user has installed the requesting app. + #[serde(rename="appInstalled")] + pub app_installed: Option, + /// The currently supported folder colors as RGB hex strings. + #[serde(rename="folderColorPalette")] + pub folder_color_palette: Option>, + /// The maximum upload size in bytes. + #[serde(rename="maxUploadSize")] + pub max_upload_size: Option, + /// The authenticated user. + pub user: Option, +} + +impl ResponseResult for About {} + + +/// Additional information about the content of the file. These fields are never populated in responses. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileContentHints { + /// Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements. + #[serde(rename="indexableText")] + pub indexable_text: Option, + /// A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail. + pub thumbnail: Option, +} + +impl NestedType for FileContentHints {} +impl Part for FileContentHints {} + + +/// A list of changes for a user. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list changes](struct.ChangeListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChangeList { + /// The page token for the next page of changes. This will be absent if the end of the current changes list has been reached. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// This is always drive#changeList. + pub kind: Option, + /// The page of changes. + pub changes: Option>, + /// The starting page token for future changes. This will be present only if the end of the current changes list has been reached. + #[serde(rename="newStartPageToken")] + pub new_start_page_token: Option, +} + +impl ResponseResult for ChangeList {} + + +/// A list of replies to a comment on a file. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list replies](struct.ReplyListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ReplyList { + /// The page token for the next page of replies. This will be absent if the end of the replies list has been reached. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// This is always drive#replyList. + pub kind: Option, + /// The page of replies. + pub replies: Option>, +} + +impl ResponseResult for ReplyList {} + + +/// A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileContentHintsThumbnail { + /// The MIME type of the thumbnail. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5). + pub image: Option, +} + +impl NestedType for FileContentHintsThumbnail {} +impl Part for FileContentHintsThumbnail {} + + +/// Additional metadata about image media, if available. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileImageMediaMetadata { + /// The exposure bias of the photo (APEX value). + #[serde(rename="exposureBias")] + pub exposure_bias: Option, + /// The length of the exposure, in seconds. + #[serde(rename="exposureTime")] + pub exposure_time: Option, + /// The smallest f-number of the lens at the focal length used to create the photo (APEX value). + #[serde(rename="maxApertureValue")] + pub max_aperture_value: Option, + /// The color space of the photo. + #[serde(rename="colorSpace")] + pub color_space: Option, + /// The height of the image in pixels. + pub height: Option, + /// The lens used to create the photo. + pub lens: Option, + /// The aperture used to create the photo (f-number). + pub aperture: Option, + /// The rotation in clockwise degrees from the image's original orientation. + pub rotation: Option, + /// The white balance mode used to create the photo. + #[serde(rename="whiteBalance")] + pub white_balance: Option, + /// The model of the camera used to create the photo. + #[serde(rename="cameraModel")] + pub camera_model: Option, + /// Whether a flash was used to create the photo. + #[serde(rename="flashUsed")] + pub flash_used: Option, + /// The make of the camera used to create the photo. + #[serde(rename="cameraMake")] + pub camera_make: Option, + /// The focal length used to create the photo, in millimeters. + #[serde(rename="focalLength")] + pub focal_length: Option, + /// The exposure mode used to create the photo. + #[serde(rename="exposureMode")] + pub exposure_mode: Option, + /// The distance to the subject of the photo, in meters. + #[serde(rename="subjectDistance")] + pub subject_distance: Option, + /// The width of the image in pixels. + pub width: Option, + /// The metering mode used to create the photo. + #[serde(rename="meteringMode")] + pub metering_mode: Option, + /// Geographic location information stored in the image. + pub location: Option, + /// The date and time the photo was taken (EXIF DateTime). + pub time: Option, + /// The ISO speed used to create the photo. + #[serde(rename="isoSpeed")] + pub iso_speed: Option, + /// The type of sensor used to create the photo. + pub sensor: Option, +} + +impl NestedType for FileImageMediaMetadata {} +impl Part for FileImageMediaMetadata {} + + +/// A list of revisions of a file. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list revisions](struct.RevisionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct RevisionList { + /// This is always drive#revisionList. + pub kind: Option, + /// The full list of revisions. + pub revisions: Option>, +} + +impl ResponseResult for RevisionList {} + + +/// A reply to a comment on a file. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [create replies](struct.ReplyCreateCall.html) (request|response) +/// * [get replies](struct.ReplyGetCall.html) (response) +/// * [update replies](struct.ReplyUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Reply { + /// This is always drive#reply. + pub kind: Option, + /// The last time the reply was modified (RFC 3339 date-time). + #[serde(rename="modifiedTime")] + pub modified_time: Option, + /// The user who created the reply. + pub author: Option, + /// Whether the reply has been deleted. A deleted reply has no content. + pub deleted: Option, + /// The content of the reply with HTML formatting. + #[serde(rename="htmlContent")] + pub html_content: Option, + /// The plain text content of the reply. This field is used for setting the content, while htmlContent should be displayed. This is required on creates if no action is specified. + pub content: Option, + /// The action the reply performed to the parent comment. Valid values are: + /// - resolve + /// - reopen + pub action: Option, + /// The time at which the reply was created (RFC 3339 date-time). + #[serde(rename="createdTime")] + pub created_time: Option, + /// The ID of the reply. + pub id: Option, +} + +impl RequestValue for Reply {} +impl ResponseResult for Reply {} + + +/// A list of generated file IDs which can be provided in create requests. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [generate ids files](struct.FileGenerateIdCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct GeneratedIds { + /// This is always drive#generatedIds + pub kind: Option, + /// The IDs generated for the requesting user in the specified space. + pub ids: Option>, + /// The type of file that can be created with these IDs. + pub space: Option, +} + +impl ResponseResult for GeneratedIds {} + + +/// The file content to which the comment refers, typically within the anchor region. For a text file, for example, this would be the text at the location of the comment. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CommentQuotedFileContent { + /// The MIME type of the quoted content. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// The quoted content itself. This is interpreted as plain text if set through the API. + pub value: Option, +} + +impl NestedType for CommentQuotedFileContent {} +impl Part for CommentQuotedFileContent {} + + +/// An notification channel used to watch for resource changes. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [watch changes](struct.ChangeWatchCall.html) (request|response) +/// * [watch files](struct.FileWatchCall.html) (request|response) +/// * [stop channels](struct.ChannelStopCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Channel { + /// A version-specific identifier for the watched resource. + #[serde(rename="resourceUri")] + pub resource_uri: Option, + /// Identifies this as a notification channel used to watch for changes to a resource. Value: the fixed string "api#channel". + pub kind: Option, + /// An opaque ID that identifies the resource being watched on this channel. Stable across different API versions. + #[serde(rename="resourceId")] + pub resource_id: Option, + /// A UUID or similar unique string that identifies this channel. + pub id: Option, + /// An arbitrary string delivered to the target address with each notification delivered over this channel. Optional. + pub token: Option, + /// Additional parameters controlling delivery channel behavior. Optional. + pub params: Option>, + /// Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional. + pub expiration: Option, + /// The address where notifications are delivered for this channel. + pub address: Option, + /// The type of delivery mechanism used for this channel. + #[serde(rename="type")] + pub type_: Option, + /// A Boolean value to indicate whether payload is wanted. Optional. + pub payload: Option, +} + +impl RequestValue for Channel {} +impl Resource for Channel {} +impl ResponseResult for Channel {} + + +/// The metadata for a revision to a file. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete revisions](struct.RevisionDeleteCall.html) (none) +/// * [get revisions](struct.RevisionGetCall.html) (response) +/// * [list revisions](struct.RevisionListCall.html) (none) +/// * [update revisions](struct.RevisionUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Revision { + /// The MIME type of the revision. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// This is always drive#revision. + pub kind: Option, + /// The last time the revision was modified (RFC 3339 date-time). + #[serde(rename="modifiedTime")] + pub modified_time: Option, + /// The last user to modify this revision. + #[serde(rename="lastModifyingUser")] + pub last_modifying_user: Option, + /// Whether to keep this revision forever, even if it is no longer the head revision. If not set, the revision will be automatically purged 30 days after newer content is uploaded. This can be set on a maximum of 200 revisions for a file. + /// This field is only applicable to files with binary content in Drive. + #[serde(rename="keepForever")] + pub keep_forever: Option, + /// Whether subsequent revisions will be automatically republished. This is only applicable to Google Docs. + #[serde(rename="publishAuto")] + pub publish_auto: Option, + /// The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive. + #[serde(rename="md5Checksum")] + pub md5_checksum: Option, + /// Whether this revision is published outside the domain. This is only applicable to Google Docs. + #[serde(rename="publishedOutsideDomain")] + pub published_outside_domain: Option, + /// Whether this revision is published. This is only applicable to Google Docs. + pub published: Option, + /// The ID of the revision. + pub id: Option, + /// The original filename used to create this revision. This is only applicable to files with binary content in Drive. + #[serde(rename="originalFilename")] + pub original_filename: Option, + /// The size of the revision's content in bytes. This is only applicable to files with binary content in Drive. + pub size: Option, +} + +impl RequestValue for Revision {} +impl Resource for Revision {} +impl ResponseResult for Revision {} + + +/// A list of comments on a file. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list comments](struct.CommentListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CommentList { + /// The page token for the next page of comments. This will be absent if the end of the comments list has been reached. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// This is always drive#commentList. + pub kind: Option, + /// The page of comments. + pub comments: Option>, +} + +impl ResponseResult for CommentList {} + + +/// Geographic location information stored in the image. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileImageMediaMetadataLocation { + /// The latitude stored in the image. + pub latitude: Option, + /// The altitude stored in the image. + pub altitude: Option, + /// The longitude stored in the image. + pub longitude: Option, +} + +impl NestedType for FileImageMediaMetadataLocation {} +impl Part for FileImageMediaMetadataLocation {} + + +/// A permission for a file. A permission grants a user, group, domain or the world access to a file or a folder hierarchy. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [create permissions](struct.PermissionCreateCall.html) (request|response) +/// * [list permissions](struct.PermissionListCall.html) (none) +/// * [get permissions](struct.PermissionGetCall.html) (response) +/// * [delete permissions](struct.PermissionDeleteCall.html) (none) +/// * [update permissions](struct.PermissionUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Permission { + /// The domain to which this permission refers. + pub domain: Option, + /// A displayable name for users, groups or domains. + #[serde(rename="displayName")] + pub display_name: Option, + /// Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone. + #[serde(rename="allowFileDiscovery")] + pub allow_file_discovery: Option, + /// This is always drive#permission. + pub kind: Option, + /// The email address of the user or group to which this permission refers. + #[serde(rename="emailAddress")] + pub email_address: Option, + /// A link to the user's profile photo, if available. + #[serde(rename="photoLink")] + pub photo_link: Option, + /// The role granted by this permission. Valid values are: + /// - owner + /// - writer + /// - commenter + /// - reader + pub role: Option, + /// The type of the grantee. Valid values are: + /// - user + /// - group + /// - domain + /// - anyone + #[serde(rename="type")] + pub type_: Option, + /// The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId. + pub id: Option, +} + +impl RequestValue for Permission {} +impl Resource for Permission {} +impl ResponseResult for Permission {} + + +/// Capabilities the current user has on the file. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileCapabilities { + /// Whether the user can copy the file. + #[serde(rename="canCopy")] + pub can_copy: Option, + /// Whether the user can modify the file's permissions and sharing settings. + #[serde(rename="canShare")] + pub can_share: Option, + /// Whether the user can edit the file's content. + #[serde(rename="canEdit")] + pub can_edit: Option, + /// Whether the user can comment on the file. + #[serde(rename="canComment")] + pub can_comment: Option, +} + +impl NestedType for FileCapabilities {} +impl Part for FileCapabilities {} + + +/// The user's storage quota limits and usage. All fields are measured in bytes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct AboutStorageQuota { + /// The total usage across all services. + pub usage: Option, + /// The usage by all files in Google Drive. + #[serde(rename="usageInDrive")] + pub usage_in_drive: Option, + /// The usage by trashed files in Google Drive. + #[serde(rename="usageInDriveTrash")] + pub usage_in_drive_trash: Option, + /// The usage limit, if applicable. This will not be present if the user has unlimited storage. + pub limit: Option, +} + +impl NestedType for AboutStorageQuota {} +impl Part for AboutStorageQuota {} + + +/// A list of files. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list files](struct.FileListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileList { + /// The page of files. + pub files: Option>, + /// The page token for the next page of files. This will be absent if the end of the files list has been reached. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// This is always drive#fileList. + pub kind: Option, +} + +impl ResponseResult for FileList {} + + +/// Information about a Drive user. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct User { + /// Whether this user is the requesting user. + pub me: Option, + /// This is always drive#user. + pub kind: Option, + /// A plain text displayable name for this user. + #[serde(rename="displayName")] + pub display_name: Option, + /// A link to the user's profile photo, if available. + #[serde(rename="photoLink")] + pub photo_link: Option, + /// The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester. + #[serde(rename="emailAddress")] + pub email_address: Option, + /// The user's ID as visible in Permission resources. + #[serde(rename="permissionId")] + pub permission_id: Option, +} + +impl Part for User {} + + +/// The metadata for a file. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [watch files](struct.FileWatchCall.html) (none) +/// * [empty trash files](struct.FileEmptyTrashCall.html) (none) +/// * [generate ids files](struct.FileGenerateIdCall.html) (none) +/// * [copy files](struct.FileCopyCall.html) (request|response) +/// * [create files](struct.FileCreateCall.html) (request|response) +/// * [list files](struct.FileListCall.html) (none) +/// * [delete files](struct.FileDeleteCall.html) (none) +/// * [update files](struct.FileUpdateCall.html) (request|response) +/// * [get files](struct.FileGetCall.html) (response) +/// * [export files](struct.FileExportCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct File { + /// The MIME type of the file. + /// Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded. + /// If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource. + #[serde(rename="mimeType")] + pub mime_type: Option, + /// The last time the file was modified by the user (RFC 3339 date-time). + #[serde(rename="modifiedByMeTime")] + pub modified_by_me_time: Option, + /// A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. + #[serde(rename="thumbnailLink")] + pub thumbnail_link: Option, + /// Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder. + #[serde(rename="explicitlyTrashed")] + pub explicitly_trashed: Option, + /// Whether users with only writer permission can modify the file's permissions. + #[serde(rename="writersCanShare")] + pub writers_can_share: Option, + /// Whether the user owns the file. + #[serde(rename="ownedByMe")] + pub owned_by_me: Option, + /// The last time the file was viewed by the user (RFC 3339 date-time). + #[serde(rename="viewedByMeTime")] + pub viewed_by_me_time: Option, + /// The ID of the file. + pub id: Option, + /// The user who shared the file with the requesting user, if applicable. + #[serde(rename="sharingUser")] + pub sharing_user: Option, + /// The size of the file's content in bytes. This is only applicable to files with binary content in Drive. + pub size: Option, + /// Additional metadata about video media. This may not be available immediately upon upload. + #[serde(rename="videoMediaMetadata")] + pub video_media_metadata: Option, + /// The last user to modify the file. + #[serde(rename="lastModifyingUser")] + pub last_modifying_user: Option, + /// The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource. + /// If an unsupported color is specified, the closest color in the palette will be used instead. + #[serde(rename="folderColorRgb")] + pub folder_color_rgb: Option, + /// A collection of arbitrary key-value pairs which are private to the requesting app. + /// Entries with null values are cleared in update and copy requests. + #[serde(rename="appProperties")] + pub app_properties: Option>, + /// Capabilities the current user has on the file. + pub capabilities: Option, + /// A link for opening the file in a relevant Google editor or viewer in a browser. + #[serde(rename="webViewLink")] + pub web_view_link: Option, + /// A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user. + pub version: Option, + /// The IDs of the parent folders which contain the file. + /// If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values. + pub parents: Option>, + /// The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive. + #[serde(rename="md5Checksum")] + pub md5_checksum: Option, + /// Whether the file has been shared. + pub shared: Option, + /// A static, unauthenticated link to the file's icon. + #[serde(rename="iconLink")] + pub icon_link: Option, + /// The full file extension extracted from the name field. May contain multiple concatenated extensions, such as "tar.gz". This is only available for files with binary content in Drive. + /// This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension. + #[serde(rename="fullFileExtension")] + pub full_file_extension: Option, + /// The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Drive. + #[serde(rename="originalFilename")] + pub original_filename: Option, + /// Additional metadata about image media, if available. + #[serde(rename="imageMediaMetadata")] + pub image_media_metadata: Option, + /// A short description of the file. + pub description: Option, + /// The last time the file was modified by anyone (RFC 3339 date-time). + /// Note that setting modifiedTime will also update modifiedByMeTime for the user. + #[serde(rename="modifiedTime")] + pub modified_time: Option, + /// Whether the file has been viewed by this user. + #[serde(rename="viewedByMe")] + pub viewed_by_me: Option, + /// This is always drive#file. + pub kind: Option, + /// The time at which the file was created (RFC 3339 date-time). + #[serde(rename="createdTime")] + pub created_time: Option, + /// The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled. + #[serde(rename="quotaBytesUsed")] + pub quota_bytes_used: Option, + /// A collection of arbitrary key-value pairs which are visible to all apps. + /// Entries with null values are cleared in update and copy requests. + pub properties: Option>, + /// The time at which the file was shared with the user, if applicable (RFC 3339 date-time). + #[serde(rename="sharedWithMeTime")] + pub shared_with_me_time: Option, + /// The full list of permissions for the file. This is only available if the requesting user can share the file. + pub permissions: Option>, + /// Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations. + #[serde(rename="viewersCanCopyContent")] + pub viewers_can_copy_content: Option, + /// The owners of the file. Currently, only certain legacy files may have more than one owner. + pub owners: Option>, + /// The name of the file. This is not necessarily unique within a folder. + pub name: Option, + /// A link for downloading the content of the file in a browser. This is only available for files with binary content in Drive. + #[serde(rename="webContentLink")] + pub web_content_link: Option, + /// The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'. + pub spaces: Option>, + /// Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash. + pub trashed: Option, + /// Additional information about the content of the file. These fields are never populated in responses. + #[serde(rename="contentHints")] + pub content_hints: Option, + /// The final component of fullFileExtension. This is only available for files with binary content in Drive. + #[serde(rename="fileExtension")] + pub file_extension: Option, + /// Whether the user has starred the file. + pub starred: Option, + /// The ID of the file's head revision. This is currently only available for files with binary content in Drive. + #[serde(rename="headRevisionId")] + pub head_revision_id: Option, +} + +impl RequestValue for File {} +impl Resource for File {} +impl ResponseResult for File {} + + +/// A list of permissions for a file. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list permissions](struct.PermissionListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PermissionList { + /// This is always drive#permissionList. + pub kind: Option, + /// The full list of permissions. + pub permissions: Option>, +} + +impl ResponseResult for PermissionList {} + + +/// Additional metadata about video media. This may not be available immediately upon upload. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FileVideoMediaMetadata { + /// The width of the video in pixels. + pub width: Option, + /// The duration of the video in milliseconds. + #[serde(rename="durationMillis")] + pub duration_millis: Option, + /// The height of the video in pixels. + pub height: Option, +} + +impl NestedType for FileVideoMediaMetadata {} +impl Part for FileVideoMediaMetadata {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get start page token changes](struct.ChangeGetStartPageTokenCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct StartPageToken { + /// This is always drive#startPageToken. + pub kind: Option, + /// The starting page token for listing changes. + #[serde(rename="startPageToken")] + pub start_page_token: Option, +} + +impl ResponseResult for StartPageToken {} + + +/// A change to a file. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list changes](struct.ChangeListCall.html) (none) +/// * [get start page token changes](struct.ChangeGetStartPageTokenCall.html) (none) +/// * [watch changes](struct.ChangeWatchCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Change { + /// This is always drive#change. + pub kind: Option, + /// Whether the file has been removed from the view of the changes list, for example by deletion or lost access. + pub removed: Option, + /// The ID of the file which has changed. + #[serde(rename="fileId")] + pub file_id: Option, + /// The updated state of the file. Present if the file has not been removed. + pub file: Option, + /// The time of this change (RFC 3339 date-time). + pub time: Option, +} + +impl Resource for Change {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *file* resources. +/// It is not used directly, but through the `Drive` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_drive3 as drive3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use drive3::Drive; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Drive::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `copy(...)`, `create(...)`, `delete(...)`, `empty_trash(...)`, `export(...)`, `generate_ids(...)`, `get(...)`, `list(...)`, `update(...)` and `watch(...)` +/// // to build up your call. +/// let rb = hub.files(); +/// # } +/// ``` +pub struct FileMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, +} + +impl<'a, C, A> MethodsBuilder for FileMethods<'a, C, A> {} + +impl<'a, C, A> FileMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates a file's metadata and/or content with patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `fileId` - The ID of the file. + pub fn update(&self, request: File, file_id: &str) -> FileUpdateCall<'a, C, A> { + FileUpdateCall { + hub: self.hub, + _request: request, + _file_id: file_id.to_string(), + _use_content_as_indexable_text: Default::default(), + _remove_parents: Default::default(), + _ocr_language: Default::default(), + _keep_revision_forever: Default::default(), + _add_parents: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Subscribes to changes to a file + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `fileId` - The ID of the file. + pub fn watch(&self, request: Channel, file_id: &str) -> FileWatchCall<'a, C, A> { + FileWatchCall { + hub: self.hub, + _request: request, + _file_id: file_id.to_string(), + _acknowledge_abuse: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a copy of a file and applies any requested updates with patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `fileId` - The ID of the file. + pub fn copy(&self, request: File, file_id: &str) -> FileCopyCall<'a, C, A> { + FileCopyCall { + hub: self.hub, + _request: request, + _file_id: file_id.to_string(), + _ocr_language: Default::default(), + _keep_revision_forever: Default::default(), + _ignore_default_visibility: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Exports a Google Doc to the requested MIME type. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + /// * `mimeType` - The MIME type of the format requested for this export. + pub fn export(&self, file_id: &str, mime_type: &str) -> FileExportCall<'a, C, A> { + FileExportCall { + hub: self.hub, + _file_id: file_id.to_string(), + _mime_type: mime_type.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Permanently deletes all of the user's trashed files. + pub fn empty_trash(&self) -> FileEmptyTrashCall<'a, C, A> { + FileEmptyTrashCall { + hub: self.hub, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists or searches files. + pub fn list(&self) -> FileListCall<'a, C, A> { + FileListCall { + hub: self.hub, + _spaces: Default::default(), + _q: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _order_by: Default::default(), + _corpus: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Generates a set of file IDs which can be provided in create requests. + pub fn generate_ids(&self) -> FileGenerateIdCall<'a, C, A> { + FileGenerateIdCall { + hub: self.hub, + _space: Default::default(), + _count: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new file. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn create(&self, request: File) -> FileCreateCall<'a, C, A> { + FileCreateCall { + hub: self.hub, + _request: request, + _use_content_as_indexable_text: Default::default(), + _ocr_language: Default::default(), + _keep_revision_forever: Default::default(), + _ignore_default_visibility: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Permanently deletes a file owned by the user without moving it to the trash. If the target is a folder, all descendants owned by the user are also deleted. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + pub fn delete(&self, file_id: &str) -> FileDeleteCall<'a, C, A> { + FileDeleteCall { + hub: self.hub, + _file_id: file_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a file's metadata or content by ID. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + pub fn get(&self, file_id: &str) -> FileGetCall<'a, C, A> { + FileGetCall { + hub: self.hub, + _file_id: file_id.to_string(), + _acknowledge_abuse: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *about* resources. +/// It is not used directly, but through the `Drive` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_drive3 as drive3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use drive3::Drive; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Drive::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` +/// // to build up your call. +/// let rb = hub.about(); +/// # } +/// ``` +pub struct AboutMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, +} + +impl<'a, C, A> MethodsBuilder for AboutMethods<'a, C, A> {} + +impl<'a, C, A> AboutMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets information about the user, the user's Drive, and system capabilities. + pub fn get(&self) -> AboutGetCall<'a, C, A> { + AboutGetCall { + hub: self.hub, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *comment* resources. +/// It is not used directly, but through the `Drive` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_drive3 as drive3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use drive3::Drive; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Drive::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.comments(); +/// # } +/// ``` +pub struct CommentMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, +} + +impl<'a, C, A> MethodsBuilder for CommentMethods<'a, C, A> {} + +impl<'a, C, A> CommentMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes a comment. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + /// * `commentId` - The ID of the comment. + pub fn delete(&self, file_id: &str, comment_id: &str) -> CommentDeleteCall<'a, C, A> { + CommentDeleteCall { + hub: self.hub, + _file_id: file_id.to_string(), + _comment_id: comment_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a comment by ID. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + /// * `commentId` - The ID of the comment. + pub fn get(&self, file_id: &str, comment_id: &str) -> CommentGetCall<'a, C, A> { + CommentGetCall { + hub: self.hub, + _file_id: file_id.to_string(), + _comment_id: comment_id.to_string(), + _include_deleted: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a comment with patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `fileId` - The ID of the file. + /// * `commentId` - The ID of the comment. + pub fn update(&self, request: Comment, file_id: &str, comment_id: &str) -> CommentUpdateCall<'a, C, A> { + CommentUpdateCall { + hub: self.hub, + _request: request, + _file_id: file_id.to_string(), + _comment_id: comment_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new comment on a file. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `fileId` - The ID of the file. + pub fn create(&self, request: Comment, file_id: &str) -> CommentCreateCall<'a, C, A> { + CommentCreateCall { + hub: self.hub, + _request: request, + _file_id: file_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists a file's comments. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + pub fn list(&self, file_id: &str) -> CommentListCall<'a, C, A> { + CommentListCall { + hub: self.hub, + _file_id: file_id.to_string(), + _start_modified_time: Default::default(), + _page_token: Default::default(), + _page_size: Default::default(), + _include_deleted: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *channel* resources. +/// It is not used directly, but through the `Drive` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_drive3 as drive3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use drive3::Drive; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Drive::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `stop(...)` +/// // to build up your call. +/// let rb = hub.channels(); +/// # } +/// ``` +pub struct ChannelMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, +} + +impl<'a, C, A> MethodsBuilder for ChannelMethods<'a, C, A> {} + +impl<'a, C, A> ChannelMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Stop watching resources through this channel + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn stop(&self, request: Channel) -> ChannelStopCall<'a, C, A> { + ChannelStopCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *reply* resources. +/// It is not used directly, but through the `Drive` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_drive3 as drive3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use drive3::Drive; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Drive::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.replies(); +/// # } +/// ``` +pub struct ReplyMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, +} + +impl<'a, C, A> MethodsBuilder for ReplyMethods<'a, C, A> {} + +impl<'a, C, A> ReplyMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a new reply to a comment. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `fileId` - The ID of the file. + /// * `commentId` - The ID of the comment. + pub fn create(&self, request: Reply, file_id: &str, comment_id: &str) -> ReplyCreateCall<'a, C, A> { + ReplyCreateCall { + hub: self.hub, + _request: request, + _file_id: file_id.to_string(), + _comment_id: comment_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a reply. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + /// * `commentId` - The ID of the comment. + /// * `replyId` - The ID of the reply. + pub fn delete(&self, file_id: &str, comment_id: &str, reply_id: &str) -> ReplyDeleteCall<'a, C, A> { + ReplyDeleteCall { + hub: self.hub, + _file_id: file_id.to_string(), + _comment_id: comment_id.to_string(), + _reply_id: reply_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists a comment's replies. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + /// * `commentId` - The ID of the comment. + pub fn list(&self, file_id: &str, comment_id: &str) -> ReplyListCall<'a, C, A> { + ReplyListCall { + hub: self.hub, + _file_id: file_id.to_string(), + _comment_id: comment_id.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _include_deleted: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a reply by ID. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + /// * `commentId` - The ID of the comment. + /// * `replyId` - The ID of the reply. + pub fn get(&self, file_id: &str, comment_id: &str, reply_id: &str) -> ReplyGetCall<'a, C, A> { + ReplyGetCall { + hub: self.hub, + _file_id: file_id.to_string(), + _comment_id: comment_id.to_string(), + _reply_id: reply_id.to_string(), + _include_deleted: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a reply with patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `fileId` - The ID of the file. + /// * `commentId` - The ID of the comment. + /// * `replyId` - The ID of the reply. + pub fn update(&self, request: Reply, file_id: &str, comment_id: &str, reply_id: &str) -> ReplyUpdateCall<'a, C, A> { + ReplyUpdateCall { + hub: self.hub, + _request: request, + _file_id: file_id.to_string(), + _comment_id: comment_id.to_string(), + _reply_id: reply_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *revision* resources. +/// It is not used directly, but through the `Drive` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_drive3 as drive3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use drive3::Drive; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Drive::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `list(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.revisions(); +/// # } +/// ``` +pub struct RevisionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, +} + +impl<'a, C, A> MethodsBuilder for RevisionMethods<'a, C, A> {} + +impl<'a, C, A> RevisionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates a revision with patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `fileId` - The ID of the file. + /// * `revisionId` - The ID of the revision. + pub fn update(&self, request: Revision, file_id: &str, revision_id: &str) -> RevisionUpdateCall<'a, C, A> { + RevisionUpdateCall { + hub: self.hub, + _request: request, + _file_id: file_id.to_string(), + _revision_id: revision_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a revision's metadata or content by ID. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + /// * `revisionId` - The ID of the revision. + pub fn get(&self, file_id: &str, revision_id: &str) -> RevisionGetCall<'a, C, A> { + RevisionGetCall { + hub: self.hub, + _file_id: file_id.to_string(), + _revision_id: revision_id.to_string(), + _acknowledge_abuse: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Permanently deletes a revision. This method is only applicable to files with binary content in Drive. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + /// * `revisionId` - The ID of the revision. + pub fn delete(&self, file_id: &str, revision_id: &str) -> RevisionDeleteCall<'a, C, A> { + RevisionDeleteCall { + hub: self.hub, + _file_id: file_id.to_string(), + _revision_id: revision_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists a file's revisions. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + pub fn list(&self, file_id: &str) -> RevisionListCall<'a, C, A> { + RevisionListCall { + hub: self.hub, + _file_id: file_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *change* resources. +/// It is not used directly, but through the `Drive` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_drive3 as drive3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use drive3::Drive; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Drive::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get_start_page_token(...)`, `list(...)` and `watch(...)` +/// // to build up your call. +/// let rb = hub.changes(); +/// # } +/// ``` +pub struct ChangeMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, +} + +impl<'a, C, A> MethodsBuilder for ChangeMethods<'a, C, A> {} + +impl<'a, C, A> ChangeMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets the starting pageToken for listing future changes. + pub fn get_start_page_token(&self) -> ChangeGetStartPageTokenCall<'a, C, A> { + ChangeGetStartPageTokenCall { + hub: self.hub, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Subscribes to changes for a user. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `pageToken` - The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method. + pub fn watch(&self, request: Channel, page_token: &str) -> ChangeWatchCall<'a, C, A> { + ChangeWatchCall { + hub: self.hub, + _request: request, + _page_token: page_token.to_string(), + _spaces: Default::default(), + _restrict_to_my_drive: Default::default(), + _page_size: Default::default(), + _include_removed: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists changes for a user. + /// + /// # Arguments + /// + /// * `pageToken` - The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method. + pub fn list(&self, page_token: &str) -> ChangeListCall<'a, C, A> { + ChangeListCall { + hub: self.hub, + _page_token: page_token.to_string(), + _spaces: Default::default(), + _restrict_to_my_drive: Default::default(), + _page_size: Default::default(), + _include_removed: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *permission* resources. +/// It is not used directly, but through the `Drive` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_drive3 as drive3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use drive3::Drive; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Drive::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.permissions(); +/// # } +/// ``` +pub struct PermissionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, +} + +impl<'a, C, A> MethodsBuilder for PermissionMethods<'a, C, A> {} + +impl<'a, C, A> PermissionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes a permission. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + /// * `permissionId` - The ID of the permission. + pub fn delete(&self, file_id: &str, permission_id: &str) -> PermissionDeleteCall<'a, C, A> { + PermissionDeleteCall { + hub: self.hub, + _file_id: file_id.to_string(), + _permission_id: permission_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists a file's permissions. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + pub fn list(&self, file_id: &str) -> PermissionListCall<'a, C, A> { + PermissionListCall { + hub: self.hub, + _file_id: file_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a permission with patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `fileId` - The ID of the file. + /// * `permissionId` - The ID of the permission. + pub fn update(&self, request: Permission, file_id: &str, permission_id: &str) -> PermissionUpdateCall<'a, C, A> { + PermissionUpdateCall { + hub: self.hub, + _request: request, + _file_id: file_id.to_string(), + _permission_id: permission_id.to_string(), + _transfer_ownership: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a permission by ID. + /// + /// # Arguments + /// + /// * `fileId` - The ID of the file. + /// * `permissionId` - The ID of the permission. + pub fn get(&self, file_id: &str, permission_id: &str) -> PermissionGetCall<'a, C, A> { + PermissionGetCall { + hub: self.hub, + _file_id: file_id.to_string(), + _permission_id: permission_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a permission for a file. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `fileId` - The ID of the file. + pub fn create(&self, request: Permission, file_id: &str) -> PermissionCreateCall<'a, C, A> { + PermissionCreateCall { + hub: self.hub, + _request: request, + _file_id: file_id.to_string(), + _transfer_ownership: Default::default(), + _send_notification_email: Default::default(), + _email_message: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Updates a file's metadata and/or content with patch semantics. +/// +/// A builder for the *update* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::File; +/// use std::fs; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = File::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload_resumable(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.files().update(req, "fileId") +/// .use_content_as_indexable_text(true) +/// .remove_parents("nonumy") +/// .ocr_language("dolores") +/// .keep_revision_forever(false) +/// .add_parents("sadipscing") +/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct FileUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: File, + _file_id: String, + _use_content_as_indexable_text: Option, + _remove_parents: Option, + _ocr_language: Option, + _keep_revision_forever: Option, + _add_parents: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileUpdateCall<'a, C, A> {} + +impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, File)> + where RS: ReadSeek { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.files.update", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + if let Some(value) = self._use_content_as_indexable_text { + params.push(("useContentAsIndexableText", value.to_string())); + } + if let Some(value) = self._remove_parents { + params.push(("removeParents", value.to_string())); + } + if let Some(value) = self._ocr_language { + params.push(("ocrLanguage", value.to_string())); + } + if let Some(value) = self._keep_revision_forever { + params.push(("keepRevisionForever", value.to_string())); + } + if let Some(value) = self._add_parents { + params.push(("addParents", value.to_string())); + } + for &field in ["alt", "fileId", "useContentAsIndexableText", "removeParents", "ocrLanguage", "keepRevisionForever", "addParents"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let (mut url, upload_type) = + if protocol == "simple" { + ("https://www.googleapis.com/upload/drive/v3/files/{fileId}".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://www.googleapis.com/resumable/upload/drive/v3/files/{fileId}".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut mp_reader: MultiPartReader = Default::default(); + let (mut body_reader, content_type) = match protocol { + "simple" => { + mp_reader.reserve_exact(2); + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 5497558138880 { + return Err(Error::UploadSizeLimitExceeded(size, 5497558138880)) + } + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) + .add_part(&mut reader, size, reader_mime_type.clone()); + let mime_type = mp_reader.mime_type(); + (&mut mp_reader as &mut io::Read, ContentType(mime_type)) + }, + _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), + }; + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(content_type) + .body(&mut body_reader); + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 5497558138880 { + return Err(Error::UploadSizeLimitExceeded(size, 5497558138880)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 5120GB + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, File)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 5120GB + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, File)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// + /// Sets the *request* property to the given value. + /// + /// 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: File) -> FileUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> FileUpdateCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// Whether to use the uploaded content as indexable text. + /// + /// Sets the *use content as indexable text* query property to the given value. + pub fn use_content_as_indexable_text(mut self, new_value: bool) -> FileUpdateCall<'a, C, A> { + self._use_content_as_indexable_text = Some(new_value); + self + } + /// A comma-separated list of parent IDs to remove. + /// + /// Sets the *remove parents* query property to the given value. + pub fn remove_parents(mut self, new_value: &str) -> FileUpdateCall<'a, C, A> { + self._remove_parents = Some(new_value.to_string()); + self + } + /// A language hint for OCR processing during image import (ISO 639-1 code). + /// + /// Sets the *ocr language* query property to the given value. + pub fn ocr_language(mut self, new_value: &str) -> FileUpdateCall<'a, C, A> { + self._ocr_language = Some(new_value.to_string()); + self + } + /// Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive. + /// + /// Sets the *keep revision forever* query property to the given value. + pub fn keep_revision_forever(mut self, new_value: bool) -> FileUpdateCall<'a, C, A> { + self._keep_revision_forever = Some(new_value); + self + } + /// A comma-separated list of parent IDs to add. + /// + /// Sets the *add parents* query property to the given value. + pub fn add_parents(mut self, new_value: &str) -> FileUpdateCall<'a, C, A> { + self._add_parents = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Subscribes to changes to a file +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `Channel` structure that you would usually get. The latter will be a default value. +/// +/// A builder for the *watch* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::Channel; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = Channel::default(); +/// +/// // 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 ! +/// let result = hub.files().watch(req, "fileId") +/// .acknowledge_abuse(false) +/// .doit(); +/// # } +/// ``` +pub struct FileWatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: Channel, + _file_id: String, + _acknowledge_abuse: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileWatchCall<'a, C, A> {} + +impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Channel)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.files.watch", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + if let Some(value) = self._acknowledge_abuse { + params.push(("acknowledgeAbuse", value.to_string())); + } + for &field in ["fileId", "acknowledgeAbuse"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if >::as_ref(&value) != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/watch".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = if enable_resource_parsing { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + } else { (res, Default::default()) }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Channel) -> FileWatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> FileWatchCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media. + /// + /// Sets the *acknowledge abuse* query property to the given value. + pub fn acknowledge_abuse(mut self, new_value: bool) -> FileWatchCall<'a, C, A> { + self._acknowledge_abuse = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileWatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileWatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileWatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a copy of a file and applies any requested updates with patch semantics. +/// +/// A builder for the *copy* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::File; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = File::default(); +/// +/// // 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 ! +/// let result = hub.files().copy(req, "fileId") +/// .ocr_language("justo") +/// .keep_revision_forever(true) +/// .ignore_default_visibility(true) +/// .doit(); +/// # } +/// ``` +pub struct FileCopyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: File, + _file_id: String, + _ocr_language: Option, + _keep_revision_forever: Option, + _ignore_default_visibility: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileCopyCall<'a, C, A> {} + +impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.files.copy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + if let Some(value) = self._ocr_language { + params.push(("ocrLanguage", value.to_string())); + } + if let Some(value) = self._keep_revision_forever { + params.push(("keepRevisionForever", value.to_string())); + } + if let Some(value) = self._ignore_default_visibility { + params.push(("ignoreDefaultVisibility", value.to_string())); + } + for &field in ["alt", "fileId", "ocrLanguage", "keepRevisionForever", "ignoreDefaultVisibility"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/copy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: File) -> FileCopyCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> FileCopyCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// A language hint for OCR processing during image import (ISO 639-1 code). + /// + /// Sets the *ocr language* query property to the given value. + pub fn ocr_language(mut self, new_value: &str) -> FileCopyCall<'a, C, A> { + self._ocr_language = Some(new_value.to_string()); + self + } + /// Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive. + /// + /// Sets the *keep revision forever* query property to the given value. + pub fn keep_revision_forever(mut self, new_value: bool) -> FileCopyCall<'a, C, A> { + self._keep_revision_forever = Some(new_value); + self + } + /// Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders. + /// + /// Sets the *ignore default visibility* query property to the given value. + pub fn ignore_default_visibility(mut self, new_value: bool) -> FileCopyCall<'a, C, A> { + self._ignore_default_visibility = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileCopyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileCopyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileCopyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Exports a Google Doc to the requested MIME type. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// +/// A builder for the *export* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.files().export("fileId", "mimeType") +/// .doit(); +/// # } +/// ``` +pub struct FileExportCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _mime_type: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileExportCall<'a, C, A> {} + +impl<'a, C, A> FileExportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.files.export", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("mimeType", self._mime_type.to_string())); + for &field in ["fileId", "mimeType"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/export".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> FileExportCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The MIME type of the format requested for this export. + /// + /// Sets the *mime type* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn mime_type(mut self, new_value: &str) -> FileExportCall<'a, C, A> { + self._mime_type = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileExportCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileExportCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileExportCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Permanently deletes all of the user's trashed files. +/// +/// A builder for the *emptyTrash* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.files().empty_trash() +/// .doit(); +/// # } +/// ``` +pub struct FileEmptyTrashCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileEmptyTrashCall<'a, C, A> {} + +impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.files.emptyTrash", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); + for &field in [].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/drive/v3/files/trash".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileEmptyTrashCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileEmptyTrashCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileEmptyTrashCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists or searches files. +/// +/// A builder for the *list* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.files().list() +/// .spaces("ipsum") +/// .q("Lorem") +/// .page_token("et") +/// .page_size(-70) +/// .order_by("aliquyam") +/// .corpus("sea") +/// .doit(); +/// # } +/// ``` +pub struct FileListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _spaces: Option, + _q: Option, + _page_token: Option, + _page_size: Option, + _order_by: Option, + _corpus: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileListCall<'a, C, A> {} + +impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, FileList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.files.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + if let Some(value) = self._spaces { + params.push(("spaces", value.to_string())); + } + if let Some(value) = self._q { + params.push(("q", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._corpus { + params.push(("corpus", value.to_string())); + } + for &field in ["alt", "spaces", "q", "pageToken", "pageSize", "orderBy", "corpus"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::MetadataReadonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'. + /// + /// Sets the *spaces* query property to the given value. + pub fn spaces(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._spaces = Some(new_value.to_string()); + self + } + /// A query for filtering the file results. See the "Search for Files" guide for supported syntax. + /// + /// Sets the *q* query property to the given value. + pub fn q(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._q = Some(new_value.to_string()); + self + } + /// The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of files to return per page. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> FileListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The source of files to list. + /// + /// Sets the *corpus* query property to the given value. + pub fn corpus(mut self, new_value: &str) -> FileListCall<'a, C, A> { + self._corpus = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::MetadataReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Generates a set of file IDs which can be provided in create requests. +/// +/// A builder for the *generateIds* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.files().generate_ids() +/// .space("Lorem") +/// .count(-75) +/// .doit(); +/// # } +/// ``` +pub struct FileGenerateIdCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _space: Option, + _count: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileGenerateIdCall<'a, C, A> {} + +impl<'a, C, A> FileGenerateIdCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GeneratedIds)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.files.generateIds", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if let Some(value) = self._space { + params.push(("space", value.to_string())); + } + if let Some(value) = self._count { + params.push(("count", value.to_string())); + } + for &field in ["alt", "space", "count"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/generateIds".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'. + /// + /// Sets the *space* query property to the given value. + pub fn space(mut self, new_value: &str) -> FileGenerateIdCall<'a, C, A> { + self._space = Some(new_value.to_string()); + self + } + /// The number of IDs to return. + /// + /// Sets the *count* query property to the given value. + pub fn count(mut self, new_value: i32) -> FileGenerateIdCall<'a, C, A> { + self._count = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileGenerateIdCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileGenerateIdCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileGenerateIdCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a new file. +/// +/// A builder for the *create* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::File; +/// use std::fs; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = File::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload_resumable(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.files().create(req) +/// .use_content_as_indexable_text(false) +/// .ocr_language("sadipscing") +/// .keep_revision_forever(true) +/// .ignore_default_visibility(true) +/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct FileCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: File, + _use_content_as_indexable_text: Option, + _ocr_language: Option, + _keep_revision_forever: Option, + _ignore_default_visibility: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileCreateCall<'a, C, A> {} + +impl<'a, C, A> FileCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, File)> + where RS: ReadSeek { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.files.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + if let Some(value) = self._use_content_as_indexable_text { + params.push(("useContentAsIndexableText", value.to_string())); + } + if let Some(value) = self._ocr_language { + params.push(("ocrLanguage", value.to_string())); + } + if let Some(value) = self._keep_revision_forever { + params.push(("keepRevisionForever", value.to_string())); + } + if let Some(value) = self._ignore_default_visibility { + params.push(("ignoreDefaultVisibility", value.to_string())); + } + for &field in ["alt", "useContentAsIndexableText", "ocrLanguage", "keepRevisionForever", "ignoreDefaultVisibility"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let (mut url, upload_type) = + if protocol == "simple" { + ("https://www.googleapis.com/upload/drive/v3/files".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://www.googleapis.com/resumable/upload/drive/v3/files".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut mp_reader: MultiPartReader = Default::default(); + let (mut body_reader, content_type) = match protocol { + "simple" => { + mp_reader.reserve_exact(2); + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 5497558138880 { + return Err(Error::UploadSizeLimitExceeded(size, 5497558138880)) + } + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) + .add_part(&mut reader, size, reader_mime_type.clone()); + let mime_type = mp_reader.mime_type(); + (&mut mp_reader as &mut io::Read, ContentType(mime_type)) + }, + _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), + }; + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(content_type) + .body(&mut body_reader); + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 5497558138880 { + return Err(Error::UploadSizeLimitExceeded(size, 5497558138880)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 5120GB + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, File)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 5120GB + /// * *multipart*: yes + /// * *valid mime types*: '*/*' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, File)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// + /// Sets the *request* property to the given value. + /// + /// 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: File) -> FileCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Whether to use the uploaded content as indexable text. + /// + /// Sets the *use content as indexable text* query property to the given value. + pub fn use_content_as_indexable_text(mut self, new_value: bool) -> FileCreateCall<'a, C, A> { + self._use_content_as_indexable_text = Some(new_value); + self + } + /// A language hint for OCR processing during image import (ISO 639-1 code). + /// + /// Sets the *ocr language* query property to the given value. + pub fn ocr_language(mut self, new_value: &str) -> FileCreateCall<'a, C, A> { + self._ocr_language = Some(new_value.to_string()); + self + } + /// Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive. + /// + /// Sets the *keep revision forever* query property to the given value. + pub fn keep_revision_forever(mut self, new_value: bool) -> FileCreateCall<'a, C, A> { + self._keep_revision_forever = Some(new_value); + self + } + /// Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders. + /// + /// Sets the *ignore default visibility* query property to the given value. + pub fn ignore_default_visibility(mut self, new_value: bool) -> FileCreateCall<'a, C, A> { + self._ignore_default_visibility = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Permanently deletes a file owned by the user without moving it to the trash. If the target is a folder, all descendants owned by the user are also deleted. +/// +/// A builder for the *delete* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.files().delete("fileId") +/// .doit(); +/// # } +/// ``` +pub struct FileDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileDeleteCall<'a, C, A> {} + +impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.files.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + for &field in ["fileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> FileDeleteCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a file's metadata or content by ID. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `File` structure that you would usually get. The latter will be a default value. +/// +/// A builder for the *get* method supported by a *file* resource. +/// It is not used directly, but through a `FileMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.files().get("fileId") +/// .acknowledge_abuse(false) +/// .doit(); +/// # } +/// ``` +pub struct FileGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _acknowledge_abuse: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for FileGetCall<'a, C, A> {} + +impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, File)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.files.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + if let Some(value) = self._acknowledge_abuse { + params.push(("acknowledgeAbuse", value.to_string())); + } + for &field in ["fileId", "acknowledgeAbuse"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if >::as_ref(&value) != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::MetadataReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = if enable_resource_parsing { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + } else { (res, Default::default()) }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> FileGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media. + /// + /// Sets the *acknowledge abuse* query property to the given value. + pub fn acknowledge_abuse(mut self, new_value: bool) -> FileGetCall<'a, C, A> { + self._acknowledge_abuse = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> FileGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> FileGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::MetadataReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> FileGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets information about the user, the user's Drive, and system capabilities. +/// +/// A builder for the *get* method supported by a *about* resource. +/// It is not used directly, but through a `AboutMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.about().get() +/// .doit(); +/// # } +/// ``` +pub struct AboutGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for AboutGetCall<'a, C, A> {} + +impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, About)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.about.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/about".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::MetadataReadonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> AboutGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> AboutGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::MetadataReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> AboutGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a comment. +/// +/// A builder for the *delete* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.comments().delete("fileId", "commentId") +/// .doit(); +/// # } +/// ``` +pub struct CommentDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _comment_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentDeleteCall<'a, C, A> {} + +impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.comments.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("commentId", self._comment_id.to_string())); + for &field in ["fileId", "commentId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/comments/{commentId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{commentId}", "commentId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["commentId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> CommentDeleteCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the comment. + /// + /// Sets the *comment id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn comment_id(mut self, new_value: &str) -> CommentDeleteCall<'a, C, A> { + self._comment_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a comment by ID. +/// +/// A builder for the *get* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.comments().get("fileId", "commentId") +/// .include_deleted(false) +/// .doit(); +/// # } +/// ``` +pub struct CommentGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _comment_id: String, + _include_deleted: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentGetCall<'a, C, A> {} + +impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Comment)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.comments.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("commentId", self._comment_id.to_string())); + if let Some(value) = self._include_deleted { + params.push(("includeDeleted", value.to_string())); + } + for &field in ["alt", "fileId", "commentId", "includeDeleted"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/comments/{commentId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{commentId}", "commentId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["commentId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> CommentGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the comment. + /// + /// Sets the *comment id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn comment_id(mut self, new_value: &str) -> CommentGetCall<'a, C, A> { + self._comment_id = new_value.to_string(); + self + } + /// Whether to return deleted comments. Deleted comments will not include their original content. + /// + /// Sets the *include deleted* query property to the given value. + pub fn include_deleted(mut self, new_value: bool) -> CommentGetCall<'a, C, A> { + self._include_deleted = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a comment with patch semantics. +/// +/// A builder for the *update* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::Comment; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = Comment::default(); +/// +/// // 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 ! +/// let result = hub.comments().update(req, "fileId", "commentId") +/// .doit(); +/// # } +/// ``` +pub struct CommentUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: Comment, + _file_id: String, + _comment_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentUpdateCall<'a, C, A> {} + +impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Comment)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.comments.update", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("commentId", self._comment_id.to_string())); + for &field in ["alt", "fileId", "commentId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/comments/{commentId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{commentId}", "commentId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["commentId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Comment) -> CommentUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> CommentUpdateCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the comment. + /// + /// Sets the *comment id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn comment_id(mut self, new_value: &str) -> CommentUpdateCall<'a, C, A> { + self._comment_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a new comment on a file. +/// +/// A builder for the *create* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::Comment; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = Comment::default(); +/// +/// // 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 ! +/// let result = hub.comments().create(req, "fileId") +/// .doit(); +/// # } +/// ``` +pub struct CommentCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: Comment, + _file_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentCreateCall<'a, C, A> {} + +impl<'a, C, A> CommentCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Comment)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.comments.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + for &field in ["alt", "fileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/comments".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Comment) -> CommentCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> CommentCreateCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists a file's comments. +/// +/// A builder for the *list* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.comments().list("fileId") +/// .start_modified_time("duo") +/// .page_token("et") +/// .page_size(-40) +/// .include_deleted(false) +/// .doit(); +/// # } +/// ``` +pub struct CommentListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _start_modified_time: Option, + _page_token: Option, + _page_size: Option, + _include_deleted: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentListCall<'a, C, A> {} + +impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CommentList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.comments.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + if let Some(value) = self._start_modified_time { + params.push(("startModifiedTime", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._include_deleted { + params.push(("includeDeleted", value.to_string())); + } + for &field in ["alt", "fileId", "startModifiedTime", "pageToken", "pageSize", "includeDeleted"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/comments".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> CommentListCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The minimum value of 'modifiedTime' for the result comments (RFC 3339 date-time). + /// + /// Sets the *start modified time* query property to the given value. + pub fn start_modified_time(mut self, new_value: &str) -> CommentListCall<'a, C, A> { + self._start_modified_time = Some(new_value.to_string()); + self + } + /// The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CommentListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of comments to return per page. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> CommentListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Whether to include deleted comments. Deleted comments will not include their original content. + /// + /// Sets the *include deleted* query property to the given value. + pub fn include_deleted(mut self, new_value: bool) -> CommentListCall<'a, C, A> { + self._include_deleted = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Stop watching resources through this channel +/// +/// A builder for the *stop* method supported by a *channel* resource. +/// It is not used directly, but through a `ChannelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::Channel; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = Channel::default(); +/// +/// // 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 ! +/// let result = hub.channels().stop(req) +/// .doit(); +/// # } +/// ``` +pub struct ChannelStopCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: Channel, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChannelStopCall<'a, C, A> {} + +impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.channels.stop", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + for &field in [].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/drive/v3/channels/stop".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Channel) -> ChannelStopCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChannelStopCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChannelStopCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChannelStopCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a new reply to a comment. +/// +/// A builder for the *create* method supported by a *reply* resource. +/// It is not used directly, but through a `ReplyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::Reply; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = Reply::default(); +/// +/// // 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 ! +/// let result = hub.replies().create(req, "fileId", "commentId") +/// .doit(); +/// # } +/// ``` +pub struct ReplyCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: Reply, + _file_id: String, + _comment_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReplyCreateCall<'a, C, A> {} + +impl<'a, C, A> ReplyCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Reply)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.replies.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("commentId", self._comment_id.to_string())); + for &field in ["alt", "fileId", "commentId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/comments/{commentId}/replies".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{commentId}", "commentId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["commentId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Reply) -> ReplyCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> ReplyCreateCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the comment. + /// + /// Sets the *comment id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn comment_id(mut self, new_value: &str) -> ReplyCreateCall<'a, C, A> { + self._comment_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReplyCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReplyCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReplyCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a reply. +/// +/// A builder for the *delete* method supported by a *reply* resource. +/// It is not used directly, but through a `ReplyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.replies().delete("fileId", "commentId", "replyId") +/// .doit(); +/// # } +/// ``` +pub struct ReplyDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _comment_id: String, + _reply_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReplyDeleteCall<'a, C, A> {} + +impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.replies.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("commentId", self._comment_id.to_string())); + params.push(("replyId", self._reply_id.to_string())); + for &field in ["fileId", "commentId", "replyId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/comments/{commentId}/replies/{replyId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{commentId}", "commentId"), ("{replyId}", "replyId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["replyId", "commentId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> ReplyDeleteCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the comment. + /// + /// Sets the *comment id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn comment_id(mut self, new_value: &str) -> ReplyDeleteCall<'a, C, A> { + self._comment_id = new_value.to_string(); + self + } + /// The ID of the reply. + /// + /// Sets the *reply id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn reply_id(mut self, new_value: &str) -> ReplyDeleteCall<'a, C, A> { + self._reply_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReplyDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReplyDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReplyDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists a comment's replies. +/// +/// A builder for the *list* method supported by a *reply* resource. +/// It is not used directly, but through a `ReplyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.replies().list("fileId", "commentId") +/// .page_token("dolor") +/// .page_size(-48) +/// .include_deleted(true) +/// .doit(); +/// # } +/// ``` +pub struct ReplyListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _comment_id: String, + _page_token: Option, + _page_size: Option, + _include_deleted: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReplyListCall<'a, C, A> {} + +impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ReplyList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.replies.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("commentId", self._comment_id.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._include_deleted { + params.push(("includeDeleted", value.to_string())); + } + for &field in ["alt", "fileId", "commentId", "pageToken", "pageSize", "includeDeleted"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/comments/{commentId}/replies".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{commentId}", "commentId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["commentId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> ReplyListCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the comment. + /// + /// Sets the *comment id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn comment_id(mut self, new_value: &str) -> ReplyListCall<'a, C, A> { + self._comment_id = new_value.to_string(); + self + } + /// The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ReplyListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maximum number of replies to return per page. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ReplyListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Whether to include deleted replies. Deleted replies will not include their original content. + /// + /// Sets the *include deleted* query property to the given value. + pub fn include_deleted(mut self, new_value: bool) -> ReplyListCall<'a, C, A> { + self._include_deleted = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReplyListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReplyListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReplyListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a reply by ID. +/// +/// A builder for the *get* method supported by a *reply* resource. +/// It is not used directly, but through a `ReplyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.replies().get("fileId", "commentId", "replyId") +/// .include_deleted(true) +/// .doit(); +/// # } +/// ``` +pub struct ReplyGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _comment_id: String, + _reply_id: String, + _include_deleted: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReplyGetCall<'a, C, A> {} + +impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Reply)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.replies.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("commentId", self._comment_id.to_string())); + params.push(("replyId", self._reply_id.to_string())); + if let Some(value) = self._include_deleted { + params.push(("includeDeleted", value.to_string())); + } + for &field in ["alt", "fileId", "commentId", "replyId", "includeDeleted"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/comments/{commentId}/replies/{replyId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{commentId}", "commentId"), ("{replyId}", "replyId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["replyId", "commentId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> ReplyGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the comment. + /// + /// Sets the *comment id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn comment_id(mut self, new_value: &str) -> ReplyGetCall<'a, C, A> { + self._comment_id = new_value.to_string(); + self + } + /// The ID of the reply. + /// + /// Sets the *reply id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn reply_id(mut self, new_value: &str) -> ReplyGetCall<'a, C, A> { + self._reply_id = new_value.to_string(); + self + } + /// Whether to return deleted replies. Deleted replies will not include their original content. + /// + /// Sets the *include deleted* query property to the given value. + pub fn include_deleted(mut self, new_value: bool) -> ReplyGetCall<'a, C, A> { + self._include_deleted = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReplyGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReplyGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReplyGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a reply with patch semantics. +/// +/// A builder for the *update* method supported by a *reply* resource. +/// It is not used directly, but through a `ReplyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::Reply; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = Reply::default(); +/// +/// // 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 ! +/// let result = hub.replies().update(req, "fileId", "commentId", "replyId") +/// .doit(); +/// # } +/// ``` +pub struct ReplyUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: Reply, + _file_id: String, + _comment_id: String, + _reply_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReplyUpdateCall<'a, C, A> {} + +impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Reply)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.replies.update", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("commentId", self._comment_id.to_string())); + params.push(("replyId", self._reply_id.to_string())); + for &field in ["alt", "fileId", "commentId", "replyId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/comments/{commentId}/replies/{replyId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{commentId}", "commentId"), ("{replyId}", "replyId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["replyId", "commentId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Reply) -> ReplyUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> ReplyUpdateCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the comment. + /// + /// Sets the *comment id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn comment_id(mut self, new_value: &str) -> ReplyUpdateCall<'a, C, A> { + self._comment_id = new_value.to_string(); + self + } + /// The ID of the reply. + /// + /// Sets the *reply id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn reply_id(mut self, new_value: &str) -> ReplyUpdateCall<'a, C, A> { + self._reply_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReplyUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ReplyUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReplyUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a revision with patch semantics. +/// +/// A builder for the *update* method supported by a *revision* resource. +/// It is not used directly, but through a `RevisionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::Revision; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = Revision::default(); +/// +/// // 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 ! +/// let result = hub.revisions().update(req, "fileId", "revisionId") +/// .doit(); +/// # } +/// ``` +pub struct RevisionUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: Revision, + _file_id: String, + _revision_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RevisionUpdateCall<'a, C, A> {} + +impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Revision)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.revisions.update", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("revisionId", self._revision_id.to_string())); + for &field in ["alt", "fileId", "revisionId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/revisions/{revisionId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{revisionId}", "revisionId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["revisionId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Revision) -> RevisionUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> RevisionUpdateCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the revision. + /// + /// Sets the *revision id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn revision_id(mut self, new_value: &str) -> RevisionUpdateCall<'a, C, A> { + self._revision_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RevisionUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RevisionUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RevisionUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a revision's metadata or content by ID. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `Revision` structure that you would usually get. The latter will be a default value. +/// +/// A builder for the *get* method supported by a *revision* resource. +/// It is not used directly, but through a `RevisionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.revisions().get("fileId", "revisionId") +/// .acknowledge_abuse(true) +/// .doit(); +/// # } +/// ``` +pub struct RevisionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _revision_id: String, + _acknowledge_abuse: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RevisionGetCall<'a, C, A> {} + +impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Revision)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.revisions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("revisionId", self._revision_id.to_string())); + if let Some(value) = self._acknowledge_abuse { + params.push(("acknowledgeAbuse", value.to_string())); + } + for &field in ["fileId", "revisionId", "acknowledgeAbuse"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if >::as_ref(&value) != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/revisions/{revisionId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::MetadataReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{revisionId}", "revisionId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["revisionId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = if enable_resource_parsing { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + } else { (res, Default::default()) }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> RevisionGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the revision. + /// + /// Sets the *revision id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn revision_id(mut self, new_value: &str) -> RevisionGetCall<'a, C, A> { + self._revision_id = new_value.to_string(); + self + } + /// Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media. + /// + /// Sets the *acknowledge abuse* query property to the given value. + pub fn acknowledge_abuse(mut self, new_value: bool) -> RevisionGetCall<'a, C, A> { + self._acknowledge_abuse = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RevisionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RevisionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::MetadataReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RevisionGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Permanently deletes a revision. This method is only applicable to files with binary content in Drive. +/// +/// A builder for the *delete* method supported by a *revision* resource. +/// It is not used directly, but through a `RevisionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.revisions().delete("fileId", "revisionId") +/// .doit(); +/// # } +/// ``` +pub struct RevisionDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _revision_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RevisionDeleteCall<'a, C, A> {} + +impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.revisions.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("revisionId", self._revision_id.to_string())); + for &field in ["fileId", "revisionId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/revisions/{revisionId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{revisionId}", "revisionId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["revisionId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> RevisionDeleteCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the revision. + /// + /// Sets the *revision id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn revision_id(mut self, new_value: &str) -> RevisionDeleteCall<'a, C, A> { + self._revision_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RevisionDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RevisionDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RevisionDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists a file's revisions. +/// +/// A builder for the *list* method supported by a *revision* resource. +/// It is not used directly, but through a `RevisionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.revisions().list("fileId") +/// .doit(); +/// # } +/// ``` +pub struct RevisionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for RevisionListCall<'a, C, A> {} + +impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, RevisionList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.revisions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + for &field in ["alt", "fileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/revisions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::MetadataReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> RevisionListCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RevisionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RevisionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::MetadataReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> RevisionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the starting pageToken for listing future changes. +/// +/// A builder for the *getStartPageToken* method supported by a *change* resource. +/// It is not used directly, but through a `ChangeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.changes().get_start_page_token() +/// .doit(); +/// # } +/// ``` +pub struct ChangeGetStartPageTokenCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChangeGetStartPageTokenCall<'a, C, A> {} + +impl<'a, C, A> ChangeGetStartPageTokenCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StartPageToken)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.changes.getStartPageToken", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/changes/startPageToken".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::MetadataReadonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChangeGetStartPageTokenCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChangeGetStartPageTokenCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::MetadataReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChangeGetStartPageTokenCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Subscribes to changes for a user. +/// +/// A builder for the *watch* method supported by a *change* resource. +/// It is not used directly, but through a `ChangeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::Channel; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = Channel::default(); +/// +/// // 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 ! +/// let result = hub.changes().watch(req, "pageToken") +/// .spaces("consetetur") +/// .restrict_to_my_drive(false) +/// .page_size(-19) +/// .include_removed(false) +/// .doit(); +/// # } +/// ``` +pub struct ChangeWatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: Channel, + _page_token: String, + _spaces: Option, + _restrict_to_my_drive: Option, + _page_size: Option, + _include_removed: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChangeWatchCall<'a, C, A> {} + +impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Channel)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.changes.watch", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + params.push(("pageToken", self._page_token.to_string())); + if let Some(value) = self._spaces { + params.push(("spaces", value.to_string())); + } + if let Some(value) = self._restrict_to_my_drive { + params.push(("restrictToMyDrive", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._include_removed { + params.push(("includeRemoved", value.to_string())); + } + for &field in ["alt", "pageToken", "spaces", "restrictToMyDrive", "pageSize", "includeRemoved"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/changes/watch".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Channel) -> ChangeWatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method. + /// + /// Sets the *page token* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_token(mut self, new_value: &str) -> ChangeWatchCall<'a, C, A> { + self._page_token = new_value.to_string(); + self + } + /// A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'. + /// + /// Sets the *spaces* query property to the given value. + pub fn spaces(mut self, new_value: &str) -> ChangeWatchCall<'a, C, A> { + self._spaces = Some(new_value.to_string()); + self + } + /// Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive. + /// + /// Sets the *restrict to my drive* query property to the given value. + pub fn restrict_to_my_drive(mut self, new_value: bool) -> ChangeWatchCall<'a, C, A> { + self._restrict_to_my_drive = Some(new_value); + self + } + /// The maximum number of changes to return per page. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ChangeWatchCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Whether to include changes indicating that items have left the view of the changes list, for example by deletion or lost access. + /// + /// Sets the *include removed* query property to the given value. + pub fn include_removed(mut self, new_value: bool) -> ChangeWatchCall<'a, C, A> { + self._include_removed = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChangeWatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChangeWatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChangeWatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists changes for a user. +/// +/// A builder for the *list* method supported by a *change* resource. +/// It is not used directly, but through a `ChangeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.changes().list("pageToken") +/// .spaces("et") +/// .restrict_to_my_drive(true) +/// .page_size(-45) +/// .include_removed(false) +/// .doit(); +/// # } +/// ``` +pub struct ChangeListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _page_token: String, + _spaces: Option, + _restrict_to_my_drive: Option, + _page_size: Option, + _include_removed: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChangeListCall<'a, C, A> {} + +impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChangeList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.changes.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("pageToken", self._page_token.to_string())); + if let Some(value) = self._spaces { + params.push(("spaces", value.to_string())); + } + if let Some(value) = self._restrict_to_my_drive { + params.push(("restrictToMyDrive", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + if let Some(value) = self._include_removed { + params.push(("includeRemoved", value.to_string())); + } + for &field in ["alt", "pageToken", "spaces", "restrictToMyDrive", "pageSize", "includeRemoved"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/changes".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::MetadataReadonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method. + /// + /// Sets the *page token* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn page_token(mut self, new_value: &str) -> ChangeListCall<'a, C, A> { + self._page_token = new_value.to_string(); + self + } + /// A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'. + /// + /// Sets the *spaces* query property to the given value. + pub fn spaces(mut self, new_value: &str) -> ChangeListCall<'a, C, A> { + self._spaces = Some(new_value.to_string()); + self + } + /// Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive. + /// + /// Sets the *restrict to my drive* query property to the given value. + pub fn restrict_to_my_drive(mut self, new_value: bool) -> ChangeListCall<'a, C, A> { + self._restrict_to_my_drive = Some(new_value); + self + } + /// The maximum number of changes to return per page. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ChangeListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// Whether to include changes indicating that items have left the view of the changes list, for example by deletion or lost access. + /// + /// Sets the *include removed* query property to the given value. + pub fn include_removed(mut self, new_value: bool) -> ChangeListCall<'a, C, A> { + self._include_removed = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChangeListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChangeListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::MetadataReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChangeListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a permission. +/// +/// A builder for the *delete* method supported by a *permission* resource. +/// It is not used directly, but through a `PermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.permissions().delete("fileId", "permissionId") +/// .doit(); +/// # } +/// ``` +pub struct PermissionDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _permission_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PermissionDeleteCall<'a, C, A> {} + +impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.permissions.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("permissionId", self._permission_id.to_string())); + for &field in ["fileId", "permissionId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/permissions/{permissionId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{permissionId}", "permissionId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["permissionId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> PermissionDeleteCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the permission. + /// + /// Sets the *permission id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn permission_id(mut self, new_value: &str) -> PermissionDeleteCall<'a, C, A> { + self._permission_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PermissionDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PermissionDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PermissionDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists a file's permissions. +/// +/// A builder for the *list* method supported by a *permission* resource. +/// It is not used directly, but through a `PermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.permissions().list("fileId") +/// .doit(); +/// # } +/// ``` +pub struct PermissionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PermissionListCall<'a, C, A> {} + +impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PermissionList)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.permissions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + for &field in ["alt", "fileId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/permissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::MetadataReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> PermissionListCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PermissionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PermissionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::MetadataReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PermissionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a permission with patch semantics. +/// +/// A builder for the *update* method supported by a *permission* resource. +/// It is not used directly, but through a `PermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::Permission; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = Permission::default(); +/// +/// // 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 ! +/// let result = hub.permissions().update(req, "fileId", "permissionId") +/// .transfer_ownership(false) +/// .doit(); +/// # } +/// ``` +pub struct PermissionUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: Permission, + _file_id: String, + _permission_id: String, + _transfer_ownership: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PermissionUpdateCall<'a, C, A> {} + +impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Permission)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.permissions.update", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("permissionId", self._permission_id.to_string())); + if let Some(value) = self._transfer_ownership { + params.push(("transferOwnership", value.to_string())); + } + for &field in ["alt", "fileId", "permissionId", "transferOwnership"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/permissions/{permissionId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{permissionId}", "permissionId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["permissionId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Permission) -> PermissionUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> PermissionUpdateCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the permission. + /// + /// Sets the *permission id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn permission_id(mut self, new_value: &str) -> PermissionUpdateCall<'a, C, A> { + self._permission_id = new_value.to_string(); + self + } + /// Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect. + /// + /// Sets the *transfer ownership* query property to the given value. + pub fn transfer_ownership(mut self, new_value: bool) -> PermissionUpdateCall<'a, C, A> { + self._transfer_ownership = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PermissionUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PermissionUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PermissionUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a permission by ID. +/// +/// A builder for the *get* method supported by a *permission* resource. +/// It is not used directly, but through a `PermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let result = hub.permissions().get("fileId", "permissionId") +/// .doit(); +/// # } +/// ``` +pub struct PermissionGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _file_id: String, + _permission_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PermissionGetCall<'a, C, A> {} + +impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Permission)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.permissions.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + params.push(("permissionId", self._permission_id.to_string())); + for &field in ["alt", "fileId", "permissionId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/permissions/{permissionId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::MetadataReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId"), ("{permissionId}", "permissionId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["permissionId", "fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> PermissionGetCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// The ID of the permission. + /// + /// Sets the *permission id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn permission_id(mut self, new_value: &str) -> PermissionGetCall<'a, C, A> { + self._permission_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PermissionGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PermissionGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::MetadataReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PermissionGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a permission for a file. +/// +/// A builder for the *create* method supported by a *permission* resource. +/// It is not used directly, but through a `PermissionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_drive3 as drive3; +/// use drive3::Permission; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use drive3::Drive; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Drive::new(hyper::Client::new(), 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 ! +/// let mut req = Permission::default(); +/// +/// // 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 ! +/// let result = hub.permissions().create(req, "fileId") +/// .transfer_ownership(false) +/// .send_notification_email(true) +/// .email_message("nonumy") +/// .doit(); +/// # } +/// ``` +pub struct PermissionCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Drive, + _request: Permission, + _file_id: String, + _transfer_ownership: Option, + _send_notification_email: Option, + _email_message: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PermissionCreateCall<'a, C, A> {} + +impl<'a, C, A> PermissionCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Permission)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "drive.permissions.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("fileId", self._file_id.to_string())); + if let Some(value) = self._transfer_ownership { + params.push(("transferOwnership", value.to_string())); + } + if let Some(value) = self._send_notification_email { + params.push(("sendNotificationEmail", value.to_string())); + } + if let Some(value) = self._email_message { + params.push(("emailMessage", value.to_string())); + } + for &field in ["alt", "fileId", "transferOwnership", "sendNotificationEmail", "emailMessage"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/drive/v3/files/{fileId}/permissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{fileId}", "fileId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["fileId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Permission) -> PermissionCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The ID of the file. + /// + /// Sets the *file id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn file_id(mut self, new_value: &str) -> PermissionCreateCall<'a, C, A> { + self._file_id = new_value.to_string(); + self + } + /// Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect. + /// + /// Sets the *transfer ownership* query property to the given value. + pub fn transfer_ownership(mut self, new_value: bool) -> PermissionCreateCall<'a, C, A> { + self._transfer_ownership = Some(new_value); + self + } + /// Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers. + /// + /// Sets the *send notification email* query property to the given value. + pub fn send_notification_email(mut self, new_value: bool) -> PermissionCreateCall<'a, C, A> { + self._send_notification_email = Some(new_value); + self + } + /// A custom message to include in the notification email. + /// + /// Sets the *email message* query property to the given value. + pub fn email_message(mut self, new_value: &str) -> PermissionCreateCall<'a, C, A> { + self._email_message = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PermissionCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PermissionCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PermissionCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/fitness1-cli/Cargo.toml b/gen/fitness1-cli/Cargo.toml index 705e5d71ad..8281def123 100644 --- a/gen/fitness1-cli/Cargo.toml +++ b/gen/fitness1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-fitness1-cli" -version = "0.3.2+20150720" +version = "0.3.3+20151021" authors = ["Sebastian Thiel "] description = "A complete library to interact with fitness (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/fitness1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/fitness1-cli/LICENSE.md b/gen/fitness1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/fitness1-cli/LICENSE.md +++ b/gen/fitness1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/fitness1-cli/README.md b/gen/fitness1-cli/README.md index a3234950ba..7b06b25f6c 100644 --- a/gen/fitness1-cli/README.md +++ b/gen/fitness1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *fitness* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/fitness1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/fitness1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/fitness1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/fitness1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/fitness1-cli). # Usage -This documentation was generated from the *fitness* API at revision *20150720*. The CLI is at version *0.3.2*. +This documentation was generated from the *fitness* API at revision *20151021*. The CLI is at version *0.3.3*. ```bash fitness1 [options] @@ -46,18 +46,18 @@ fitness1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/fitness1-cli/mkdocs.yml b/gen/fitness1-cli/mkdocs.yml index 5b8c1674f9..d098139f61 100644 --- a/gen/fitness1-cli/mkdocs.yml +++ b/gen/fitness1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: fitness v0.3.2+20150720 +site_name: fitness v0.3.3+20151021 site_url: http://byron.github.io/google-apis-rs/google-fitness1-cli site_description: Write integrating applications with bcore @@ -25,5 +25,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/fitness1-cli/src/main.rs b/gen/fitness1-cli/src/main.rs index 83e7c901d6..8a5914e87d 100644 --- a/gen/fitness1-cli/src/main.rs +++ b/gen/fitness1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Fitness>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _users_data_sources_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _users_data_sources_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data-stream-name" => Some(("dataStreamName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -94,7 +94,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DataSource = json::value::from_value(object).unwrap(); let mut call = self.hub.users().data_sources_create(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -107,7 +107,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -120,7 +120,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -143,10 +143,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_data_sources_datasets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_data_sources_datasets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().data_sources_datasets_delete(opt.value_of("user-id").unwrap_or(""), opt.value_of("data-source-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "modified-time-millis" => { @@ -165,7 +165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["modified-time-millis", "current-time-millis"].iter().map(|v|*v)); @@ -179,7 +179,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -194,10 +194,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_data_sources_datasets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_data_sources_datasets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().data_sources_datasets_get(opt.value_of("user-id").unwrap_or(""), opt.value_of("data-source-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -216,7 +216,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "limit"].iter().map(|v|*v)); @@ -230,7 +230,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -253,13 +253,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_data_sources_datasets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_data_sources_datasets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -273,8 +273,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "min-start-time-ns" => Some(("minStartTimeNs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "next-page-token" => Some(("nextPageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -292,7 +292,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Dataset = json::value::from_value(object).unwrap(); let mut call = self.hub.users().data_sources_datasets_patch(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("data-source-id").unwrap_or(""), opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "current-time-millis" => { @@ -308,7 +308,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["current-time-millis"].iter().map(|v|*v)); @@ -322,7 +322,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -345,10 +345,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_data_sources_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_data_sources_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().data_sources_delete(opt.value_of("user-id").unwrap_or(""), opt.value_of("data-source-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -361,7 +361,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -374,7 +374,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -397,10 +397,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_data_sources_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_data_sources_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().data_sources_get(opt.value_of("user-id").unwrap_or(""), opt.value_of("data-source-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -413,7 +413,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -426,7 +426,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -449,10 +449,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_data_sources_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_data_sources_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().data_sources_list(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "data-type-name" => { @@ -468,7 +468,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["data-type-name"].iter().map(|v|*v)); @@ -482,7 +482,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -505,13 +505,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_data_sources_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_data_sources_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -525,8 +525,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data-stream-name" => Some(("dataStreamName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -554,7 +554,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DataSource = json::value::from_value(object).unwrap(); let mut call = self.hub.users().data_sources_patch(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("data-source-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -567,7 +567,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -580,7 +580,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -603,13 +603,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_data_sources_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_data_sources_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -623,8 +623,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data-stream-name" => Some(("dataStreamName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -652,7 +652,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DataSource = json::value::from_value(object).unwrap(); let mut call = self.hub.users().data_sources_update(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("data-source-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -665,7 +665,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -678,7 +678,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -701,13 +701,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_dataset_aggregate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_dataset_aggregate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -721,8 +721,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "bucket-by-activity-segment.activity-data-source-id" => Some(("bucketByActivitySegment.activityDataSourceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "bucket-by-activity-segment.min-duration-millis" => Some(("bucketByActivitySegment.minDurationMillis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -744,7 +744,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AggregateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.users().dataset_aggregate(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -757,7 +757,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -770,7 +770,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -793,10 +793,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_sessions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_sessions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().sessions_delete(opt.value_of("user-id").unwrap_or(""), opt.value_of("session-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "current-time-millis" => { @@ -812,7 +812,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["current-time-millis"].iter().map(|v|*v)); @@ -826,7 +826,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -841,10 +841,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_sessions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_sessions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().sessions_list(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-time" => { @@ -869,7 +869,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "end-time", "include-deleted", "start-time"].iter().map(|v|*v)); @@ -883,7 +883,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -906,13 +906,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_sessions_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_sessions_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -926,8 +926,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "modified-time-millis" => Some(("modifiedTimeMillis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "end-time-millis" => Some(("endTimeMillis", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -953,7 +953,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Session = json::value::from_value(object).unwrap(); let mut call = self.hub.users().sessions_update(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("session-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "current-time-millis" => { @@ -969,7 +969,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["current-time-millis"].iter().map(|v|*v)); @@ -983,7 +983,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1075,14 +1075,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "fitness1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "fitness1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1102,7 +1102,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1141,7 +1141,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("users", "methods: 'data-sources-create', 'data-sources-datasets-delete', 'data-sources-datasets-get', 'data-sources-datasets-patch', 'data-sources-delete', 'data-sources-get', 'data-sources-list', 'data-sources-patch', 'data-sources-update', 'dataset-aggregate', 'sessions-delete', 'sessions-list' and 'sessions-update'", vec![ - ("data-sources-create", + ("data-sources-create", Some(r##"Creates a new data source that is unique across all data sources belonging to this user. The data stream ID field can be omitted and will be generated by the server with the correct format. The data stream ID is an ordered combination of some fields from the data source. In addition to the data source fields reflected into the data source ID, the developer project number that is authenticated when creating the data source is included. This developer project number is obfuscated when read by any other developer reading public data types."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_data-sources-create", vec![ @@ -1169,7 +1169,7 @@ fn main() { Some(false), Some(false)), ]), - ("data-sources-datasets-delete", + ("data-sources-datasets-delete", Some(r##"Performs an inclusive delete of all data points whose start and end times have any overlap with the time range specified by the dataset ID. For most data types, the entire data point will be deleted. For data types where the time span represents a consistent value (such as com.google.activity.segment), and a data point straddles either end point of the dataset, only the overlapping portion of the data point will be deleted."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_data-sources-datasets-delete", vec![ @@ -1197,7 +1197,7 @@ fn main() { Some(false), Some(true)), ]), - ("data-sources-datasets-get", + ("data-sources-datasets-get", Some(r##"Returns a dataset containing all data points whose start and end times overlap with the specified range of the dataset minimum start time and maximum end time. Specifically, any data point whose start time is less than or equal to the dataset end time and whose end time is greater than or equal to the dataset start time."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_data-sources-datasets-get", vec![ @@ -1231,7 +1231,7 @@ fn main() { Some(false), Some(false)), ]), - ("data-sources-datasets-patch", + ("data-sources-datasets-patch", Some(r##"Adds data points to a dataset. The dataset need not be previously created. All points within the given dataset will be returned with subsquent calls to retrieve this dataset. Data points can belong to more than one dataset. This method does not use patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_data-sources-datasets-patch", vec![ @@ -1271,7 +1271,7 @@ fn main() { Some(false), Some(false)), ]), - ("data-sources-delete", + ("data-sources-delete", Some(r##"Delete the data source if there are no datapoints associated with it"##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_data-sources-delete", vec![ @@ -1299,7 +1299,7 @@ fn main() { Some(false), Some(false)), ]), - ("data-sources-get", + ("data-sources-get", Some(r##"Returns a data source identified by a data stream ID."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_data-sources-get", vec![ @@ -1327,7 +1327,7 @@ fn main() { Some(false), Some(false)), ]), - ("data-sources-list", + ("data-sources-list", Some(r##"Lists all data sources that are visible to the developer, using the OAuth scopes provided. The list is not exhaustive: the user may have private data sources that are only visible to other developers or calls using other scopes."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_data-sources-list", vec![ @@ -1349,7 +1349,7 @@ fn main() { Some(false), Some(false)), ]), - ("data-sources-patch", + ("data-sources-patch", Some(r##"Updates a given data source. It is an error to modify the data source's data stream ID, data type, type, stream name or device information apart from the device version. Changing these fields would require a new unique data stream ID and separate data source. Data sources are identified by their data stream ID. This method supports patch semantics."##), @@ -1385,7 +1385,7 @@ fn main() { Some(false), Some(false)), ]), - ("data-sources-update", + ("data-sources-update", Some(r##"Updates a given data source. It is an error to modify the data source's data stream ID, data type, type, stream name or device information apart from the device version. Changing these fields would require a new unique data stream ID and separate data source. Data sources are identified by their data stream ID."##), @@ -1421,7 +1421,7 @@ fn main() { Some(false), Some(false)), ]), - ("dataset-aggregate", + ("dataset-aggregate", Some(r##"Aggregates data of a certain type or stream into buckets divided by a given type of boundary. Multiple data sets of multiple types and from multiple sources can be aggreated into exactly one bucket type per request."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_dataset-aggregate", vec![ @@ -1449,7 +1449,7 @@ fn main() { Some(false), Some(false)), ]), - ("sessions-delete", + ("sessions-delete", Some(r##"Deletes a session specified by the given session ID."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_sessions-delete", vec![ @@ -1471,7 +1471,7 @@ fn main() { Some(false), Some(true)), ]), - ("sessions-list", + ("sessions-list", Some(r##"Lists sessions previously created."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_sessions-list", vec![ @@ -1493,7 +1493,7 @@ fn main() { Some(false), Some(false)), ]), - ("sessions-update", + ("sessions-update", Some(r##"Updates or insert a given session."##), "Details at http://byron.github.io/google-apis-rs/google_fitness1_cli/users_sessions-update", vec![ @@ -1533,7 +1533,7 @@ fn main() { let mut app = App::new("fitness1") .author("Sebastian Thiel ") - .version("0.3.2+20150720") + .version("0.3.3+20151021") .about("Google Fit API") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_fitness1_cli") .arg(Arg::with_name("url") @@ -1557,7 +1557,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1568,7 +1568,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/fitness1/Cargo.toml b/gen/fitness1/Cargo.toml index 8b852dad0a..fa5e821cd4 100644 --- a/gen/fitness1/Cargo.toml +++ b/gen/fitness1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-fitness1" -version = "0.1.10+20150720" +version = "0.1.11+20151021" authors = ["Sebastian Thiel "] description = "A complete library to interact with fitness (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/fitness1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/fitness1/LICENSE.md b/gen/fitness1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/fitness1/LICENSE.md +++ b/gen/fitness1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/fitness1/README.md b/gen/fitness1/README.md index 8c7972ae6a..2c7aced5b2 100644 --- a/gen/fitness1/README.md +++ b/gen/fitness1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-fitness1` library allows access to all features of the *Google fitness* service. -This documentation was generated from *fitness* crate version *0.1.10+20150720*, where *20150720* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *fitness* crate version *0.1.11+20151021*, where *20151021* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *fitness* *v1* API can be found at the [official documentation site](https://developers.google.com/fit/rest/). diff --git a/gen/fitness1/src/cmn.rs b/gen/fitness1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/fitness1/src/cmn.rs +++ b/gen/fitness1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/fitness1/src/lib.rs b/gen/fitness1/src/lib.rs index be984f87c3..76d13cbafc 100644 --- a/gen/fitness1/src/lib.rs +++ b/gen/fitness1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *fitness* crate version *0.1.10+20150720*, where *20150720* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *fitness* crate version *0.1.11+20151021*, where *20151021* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *fitness* *v1* API can be found at the //! [official documentation site](https://developers.google.com/fit/rest/). diff --git a/gen/fitness1/src/lib.rs.in b/gen/fitness1/src/lib.rs.in index 6ef7925481..addbeed0b6 100644 --- a/gen/fitness1/src/lib.rs.in +++ b/gen/fitness1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -152,7 +153,7 @@ impl<'a, C, A> Fitness Fitness { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -161,7 +162,7 @@ impl<'a, C, A> Fitness } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1055,7 +1056,7 @@ impl<'a, C, A> UserDatasetAggregateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.dataset.aggregate", + dlg.begin(MethodInfo { id: "fitness.users.dataset.aggregate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -1073,7 +1074,7 @@ impl<'a, C, A> UserDatasetAggregateCall<'a, C, A> where C: BorrowMut UserDatasetAggregateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1148,7 +1149,7 @@ impl<'a, C, A> UserDatasetAggregateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1158,10 +1159,10 @@ impl<'a, C, A> UserDatasetAggregateCall<'a, C, A> where C: BorrowMut UserDatasetAggregateCall<'a, C, A> where C: BorrowMut UserDatasetAggregateCall<'a, C, A> { self._request = new_value; @@ -1203,7 +1204,7 @@ impl<'a, C, A> UserDatasetAggregateCall<'a, C, A> where C: BorrowMut UserDatasetAggregateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -1221,12 +1222,12 @@ impl<'a, C, A> UserDatasetAggregateCall<'a, C, A> where C: BorrowMut UserDatasetAggregateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserDatasetAggregateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDatasetAggregateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1316,7 +1317,7 @@ impl<'a, C, A> UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.dataSources.delete", + dlg.begin(MethodInfo { id: "fitness.users.dataSources.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -1359,7 +1360,7 @@ impl<'a, C, A> UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1395,7 +1396,7 @@ impl<'a, C, A> UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1405,10 +1406,10 @@ impl<'a, C, A> UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -1451,7 +1452,7 @@ impl<'a, C, A> UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDeleteCall<'a, C, A> { self._data_source_id = new_value.to_string(); @@ -1469,12 +1470,12 @@ impl<'a, C, A> UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserDataSourceDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDataSourceDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1569,7 +1570,7 @@ impl<'a, C, A> UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.dataSources.datasets.get", + dlg.begin(MethodInfo { id: "fitness.users.dataSources.datasets.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -1619,7 +1620,7 @@ impl<'a, C, A> UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1655,7 +1656,7 @@ impl<'a, C, A> UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1665,10 +1666,10 @@ impl<'a, C, A> UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -1711,7 +1712,7 @@ impl<'a, C, A> UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetGetCall<'a, C, A> { self._data_source_id = new_value.to_string(); @@ -1721,7 +1722,7 @@ impl<'a, C, A> UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetGetCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -1753,12 +1754,12 @@ impl<'a, C, A> UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserDataSourceDatasetGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDataSourceDatasetGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1854,7 +1855,7 @@ impl<'a, C, A> UserDataSourceCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.dataSources.create", + dlg.begin(MethodInfo { id: "fitness.users.dataSources.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -1896,14 +1897,14 @@ impl<'a, C, A> UserDataSourceCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1947,7 +1948,7 @@ impl<'a, C, A> UserDataSourceCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1957,10 +1958,10 @@ impl<'a, C, A> UserDataSourceCreateCall<'a, C, A> where C: BorrowMut UserDataSourceCreateCall<'a, C, A> where C: BorrowMut UserDataSourceCreateCall<'a, C, A> { self._request = new_value; @@ -2002,7 +2003,7 @@ impl<'a, C, A> UserDataSourceCreateCall<'a, C, A> where C: BorrowMut UserDataSourceCreateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2020,12 +2021,12 @@ impl<'a, C, A> UserDataSourceCreateCall<'a, C, A> where C: BorrowMut UserDataSourceCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserDataSourceCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDataSourceCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2120,7 +2121,7 @@ impl<'a, C, A> UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.dataSources.datasets.delete", + dlg.begin(MethodInfo { id: "fitness.users.dataSources.datasets.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -2169,7 +2170,7 @@ impl<'a, C, A> UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2205,7 +2206,7 @@ impl<'a, C, A> UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2215,10 +2216,10 @@ impl<'a, C, A> UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2251,7 +2252,7 @@ impl<'a, C, A> UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetDeleteCall<'a, C, A> { self._data_source_id = new_value.to_string(); @@ -2261,7 +2262,7 @@ impl<'a, C, A> UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetDeleteCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -2293,12 +2294,12 @@ impl<'a, C, A> UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserDataSourceDatasetDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDataSourceDatasetDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2398,7 +2399,7 @@ impl<'a, C, A> UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.dataSources.datasets.patch", + dlg.begin(MethodInfo { id: "fitness.users.dataSources.datasets.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -2445,14 +2446,14 @@ impl<'a, C, A> UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2496,7 +2497,7 @@ impl<'a, C, A> UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2506,10 +2507,10 @@ impl<'a, C, A> UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetPatchCall<'a, C, A> { self._request = new_value; @@ -2551,7 +2552,7 @@ impl<'a, C, A> UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetPatchCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2561,7 +2562,7 @@ impl<'a, C, A> UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetPatchCall<'a, C, A> { self._data_source_id = new_value.to_string(); @@ -2571,7 +2572,7 @@ impl<'a, C, A> UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetPatchCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -2596,12 +2597,12 @@ impl<'a, C, A> UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut UserDataSourceDatasetPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserDataSourceDatasetPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDataSourceDatasetPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2693,7 +2694,7 @@ impl<'a, C, A> UserSessionDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.sessions.delete", + dlg.begin(MethodInfo { id: "fitness.users.sessions.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -2738,7 +2739,7 @@ impl<'a, C, A> UserSessionDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2774,7 +2775,7 @@ impl<'a, C, A> UserSessionDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2784,10 +2785,10 @@ impl<'a, C, A> UserSessionDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2810,7 +2811,7 @@ impl<'a, C, A> UserSessionDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserSessionDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2820,7 +2821,7 @@ impl<'a, C, A> UserSessionDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *session id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn session_id(mut self, new_value: &str) -> UserSessionDeleteCall<'a, C, A> { self._session_id = new_value.to_string(); @@ -2845,12 +2846,12 @@ impl<'a, C, A> UserSessionDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2867,17 +2868,17 @@ impl<'a, C, A> UserSessionDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ActivityWrite`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserSessionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserSessionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2940,7 +2941,7 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.dataSources.get", + dlg.begin(MethodInfo { id: "fitness.users.dataSources.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -2983,7 +2984,7 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3019,7 +3020,7 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3029,10 +3030,10 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3065,7 +3066,7 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserDataSourceGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3075,7 +3076,7 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *data source id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn data_source_id(mut self, new_value: &str) -> UserDataSourceGetCall<'a, C, A> { self._data_source_id = new_value.to_string(); @@ -3093,12 +3094,12 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3115,17 +3116,17 @@ impl<'a, C, A> UserDataSourceGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ActivityRead`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserDataSourceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDataSourceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3197,7 +3198,7 @@ impl<'a, C, A> UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.dataSources.update", + dlg.begin(MethodInfo { id: "fitness.users.dataSources.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -3240,14 +3241,14 @@ impl<'a, C, A> UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3291,7 +3292,7 @@ impl<'a, C, A> UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3301,10 +3302,10 @@ impl<'a, C, A> UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut UserDataSourceUpdateCall<'a, C, A> { self._request = new_value; @@ -3346,7 +3347,7 @@ impl<'a, C, A> UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut UserDataSourceUpdateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3356,7 +3357,7 @@ impl<'a, C, A> UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut UserDataSourceUpdateCall<'a, C, A> { self._data_source_id = new_value.to_string(); @@ -3374,12 +3375,12 @@ impl<'a, C, A> UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut UserDataSourceUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserDataSourceUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDataSourceUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3476,7 +3477,7 @@ impl<'a, C, A> UserSessionListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.sessions.list", + dlg.begin(MethodInfo { id: "fitness.users.sessions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -3530,7 +3531,7 @@ impl<'a, C, A> UserSessionListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3566,7 +3567,7 @@ impl<'a, C, A> UserSessionListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3576,10 +3577,10 @@ impl<'a, C, A> UserSessionListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3612,7 +3613,7 @@ impl<'a, C, A> UserSessionListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserSessionListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3658,12 +3659,12 @@ impl<'a, C, A> UserSessionListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3680,17 +3681,17 @@ impl<'a, C, A> UserSessionListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ActivityRead`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserSessionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserSessionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3762,7 +3763,7 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.sessions.update", + dlg.begin(MethodInfo { id: "fitness.users.sessions.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -3808,14 +3809,14 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3859,7 +3860,7 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3869,10 +3870,10 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3904,7 +3905,7 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Session) -> UserSessionUpdateCall<'a, C, A> { self._request = new_value; @@ -3914,7 +3915,7 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserSessionUpdateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3924,7 +3925,7 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *session id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn session_id(mut self, new_value: &str) -> UserSessionUpdateCall<'a, C, A> { self._session_id = new_value.to_string(); @@ -3949,12 +3950,12 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3971,17 +3972,17 @@ impl<'a, C, A> UserSessionUpdateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ActivityWrite`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserSessionUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserSessionUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4053,7 +4054,7 @@ impl<'a, C, A> UserDataSourcePatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.dataSources.patch", + dlg.begin(MethodInfo { id: "fitness.users.dataSources.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -4096,14 +4097,14 @@ impl<'a, C, A> UserDataSourcePatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4147,7 +4148,7 @@ impl<'a, C, A> UserDataSourcePatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4157,10 +4158,10 @@ impl<'a, C, A> UserDataSourcePatchCall<'a, C, A> where C: BorrowMut UserDataSourcePatchCall<'a, C, A> where C: BorrowMut UserDataSourcePatchCall<'a, C, A> { self._request = new_value; @@ -4202,7 +4203,7 @@ impl<'a, C, A> UserDataSourcePatchCall<'a, C, A> where C: BorrowMut UserDataSourcePatchCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4212,7 +4213,7 @@ impl<'a, C, A> UserDataSourcePatchCall<'a, C, A> where C: BorrowMut UserDataSourcePatchCall<'a, C, A> { self._data_source_id = new_value.to_string(); @@ -4230,12 +4231,12 @@ impl<'a, C, A> UserDataSourcePatchCall<'a, C, A> where C: BorrowMut UserDataSourcePatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserDataSourcePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDataSourcePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4326,7 +4327,7 @@ impl<'a, C, A> UserDataSourceListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fitness.users.dataSources.list", + dlg.begin(MethodInfo { id: "fitness.users.dataSources.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -4375,7 +4376,7 @@ impl<'a, C, A> UserDataSourceListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4411,7 +4412,7 @@ impl<'a, C, A> UserDataSourceListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4421,10 +4422,10 @@ impl<'a, C, A> UserDataSourceListCall<'a, C, A> where C: BorrowMut UserDataSourceListCall<'a, C, A> where C: BorrowMut UserDataSourceListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4483,12 +4484,12 @@ impl<'a, C, A> UserDataSourceListCall<'a, C, A> where C: BorrowMut UserDataSourceListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserDataSourceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDataSourceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/freebase1-cli/Cargo.toml b/gen/freebase1-cli/Cargo.toml index 2f3dc737d7..4df3a0cc6b 100644 --- a/gen/freebase1-cli/Cargo.toml +++ b/gen/freebase1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-freebase1-cli" -version = "0.3.2+20150728" +version = "0.3.3+20150728" authors = ["Sebastian Thiel "] description = "A complete library to interact with freebase (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/freebase1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/freebase1-cli/LICENSE.md b/gen/freebase1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/freebase1-cli/LICENSE.md +++ b/gen/freebase1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/freebase1-cli/README.md b/gen/freebase1-cli/README.md index 4bf6278dba..79c3df4a78 100644 --- a/gen/freebase1-cli/README.md +++ b/gen/freebase1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *freebase* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/freebase1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/freebase1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/freebase1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/freebase1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/freebase1-cli). # Usage -This documentation was generated from the *freebase* API at revision *20150728*. The CLI is at version *0.3.2*. +This documentation was generated from the *freebase* API at revision *20150728*. The CLI is at version *0.3.3*. ```bash freebase1 [options] @@ -35,14 +35,14 @@ freebase1 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/freebase1-cli/mkdocs.yml b/gen/freebase1-cli/mkdocs.yml index 5ae85b022e..a834e0a9ec 100644 --- a/gen/freebase1-cli/mkdocs.yml +++ b/gen/freebase1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: freebase v0.3.2+20150728 +site_name: freebase v0.3.3+20150728 site_url: http://byron.github.io/google-apis-rs/google-freebase1-cli site_description: Write integrating applications with bcore @@ -14,5 +14,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/freebase1-cli/src/main.rs b/gen/freebase1-cli/src/main.rs index 39d938dbb6..e12ef11662 100644 --- a/gen/freebase1-cli/src/main.rs +++ b/gen/freebase1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Freebase>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _methods_reconcile(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _methods_reconcile(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.methods().reconcile(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "prop" => { @@ -79,7 +79,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["lang", "kind", "name", "confidence", "prop", "limit"].iter().map(|v|*v)); @@ -113,11 +113,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _methods_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _methods_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.methods().search(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "without" => { @@ -202,7 +202,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["domain", "help", "query", "stemmed", "cursor", "prefixed", "exact", "mid", "encode", "type", "as-of-time", "scoring", "format", "spell", "with", "lang", "indent", "filter", "callback", "without", "limit", "output", "mql-output"].iter().map(|v|*v)); @@ -273,14 +273,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "freebase1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "freebase1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -300,7 +300,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -339,7 +339,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("methods", "methods: 'reconcile' and 'search'", vec![ - ("reconcile", + ("reconcile", Some(r##"Reconcile entities to Freebase open data."##), "Details at http://byron.github.io/google-apis-rs/google_freebase1_cli/methods_reconcile", vec![ @@ -355,7 +355,7 @@ fn main() { Some(false), Some(false)), ]), - ("search", + ("search", Some(r##"Search Freebase open data."##), "Details at http://byron.github.io/google-apis-rs/google_freebase1_cli/methods_search", vec![ @@ -377,7 +377,7 @@ fn main() { let mut app = App::new("freebase1") .author("Sebastian Thiel ") - .version("0.3.2+20150728") + .version("0.3.3+20150728") .about("Find Freebase entities using textual queries and other constraints.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_freebase1_cli") .arg(Arg::with_name("folder") @@ -396,7 +396,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -407,7 +407,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/freebase1/Cargo.toml b/gen/freebase1/Cargo.toml index b5bf0f126e..fc3926c367 100644 --- a/gen/freebase1/Cargo.toml +++ b/gen/freebase1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-freebase1" -version = "0.1.10+20150728" +version = "0.1.11+20150728" authors = ["Sebastian Thiel "] description = "A complete library to interact with freebase (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/freebase1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/freebase1/LICENSE.md b/gen/freebase1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/freebase1/LICENSE.md +++ b/gen/freebase1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/freebase1/README.md b/gen/freebase1/README.md index 71a8a33e44..972f80bd8b 100644 --- a/gen/freebase1/README.md +++ b/gen/freebase1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-freebase1` library allows access to all features of the *Google freebase* service. -This documentation was generated from *freebase* crate version *0.1.10+20150728*, where *20150728* is the exact revision of the *freebase:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *freebase* crate version *0.1.11+20150728*, where *20150728* is the exact revision of the *freebase:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *freebase* *v1* API can be found at the [official documentation site](https://developers.google.com/freebase/). diff --git a/gen/freebase1/src/cmn.rs b/gen/freebase1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/freebase1/src/cmn.rs +++ b/gen/freebase1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/freebase1/src/lib.rs b/gen/freebase1/src/lib.rs index 9b22bebf0a..f5f266e159 100644 --- a/gen/freebase1/src/lib.rs +++ b/gen/freebase1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *freebase* crate version *0.1.10+20150728*, where *20150728* is the exact revision of the *freebase:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *freebase* crate version *0.1.11+20150728*, where *20150728* is the exact revision of the *freebase:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *freebase* *v1* API can be found at the //! [official documentation site](https://developers.google.com/freebase/). diff --git a/gen/freebase1/src/lib.rs.in b/gen/freebase1/src/lib.rs.in index 917ddd18e2..185d53c106 100644 --- a/gen/freebase1/src/lib.rs.in +++ b/gen/freebase1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -110,7 +111,7 @@ impl<'a, C, A> Freebase Freebase { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -119,7 +120,7 @@ impl<'a, C, A> Freebase } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -396,7 +397,7 @@ impl<'a, C, A> MethodReconcileCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "freebase.reconcile", + dlg.begin(MethodInfo { id: "freebase.reconcile", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); if self._prop.len() > 0 { @@ -455,7 +456,7 @@ impl<'a, C, A> MethodReconcileCall<'a, C, A> where C: BorrowMut, } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -476,7 +477,7 @@ impl<'a, C, A> MethodReconcileCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -486,10 +487,10 @@ impl<'a, C, A> MethodReconcileCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -576,12 +577,12 @@ impl<'a, C, A> MethodReconcileCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -701,7 +702,7 @@ impl<'a, C, A> MethodSearchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "freebase.search", + dlg.begin(MethodInfo { id: "freebase.search", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((24 + self._additional_params.len())); if self._without.len() > 0 { @@ -826,7 +827,7 @@ impl<'a, C, A> MethodSearchCall<'a, C, A> where C: BorrowMut, A: } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -847,7 +848,7 @@ impl<'a, C, A> MethodSearchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -857,10 +858,10 @@ impl<'a, C, A> MethodSearchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1059,12 +1060,12 @@ impl<'a, C, A> MethodSearchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/freebase1_sandbox-cli/Cargo.toml b/gen/freebase1_sandbox-cli/Cargo.toml index 67b85afae2..66a7290d9f 100644 --- a/gen/freebase1_sandbox-cli/Cargo.toml +++ b/gen/freebase1_sandbox-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-freebase1_sandbox-cli" -version = "0.3.2+20150715" +version = "0.3.3+20150715" authors = ["Sebastian Thiel "] description = "A complete library to interact with freebase (protocol v1sandbox)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/freebase1_sandbox-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/freebase1_sandbox-cli/LICENSE.md b/gen/freebase1_sandbox-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/freebase1_sandbox-cli/LICENSE.md +++ b/gen/freebase1_sandbox-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/freebase1_sandbox-cli/README.md b/gen/freebase1_sandbox-cli/README.md index ba81c25c27..69646b9216 100644 --- a/gen/freebase1_sandbox-cli/README.md +++ b/gen/freebase1_sandbox-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *freebase* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/freebase1-sandbox.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/freebase1-sandbox.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/freebase1-sandbox.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/freebase1-sandbox.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/freebase1_sandbox-cli). # Usage -This documentation was generated from the *freebase* API at revision *20150715*. The CLI is at version *0.3.2*. +This documentation was generated from the *freebase* API at revision *20150715*. The CLI is at version *0.3.3*. ```bash freebase1-sandbox [options] @@ -35,14 +35,14 @@ freebase1-sandbox [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/freebase1_sandbox-cli/mkdocs.yml b/gen/freebase1_sandbox-cli/mkdocs.yml index b5dd72c756..9adef8be03 100644 --- a/gen/freebase1_sandbox-cli/mkdocs.yml +++ b/gen/freebase1_sandbox-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: freebase v0.3.2+20150715 +site_name: freebase v0.3.3+20150715 site_url: http://byron.github.io/google-apis-rs/google-freebase1_sandbox-cli site_description: Write integrating applications with bcore @@ -14,5 +14,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/freebase1_sandbox-cli/src/main.rs b/gen/freebase1_sandbox-cli/src/main.rs index e1bddde1a3..fc28297949 100644 --- a/gen/freebase1_sandbox-cli/src/main.rs +++ b/gen/freebase1_sandbox-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Freebase>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _methods_reconcile(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _methods_reconcile(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.methods().reconcile(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "prop" => { @@ -79,7 +79,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["lang", "kind", "name", "confidence", "prop", "limit"].iter().map(|v|*v)); @@ -113,11 +113,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _methods_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _methods_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.methods().search(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "without" => { @@ -202,7 +202,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["domain", "help", "query", "stemmed", "cursor", "prefixed", "exact", "mid", "encode", "type", "as-of-time", "scoring", "format", "spell", "with", "lang", "indent", "filter", "callback", "without", "limit", "output", "mql-output"].iter().map(|v|*v)); @@ -273,14 +273,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "freebase1-sandbox-secret.json", + match cmn::application_secret_from_directory(&config_dir, "freebase1-sandbox-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -300,7 +300,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -339,7 +339,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("methods", "methods: 'reconcile' and 'search'", vec![ - ("reconcile", + ("reconcile", Some(r##"Reconcile entities to Freebase open data."##), "Details at http://byron.github.io/google-apis-rs/google_freebase1_sandbox_cli/methods_reconcile", vec![ @@ -355,7 +355,7 @@ fn main() { Some(false), Some(false)), ]), - ("search", + ("search", Some(r##"Search Freebase open data."##), "Details at http://byron.github.io/google-apis-rs/google_freebase1_sandbox_cli/methods_search", vec![ @@ -377,7 +377,7 @@ fn main() { let mut app = App::new("freebase1-sandbox") .author("Sebastian Thiel ") - .version("0.3.2+20150715") + .version("0.3.3+20150715") .about("Find Freebase entities using textual queries and other constraints.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_freebase1_sandbox_cli") .arg(Arg::with_name("folder") @@ -396,7 +396,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -407,7 +407,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/freebase1_sandbox/Cargo.toml b/gen/freebase1_sandbox/Cargo.toml index 950b858ee7..60f6d9131c 100644 --- a/gen/freebase1_sandbox/Cargo.toml +++ b/gen/freebase1_sandbox/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-freebase1_sandbox" -version = "0.1.10+20150715" +version = "0.1.11+20150715" authors = ["Sebastian Thiel "] description = "A complete library to interact with freebase (protocol v1sandbox)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/freebase1_sandbox" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/freebase1_sandbox/LICENSE.md b/gen/freebase1_sandbox/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/freebase1_sandbox/LICENSE.md +++ b/gen/freebase1_sandbox/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/freebase1_sandbox/README.md b/gen/freebase1_sandbox/README.md index fa8302cd5e..31d9d8f0b7 100644 --- a/gen/freebase1_sandbox/README.md +++ b/gen/freebase1_sandbox/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-freebase1_sandbox` library allows access to all features of the *Google freebase* service. -This documentation was generated from *freebase* crate version *0.1.10+20150715*, where *20150715* is the exact revision of the *freebase:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *freebase* crate version *0.1.11+20150715*, where *20150715* is the exact revision of the *freebase:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *freebase* *v1_sandbox* API can be found at the [official documentation site](https://developers.google.com/freebase/). diff --git a/gen/freebase1_sandbox/src/cmn.rs b/gen/freebase1_sandbox/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/freebase1_sandbox/src/cmn.rs +++ b/gen/freebase1_sandbox/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/freebase1_sandbox/src/lib.rs b/gen/freebase1_sandbox/src/lib.rs index 66a658d7c1..6d0e596a72 100644 --- a/gen/freebase1_sandbox/src/lib.rs +++ b/gen/freebase1_sandbox/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *freebase* crate version *0.1.10+20150715*, where *20150715* is the exact revision of the *freebase:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *freebase* crate version *0.1.11+20150715*, where *20150715* is the exact revision of the *freebase:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *freebase* *v1_sandbox* API can be found at the //! [official documentation site](https://developers.google.com/freebase/). diff --git a/gen/freebase1_sandbox/src/lib.rs.in b/gen/freebase1_sandbox/src/lib.rs.in index be5db38589..e7050a24e5 100644 --- a/gen/freebase1_sandbox/src/lib.rs.in +++ b/gen/freebase1_sandbox/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -110,7 +111,7 @@ impl<'a, C, A> Freebase Freebase { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -119,7 +120,7 @@ impl<'a, C, A> Freebase } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -396,7 +397,7 @@ impl<'a, C, A> MethodReconcileCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "freebase.reconcile", + dlg.begin(MethodInfo { id: "freebase.reconcile", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); if self._prop.len() > 0 { @@ -455,7 +456,7 @@ impl<'a, C, A> MethodReconcileCall<'a, C, A> where C: BorrowMut, } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -476,7 +477,7 @@ impl<'a, C, A> MethodReconcileCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -486,10 +487,10 @@ impl<'a, C, A> MethodReconcileCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -576,12 +577,12 @@ impl<'a, C, A> MethodReconcileCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -701,7 +702,7 @@ impl<'a, C, A> MethodSearchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "freebase.search", + dlg.begin(MethodInfo { id: "freebase.search", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((24 + self._additional_params.len())); if self._without.len() > 0 { @@ -826,7 +827,7 @@ impl<'a, C, A> MethodSearchCall<'a, C, A> where C: BorrowMut, A: } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -847,7 +848,7 @@ impl<'a, C, A> MethodSearchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -857,10 +858,10 @@ impl<'a, C, A> MethodSearchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1059,12 +1060,12 @@ impl<'a, C, A> MethodSearchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/fusiontables2-cli/Cargo.toml b/gen/fusiontables2-cli/Cargo.toml index 5a9126eefe..3bffb80fd9 100644 --- a/gen/fusiontables2-cli/Cargo.toml +++ b/gen/fusiontables2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-fusiontables2-cli" -version = "0.3.2+20150618" +version = "0.3.3+20150618" authors = ["Sebastian Thiel "] description = "A complete library to interact with fusiontables (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/fusiontables2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/fusiontables2-cli/LICENSE.md b/gen/fusiontables2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/fusiontables2-cli/LICENSE.md +++ b/gen/fusiontables2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/fusiontables2-cli/README.md b/gen/fusiontables2-cli/README.md index 5c680353af..3338c71269 100644 --- a/gen/fusiontables2-cli/README.md +++ b/gen/fusiontables2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *fusiontables* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/fusiontables2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/fusiontables2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/fusiontables2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/fusiontables2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/fusiontables2-cli). # Usage -This documentation was generated from the *fusiontables* API at revision *20150618*. The CLI is at version *0.3.2*. +This documentation was generated from the *fusiontables* API at revision *20150618*. The CLI is at version *0.3.3*. ```bash fusiontables2 [options] @@ -71,18 +71,18 @@ fusiontables2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/fusiontables2-cli/mkdocs.yml b/gen/fusiontables2-cli/mkdocs.yml index e5c56a7cad..4bb1b485ff 100644 --- a/gen/fusiontables2-cli/mkdocs.yml +++ b/gen/fusiontables2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: fusiontables v0.3.2+20150618 +site_name: fusiontables v0.3.3+20150618 site_url: http://byron.github.io/google-apis-rs/google-fusiontables2-cli site_description: Write integrating applications with bcore @@ -45,5 +45,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/fusiontables2-cli/src/main.rs b/gen/fusiontables2-cli/src/main.rs index d747d3da95..0f61f77ccf 100644 --- a/gen/fusiontables2-cli/src/main.rs +++ b/gen/fusiontables2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Fusiontables>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _column_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _column_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.column().delete(opt.value_of("table-id").unwrap_or(""), opt.value_of("column-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -89,10 +89,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _column_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _column_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.column().get(opt.value_of("table-id").unwrap_or(""), opt.value_of("column-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -105,7 +105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -141,13 +141,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _column_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _column_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -161,8 +161,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "graph-predicate" => Some(("graphPredicate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -189,7 +189,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Column = json::value::from_value(object).unwrap(); let mut call = self.hub.column().insert(request, opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -202,7 +202,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -215,7 +215,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -238,10 +238,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _column_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _column_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.column().list(opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -260,7 +260,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -274,7 +274,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -297,13 +297,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _column_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _column_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -317,8 +317,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "graph-predicate" => Some(("graphPredicate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -345,7 +345,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Column = json::value::from_value(object).unwrap(); let mut call = self.hub.column().patch(request, opt.value_of("table-id").unwrap_or(""), opt.value_of("column-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -358,7 +358,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -371,7 +371,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -394,13 +394,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _column_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _column_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -414,8 +414,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "graph-predicate" => Some(("graphPredicate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -442,7 +442,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Column = json::value::from_value(object).unwrap(); let mut call = self.hub.column().update(request, opt.value_of("table-id").unwrap_or(""), opt.value_of("column-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -455,7 +455,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -468,7 +468,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -491,11 +491,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _query_sql(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _query_sql(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.query().sql(opt.value_of("sql").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "typed" => { @@ -517,7 +517,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["typed", "hdrs"].iter().map(|v|*v)); @@ -531,7 +531,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -559,11 +559,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _query_sql_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _query_sql_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.query().sql_get(opt.value_of("sql").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "typed" => { @@ -585,7 +585,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["typed", "hdrs"].iter().map(|v|*v)); @@ -599,7 +599,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -627,11 +627,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _style_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _style_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let style_id: i32 = arg_from_str(&opt.value_of("style-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.style().delete(opt.value_of("table-id").unwrap_or(""), style_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -644,7 +644,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -657,7 +657,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -672,11 +672,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _style_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _style_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let style_id: i32 = arg_from_str(&opt.value_of("style-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.style().get(opt.value_of("table-id").unwrap_or(""), style_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -689,7 +689,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -702,7 +702,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -725,13 +725,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _style_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _style_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -745,8 +745,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "marker-options.icon-styler.gradient.max" => Some(("markerOptions.iconStyler.gradient.max", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "marker-options.icon-styler.gradient.min" => Some(("markerOptions.iconStyler.gradient.min", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -797,7 +797,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::StyleSetting = json::value::from_value(object).unwrap(); let mut call = self.hub.style().insert(request, opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -810,7 +810,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -823,7 +823,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -846,10 +846,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _style_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _style_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.style().list(opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -868,7 +868,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -882,7 +882,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -905,13 +905,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _style_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _style_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -925,8 +925,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "marker-options.icon-styler.gradient.max" => Some(("markerOptions.iconStyler.gradient.max", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "marker-options.icon-styler.gradient.min" => Some(("markerOptions.iconStyler.gradient.min", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -978,7 +978,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::StyleSetting = json::value::from_value(object).unwrap(); let style_id: i32 = arg_from_str(&opt.value_of("style-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.style().patch(request, opt.value_of("table-id").unwrap_or(""), style_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -991,7 +991,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1004,7 +1004,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1027,13 +1027,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _style_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _style_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1047,8 +1047,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "marker-options.icon-styler.gradient.max" => Some(("markerOptions.iconStyler.gradient.max", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "marker-options.icon-styler.gradient.min" => Some(("markerOptions.iconStyler.gradient.min", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -1100,7 +1100,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::StyleSetting = json::value::from_value(object).unwrap(); let style_id: i32 = arg_from_str(&opt.value_of("style-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.style().update(request, opt.value_of("table-id").unwrap_or(""), style_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1113,7 +1113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1126,7 +1126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1149,10 +1149,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _table_copy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _table_copy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.table().copy(opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "copy-presentation" => { @@ -1168,7 +1168,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["copy-presentation"].iter().map(|v|*v)); @@ -1182,7 +1182,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1205,10 +1205,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _table_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _table_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.table().delete(opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1221,7 +1221,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1234,7 +1234,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1249,10 +1249,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _table_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _table_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.table().get(opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1265,7 +1265,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1278,7 +1278,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1301,10 +1301,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _table_import_rows(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _table_import_rows(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.table().import_rows(opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-line" => { @@ -1332,7 +1332,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["encoding", "end-line", "start-line", "delimiter", "is-strict"].iter().map(|v|*v)); @@ -1341,7 +1341,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1349,7 +1349,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1373,10 +1373,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _table_import_table(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _table_import_table(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.table().import_table(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "encoding" => { @@ -1395,7 +1395,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["delimiter", "encoding"].iter().map(|v|*v)); @@ -1404,7 +1404,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1412,7 +1412,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1436,13 +1436,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _table_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _table_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1456,8 +1456,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "table-properties-json-schema" => Some(("tablePropertiesJsonSchema", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1483,7 +1483,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Table = json::value::from_value(object).unwrap(); let mut call = self.hub.table().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1496,7 +1496,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1509,7 +1509,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1532,10 +1532,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _table_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _table_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.table().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1554,7 +1554,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1568,7 +1568,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1591,13 +1591,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _table_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _table_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1611,8 +1611,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "table-properties-json-schema" => Some(("tablePropertiesJsonSchema", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1638,7 +1638,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Table = json::value::from_value(object).unwrap(); let mut call = self.hub.table().patch(request, opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "replace-view-definition" => { @@ -1654,7 +1654,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["replace-view-definition"].iter().map(|v|*v)); @@ -1668,7 +1668,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1691,10 +1691,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _table_replace_rows(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _table_replace_rows(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.table().replace_rows(opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-line" => { @@ -1722,7 +1722,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["encoding", "end-line", "start-line", "delimiter", "is-strict"].iter().map(|v|*v)); @@ -1731,7 +1731,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1739,7 +1739,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1763,13 +1763,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _table_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _table_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1783,8 +1783,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "table-properties-json-schema" => Some(("tablePropertiesJsonSchema", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1810,7 +1810,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Table = json::value::from_value(object).unwrap(); let mut call = self.hub.table().update(request, opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "replace-view-definition" => { @@ -1826,7 +1826,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["replace-view-definition"].iter().map(|v|*v)); @@ -1840,7 +1840,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1863,10 +1863,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _task_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _task_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.task().delete(opt.value_of("table-id").unwrap_or(""), opt.value_of("task-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1879,7 +1879,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1892,7 +1892,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1907,10 +1907,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _task_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _task_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.task().get(opt.value_of("table-id").unwrap_or(""), opt.value_of("task-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1923,7 +1923,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1936,7 +1936,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1959,10 +1959,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _task_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _task_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.task().list(opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -1984,7 +1984,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "start-index", "max-results"].iter().map(|v|*v)); @@ -1998,7 +1998,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2021,11 +2021,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _template_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _template_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let template_id: i32 = arg_from_str(&opt.value_of("template-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.template().delete(opt.value_of("table-id").unwrap_or(""), template_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2038,7 +2038,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2051,7 +2051,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2066,11 +2066,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _template_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _template_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let template_id: i32 = arg_from_str(&opt.value_of("template-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.template().get(opt.value_of("table-id").unwrap_or(""), template_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2083,7 +2083,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2096,7 +2096,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2119,13 +2119,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _template_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _template_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2139,8 +2139,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "body" => Some(("body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2160,7 +2160,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Template = json::value::from_value(object).unwrap(); let mut call = self.hub.template().insert(request, opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2173,7 +2173,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2186,7 +2186,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2209,10 +2209,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _template_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _template_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.template().list(opt.value_of("table-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2231,7 +2231,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -2245,7 +2245,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2268,13 +2268,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _template_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _template_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2288,8 +2288,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "body" => Some(("body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2310,7 +2310,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Template = json::value::from_value(object).unwrap(); let template_id: i32 = arg_from_str(&opt.value_of("template-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.template().patch(request, opt.value_of("table-id").unwrap_or(""), template_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2323,7 +2323,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2336,7 +2336,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2359,13 +2359,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _template_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _template_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2379,8 +2379,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "body" => Some(("body", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2401,7 +2401,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Template = json::value::from_value(object).unwrap(); let template_id: i32 = arg_from_str(&opt.value_of("template-id").unwrap_or(""), err, "", "integer"); let mut call = self.hub.template().update(request, opt.value_of("table-id").unwrap_or(""), template_id); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2414,7 +2414,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2427,7 +2427,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2619,14 +2619,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "fusiontables2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "fusiontables2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -2646,7 +2646,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -2686,7 +2686,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("column", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes the specified column."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/column_delete", vec![ @@ -2708,7 +2708,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves a specific column by its ID."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/column_get", vec![ @@ -2736,7 +2736,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Adds a new column to the table."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/column_insert", vec![ @@ -2764,7 +2764,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of columns."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/column_list", vec![ @@ -2786,7 +2786,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates the name or type of an existing column. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/column_patch", vec![ @@ -2820,7 +2820,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates the name or type of an existing column."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/column_update", vec![ @@ -2857,7 +2857,7 @@ fn main() { ]), ("query", "methods: 'sql' and 'sql-get'", vec![ - ("sql", + ("sql", Some(r##"Executes a Fusion Tables SQL statement, which can be any of - SELECT - INSERT @@ -2893,7 +2893,7 @@ fn main() { Some(false), Some(false)), ]), - ("sql-get", + ("sql-get", Some(r##"Executes a SQL statement which can be any of - SELECT - SHOW @@ -2924,7 +2924,7 @@ fn main() { ]), ("style", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a style."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/style_delete", vec![ @@ -2946,7 +2946,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a specific style."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/style_get", vec![ @@ -2974,7 +2974,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Adds a new style for the table."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/style_insert", vec![ @@ -3002,7 +3002,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of styles."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/style_list", vec![ @@ -3024,7 +3024,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing style. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/style_patch", vec![ @@ -3058,7 +3058,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing style."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/style_update", vec![ @@ -3095,7 +3095,7 @@ fn main() { ]), ("table", "methods: 'copy', 'delete', 'get', 'import-rows', 'import-table', 'insert', 'list', 'patch', 'replace-rows' and 'update'", vec![ - ("copy", + ("copy", Some(r##"Copies a table."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/table_copy", vec![ @@ -3117,7 +3117,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a table."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/table_delete", vec![ @@ -3133,7 +3133,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves a specific table by its ID."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/table_get", vec![ @@ -3155,7 +3155,7 @@ fn main() { Some(false), Some(false)), ]), - ("import-rows", + ("import-rows", Some(r##"Imports more rows into a table."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/table_import-rows", vec![ @@ -3183,7 +3183,7 @@ fn main() { Some(false), Some(false)), ]), - ("import-table", + ("import-table", Some(r##"Imports a new table."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/table_import-table", vec![ @@ -3211,7 +3211,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new table."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/table_insert", vec![ @@ -3233,7 +3233,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of tables a user owns."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/table_list", vec![ @@ -3249,7 +3249,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing table. Unless explicitly requested, only the name, description, and attribution will be updated. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/table_patch", vec![ @@ -3277,7 +3277,7 @@ fn main() { Some(false), Some(false)), ]), - ("replace-rows", + ("replace-rows", Some(r##"Replaces rows of an existing table. Current rows remain visible until all replacement rows are ready."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/table_replace-rows", vec![ @@ -3305,7 +3305,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing table. Unless explicitly requested, only the name, description, and attribution will be updated."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/table_update", vec![ @@ -3336,7 +3336,7 @@ fn main() { ]), ("task", "methods: 'delete', 'get' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes a specific task by its ID, unless that task has already started running."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/task_delete", vec![ @@ -3358,7 +3358,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves a specific task by its ID."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/task_get", vec![ @@ -3386,7 +3386,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of tasks."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/task_list", vec![ @@ -3411,7 +3411,7 @@ fn main() { ]), ("template", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a template"##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/template_delete", vec![ @@ -3433,7 +3433,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves a specific template by its id"##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/template_get", vec![ @@ -3461,7 +3461,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new template for the table."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/template_insert", vec![ @@ -3489,7 +3489,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of templates."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/template_list", vec![ @@ -3511,7 +3511,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing template. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/template_patch", vec![ @@ -3545,7 +3545,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing template"##), "Details at http://byron.github.io/google-apis-rs/google_fusiontables2_cli/template_update", vec![ @@ -3585,7 +3585,7 @@ fn main() { let mut app = App::new("fusiontables2") .author("Sebastian Thiel ") - .version("0.3.2+20150618") + .version("0.3.3+20150618") .about("API for working with Fusion Tables data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_fusiontables2_cli") .arg(Arg::with_name("url") @@ -3609,7 +3609,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -3620,7 +3620,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/fusiontables2/Cargo.toml b/gen/fusiontables2/Cargo.toml index 19c650353a..87043ab631 100644 --- a/gen/fusiontables2/Cargo.toml +++ b/gen/fusiontables2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-fusiontables2" -version = "0.1.10+20150618" +version = "0.1.11+20150618" authors = ["Sebastian Thiel "] description = "A complete library to interact with fusiontables (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/fusiontables2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/fusiontables2/LICENSE.md b/gen/fusiontables2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/fusiontables2/LICENSE.md +++ b/gen/fusiontables2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/fusiontables2/README.md b/gen/fusiontables2/README.md index 22db41a14c..2601936002 100644 --- a/gen/fusiontables2/README.md +++ b/gen/fusiontables2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-fusiontables2` library allows access to all features of the *Google fusiontables* service. -This documentation was generated from *fusiontables* crate version *0.1.10+20150618*, where *20150618* is the exact revision of the *fusiontables:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *fusiontables* crate version *0.1.11+20150618*, where *20150618* is the exact revision of the *fusiontables:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *fusiontables* *v2* API can be found at the [official documentation site](https://developers.google.com/fusiontables). diff --git a/gen/fusiontables2/src/cmn.rs b/gen/fusiontables2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/fusiontables2/src/cmn.rs +++ b/gen/fusiontables2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/fusiontables2/src/lib.rs b/gen/fusiontables2/src/lib.rs index 1cbce960b3..189e869e19 100644 --- a/gen/fusiontables2/src/lib.rs +++ b/gen/fusiontables2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *fusiontables* crate version *0.1.10+20150618*, where *20150618* is the exact revision of the *fusiontables:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *fusiontables* crate version *0.1.11+20150618*, where *20150618* is the exact revision of the *fusiontables:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *fusiontables* *v2* API can be found at the //! [official documentation site](https://developers.google.com/fusiontables). diff --git a/gen/fusiontables2/src/lib.rs.in b/gen/fusiontables2/src/lib.rs.in index 2c8dcebb71..d316521654 100644 --- a/gen/fusiontables2/src/lib.rs.in +++ b/gen/fusiontables2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -133,7 +134,7 @@ impl<'a, C, A> Fusiontables Fusiontables { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -157,7 +158,7 @@ impl<'a, C, A> Fusiontables } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1700,7 +1701,7 @@ impl<'a, C, A> StyleListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.style.list", + dlg.begin(MethodInfo { id: "fusiontables.style.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -1748,7 +1749,7 @@ impl<'a, C, A> StyleListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1784,7 +1785,7 @@ impl<'a, C, A> StyleListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1794,10 +1795,10 @@ impl<'a, C, A> StyleListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1830,7 +1831,7 @@ impl<'a, C, A> StyleListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> StyleListCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -1862,12 +1863,12 @@ impl<'a, C, A> StyleListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1884,17 +1885,17 @@ impl<'a, C, A> StyleListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StyleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StyleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1964,7 +1965,7 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.style.update", + dlg.begin(MethodInfo { id: "fusiontables.style.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -2007,14 +2008,14 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2058,7 +2059,7 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2068,10 +2069,10 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2103,7 +2104,7 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: StyleSetting) -> StyleUpdateCall<'a, C, A> { self._request = new_value; @@ -2113,7 +2114,7 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> StyleUpdateCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -2123,7 +2124,7 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *style id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn style_id(mut self, new_value: i32) -> StyleUpdateCall<'a, C, A> { self._style_id = new_value; @@ -2141,12 +2142,12 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2163,17 +2164,17 @@ impl<'a, C, A> StyleUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StyleUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StyleUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2242,7 +2243,7 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.style.insert", + dlg.begin(MethodInfo { id: "fusiontables.style.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -2284,14 +2285,14 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2335,7 +2336,7 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2345,10 +2346,10 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2380,7 +2381,7 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: StyleSetting) -> StyleInsertCall<'a, C, A> { self._request = new_value; @@ -2390,7 +2391,7 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> StyleInsertCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -2408,12 +2409,12 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2430,17 +2431,17 @@ impl<'a, C, A> StyleInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StyleInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StyleInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2503,7 +2504,7 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.style.get", + dlg.begin(MethodInfo { id: "fusiontables.style.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -2546,7 +2547,7 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2582,7 +2583,7 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2592,10 +2593,10 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2628,7 +2629,7 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> StyleGetCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -2638,7 +2639,7 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *style id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn style_id(mut self, new_value: i32) -> StyleGetCall<'a, C, A> { self._style_id = new_value; @@ -2656,12 +2657,12 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2678,17 +2679,17 @@ impl<'a, C, A> StyleGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StyleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StyleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2751,7 +2752,7 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.style.delete", + dlg.begin(MethodInfo { id: "fusiontables.style.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -2793,7 +2794,7 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2829,7 +2830,7 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2839,10 +2840,10 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2865,7 +2866,7 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> StyleDeleteCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -2875,7 +2876,7 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *style id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn style_id(mut self, new_value: i32) -> StyleDeleteCall<'a, C, A> { self._style_id = new_value; @@ -2893,12 +2894,12 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2915,17 +2916,17 @@ impl<'a, C, A> StyleDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StyleDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StyleDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2995,7 +2996,7 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.style.patch", + dlg.begin(MethodInfo { id: "fusiontables.style.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -3038,14 +3039,14 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3089,7 +3090,7 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3099,10 +3100,10 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3134,7 +3135,7 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: StyleSetting) -> StylePatchCall<'a, C, A> { self._request = new_value; @@ -3144,7 +3145,7 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> StylePatchCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -3154,7 +3155,7 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *style id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn style_id(mut self, new_value: i32) -> StylePatchCall<'a, C, A> { self._style_id = new_value; @@ -3172,12 +3173,12 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3194,17 +3195,17 @@ impl<'a, C, A> StylePatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> StylePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> StylePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3272,7 +3273,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.task.list", + dlg.begin(MethodInfo { id: "fusiontables.task.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -3323,7 +3324,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3359,7 +3360,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3369,10 +3370,10 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3405,7 +3406,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TaskListCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -3444,12 +3445,12 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3466,17 +3467,17 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3539,7 +3540,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.task.delete", + dlg.begin(MethodInfo { id: "fusiontables.task.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -3581,7 +3582,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3617,7 +3618,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3627,10 +3628,10 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3653,7 +3654,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TaskDeleteCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -3663,7 +3664,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *task id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task_id(mut self, new_value: &str) -> TaskDeleteCall<'a, C, A> { self._task_id = new_value.to_string(); @@ -3681,12 +3682,12 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3703,17 +3704,17 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3776,7 +3777,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.task.get", + dlg.begin(MethodInfo { id: "fusiontables.task.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -3819,7 +3820,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3855,7 +3856,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3865,10 +3866,10 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3901,7 +3902,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TaskGetCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -3911,7 +3912,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *task id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task_id(mut self, new_value: &str) -> TaskGetCall<'a, C, A> { self._task_id = new_value.to_string(); @@ -3929,12 +3930,12 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3951,17 +3952,17 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4030,7 +4031,7 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.column.insert", + dlg.begin(MethodInfo { id: "fusiontables.column.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -4072,14 +4073,14 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4123,7 +4124,7 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4133,10 +4134,10 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4168,7 +4169,7 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Column) -> ColumnInsertCall<'a, C, A> { self._request = new_value; @@ -4178,7 +4179,7 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> ColumnInsertCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -4196,12 +4197,12 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4218,17 +4219,17 @@ impl<'a, C, A> ColumnInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ColumnInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ColumnInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4298,7 +4299,7 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.column.update", + dlg.begin(MethodInfo { id: "fusiontables.column.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -4341,14 +4342,14 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4392,7 +4393,7 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4402,10 +4403,10 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4437,7 +4438,7 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Column) -> ColumnUpdateCall<'a, C, A> { self._request = new_value; @@ -4447,7 +4448,7 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> ColumnUpdateCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -4457,7 +4458,7 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *column id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn column_id(mut self, new_value: &str) -> ColumnUpdateCall<'a, C, A> { self._column_id = new_value.to_string(); @@ -4475,12 +4476,12 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4497,17 +4498,17 @@ impl<'a, C, A> ColumnUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ColumnUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ColumnUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4573,7 +4574,7 @@ impl<'a, C, A> ColumnListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.column.list", + dlg.begin(MethodInfo { id: "fusiontables.column.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -4621,7 +4622,7 @@ impl<'a, C, A> ColumnListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4657,7 +4658,7 @@ impl<'a, C, A> ColumnListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4667,10 +4668,10 @@ impl<'a, C, A> ColumnListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4703,7 +4704,7 @@ impl<'a, C, A> ColumnListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> ColumnListCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -4735,12 +4736,12 @@ impl<'a, C, A> ColumnListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4757,17 +4758,17 @@ impl<'a, C, A> ColumnListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ColumnListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ColumnListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4837,7 +4838,7 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.column.patch", + dlg.begin(MethodInfo { id: "fusiontables.column.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -4880,14 +4881,14 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4931,7 +4932,7 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4941,10 +4942,10 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4976,7 +4977,7 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Column) -> ColumnPatchCall<'a, C, A> { self._request = new_value; @@ -4986,7 +4987,7 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> ColumnPatchCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -4996,7 +4997,7 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *column id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn column_id(mut self, new_value: &str) -> ColumnPatchCall<'a, C, A> { self._column_id = new_value.to_string(); @@ -5014,12 +5015,12 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5036,17 +5037,17 @@ impl<'a, C, A> ColumnPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ColumnPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ColumnPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5109,7 +5110,7 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.column.delete", + dlg.begin(MethodInfo { id: "fusiontables.column.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -5151,7 +5152,7 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5187,7 +5188,7 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5197,10 +5198,10 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5223,7 +5224,7 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> ColumnDeleteCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -5233,7 +5234,7 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *column id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn column_id(mut self, new_value: &str) -> ColumnDeleteCall<'a, C, A> { self._column_id = new_value.to_string(); @@ -5251,12 +5252,12 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5273,17 +5274,17 @@ impl<'a, C, A> ColumnDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ColumnDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ColumnDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5346,7 +5347,7 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.column.get", + dlg.begin(MethodInfo { id: "fusiontables.column.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -5389,7 +5390,7 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5425,7 +5426,7 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5435,10 +5436,10 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5471,7 +5472,7 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> ColumnGetCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -5481,7 +5482,7 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *column id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn column_id(mut self, new_value: &str) -> ColumnGetCall<'a, C, A> { self._column_id = new_value.to_string(); @@ -5499,12 +5500,12 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5521,17 +5522,17 @@ impl<'a, C, A> ColumnGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ColumnGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ColumnGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5601,7 +5602,7 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.template.update", + dlg.begin(MethodInfo { id: "fusiontables.template.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -5644,14 +5645,14 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5695,7 +5696,7 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5705,10 +5706,10 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5740,7 +5741,7 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Template) -> TemplateUpdateCall<'a, C, A> { self._request = new_value; @@ -5750,7 +5751,7 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TemplateUpdateCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -5760,7 +5761,7 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *template id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn template_id(mut self, new_value: i32) -> TemplateUpdateCall<'a, C, A> { self._template_id = new_value; @@ -5778,12 +5779,12 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5800,17 +5801,17 @@ impl<'a, C, A> TemplateUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TemplateUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TemplateUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5876,7 +5877,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.template.list", + dlg.begin(MethodInfo { id: "fusiontables.template.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -5924,7 +5925,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5960,7 +5961,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5970,10 +5971,10 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6006,7 +6007,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TemplateListCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -6038,12 +6039,12 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6060,17 +6061,17 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TemplateListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TemplateListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6133,7 +6134,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.template.delete", + dlg.begin(MethodInfo { id: "fusiontables.template.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -6175,7 +6176,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6211,7 +6212,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6221,10 +6222,10 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6247,7 +6248,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TemplateDeleteCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -6257,7 +6258,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *template id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn template_id(mut self, new_value: i32) -> TemplateDeleteCall<'a, C, A> { self._template_id = new_value; @@ -6275,12 +6276,12 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6297,17 +6298,17 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TemplateDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TemplateDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6376,7 +6377,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.template.insert", + dlg.begin(MethodInfo { id: "fusiontables.template.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -6418,14 +6419,14 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6469,7 +6470,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6479,10 +6480,10 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6514,7 +6515,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Template) -> TemplateInsertCall<'a, C, A> { self._request = new_value; @@ -6524,7 +6525,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TemplateInsertCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -6542,12 +6543,12 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6564,17 +6565,17 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TemplateInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TemplateInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6644,7 +6645,7 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.template.patch", + dlg.begin(MethodInfo { id: "fusiontables.template.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -6687,14 +6688,14 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6738,7 +6739,7 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6748,10 +6749,10 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6783,7 +6784,7 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Template) -> TemplatePatchCall<'a, C, A> { self._request = new_value; @@ -6793,7 +6794,7 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TemplatePatchCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -6803,7 +6804,7 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *template id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn template_id(mut self, new_value: i32) -> TemplatePatchCall<'a, C, A> { self._template_id = new_value; @@ -6821,12 +6822,12 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6843,17 +6844,17 @@ impl<'a, C, A> TemplatePatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TemplatePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TemplatePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6916,7 +6917,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.template.get", + dlg.begin(MethodInfo { id: "fusiontables.template.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -6959,7 +6960,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6995,7 +6996,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7005,10 +7006,10 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7041,7 +7042,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TemplateGetCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -7051,7 +7052,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *template id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn template_id(mut self, new_value: i32) -> TemplateGetCall<'a, C, A> { self._template_id = new_value; @@ -7069,12 +7070,12 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7091,17 +7092,17 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TemplateGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TemplateGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7175,7 +7176,7 @@ impl<'a, C, A> QuerySqlGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.query.sqlGet", + dlg.begin(MethodInfo { id: "fusiontables.query.sqlGet", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("sql", self._sql.to_string())); @@ -7218,7 +7219,7 @@ impl<'a, C, A> QuerySqlGetCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7254,7 +7255,7 @@ impl<'a, C, A> QuerySqlGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7264,10 +7265,10 @@ impl<'a, C, A> QuerySqlGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7303,7 +7304,7 @@ impl<'a, C, A> QuerySqlGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *sql* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sql(mut self, new_value: &str) -> QuerySqlGetCall<'a, C, A> { self._sql = new_value.to_string(); @@ -7335,12 +7336,12 @@ impl<'a, C, A> QuerySqlGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7357,17 +7358,17 @@ impl<'a, C, A> QuerySqlGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> QuerySqlGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> QuerySqlGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7445,7 +7446,7 @@ impl<'a, C, A> QuerySqlCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.query.sql", + dlg.begin(MethodInfo { id: "fusiontables.query.sql", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("sql", self._sql.to_string())); @@ -7488,7 +7489,7 @@ impl<'a, C, A> QuerySqlCall<'a, C, A> where C: BorrowMut, A: oaut self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7524,7 +7525,7 @@ impl<'a, C, A> QuerySqlCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7534,10 +7535,10 @@ impl<'a, C, A> QuerySqlCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7577,7 +7578,7 @@ impl<'a, C, A> QuerySqlCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *sql* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sql(mut self, new_value: &str) -> QuerySqlCall<'a, C, A> { self._sql = new_value.to_string(); @@ -7609,12 +7610,12 @@ impl<'a, C, A> QuerySqlCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7631,17 +7632,17 @@ impl<'a, C, A> QuerySqlCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> QuerySqlCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> QuerySqlCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7712,7 +7713,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.table.patch", + dlg.begin(MethodInfo { id: "fusiontables.table.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -7757,14 +7758,14 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7808,7 +7809,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7818,10 +7819,10 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7853,7 +7854,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Table) -> TablePatchCall<'a, C, A> { self._request = new_value; @@ -7863,7 +7864,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TablePatchCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -7888,12 +7889,12 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7910,17 +7911,17 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TablePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TablePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7994,7 +7995,7 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.table.replaceRows", + dlg.begin(MethodInfo { id: "fusiontables.table.replaceRows", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -8025,13 +8026,13 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/fusiontables/v2/tables/{tableId}/replace".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/fusiontables/v2/tables/{tableId}/replace".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -8059,7 +8060,7 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8123,7 +8124,7 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8133,10 +8134,10 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8240,7 +8241,7 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TableReplaceRowCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -8293,12 +8294,12 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8315,17 +8316,17 @@ impl<'a, C, A> TableReplaceRowCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableReplaceRowCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableReplaceRowCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8396,7 +8397,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.table.update", + dlg.begin(MethodInfo { id: "fusiontables.table.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -8441,14 +8442,14 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8492,7 +8493,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8502,10 +8503,10 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8537,7 +8538,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Table) -> TableUpdateCall<'a, C, A> { self._request = new_value; @@ -8547,7 +8548,7 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TableUpdateCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -8572,12 +8573,12 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8594,17 +8595,17 @@ impl<'a, C, A> TableUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8666,7 +8667,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.table.delete", + dlg.begin(MethodInfo { id: "fusiontables.table.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -8707,7 +8708,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8743,7 +8744,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8753,10 +8754,10 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8779,7 +8780,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TableDeleteCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -8797,12 +8798,12 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8819,17 +8820,17 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8897,7 +8898,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.table.insert", + dlg.begin(MethodInfo { id: "fusiontables.table.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -8917,14 +8918,14 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8968,7 +8969,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8978,10 +8979,10 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9013,7 +9014,7 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Table) -> TableInsertCall<'a, C, A> { self._request = new_value; @@ -9031,12 +9032,12 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9053,17 +9054,17 @@ impl<'a, C, A> TableInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9125,7 +9126,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.table.get", + dlg.begin(MethodInfo { id: "fusiontables.table.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -9167,7 +9168,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9203,7 +9204,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9213,10 +9214,10 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9249,7 +9250,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TableGetCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -9267,12 +9268,12 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9289,17 +9290,17 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9364,7 +9365,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.table.list", + dlg.begin(MethodInfo { id: "fusiontables.table.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -9390,7 +9391,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9426,7 +9427,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9436,10 +9437,10 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9494,12 +9495,12 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9516,17 +9517,17 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9600,7 +9601,7 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.table.importRows", + dlg.begin(MethodInfo { id: "fusiontables.table.importRows", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -9631,13 +9632,13 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/fusiontables/v2/tables/{tableId}/import".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/fusiontables/v2/tables/{tableId}/import".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -9665,7 +9666,7 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9729,7 +9730,7 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9739,10 +9740,10 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9846,7 +9847,7 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TableImportRowCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -9899,12 +9900,12 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9921,17 +9922,17 @@ impl<'a, C, A> TableImportRowCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableImportRowCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableImportRowCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9999,7 +10000,7 @@ impl<'a, C, A> TableImportTableCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.table.importTable", + dlg.begin(MethodInfo { id: "fusiontables.table.importTable", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -10021,20 +10022,20 @@ impl<'a, C, A> TableImportTableCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/fusiontables/v2/tables/import".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/fusiontables/v2/tables/import".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10098,7 +10099,7 @@ impl<'a, C, A> TableImportTableCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10108,10 +10109,10 @@ impl<'a, C, A> TableImportTableCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10215,7 +10216,7 @@ impl<'a, C, A> TableImportTableCall<'a, C, A> where C: BorrowMut, /// /// Sets the *name* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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) -> TableImportTableCall<'a, C, A> { self._name = new_value.to_string(); @@ -10247,12 +10248,12 @@ impl<'a, C, A> TableImportTableCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10269,17 +10270,17 @@ impl<'a, C, A> TableImportTableCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableImportTableCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableImportTableCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10343,7 +10344,7 @@ impl<'a, C, A> TableCopyCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "fusiontables.table.copy", + dlg.begin(MethodInfo { id: "fusiontables.table.copy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -10388,7 +10389,7 @@ impl<'a, C, A> TableCopyCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10424,7 +10425,7 @@ impl<'a, C, A> TableCopyCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10434,10 +10435,10 @@ impl<'a, C, A> TableCopyCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10470,7 +10471,7 @@ impl<'a, C, A> TableCopyCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TableCopyCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -10495,12 +10496,12 @@ impl<'a, C, A> TableCopyCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10517,17 +10518,17 @@ impl<'a, C, A> TableCopyCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableCopyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableCopyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/games1-cli/Cargo.toml b/gen/games1-cli/Cargo.toml index eea9d2ff3e..0e0d4d9a79 100644 --- a/gen/games1-cli/Cargo.toml +++ b/gen/games1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-games1-cli" -version = "0.3.2+20151012" +version = "0.3.3+20160126" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/games1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/games1-cli/LICENSE.md b/gen/games1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/games1-cli/LICENSE.md +++ b/gen/games1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/games1-cli/README.md b/gen/games1-cli/README.md index d777401b75..9674bf0521 100644 --- a/gen/games1-cli/README.md +++ b/gen/games1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Games* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/games1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/games1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/games1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/games1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/games1-cli). # Usage -This documentation was generated from the *Games* API at revision *20151012*. The CLI is at version *0.3.2*. +This documentation was generated from the *Games* API at revision *20160126*. The CLI is at version *0.3.3*. ```bash games1 [options] @@ -40,6 +40,7 @@ games1 [options] applications get [-p ]... [-o ] played [-p ]... + verify [-p ]... [-o ] events list-by-player [-p ]... [-o ] list-definitions [-p ]... [-o ] @@ -99,18 +100,18 @@ games1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/games1-cli/mkdocs.yml b/gen/games1-cli/mkdocs.yml index d6f2d1e138..b9de62f418 100644 --- a/gen/games1-cli/mkdocs.yml +++ b/gen/games1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games v0.3.2+20151012 +site_name: Games v0.3.3+20160126 site_url: http://byron.github.io/google-apis-rs/google-games1-cli site_description: Write integrating applications with bcore @@ -18,6 +18,7 @@ pages: - ['achievements_update-multiple.md', 'Achievements', 'Update Multiple'] - ['applications_get.md', 'Applications', 'Get'] - ['applications_played.md', 'Applications', 'Played'] +- ['applications_verify.md', 'Applications', 'Verify'] - ['events_list-by-player.md', 'Events', 'List By Player'] - ['events_list-definitions.md', 'Events', 'List Definitions'] - ['events_record.md', 'Events', 'Record'] @@ -64,5 +65,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/games1-cli/src/main.rs b/gen/games1-cli/src/main.rs index dff3e718ec..396a7e460f 100644 --- a/gen/games1-cli/src/main.rs +++ b/gen/games1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Games>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _achievement_definitions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _achievement_definitions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievement_definitions().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -70,7 +70,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -84,7 +84,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -107,11 +107,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievements_increment(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievements_increment(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let steps_to_increment: i32 = arg_from_str(&opt.value_of("steps-to-increment").unwrap_or(""), err, "", "integer"); let mut call = self.hub.achievements().increment(opt.value_of("achievement-id").unwrap_or(""), steps_to_increment); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "request-id" => { @@ -127,7 +127,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["request-id"].iter().map(|v|*v)); @@ -141,7 +141,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -164,10 +164,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievements_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievements_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievements().list(opt.value_of("player-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "state" => { @@ -192,7 +192,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "state", "language", "max-results"].iter().map(|v|*v)); @@ -206,7 +206,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -229,10 +229,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievements_reveal(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievements_reveal(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievements().reveal(opt.value_of("achievement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -245,7 +245,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -258,7 +258,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -281,11 +281,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievements_set_steps_at_least(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievements_set_steps_at_least(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let steps: i32 = arg_from_str(&opt.value_of("steps").unwrap_or(""), err, "", "integer"); let mut call = self.hub.achievements().set_steps_at_least(opt.value_of("achievement-id").unwrap_or(""), steps); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -298,7 +298,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -311,7 +311,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -334,10 +334,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievements_unlock(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievements_unlock(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievements().unlock(opt.value_of("achievement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -350,7 +350,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -363,7 +363,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -386,13 +386,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievements_update_multiple(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievements_update_multiple(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -406,8 +406,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -422,7 +422,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AchievementUpdateMultipleRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.achievements().update_multiple(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -435,7 +435,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -448,7 +448,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -471,10 +471,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _applications_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _applications_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.applications().get(opt.value_of("application-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "platform-type" => { @@ -493,7 +493,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["platform-type", "language"].iter().map(|v|*v)); @@ -507,7 +507,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -530,10 +530,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _applications_played(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _applications_played(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.applications().played(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -546,7 +546,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -559,7 +559,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -574,10 +574,62 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_list_by_player(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _applications_verify(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.applications().verify(opt.value_of("application-id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _events_list_by_player(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().list_by_player(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -599,7 +651,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -613,7 +665,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -636,10 +688,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_list_definitions(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_list_definitions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().list_definitions(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -661,7 +713,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -675,7 +727,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -698,13 +750,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_record(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_record(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -718,8 +770,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "request-id" => Some(("requestId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -736,7 +788,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EventRecordRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.events().record(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -752,7 +804,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -766,7 +818,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -789,10 +841,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _leaderboards_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _leaderboards_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.leaderboards().get(opt.value_of("leaderboard-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -808,7 +860,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -822,7 +874,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -845,10 +897,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _leaderboards_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _leaderboards_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.leaderboards().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -870,7 +922,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -884,7 +936,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -907,10 +959,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _metagame_get_metagame_config(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _metagame_get_metagame_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.metagame().get_metagame_config(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -923,7 +975,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -936,7 +988,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -959,10 +1011,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _metagame_list_categories_by_player(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _metagame_list_categories_by_player(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.metagame().list_categories_by_player(opt.value_of("player-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -984,7 +1036,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -998,7 +1050,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1021,10 +1073,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _players_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _players_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.players().get(opt.value_of("player-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -1040,7 +1092,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -1054,7 +1106,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1077,10 +1129,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _players_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _players_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.players().list(opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1102,7 +1154,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -1116,7 +1168,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1139,13 +1191,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pushtokens_remove(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pushtokens_remove(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1159,8 +1211,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ios.apns-device-token" => Some(("ios.apns_device_token", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1177,7 +1229,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PushTokenId = json::value::from_value(object).unwrap(); let mut call = self.hub.pushtokens().remove(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1190,7 +1242,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1203,7 +1255,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1218,13 +1270,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _pushtokens_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _pushtokens_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1238,8 +1290,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "client-revision" => Some(("clientRevision", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1259,7 +1311,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PushToken = json::value::from_value(object).unwrap(); let mut call = self.hub.pushtokens().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1272,7 +1324,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1285,7 +1337,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1300,10 +1352,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _quest_milestones_claim(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _quest_milestones_claim(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.quest_milestones().claim(opt.value_of("quest-id").unwrap_or(""), opt.value_of("milestone-id").unwrap_or(""), opt.value_of("request-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1316,7 +1368,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1329,7 +1381,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1344,10 +1396,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _quests_accept(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _quests_accept(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.quests().accept(opt.value_of("quest-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -1363,7 +1415,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -1377,7 +1429,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1400,10 +1452,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _quests_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _quests_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.quests().list(opt.value_of("player-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1425,7 +1477,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -1439,7 +1491,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1462,10 +1514,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _revisions_check(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _revisions_check(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.revisions().check(opt.value_of("client-revision").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1478,7 +1530,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1491,7 +1543,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1514,13 +1566,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rooms_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rooms_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1534,8 +1586,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "auto-matching-criteria.kind" => Some(("autoMatchingCriteria.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1567,7 +1619,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RoomCreateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.rooms().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -1583,7 +1635,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -1597,7 +1649,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1620,10 +1672,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rooms_decline(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rooms_decline(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rooms().decline(opt.value_of("room-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -1639,7 +1691,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -1653,7 +1705,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1676,10 +1728,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rooms_dismiss(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rooms_dismiss(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rooms().dismiss(opt.value_of("room-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1692,7 +1744,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1705,7 +1757,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1720,10 +1772,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rooms_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rooms_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rooms().get(opt.value_of("room-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -1739,7 +1791,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -1753,7 +1805,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1776,13 +1828,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rooms_join(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rooms_join(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1796,8 +1848,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "network-diagnostics.kind" => Some(("networkDiagnostics.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network-diagnostics.ios-network-type" => Some(("networkDiagnostics.iosNetworkType", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -1822,7 +1874,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RoomJoinRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.rooms().join(request, opt.value_of("room-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -1838,7 +1890,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -1852,7 +1904,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1875,13 +1927,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rooms_leave(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rooms_leave(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1895,8 +1947,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reason" => Some(("reason", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1919,7 +1971,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RoomLeaveRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.rooms().leave(request, opt.value_of("room-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -1935,7 +1987,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -1949,7 +2001,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1972,10 +2024,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rooms_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rooms_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rooms().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1997,7 +2049,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -2011,7 +2063,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2034,13 +2086,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rooms_report_status(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rooms_report_status(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2054,8 +2106,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -2070,7 +2122,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RoomP2PStatuses = json::value::from_value(object).unwrap(); let mut call = self.hub.rooms().report_status(request, opt.value_of("room-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2086,7 +2138,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -2100,7 +2152,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2123,10 +2175,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _scores_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _scores_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.scores().get(opt.value_of("player-id").unwrap_or(""), opt.value_of("leaderboard-id").unwrap_or(""), opt.value_of("time-span").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2151,7 +2203,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results", "include-rank-type"].iter().map(|v|*v)); @@ -2165,7 +2217,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2188,10 +2240,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _scores_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _scores_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.scores().list(opt.value_of("leaderboard-id").unwrap_or(""), opt.value_of("collection").unwrap_or(""), opt.value_of("time-span").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2213,7 +2265,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -2227,7 +2279,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2250,10 +2302,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _scores_list_window(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _scores_list_window(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.scores().list_window(opt.value_of("leaderboard-id").unwrap_or(""), opt.value_of("collection").unwrap_or(""), opt.value_of("time-span").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "return-top-if-absent" => { @@ -2281,7 +2333,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["return-top-if-absent", "results-above", "language", "max-results", "page-token"].iter().map(|v|*v)); @@ -2295,7 +2347,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2318,10 +2370,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _scores_submit(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _scores_submit(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.scores().submit(opt.value_of("leaderboard-id").unwrap_or(""), opt.value_of("score").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "score-tag" => { @@ -2340,7 +2392,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language", "score-tag"].iter().map(|v|*v)); @@ -2354,7 +2406,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2377,13 +2429,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _scores_submit_multiple(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _scores_submit_multiple(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2397,8 +2449,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -2413,7 +2465,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlayerScoreSubmissionList = json::value::from_value(object).unwrap(); let mut call = self.hub.scores().submit_multiple(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2429,7 +2481,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -2443,7 +2495,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2466,10 +2518,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _snapshots_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _snapshots_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.snapshots().get(opt.value_of("snapshot-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2485,7 +2537,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -2499,7 +2551,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2522,10 +2574,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _snapshots_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _snapshots_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.snapshots().list(opt.value_of("player-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2547,7 +2599,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -2561,7 +2613,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2584,10 +2636,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_cancel(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().cancel(opt.value_of("match-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2600,7 +2652,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2613,7 +2665,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2628,13 +2680,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2648,8 +2700,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "invited-player-ids" => Some(("invitedPlayerIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2671,7 +2723,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TurnBasedMatchCreateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.turn_based_matches().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2687,7 +2739,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -2701,7 +2753,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2724,10 +2776,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_decline(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_decline(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().decline(opt.value_of("match-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2743,7 +2795,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -2757,7 +2809,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2780,10 +2832,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_dismiss(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_dismiss(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().dismiss(opt.value_of("match-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2796,7 +2848,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2809,7 +2861,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2824,13 +2876,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_finish(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_finish(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2844,8 +2896,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data.kind" => Some(("data.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2863,7 +2915,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TurnBasedMatchResults = json::value::from_value(object).unwrap(); let mut call = self.hub.turn_based_matches().finish(request, opt.value_of("match-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2879,7 +2931,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -2893,7 +2945,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2916,10 +2968,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().get(opt.value_of("match-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2938,7 +2990,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language", "include-match-data"].iter().map(|v|*v)); @@ -2952,7 +3004,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2975,10 +3027,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_join(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_join(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().join(opt.value_of("match-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -2994,7 +3046,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -3008,7 +3060,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3031,10 +3083,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_leave(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_leave(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().leave(opt.value_of("match-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -3050,7 +3102,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -3064,7 +3116,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3087,11 +3139,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_leave_turn(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_leave_turn(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let match_version: i32 = arg_from_str(&opt.value_of("match-version").unwrap_or(""), err, "", "integer"); let mut call = self.hub.turn_based_matches().leave_turn(opt.value_of("match-id").unwrap_or(""), match_version); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "pending-participant-id" => { @@ -3110,7 +3162,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language", "pending-participant-id"].iter().map(|v|*v)); @@ -3124,7 +3176,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3147,10 +3199,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3178,7 +3230,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-completed-matches", "language", "max-results", "include-match-data"].iter().map(|v|*v)); @@ -3192,7 +3244,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3215,10 +3267,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_rematch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_rematch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().rematch(opt.value_of("match-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "request-id" => { @@ -3237,7 +3289,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["request-id", "language"].iter().map(|v|*v)); @@ -3251,7 +3303,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3274,10 +3326,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_sync(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_sync(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().sync(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3305,7 +3357,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-completed-matches", "language", "max-results", "include-match-data"].iter().map(|v|*v)); @@ -3319,7 +3371,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3342,13 +3394,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_take_turn(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_take_turn(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3362,8 +3414,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "data.kind" => Some(("data.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3382,7 +3434,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TurnBasedMatchTurn = json::value::from_value(object).unwrap(); let mut call = self.hub.turn_based_matches().take_turn(request, opt.value_of("match-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "language" => { @@ -3398,7 +3450,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["language"].iter().map(|v|*v)); @@ -3412,7 +3464,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3485,6 +3537,9 @@ impl<'n, 'a> Engine<'n, 'a> { ("played", Some(opt)) => { call_result = self._applications_played(opt, dry_run, &mut err); }, + ("verify", Some(opt)) => { + call_result = self._applications_verify(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("applications".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -3733,14 +3788,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "games1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "games1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -3760,7 +3815,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -3799,7 +3854,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("achievement-definitions", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Lists all the achievement definitions for your application."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/achievement-definitions_list", vec![ @@ -3818,7 +3873,7 @@ fn main() { ]), ("achievements", "methods: 'increment', 'list', 'reveal', 'set-steps-at-least', 'unlock' and 'update-multiple'", vec![ - ("increment", + ("increment", Some(r##"Increments the steps of the achievement with the given ID for the currently authenticated player."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/achievements_increment", vec![ @@ -3846,7 +3901,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the progress for all your application's achievements for the currently authenticated player."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/achievements_list", vec![ @@ -3868,7 +3923,7 @@ fn main() { Some(false), Some(false)), ]), - ("reveal", + ("reveal", Some(r##"Sets the state of the achievement with the given ID to REVEALED for the currently authenticated player."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/achievements_reveal", vec![ @@ -3890,7 +3945,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-steps-at-least", + ("set-steps-at-least", Some(r##"Sets the steps for the currently authenticated player towards unlocking an achievement. If the steps parameter is less than the current number of steps that the player already gained for the achievement, the achievement is not modified."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/achievements_set-steps-at-least", vec![ @@ -3918,7 +3973,7 @@ fn main() { Some(false), Some(false)), ]), - ("unlock", + ("unlock", Some(r##"Unlocks this achievement for the currently authenticated player."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/achievements_unlock", vec![ @@ -3940,7 +3995,7 @@ fn main() { Some(false), Some(false)), ]), - ("update-multiple", + ("update-multiple", Some(r##"Updates multiple achievements for the currently authenticated player."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/achievements_update-multiple", vec![ @@ -3964,8 +4019,8 @@ fn main() { ]), ]), - ("applications", "methods: 'get' and 'played'", vec![ - ("get", + ("applications", "methods: 'get', 'played' and 'verify'", vec![ + ("get", Some(r##"Retrieves the metadata of the application with the given ID. If the requested application is not available for the specified platformType, the returned response will not include any instance data."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/applications_get", vec![ @@ -3987,7 +4042,7 @@ fn main() { Some(false), Some(false)), ]), - ("played", + ("played", Some(r##"Indicate that the the currently authenticated user is playing your application."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/applications_played", vec![ @@ -3997,10 +4052,32 @@ fn main() { Some(false), Some(true)), ]), + ("verify", + Some(r##"Verifies the auth token provided with this request is for the application with the specified ID, and returns the ID of the player it was granted for."##), + "Details at http://byron.github.io/google-apis-rs/google_games1_cli/applications_verify", + vec![ + (Some(r##"application-id"##), + None, + Some(r##"The application ID from the Google Play developer console."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), ]), ("events", "methods: 'list-by-player', 'list-definitions' and 'record'", vec![ - ("list-by-player", + ("list-by-player", Some(r##"Returns a list showing the current progress on events in this application for the currently authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/events_list-by-player", vec![ @@ -4016,7 +4093,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-definitions", + ("list-definitions", Some(r##"Returns a list of the event definitions in this application."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/events_list-definitions", vec![ @@ -4032,7 +4109,7 @@ fn main() { Some(false), Some(false)), ]), - ("record", + ("record", Some(r##"Records a batch of changes to the number of times events have occurred for the currently authenticated user of this application."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/events_record", vec![ @@ -4057,7 +4134,7 @@ fn main() { ]), ("leaderboards", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves the metadata of the leaderboard with the given ID."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/leaderboards_get", vec![ @@ -4079,7 +4156,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all the leaderboard metadata for your application."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/leaderboards_list", vec![ @@ -4098,7 +4175,7 @@ fn main() { ]), ("metagame", "methods: 'get-metagame-config' and 'list-categories-by-player'", vec![ - ("get-metagame-config", + ("get-metagame-config", Some(r##"Return the metagame configuration data for the calling application."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/metagame_get-metagame-config", vec![ @@ -4114,7 +4191,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-categories-by-player", + ("list-categories-by-player", Some(r##"List play data aggregated per category for the player corresponding to playerId."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/metagame_list-categories-by-player", vec![ @@ -4145,7 +4222,7 @@ fn main() { ]), ("players", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves the Player resource with the given ID. To retrieve the player for the currently authenticated user, set playerId to me."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/players_get", vec![ @@ -4167,7 +4244,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Get the collection of players for the currently authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/players_list", vec![ @@ -4192,7 +4269,7 @@ fn main() { ]), ("pushtokens", "methods: 'remove' and 'update'", vec![ - ("remove", + ("remove", Some(r##"Removes a push token for the current user and application. Removing a non-existent push token will report success."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/pushtokens_remove", vec![ @@ -4208,7 +4285,7 @@ fn main() { Some(false), Some(true)), ]), - ("update", + ("update", Some(r##"Registers a push token for the current user and application."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/pushtokens_update", vec![ @@ -4227,7 +4304,7 @@ fn main() { ]), ("quest-milestones", "methods: 'claim'", vec![ - ("claim", + ("claim", Some(r##"Report that a reward for the milestone corresponding to milestoneId for the quest corresponding to questId has been claimed by the currently authorized user."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/quest-milestones_claim", vec![ @@ -4258,7 +4335,7 @@ fn main() { ]), ("quests", "methods: 'accept' and 'list'", vec![ - ("accept", + ("accept", Some(r##"Indicates that the currently authorized user will participate in the quest."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/quests_accept", vec![ @@ -4280,7 +4357,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Get a list of quests for your application and the currently authenticated player."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/quests_list", vec![ @@ -4305,7 +4382,7 @@ fn main() { ]), ("revisions", "methods: 'check'", vec![ - ("check", + ("check", Some(r##"Checks whether the games client is out of date."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/revisions_check", vec![ @@ -4335,7 +4412,7 @@ fn main() { ]), ("rooms", "methods: 'create', 'decline', 'dismiss', 'get', 'join', 'leave', 'list' and 'report-status'", vec![ - ("create", + ("create", Some(r##"Create a room. For internal use by the Games SDK only. Calling this method directly is unsupported."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/rooms_create", vec![ @@ -4357,7 +4434,7 @@ fn main() { Some(false), Some(false)), ]), - ("decline", + ("decline", Some(r##"Decline an invitation to join a room. For internal use by the Games SDK only. Calling this method directly is unsupported."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/rooms_decline", vec![ @@ -4379,7 +4456,7 @@ fn main() { Some(false), Some(false)), ]), - ("dismiss", + ("dismiss", Some(r##"Dismiss an invitation to join a room. For internal use by the Games SDK only. Calling this method directly is unsupported."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/rooms_dismiss", vec![ @@ -4395,7 +4472,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Get the data for a room."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/rooms_get", vec![ @@ -4417,7 +4494,7 @@ fn main() { Some(false), Some(false)), ]), - ("join", + ("join", Some(r##"Join a room. For internal use by the Games SDK only. Calling this method directly is unsupported."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/rooms_join", vec![ @@ -4445,7 +4522,7 @@ fn main() { Some(false), Some(false)), ]), - ("leave", + ("leave", Some(r##"Leave a room. For internal use by the Games SDK only. Calling this method directly is unsupported."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/rooms_leave", vec![ @@ -4473,7 +4550,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns invitations to join rooms."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/rooms_list", vec![ @@ -4489,7 +4566,7 @@ fn main() { Some(false), Some(false)), ]), - ("report-status", + ("report-status", Some(r##"Updates sent by a client reporting the status of peers in a room. For internal use by the Games SDK only. Calling this method directly is unsupported."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/rooms_report-status", vec![ @@ -4520,7 +4597,7 @@ fn main() { ]), ("scores", "methods: 'get', 'list', 'list-window', 'submit' and 'submit-multiple'", vec![ - ("get", + ("get", Some(r##"Get high scores, and optionally ranks, in leaderboards for the currently authenticated player. For a specific time span, leaderboardId can be set to ALL to retrieve data for all leaderboards in a given time span. NOTE: You cannot ask for 'ALL' leaderboards and 'ALL' timeSpans in the same request; only one parameter may be set to 'ALL'."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/scores_get", @@ -4555,7 +4632,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the scores in a leaderboard, starting from the top."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/scores_list", vec![ @@ -4589,7 +4666,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-window", + ("list-window", Some(r##"Lists the scores in a leaderboard around (and including) a player's score."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/scores_list-window", vec![ @@ -4623,7 +4700,7 @@ fn main() { Some(false), Some(false)), ]), - ("submit", + ("submit", Some(r##"Submits a score to the specified leaderboard."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/scores_submit", vec![ @@ -4651,7 +4728,7 @@ fn main() { Some(false), Some(false)), ]), - ("submit-multiple", + ("submit-multiple", Some(r##"Submits multiple scores to leaderboards."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/scores_submit-multiple", vec![ @@ -4676,7 +4753,7 @@ fn main() { ]), ("snapshots", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves the metadata for a given snapshot ID."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/snapshots_get", vec![ @@ -4698,7 +4775,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of snapshots created by your application for the player corresponding to the player ID."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/snapshots_list", vec![ @@ -4723,7 +4800,7 @@ fn main() { ]), ("turn-based-matches", "methods: 'cancel', 'create', 'decline', 'dismiss', 'finish', 'get', 'join', 'leave', 'leave-turn', 'list', 'rematch', 'sync' and 'take-turn'", vec![ - ("cancel", + ("cancel", Some(r##"Cancel a turn-based match."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_cancel", vec![ @@ -4739,7 +4816,7 @@ fn main() { Some(false), Some(true)), ]), - ("create", + ("create", Some(r##"Create a turn-based match."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_create", vec![ @@ -4761,7 +4838,7 @@ fn main() { Some(false), Some(false)), ]), - ("decline", + ("decline", Some(r##"Decline an invitation to play a turn-based match."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_decline", vec![ @@ -4783,7 +4860,7 @@ fn main() { Some(false), Some(false)), ]), - ("dismiss", + ("dismiss", Some(r##"Dismiss a turn-based match from the match list. The match will no longer show up in the list and will not generate notifications."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_dismiss", vec![ @@ -4799,7 +4876,7 @@ fn main() { Some(false), Some(true)), ]), - ("finish", + ("finish", Some(r##"Finish a turn-based match. Each player should make this call once, after all results are in. Only the player whose turn it is may make the first call to Finish, and can pass in the final match state."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_finish", vec![ @@ -4827,7 +4904,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Get the data for a turn-based match."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_get", vec![ @@ -4849,7 +4926,7 @@ fn main() { Some(false), Some(false)), ]), - ("join", + ("join", Some(r##"Join a turn-based match."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_join", vec![ @@ -4871,7 +4948,7 @@ fn main() { Some(false), Some(false)), ]), - ("leave", + ("leave", Some(r##"Leave a turn-based match when it is not the current player's turn, without canceling the match."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_leave", vec![ @@ -4893,7 +4970,7 @@ fn main() { Some(false), Some(false)), ]), - ("leave-turn", + ("leave-turn", Some(r##"Leave a turn-based match during the current player's turn, without canceling the match."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_leave-turn", vec![ @@ -4921,7 +4998,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns turn-based matches the player is or was involved in."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_list", vec![ @@ -4937,7 +5014,7 @@ fn main() { Some(false), Some(false)), ]), - ("rematch", + ("rematch", Some(r##"Create a rematch of a match that was previously completed, with the same participants. This can be called by only one player on a match still in their list; the player must have called Finish first. Returns the newly created match; it will be the caller's turn."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_rematch", vec![ @@ -4959,7 +5036,7 @@ fn main() { Some(false), Some(false)), ]), - ("sync", + ("sync", Some(r##"Returns turn-based matches the player is or was involved in that changed since the last sync call, with the least recent changes coming first. Matches that should be removed from the local cache will have a status of MATCH_DELETED."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_sync", vec![ @@ -4975,7 +5052,7 @@ fn main() { Some(false), Some(false)), ]), - ("take-turn", + ("take-turn", Some(r##"Commit the results of a player turn."##), "Details at http://byron.github.io/google-apis-rs/google_games1_cli/turn-based-matches_take-turn", vec![ @@ -5009,7 +5086,7 @@ fn main() { let mut app = App::new("games1") .author("Sebastian Thiel ") - .version("0.3.2+20151012") + .version("0.3.3+20160126") .about("The API for Google Play Game Services.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_games1_cli") .arg(Arg::with_name("url") @@ -5033,7 +5110,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -5044,7 +5121,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/games1/Cargo.toml b/gen/games1/Cargo.toml index a20188ed03..58a05ed967 100644 --- a/gen/games1/Cargo.toml +++ b/gen/games1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-games1" -version = "0.1.10+20151012" +version = "0.1.11+20160126" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/games1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/games1/LICENSE.md b/gen/games1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/games1/LICENSE.md +++ b/gen/games1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/games1/README.md b/gen/games1/README.md index fcbb4392e7..9791578f48 100644 --- a/gen/games1/README.md +++ b/gen/games1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-games1` library allows access to all features of the *Google Games* service. -This documentation was generated from *Games* crate version *0.1.10+20151012*, where *20151012* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Games* crate version *0.1.11+20160126*, where *20160126* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Games* *v1* API can be found at the [official documentation site](https://developers.google.com/games/services/). @@ -18,7 +18,7 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * achievements * [*increment*](http://byron.github.io/google-apis-rs/google_games1/struct.AchievementIncrementCall.html), [*list*](http://byron.github.io/google-apis-rs/google_games1/struct.AchievementListCall.html), [*reveal*](http://byron.github.io/google-apis-rs/google_games1/struct.AchievementRevealCall.html), [*set steps at least*](http://byron.github.io/google-apis-rs/google_games1/struct.AchievementSetStepsAtLeastCall.html), [*unlock*](http://byron.github.io/google-apis-rs/google_games1/struct.AchievementUnlockCall.html) and [*update multiple*](http://byron.github.io/google-apis-rs/google_games1/struct.AchievementUpdateMultipleCall.html) * [applications](http://byron.github.io/google-apis-rs/google_games1/struct.Application.html) - * [*get*](http://byron.github.io/google-apis-rs/google_games1/struct.ApplicationGetCall.html) and [*played*](http://byron.github.io/google-apis-rs/google_games1/struct.ApplicationPlayedCall.html) + * [*get*](http://byron.github.io/google-apis-rs/google_games1/struct.ApplicationGetCall.html), [*played*](http://byron.github.io/google-apis-rs/google_games1/struct.ApplicationPlayedCall.html) and [*verify*](http://byron.github.io/google-apis-rs/google_games1/struct.ApplicationVerifyCall.html) * events * [*list by player*](http://byron.github.io/google-apis-rs/google_games1/struct.EventListByPlayerCall.html), [*list definitions*](http://byron.github.io/google-apis-rs/google_games1/struct.EventListDefinitionCall.html) and [*record*](http://byron.github.io/google-apis-rs/google_games1/struct.EventRecordCall.html) * [leaderboards](http://byron.github.io/google-apis-rs/google_games1/struct.Leaderboard.html) diff --git a/gen/games1/src/cmn.rs b/gen/games1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/games1/src/cmn.rs +++ b/gen/games1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/games1/src/lib.rs b/gen/games1/src/lib.rs index 67df71dd42..7fc1de0462 100644 --- a/gen/games1/src/lib.rs +++ b/gen/games1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Games* crate version *0.1.10+20151012*, where *20151012* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Games* crate version *0.1.11+20160126*, where *20160126* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Games* *v1* API can be found at the //! [official documentation site](https://developers.google.com/games/services/). @@ -16,7 +16,7 @@ //! * achievements //! * [*increment*](struct.AchievementIncrementCall.html), [*list*](struct.AchievementListCall.html), [*reveal*](struct.AchievementRevealCall.html), [*set steps at least*](struct.AchievementSetStepsAtLeastCall.html), [*unlock*](struct.AchievementUnlockCall.html) and [*update multiple*](struct.AchievementUpdateMultipleCall.html) //! * [applications](struct.Application.html) -//! * [*get*](struct.ApplicationGetCall.html) and [*played*](struct.ApplicationPlayedCall.html) +//! * [*get*](struct.ApplicationGetCall.html), [*played*](struct.ApplicationPlayedCall.html) and [*verify*](struct.ApplicationVerifyCall.html) //! * events //! * [*list by player*](struct.EventListByPlayerCall.html), [*list definitions*](struct.EventListDefinitionCall.html) and [*record*](struct.EventRecordCall.html) //! * [leaderboards](struct.Leaderboard.html) @@ -128,9 +128,9 @@ //! // 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 ! -//! let result = hub.turn_based_matches().leave_turn("matchId", -74) -//! .pending_participant_id("dolor") -//! .language("diam") +//! let result = hub.turn_based_matches().leave_turn("matchId", -48) +//! .pending_participant_id("diam") +//! .language("kasd") //! .doit(); //! //! match result { diff --git a/gen/games1/src/lib.rs.in b/gen/games1/src/lib.rs.in index 3df1f04c9c..367666513a 100644 --- a/gen/games1/src/lib.rs.in +++ b/gen/games1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -136,7 +137,7 @@ impl<'a, C, A> Games Games { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -187,7 +188,7 @@ impl<'a, C, A> Games } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -903,29 +904,24 @@ pub struct AchievementDefinitionsListResponse { impl ResponseResult for AchievementDefinitionsListResponse {} -/// This is a JSON template for peer session diagnostics. +/// This is a JSON template for a third party application verification response resource. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [verify applications](struct.ApplicationVerifyCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PeerSessionDiagnostics { - /// Unreliable channel diagnostics. - #[serde(rename="unreliableChannel")] - pub unreliable_channel: Option, - /// Uniquely identifies the type of this resource. Value is always the fixed string games#peerSessionDiagnostics. +pub struct ApplicationVerifyResponse { + /// The ID of the player that was issued the auth token used in this request. + pub player_id: Option, + /// Uniquely identifies the type of this resource. Value is always the fixed string games#applicationVerifyResponse. pub kind: Option, - /// Reliable channel diagnostics. - #[serde(rename="reliableChannel")] - pub reliable_channel: Option, - /// Connected time in milliseconds. - #[serde(rename="connectedTimestampMillis")] - pub connected_timestamp_millis: Option, - /// The participant ID of the peer. - #[serde(rename="participantId")] - pub participant_id: Option, } -impl Part for PeerSessionDiagnostics {} +impl ResponseResult for ApplicationVerifyResponse {} /// This is a JSON template for sending a turn-based match data object. @@ -1417,6 +1413,7 @@ impl ResponseResult for PlayerLeaderboardScoreListResponse {} /// /// * [get applications](struct.ApplicationGetCall.html) (response) /// * [played applications](struct.ApplicationPlayedCall.html) (none) +/// * [verify applications](struct.ApplicationVerifyCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Application { @@ -1872,6 +1869,31 @@ pub struct RoomCreateRequest { impl RequestValue for RoomCreateRequest {} +/// This is a JSON template for peer session diagnostics. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PeerSessionDiagnostics { + /// Unreliable channel diagnostics. + #[serde(rename="unreliableChannel")] + pub unreliable_channel: Option, + /// Uniquely identifies the type of this resource. Value is always the fixed string games#peerSessionDiagnostics. + pub kind: Option, + /// Reliable channel diagnostics. + #[serde(rename="reliableChannel")] + pub reliable_channel: Option, + /// Connected time in milliseconds. + #[serde(rename="connectedTimestampMillis")] + pub connected_timestamp_millis: Option, + /// The participant ID of the peer. + #[serde(rename="participantId")] + pub participant_id: Option, +} + +impl Part for PeerSessionDiagnostics {} + + /// This is a JSON template for a list of quest objects. /// /// # Activities @@ -2744,6 +2766,9 @@ impl Part for PlayerEvent {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Player { + /// The player ID that was used for this player the first time they signed into the game in question. This is only populated for calls to player.get for the requesting player, only if the player ID has subsequently changed, and only to clients that support remapping player IDs. + #[serde(rename="originalPlayerId")] + pub original_player_id: Option, /// Uniquely identifies the type of this resource. Value is always the fixed string games#player. pub kind: Option, /// The name to display for the player. @@ -2751,17 +2776,23 @@ pub struct Player { pub display_name: Option, /// An object representation of the individual components of the player's name. For some players, these fields may not be present. pub name: Option, - /// The player's title rewarded for their game activities. - pub title: Option, - /// The ID of the player. - #[serde(rename="playerId")] - pub player_id: Option, /// Details about the last time this player played a multiplayer game with the currently authenticated player. Populated for PLAYED_WITH player collection members. #[serde(rename="lastPlayedWith")] pub last_played_with: Option, + /// The ID of the player. + #[serde(rename="playerId")] + pub player_id: Option, + /// The url to the portrait mode player banner image. + #[serde(rename="bannerUrlPortrait")] + pub banner_url_portrait: Option, + /// The player's title rewarded for their game activities. + pub title: Option, /// An object to represent Play Game experience information for the player. #[serde(rename="experienceInfo")] pub experience_info: Option, + /// The url to the landscape mode player banner image. + #[serde(rename="bannerUrlLandscape")] + pub banner_url_landscape: Option, /// The base URL for the image that represents the player. #[serde(rename="avatarImageUrl")] pub avatar_image_url: Option, @@ -3740,7 +3771,7 @@ impl<'a, C, A> TurnBasedMatcheMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Games::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)` and `played(...)` +/// // like `get(...)`, `played(...)` and `verify(...)` /// // to build up your call. /// let rb = hub.applications(); /// # } @@ -3755,6 +3786,23 @@ impl<'a, C, A> MethodsBuilder for ApplicationMethods<'a, C, A> {} impl<'a, C, A> ApplicationMethods<'a, C, A> { + /// Create a builder to help you perform the following task: + /// + /// Verifies the auth token provided with this request is for the application with the specified ID, and returns the ID of the player it was granted for. + /// + /// # Arguments + /// + /// * `applicationId` - The application ID from the Google Play developer console. + pub fn verify(&self, application_id: &str) -> ApplicationVerifyCall<'a, C, A> { + ApplicationVerifyCall { + hub: self.hub, + _application_id: application_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Retrieves the metadata of the application with the given ID. If the requested application is not available for the specified platformType, the returned response will not include any instance data. @@ -4545,7 +4593,7 @@ impl<'a, C, A> AchievementListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.achievements.list", + dlg.begin(MethodInfo { id: "games.achievements.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("playerId", self._player_id.to_string())); @@ -4599,7 +4647,7 @@ impl<'a, C, A> AchievementListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4635,7 +4683,7 @@ impl<'a, C, A> AchievementListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4645,10 +4693,10 @@ impl<'a, C, A> AchievementListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4681,7 +4729,7 @@ impl<'a, C, A> AchievementListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *player id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn player_id(mut self, new_value: &str) -> AchievementListCall<'a, C, A> { self._player_id = new_value.to_string(); @@ -4727,12 +4775,12 @@ impl<'a, C, A> AchievementListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4749,17 +4797,17 @@ impl<'a, C, A> AchievementListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AchievementListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4824,7 +4872,7 @@ impl<'a, C, A> AchievementIncrementCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.achievements.increment", + dlg.begin(MethodInfo { id: "games.achievements.increment", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("achievementId", self._achievement_id.to_string())); @@ -4870,7 +4918,7 @@ impl<'a, C, A> AchievementIncrementCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4906,7 +4954,7 @@ impl<'a, C, A> AchievementIncrementCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4916,10 +4964,10 @@ impl<'a, C, A> AchievementIncrementCall<'a, C, A> where C: BorrowMut AchievementIncrementCall<'a, C, A> where C: BorrowMut AchievementIncrementCall<'a, C, A> { self._achievement_id = new_value.to_string(); @@ -4962,7 +5010,7 @@ impl<'a, C, A> AchievementIncrementCall<'a, C, A> where C: BorrowMut AchievementIncrementCall<'a, C, A> { self._steps_to_increment = new_value; @@ -4987,12 +5035,12 @@ impl<'a, C, A> AchievementIncrementCall<'a, C, A> where C: BorrowMut AchievementIncrementCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementIncrementCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementIncrementCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5082,7 +5130,7 @@ impl<'a, C, A> AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.achievements.setStepsAtLeast", + dlg.begin(MethodInfo { id: "games.achievements.setStepsAtLeast", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("achievementId", self._achievement_id.to_string())); @@ -5125,7 +5173,7 @@ impl<'a, C, A> AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5161,7 +5209,7 @@ impl<'a, C, A> AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5171,10 +5219,10 @@ impl<'a, C, A> AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut AchievementSetStepsAtLeastCall<'a, C, A> { self._achievement_id = new_value.to_string(); @@ -5217,7 +5265,7 @@ impl<'a, C, A> AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut AchievementSetStepsAtLeastCall<'a, C, A> { self._steps = new_value; @@ -5235,12 +5283,12 @@ impl<'a, C, A> AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut AchievementSetStepsAtLeastCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementSetStepsAtLeastCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementSetStepsAtLeastCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5335,7 +5383,7 @@ impl<'a, C, A> AchievementUpdateMultipleCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.achievements.updateMultiple", + dlg.begin(MethodInfo { id: "games.achievements.updateMultiple", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -5355,14 +5403,14 @@ impl<'a, C, A> AchievementUpdateMultipleCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5406,7 +5454,7 @@ impl<'a, C, A> AchievementUpdateMultipleCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5416,10 +5464,10 @@ impl<'a, C, A> AchievementUpdateMultipleCall<'a, C, A> where C: BorrowMut AchievementUpdateMultipleCall<'a, C, A> where C: BorrowMut AchievementUpdateMultipleCall<'a, C, A> { self._request = new_value; @@ -5469,12 +5517,12 @@ impl<'a, C, A> AchievementUpdateMultipleCall<'a, C, A> where C: BorrowMut AchievementUpdateMultipleCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementUpdateMultipleCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementUpdateMultipleCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5563,7 +5611,7 @@ impl<'a, C, A> AchievementRevealCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.achievements.reveal", + dlg.begin(MethodInfo { id: "games.achievements.reveal", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("achievementId", self._achievement_id.to_string())); @@ -5605,7 +5653,7 @@ impl<'a, C, A> AchievementRevealCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5641,7 +5689,7 @@ impl<'a, C, A> AchievementRevealCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5651,10 +5699,10 @@ impl<'a, C, A> AchievementRevealCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5687,7 +5735,7 @@ impl<'a, C, A> AchievementRevealCall<'a, C, A> where C: BorrowMut /// /// Sets the *achievement id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn achievement_id(mut self, new_value: &str) -> AchievementRevealCall<'a, C, A> { self._achievement_id = new_value.to_string(); @@ -5705,12 +5753,12 @@ impl<'a, C, A> AchievementRevealCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5727,17 +5775,17 @@ impl<'a, C, A> AchievementRevealCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AchievementRevealCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementRevealCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5799,7 +5847,7 @@ impl<'a, C, A> AchievementUnlockCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.achievements.unlock", + dlg.begin(MethodInfo { id: "games.achievements.unlock", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("achievementId", self._achievement_id.to_string())); @@ -5841,7 +5889,7 @@ impl<'a, C, A> AchievementUnlockCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5877,7 +5925,7 @@ impl<'a, C, A> AchievementUnlockCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5887,10 +5935,10 @@ impl<'a, C, A> AchievementUnlockCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5923,7 +5971,7 @@ impl<'a, C, A> AchievementUnlockCall<'a, C, A> where C: BorrowMut /// /// Sets the *achievement id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn achievement_id(mut self, new_value: &str) -> AchievementUnlockCall<'a, C, A> { self._achievement_id = new_value.to_string(); @@ -5941,12 +5989,12 @@ impl<'a, C, A> AchievementUnlockCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5963,17 +6011,17 @@ impl<'a, C, A> AchievementUnlockCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AchievementUnlockCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementUnlockCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6037,7 +6085,7 @@ impl<'a, C, A> LeaderboardGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.leaderboards.get", + dlg.begin(MethodInfo { id: "games.leaderboards.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("leaderboardId", self._leaderboard_id.to_string())); @@ -6082,7 +6130,7 @@ impl<'a, C, A> LeaderboardGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6118,7 +6166,7 @@ impl<'a, C, A> LeaderboardGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6128,10 +6176,10 @@ impl<'a, C, A> LeaderboardGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6164,7 +6212,7 @@ impl<'a, C, A> LeaderboardGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *leaderboard id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn leaderboard_id(mut self, new_value: &str) -> LeaderboardGetCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -6189,12 +6237,12 @@ impl<'a, C, A> LeaderboardGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6211,17 +6259,17 @@ impl<'a, C, A> LeaderboardGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LeaderboardGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LeaderboardGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6288,7 +6336,7 @@ impl<'a, C, A> LeaderboardListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.leaderboards.list", + dlg.begin(MethodInfo { id: "games.leaderboards.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -6317,7 +6365,7 @@ impl<'a, C, A> LeaderboardListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6353,7 +6401,7 @@ impl<'a, C, A> LeaderboardListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6363,10 +6411,10 @@ impl<'a, C, A> LeaderboardListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6428,12 +6476,12 @@ impl<'a, C, A> LeaderboardListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6450,17 +6498,17 @@ impl<'a, C, A> LeaderboardListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LeaderboardListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LeaderboardListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6529,7 +6577,7 @@ impl<'a, C, A> MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.metagame.listCategoriesByPlayer", + dlg.begin(MethodInfo { id: "games.metagame.listCategoriesByPlayer", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("playerId", self._player_id.to_string())); @@ -6581,7 +6629,7 @@ impl<'a, C, A> MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6617,7 +6665,7 @@ impl<'a, C, A> MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6627,10 +6675,10 @@ impl<'a, C, A> MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut MetagameListCategoriesByPlayerCall<'a, C, A> { self._player_id = new_value.to_string(); @@ -6673,7 +6721,7 @@ impl<'a, C, A> MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut MetagameListCategoriesByPlayerCall<'a, C, A> { self._collection = new_value.to_string(); @@ -6712,12 +6760,12 @@ impl<'a, C, A> MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut MetagameListCategoriesByPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MetagameListCategoriesByPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MetagameListCategoriesByPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6805,7 +6853,7 @@ impl<'a, C, A> MetagameGetMetagameConfigCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.metagame.getMetagameConfig", + dlg.begin(MethodInfo { id: "games.metagame.getMetagameConfig", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -6825,7 +6873,7 @@ impl<'a, C, A> MetagameGetMetagameConfigCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6861,7 +6909,7 @@ impl<'a, C, A> MetagameGetMetagameConfigCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6871,10 +6919,10 @@ impl<'a, C, A> MetagameGetMetagameConfigCall<'a, C, A> where C: BorrowMut MetagameGetMetagameConfigCall<'a, C, A> where C: BorrowMut MetagameGetMetagameConfigCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MetagameGetMetagameConfigCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MetagameGetMetagameConfigCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7015,7 +7063,7 @@ impl<'a, C, A> PlayerListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.players.list", + dlg.begin(MethodInfo { id: "games.players.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("collection", self._collection.to_string())); @@ -7066,7 +7114,7 @@ impl<'a, C, A> PlayerListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7102,7 +7150,7 @@ impl<'a, C, A> PlayerListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7112,10 +7160,10 @@ impl<'a, C, A> PlayerListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7148,7 +7196,7 @@ impl<'a, C, A> PlayerListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *collection* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection(mut self, new_value: &str) -> PlayerListCall<'a, C, A> { self._collection = new_value.to_string(); @@ -7187,12 +7235,12 @@ impl<'a, C, A> PlayerListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7209,17 +7257,17 @@ impl<'a, C, A> PlayerListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlayerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlayerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7283,7 +7331,7 @@ impl<'a, C, A> PlayerGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.players.get", + dlg.begin(MethodInfo { id: "games.players.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("playerId", self._player_id.to_string())); @@ -7328,7 +7376,7 @@ impl<'a, C, A> PlayerGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7364,7 +7412,7 @@ impl<'a, C, A> PlayerGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7374,10 +7422,10 @@ impl<'a, C, A> PlayerGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7410,7 +7458,7 @@ impl<'a, C, A> PlayerGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *player id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn player_id(mut self, new_value: &str) -> PlayerGetCall<'a, C, A> { self._player_id = new_value.to_string(); @@ -7435,12 +7483,12 @@ impl<'a, C, A> PlayerGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7457,17 +7505,17 @@ impl<'a, C, A> PlayerGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlayerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlayerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7531,7 +7579,7 @@ impl<'a, C, A> QuestAcceptCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.quests.accept", + dlg.begin(MethodInfo { id: "games.quests.accept", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("questId", self._quest_id.to_string())); @@ -7576,7 +7624,7 @@ impl<'a, C, A> QuestAcceptCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7612,7 +7660,7 @@ impl<'a, C, A> QuestAcceptCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7622,10 +7670,10 @@ impl<'a, C, A> QuestAcceptCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7658,7 +7706,7 @@ impl<'a, C, A> QuestAcceptCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *quest id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn quest_id(mut self, new_value: &str) -> QuestAcceptCall<'a, C, A> { self._quest_id = new_value.to_string(); @@ -7683,12 +7731,12 @@ impl<'a, C, A> QuestAcceptCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7705,17 +7753,17 @@ impl<'a, C, A> QuestAcceptCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> QuestAcceptCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> QuestAcceptCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7783,7 +7831,7 @@ impl<'a, C, A> QuestListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.quests.list", + dlg.begin(MethodInfo { id: "games.quests.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("playerId", self._player_id.to_string())); @@ -7834,7 +7882,7 @@ impl<'a, C, A> QuestListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7870,7 +7918,7 @@ impl<'a, C, A> QuestListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7880,10 +7928,10 @@ impl<'a, C, A> QuestListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7916,7 +7964,7 @@ impl<'a, C, A> QuestListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *player id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn player_id(mut self, new_value: &str) -> QuestListCall<'a, C, A> { self._player_id = new_value.to_string(); @@ -7955,12 +8003,12 @@ impl<'a, C, A> QuestListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7977,17 +8025,17 @@ impl<'a, C, A> QuestListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> QuestListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> QuestListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8051,7 +8099,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.snapshots.get", + dlg.begin(MethodInfo { id: "games.snapshots.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("snapshotId", self._snapshot_id.to_string())); @@ -8096,7 +8144,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8132,7 +8180,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8142,10 +8190,10 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8178,7 +8226,7 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *snapshot id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn snapshot_id(mut self, new_value: &str) -> SnapshotGetCall<'a, C, A> { self._snapshot_id = new_value.to_string(); @@ -8203,12 +8251,12 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8225,17 +8273,17 @@ impl<'a, C, A> SnapshotGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DriveAppdata`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SnapshotGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SnapshotGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8303,7 +8351,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.snapshots.list", + dlg.begin(MethodInfo { id: "games.snapshots.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("playerId", self._player_id.to_string())); @@ -8354,7 +8402,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8390,7 +8438,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8400,10 +8448,10 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8436,7 +8484,7 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *player id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn player_id(mut self, new_value: &str) -> SnapshotListCall<'a, C, A> { self._player_id = new_value.to_string(); @@ -8475,12 +8523,12 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8497,17 +8545,17 @@ impl<'a, C, A> SnapshotListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::DriveAppdata`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SnapshotListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SnapshotListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8569,7 +8617,7 @@ impl<'a, C, A> TurnBasedMatcheDismisCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.dismiss", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.dismiss", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("matchId", self._match_id.to_string())); @@ -8610,7 +8658,7 @@ impl<'a, C, A> TurnBasedMatcheDismisCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8646,7 +8694,7 @@ impl<'a, C, A> TurnBasedMatcheDismisCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8656,10 +8704,10 @@ impl<'a, C, A> TurnBasedMatcheDismisCall<'a, C, A> where C: BorrowMut TurnBasedMatcheDismisCall<'a, C, A> where C: BorrowMut TurnBasedMatcheDismisCall<'a, C, A> { self._match_id = new_value.to_string(); @@ -8700,12 +8748,12 @@ impl<'a, C, A> TurnBasedMatcheDismisCall<'a, C, A> where C: BorrowMut TurnBasedMatcheDismisCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheDismisCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheDismisCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8803,7 +8851,7 @@ impl<'a, C, A> TurnBasedMatcheSyncCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.sync", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.sync", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -8838,7 +8886,7 @@ impl<'a, C, A> TurnBasedMatcheSyncCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8874,7 +8922,7 @@ impl<'a, C, A> TurnBasedMatcheSyncCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8884,10 +8932,10 @@ impl<'a, C, A> TurnBasedMatcheSyncCall<'a, C, A> where C: BorrowMut TurnBasedMatcheSyncCall<'a, C, A> where C: BorrowMut TurnBasedMatcheSyncCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheSyncCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheSyncCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9059,7 +9107,7 @@ impl<'a, C, A> TurnBasedMatcheDeclineCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.decline", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.decline", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("matchId", self._match_id.to_string())); @@ -9104,7 +9152,7 @@ impl<'a, C, A> TurnBasedMatcheDeclineCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9140,7 +9188,7 @@ impl<'a, C, A> TurnBasedMatcheDeclineCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9150,10 +9198,10 @@ impl<'a, C, A> TurnBasedMatcheDeclineCall<'a, C, A> where C: BorrowMut TurnBasedMatcheDeclineCall<'a, C, A> where C: BorrowMut TurnBasedMatcheDeclineCall<'a, C, A> { self._match_id = new_value.to_string(); @@ -9211,12 +9259,12 @@ impl<'a, C, A> TurnBasedMatcheDeclineCall<'a, C, A> where C: BorrowMut TurnBasedMatcheDeclineCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheDeclineCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheDeclineCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9309,7 +9357,7 @@ impl<'a, C, A> TurnBasedMatcheGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.get", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("matchId", self._match_id.to_string())); @@ -9357,7 +9405,7 @@ impl<'a, C, A> TurnBasedMatcheGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9393,7 +9441,7 @@ impl<'a, C, A> TurnBasedMatcheGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9403,10 +9451,10 @@ impl<'a, C, A> TurnBasedMatcheGetCall<'a, C, A> where C: BorrowMut TurnBasedMatcheGetCall<'a, C, A> where C: BorrowMut TurnBasedMatcheGetCall<'a, C, A> { self._match_id = new_value.to_string(); @@ -9471,12 +9519,12 @@ impl<'a, C, A> TurnBasedMatcheGetCall<'a, C, A> where C: BorrowMut TurnBasedMatcheGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9573,7 +9621,7 @@ impl<'a, C, A> TurnBasedMatcheCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.create", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._language { @@ -9596,14 +9644,14 @@ impl<'a, C, A> TurnBasedMatcheCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9647,7 +9695,7 @@ impl<'a, C, A> TurnBasedMatcheCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9657,10 +9705,10 @@ impl<'a, C, A> TurnBasedMatcheCreateCall<'a, C, A> where C: BorrowMut TurnBasedMatcheCreateCall<'a, C, A> where C: BorrowMut TurnBasedMatcheCreateCall<'a, C, A> { self._request = new_value; @@ -9717,12 +9765,12 @@ impl<'a, C, A> TurnBasedMatcheCreateCall<'a, C, A> where C: BorrowMut TurnBasedMatcheCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9813,7 +9861,7 @@ impl<'a, C, A> TurnBasedMatcheJoinCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.join", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.join", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("matchId", self._match_id.to_string())); @@ -9858,7 +9906,7 @@ impl<'a, C, A> TurnBasedMatcheJoinCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9894,7 +9942,7 @@ impl<'a, C, A> TurnBasedMatcheJoinCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9904,10 +9952,10 @@ impl<'a, C, A> TurnBasedMatcheJoinCall<'a, C, A> where C: BorrowMut TurnBasedMatcheJoinCall<'a, C, A> where C: BorrowMut TurnBasedMatcheJoinCall<'a, C, A> { self._match_id = new_value.to_string(); @@ -9965,12 +10013,12 @@ impl<'a, C, A> TurnBasedMatcheJoinCall<'a, C, A> where C: BorrowMut TurnBasedMatcheJoinCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheJoinCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheJoinCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10064,7 +10112,7 @@ impl<'a, C, A> TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.leaveTurn", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.leaveTurn", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("matchId", self._match_id.to_string())); @@ -10113,7 +10161,7 @@ impl<'a, C, A> TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10149,7 +10197,7 @@ impl<'a, C, A> TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10159,10 +10207,10 @@ impl<'a, C, A> TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveTurnCall<'a, C, A> { self._match_id = new_value.to_string(); @@ -10205,7 +10253,7 @@ impl<'a, C, A> TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveTurnCall<'a, C, A> { self._match_version = new_value; @@ -10237,12 +10285,12 @@ impl<'a, C, A> TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveTurnCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheLeaveTurnCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheLeaveTurnCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10331,7 +10379,7 @@ impl<'a, C, A> TurnBasedMatcheCancelCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.cancel", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.cancel", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("matchId", self._match_id.to_string())); @@ -10372,7 +10420,7 @@ impl<'a, C, A> TurnBasedMatcheCancelCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10408,7 +10456,7 @@ impl<'a, C, A> TurnBasedMatcheCancelCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10418,10 +10466,10 @@ impl<'a, C, A> TurnBasedMatcheCancelCall<'a, C, A> where C: BorrowMut TurnBasedMatcheCancelCall<'a, C, A> where C: BorrowMut TurnBasedMatcheCancelCall<'a, C, A> { self._match_id = new_value.to_string(); @@ -10462,12 +10510,12 @@ impl<'a, C, A> TurnBasedMatcheCancelCall<'a, C, A> where C: BorrowMut TurnBasedMatcheCancelCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheCancelCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheCancelCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10565,7 +10613,7 @@ impl<'a, C, A> TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.finish", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.finish", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("matchId", self._match_id.to_string())); @@ -10610,14 +10658,14 @@ impl<'a, C, A> TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10661,7 +10709,7 @@ impl<'a, C, A> TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10671,10 +10719,10 @@ impl<'a, C, A> TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut TurnBasedMatcheFinishCall<'a, C, A> { self._request = new_value; @@ -10716,7 +10764,7 @@ impl<'a, C, A> TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut TurnBasedMatcheFinishCall<'a, C, A> { self._match_id = new_value.to_string(); @@ -10741,12 +10789,12 @@ impl<'a, C, A> TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut TurnBasedMatcheFinishCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheFinishCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheFinishCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10837,7 +10885,7 @@ impl<'a, C, A> TurnBasedMatcheLeaveCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.leave", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.leave", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("matchId", self._match_id.to_string())); @@ -10882,7 +10930,7 @@ impl<'a, C, A> TurnBasedMatcheLeaveCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10918,7 +10966,7 @@ impl<'a, C, A> TurnBasedMatcheLeaveCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10928,10 +10976,10 @@ impl<'a, C, A> TurnBasedMatcheLeaveCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveCall<'a, C, A> { self._match_id = new_value.to_string(); @@ -10989,12 +11037,12 @@ impl<'a, C, A> TurnBasedMatcheLeaveCall<'a, C, A> where C: BorrowMut TurnBasedMatcheLeaveCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheLeaveCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheLeaveCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11092,7 +11140,7 @@ impl<'a, C, A> TurnBasedMatcheListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.list", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -11127,7 +11175,7 @@ impl<'a, C, A> TurnBasedMatcheListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11163,7 +11211,7 @@ impl<'a, C, A> TurnBasedMatcheListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11173,10 +11221,10 @@ impl<'a, C, A> TurnBasedMatcheListCall<'a, C, A> where C: BorrowMut TurnBasedMatcheListCall<'a, C, A> where C: BorrowMut TurnBasedMatcheListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11355,7 +11403,7 @@ impl<'a, C, A> TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.takeTurn", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.takeTurn", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("matchId", self._match_id.to_string())); @@ -11400,14 +11448,14 @@ impl<'a, C, A> TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11451,7 +11499,7 @@ impl<'a, C, A> TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11461,10 +11509,10 @@ impl<'a, C, A> TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheTakeTurnCall<'a, C, A> { self._request = new_value; @@ -11506,7 +11554,7 @@ impl<'a, C, A> TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheTakeTurnCall<'a, C, A> { self._match_id = new_value.to_string(); @@ -11531,12 +11579,12 @@ impl<'a, C, A> TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut TurnBasedMatcheTakeTurnCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheTakeTurnCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheTakeTurnCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11629,7 +11677,7 @@ impl<'a, C, A> TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.turnBasedMatches.rematch", + dlg.begin(MethodInfo { id: "games.turnBasedMatches.rematch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("matchId", self._match_id.to_string())); @@ -11677,7 +11725,7 @@ impl<'a, C, A> TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11713,7 +11761,7 @@ impl<'a, C, A> TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11723,10 +11771,10 @@ impl<'a, C, A> TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut TurnBasedMatcheRematchCall<'a, C, A> { self._match_id = new_value.to_string(); @@ -11791,12 +11839,12 @@ impl<'a, C, A> TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheRematchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheRematchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Verifies the auth token provided with this request is for the application with the specified ID, and returns the ID of the player it was granted for. +/// +/// A builder for the *verify* method supported by a *application* resource. +/// It is not used directly, but through a `ApplicationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_games1 as games1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use games1::Games; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Games::new(hyper::Client::new(), 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 ! +/// let result = hub.applications().verify("applicationId") +/// .doit(); +/// # } +/// ``` +pub struct ApplicationVerifyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Games, + _application_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ApplicationVerifyCall<'a, C, A> {} + +impl<'a, C, A> ApplicationVerifyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ApplicationVerifyResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "games.applications.verify", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("applicationId", self._application_id.to_string())); + for &field in ["alt", "applicationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/games/v1/applications/{applicationId}/verify".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{applicationId}", "applicationId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["applicationId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The application ID from the Google Play developer console. + /// + /// Sets the *application id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn application_id(mut self, new_value: &str) -> ApplicationVerifyCall<'a, C, A> { + self._application_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ApplicationVerifyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ApplicationVerifyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ApplicationVerifyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11858,8 +12142,8 @@ impl<'a, C, A> TurnBasedMatcheRematchCall<'a, C, A> where C: BorrowMut ApplicationGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.applications.get", + dlg.begin(MethodInfo { id: "games.applications.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("applicationId", self._application_id.to_string())); @@ -11937,7 +12221,7 @@ impl<'a, C, A> ApplicationGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11973,7 +12257,7 @@ impl<'a, C, A> ApplicationGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11983,10 +12267,10 @@ impl<'a, C, A> ApplicationGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12019,7 +12303,7 @@ impl<'a, C, A> ApplicationGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *application id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn application_id(mut self, new_value: &str) -> ApplicationGetCall<'a, C, A> { self._application_id = new_value.to_string(); @@ -12051,12 +12335,12 @@ impl<'a, C, A> ApplicationGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12073,17 +12357,17 @@ impl<'a, C, A> ApplicationGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ApplicationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ApplicationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12144,7 +12428,7 @@ impl<'a, C, A> ApplicationPlayedCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.applications.played", + dlg.begin(MethodInfo { id: "games.applications.played", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -12163,7 +12447,7 @@ impl<'a, C, A> ApplicationPlayedCall<'a, C, A> where C: BorrowMut self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12199,7 +12483,7 @@ impl<'a, C, A> ApplicationPlayedCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12209,10 +12493,10 @@ impl<'a, C, A> ApplicationPlayedCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12243,12 +12527,12 @@ impl<'a, C, A> ApplicationPlayedCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12265,17 +12549,17 @@ impl<'a, C, A> ApplicationPlayedCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ApplicationPlayedCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ApplicationPlayedCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12310,7 +12594,7 @@ impl<'a, C, A> ApplicationPlayedCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.rooms().get("roomId") -/// .language("et") +/// .language("clita") /// .doit(); /// # } /// ``` @@ -12339,7 +12623,7 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.rooms.get", + dlg.begin(MethodInfo { id: "games.rooms.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("roomId", self._room_id.to_string())); @@ -12384,7 +12668,7 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12420,7 +12704,7 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12430,10 +12714,10 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12466,7 +12750,7 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *room id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn room_id(mut self, new_value: &str) -> RoomGetCall<'a, C, A> { self._room_id = new_value.to_string(); @@ -12491,12 +12775,12 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12513,17 +12797,17 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RoomGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RoomGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12564,7 +12848,7 @@ impl<'a, C, A> RoomGetCall<'a, C, A> where C: BorrowMut, A: oauth /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.rooms().leave(req, "roomId") -/// .language("consetetur") +/// .language("takimata") /// .doit(); /// # } /// ``` @@ -12594,7 +12878,7 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.rooms.leave", + dlg.begin(MethodInfo { id: "games.rooms.leave", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("roomId", self._room_id.to_string())); @@ -12639,14 +12923,14 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12690,7 +12974,7 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12700,10 +12984,10 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12735,7 +13019,7 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: RoomLeaveRequest) -> RoomLeaveCall<'a, C, A> { self._request = new_value; @@ -12745,7 +13029,7 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *room id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn room_id(mut self, new_value: &str) -> RoomLeaveCall<'a, C, A> { self._room_id = new_value.to_string(); @@ -12770,12 +13054,12 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12792,17 +13076,17 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RoomLeaveCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RoomLeaveCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12837,9 +13121,9 @@ impl<'a, C, A> RoomLeaveCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.rooms().list() -/// .page_token("takimata") -/// .max_results(-40) -/// .language("kasd") +/// .page_token("nonumy") +/// .max_results(-13) +/// .language("sanctus") /// .doit(); /// # } /// ``` @@ -12869,7 +13153,7 @@ impl<'a, C, A> RoomListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.rooms.list", + dlg.begin(MethodInfo { id: "games.rooms.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -12898,7 +13182,7 @@ impl<'a, C, A> RoomListCall<'a, C, A> where C: BorrowMut, A: oaut self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12934,7 +13218,7 @@ impl<'a, C, A> RoomListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12944,10 +13228,10 @@ impl<'a, C, A> RoomListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13009,12 +13293,12 @@ impl<'a, C, A> RoomListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13031,17 +13315,17 @@ impl<'a, C, A> RoomListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RoomListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RoomListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13082,7 +13366,7 @@ impl<'a, C, A> RoomListCall<'a, C, A> where C: BorrowMut, A: oaut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.rooms().report_status(req, "roomId") -/// .language("takimata") +/// .language("At") /// .doit(); /// # } /// ``` @@ -13112,7 +13396,7 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.rooms.reportStatus", + dlg.begin(MethodInfo { id: "games.rooms.reportStatus", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("roomId", self._room_id.to_string())); @@ -13157,14 +13441,14 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13208,7 +13492,7 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13218,10 +13502,10 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13253,7 +13537,7 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: RoomP2PStatuses) -> RoomReportStatuCall<'a, C, A> { self._request = new_value; @@ -13263,7 +13547,7 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, /// /// Sets the *room id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn room_id(mut self, new_value: &str) -> RoomReportStatuCall<'a, C, A> { self._room_id = new_value.to_string(); @@ -13288,12 +13572,12 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13310,17 +13594,17 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RoomReportStatuCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RoomReportStatuCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13361,7 +13645,7 @@ impl<'a, C, A> RoomReportStatuCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.rooms().create(req) -/// .language("At") +/// .language("labore") /// .doit(); /// # } /// ``` @@ -13390,7 +13674,7 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.rooms.create", + dlg.begin(MethodInfo { id: "games.rooms.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._language { @@ -13413,14 +13697,14 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13464,7 +13748,7 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13474,10 +13758,10 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13509,7 +13793,7 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: RoomCreateRequest) -> RoomCreateCall<'a, C, A> { self._request = new_value; @@ -13534,12 +13818,12 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13556,17 +13840,17 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RoomCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RoomCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13601,7 +13885,7 @@ impl<'a, C, A> RoomCreateCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.rooms().decline("roomId") -/// .language("invidunt") +/// .language("ea") /// .doit(); /// # } /// ``` @@ -13630,7 +13914,7 @@ impl<'a, C, A> RoomDeclineCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.rooms.decline", + dlg.begin(MethodInfo { id: "games.rooms.decline", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("roomId", self._room_id.to_string())); @@ -13675,7 +13959,7 @@ impl<'a, C, A> RoomDeclineCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13711,7 +13995,7 @@ impl<'a, C, A> RoomDeclineCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13721,10 +14005,10 @@ impl<'a, C, A> RoomDeclineCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13757,7 +14041,7 @@ impl<'a, C, A> RoomDeclineCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *room id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn room_id(mut self, new_value: &str) -> RoomDeclineCall<'a, C, A> { self._room_id = new_value.to_string(); @@ -13782,12 +14066,12 @@ impl<'a, C, A> RoomDeclineCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13804,17 +14088,17 @@ impl<'a, C, A> RoomDeclineCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RoomDeclineCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RoomDeclineCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13876,7 +14160,7 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.rooms.dismiss", + dlg.begin(MethodInfo { id: "games.rooms.dismiss", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("roomId", self._room_id.to_string())); @@ -13917,7 +14201,7 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13953,7 +14237,7 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13963,10 +14247,10 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13989,7 +14273,7 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *room id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn room_id(mut self, new_value: &str) -> RoomDismisCall<'a, C, A> { self._room_id = new_value.to_string(); @@ -14007,12 +14291,12 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14029,17 +14313,17 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RoomDismisCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RoomDismisCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14080,7 +14364,7 @@ impl<'a, C, A> RoomDismisCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.rooms().join(req, "roomId") -/// .language("rebum.") +/// .language("dolore") /// .doit(); /// # } /// ``` @@ -14110,7 +14394,7 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.rooms.join", + dlg.begin(MethodInfo { id: "games.rooms.join", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("roomId", self._room_id.to_string())); @@ -14155,14 +14439,14 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14206,7 +14490,7 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14216,10 +14500,10 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14251,7 +14535,7 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: RoomJoinRequest) -> RoomJoinCall<'a, C, A> { self._request = new_value; @@ -14261,7 +14545,7 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *room id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn room_id(mut self, new_value: &str) -> RoomJoinCall<'a, C, A> { self._room_id = new_value.to_string(); @@ -14286,12 +14570,12 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14308,17 +14592,17 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RoomJoinCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RoomJoinCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14353,8 +14637,8 @@ impl<'a, C, A> RoomJoinCall<'a, C, A> where C: BorrowMut, A: oaut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.scores().submit("leaderboardId", "score") -/// .score_tag("sed") -/// .language("aliquyam") +/// .score_tag("aliquyam") +/// .language("sit") /// .doit(); /// # } /// ``` @@ -14385,7 +14669,7 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.scores.submit", + dlg.begin(MethodInfo { id: "games.scores.submit", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("leaderboardId", self._leaderboard_id.to_string())); @@ -14434,7 +14718,7 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14470,7 +14754,7 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14480,10 +14764,10 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14516,7 +14800,7 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *leaderboard id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn leaderboard_id(mut self, new_value: &str) -> ScoreSubmitCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -14526,7 +14810,7 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *score* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn score(mut self, new_value: &str) -> ScoreSubmitCall<'a, C, A> { self._score = new_value.to_string(); @@ -14558,12 +14842,12 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14580,17 +14864,17 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ScoreSubmitCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScoreSubmitCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14625,9 +14909,9 @@ impl<'a, C, A> ScoreSubmitCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.scores().list("leaderboardId", "collection", "timeSpan") -/// .page_token("labore") -/// .max_results(-30) -/// .language("ea") +/// .page_token("sed") +/// .max_results(-16) +/// .language("gubergren") /// .doit(); /// # } /// ``` @@ -14660,7 +14944,7 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.scores.list", + dlg.begin(MethodInfo { id: "games.scores.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("leaderboardId", self._leaderboard_id.to_string())); @@ -14713,7 +14997,7 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14749,7 +15033,7 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14759,10 +15043,10 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14795,7 +15079,7 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *leaderboard id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn leaderboard_id(mut self, new_value: &str) -> ScoreListCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -14805,7 +15089,7 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *collection* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection(mut self, new_value: &str) -> ScoreListCall<'a, C, A> { self._collection = new_value.to_string(); @@ -14815,7 +15099,7 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *time span* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn time_span(mut self, new_value: &str) -> ScoreListCall<'a, C, A> { self._time_span = new_value.to_string(); @@ -14854,12 +15138,12 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14876,17 +15160,17 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ScoreListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScoreListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14922,10 +15206,10 @@ impl<'a, C, A> ScoreListCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.scores().get("playerId", "leaderboardId", "timeSpan") -/// .page_token("tempor") -/// .max_results(-59) -/// .language("labore") -/// .include_rank_type("ipsum") +/// .page_token("sea") +/// .max_results(-85) +/// .language("ipsum") +/// .include_rank_type("aliquyam") /// .doit(); /// # } /// ``` @@ -14959,7 +15243,7 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.scores.get", + dlg.begin(MethodInfo { id: "games.scores.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("playerId", self._player_id.to_string())); @@ -15015,7 +15299,7 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15051,7 +15335,7 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15061,10 +15345,10 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15097,7 +15381,7 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *player id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn player_id(mut self, new_value: &str) -> ScoreGetCall<'a, C, A> { self._player_id = new_value.to_string(); @@ -15107,7 +15391,7 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *leaderboard id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn leaderboard_id(mut self, new_value: &str) -> ScoreGetCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -15117,7 +15401,7 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *time span* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn time_span(mut self, new_value: &str) -> ScoreGetCall<'a, C, A> { self._time_span = new_value.to_string(); @@ -15163,12 +15447,12 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15185,17 +15469,17 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ScoreGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScoreGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15236,7 +15520,7 @@ impl<'a, C, A> ScoreGetCall<'a, C, A> where C: BorrowMut, A: oaut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.scores().submit_multiple(req) -/// .language("aliquyam") +/// .language("dolores") /// .doit(); /// # } /// ``` @@ -15265,7 +15549,7 @@ impl<'a, C, A> ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.scores.submitMultiple", + dlg.begin(MethodInfo { id: "games.scores.submitMultiple", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._language { @@ -15288,14 +15572,14 @@ impl<'a, C, A> ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15339,7 +15623,7 @@ impl<'a, C, A> ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15349,10 +15633,10 @@ impl<'a, C, A> ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut ScoreSubmitMultipleCall<'a, C, A> { self._request = new_value; @@ -15409,12 +15693,12 @@ impl<'a, C, A> ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ScoreSubmitMultipleCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScoreSubmitMultipleCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15476,11 +15760,11 @@ impl<'a, C, A> ScoreSubmitMultipleCall<'a, C, A> where C: BorrowMut ScoreListWindowCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.scores.listWindow", + dlg.begin(MethodInfo { id: "games.scores.listWindow", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("leaderboardId", self._leaderboard_id.to_string())); @@ -15574,7 +15858,7 @@ impl<'a, C, A> ScoreListWindowCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15610,7 +15894,7 @@ impl<'a, C, A> ScoreListWindowCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15620,10 +15904,10 @@ impl<'a, C, A> ScoreListWindowCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15656,7 +15940,7 @@ impl<'a, C, A> ScoreListWindowCall<'a, C, A> where C: BorrowMut, /// /// Sets the *leaderboard id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn leaderboard_id(mut self, new_value: &str) -> ScoreListWindowCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -15666,7 +15950,7 @@ impl<'a, C, A> ScoreListWindowCall<'a, C, A> where C: BorrowMut, /// /// Sets the *collection* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection(mut self, new_value: &str) -> ScoreListWindowCall<'a, C, A> { self._collection = new_value.to_string(); @@ -15676,7 +15960,7 @@ impl<'a, C, A> ScoreListWindowCall<'a, C, A> where C: BorrowMut, /// /// Sets the *time span* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn time_span(mut self, new_value: &str) -> ScoreListWindowCall<'a, C, A> { self._time_span = new_value.to_string(); @@ -15729,12 +16013,12 @@ impl<'a, C, A> ScoreListWindowCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15751,17 +16035,17 @@ impl<'a, C, A> ScoreListWindowCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ScoreListWindowCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScoreListWindowCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15829,7 +16113,7 @@ impl<'a, C, A> PushtokenRemoveCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.pushtokens.remove", + dlg.begin(MethodInfo { id: "games.pushtokens.remove", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in [].iter() { @@ -15848,14 +16132,14 @@ impl<'a, C, A> PushtokenRemoveCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15899,7 +16183,7 @@ impl<'a, C, A> PushtokenRemoveCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15909,10 +16193,10 @@ impl<'a, C, A> PushtokenRemoveCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15934,7 +16218,7 @@ impl<'a, C, A> PushtokenRemoveCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: PushTokenId) -> PushtokenRemoveCall<'a, C, A> { self._request = new_value; @@ -15952,12 +16236,12 @@ impl<'a, C, A> PushtokenRemoveCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15974,17 +16258,17 @@ impl<'a, C, A> PushtokenRemoveCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PushtokenRemoveCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PushtokenRemoveCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16052,7 +16336,7 @@ impl<'a, C, A> PushtokenUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.pushtokens.update", + dlg.begin(MethodInfo { id: "games.pushtokens.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in [].iter() { @@ -16071,14 +16355,14 @@ impl<'a, C, A> PushtokenUpdateCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -16122,7 +16406,7 @@ impl<'a, C, A> PushtokenUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16132,10 +16416,10 @@ impl<'a, C, A> PushtokenUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16157,7 +16441,7 @@ impl<'a, C, A> PushtokenUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: PushToken) -> PushtokenUpdateCall<'a, C, A> { self._request = new_value; @@ -16175,12 +16459,12 @@ impl<'a, C, A> PushtokenUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16197,17 +16481,17 @@ impl<'a, C, A> PushtokenUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PushtokenUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PushtokenUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16269,7 +16553,7 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.revisions.check", + dlg.begin(MethodInfo { id: "games.revisions.check", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("clientRevision", self._client_revision.to_string())); @@ -16290,7 +16574,7 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16326,7 +16610,7 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16336,10 +16620,10 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16377,7 +16661,7 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *client revision* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn client_revision(mut self, new_value: &str) -> RevisionCheckCall<'a, C, A> { self._client_revision = new_value.to_string(); @@ -16395,12 +16679,12 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16417,17 +16701,17 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RevisionCheckCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RevisionCheckCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16462,9 +16746,9 @@ impl<'a, C, A> RevisionCheckCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.events().list_definitions() -/// .page_token("diam") -/// .max_results(-71) -/// .language("est") +/// .page_token("justo") +/// .max_results(-57) +/// .language("clita") /// .doit(); /// # } /// ``` @@ -16494,7 +16778,7 @@ impl<'a, C, A> EventListDefinitionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.events.listDefinitions", + dlg.begin(MethodInfo { id: "games.events.listDefinitions", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -16523,7 +16807,7 @@ impl<'a, C, A> EventListDefinitionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16559,7 +16843,7 @@ impl<'a, C, A> EventListDefinitionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16569,10 +16853,10 @@ impl<'a, C, A> EventListDefinitionCall<'a, C, A> where C: BorrowMut EventListDefinitionCall<'a, C, A> where C: BorrowMut EventListDefinitionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EventListDefinitionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventListDefinitionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16707,7 +16991,7 @@ impl<'a, C, A> EventListDefinitionCall<'a, C, A> where C: BorrowMut EventRecordCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.events.record", + dlg.begin(MethodInfo { id: "games.events.record", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._language { @@ -16759,14 +17043,14 @@ impl<'a, C, A> EventRecordCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -16810,7 +17094,7 @@ impl<'a, C, A> EventRecordCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16820,10 +17104,10 @@ impl<'a, C, A> EventRecordCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16855,7 +17139,7 @@ impl<'a, C, A> EventRecordCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: EventRecordRequest) -> EventRecordCall<'a, C, A> { self._request = new_value; @@ -16880,12 +17164,12 @@ impl<'a, C, A> EventRecordCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16902,17 +17186,17 @@ impl<'a, C, A> EventRecordCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventRecordCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventRecordCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16947,9 +17231,9 @@ impl<'a, C, A> EventRecordCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.events().list_by_player() -/// .page_token("invidunt") -/// .max_results(-87) -/// .language("dolores") +/// .page_token("ut") +/// .max_results(-19) +/// .language("eos") /// .doit(); /// # } /// ``` @@ -16979,7 +17263,7 @@ impl<'a, C, A> EventListByPlayerCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.events.listByPlayer", + dlg.begin(MethodInfo { id: "games.events.listByPlayer", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -17008,7 +17292,7 @@ impl<'a, C, A> EventListByPlayerCall<'a, C, A> where C: BorrowMut self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17044,7 +17328,7 @@ impl<'a, C, A> EventListByPlayerCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17054,10 +17338,10 @@ impl<'a, C, A> EventListByPlayerCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17119,12 +17403,12 @@ impl<'a, C, A> EventListByPlayerCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17141,17 +17425,17 @@ impl<'a, C, A> EventListByPlayerCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventListByPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventListByPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17215,7 +17499,7 @@ impl<'a, C, A> QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.questMilestones.claim", + dlg.begin(MethodInfo { id: "games.questMilestones.claim", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("questId", self._quest_id.to_string())); @@ -17258,7 +17542,7 @@ impl<'a, C, A> QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17294,7 +17578,7 @@ impl<'a, C, A> QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17304,10 +17588,10 @@ impl<'a, C, A> QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut QuestMilestoneClaimCall<'a, C, A> { self._quest_id = new_value.to_string(); @@ -17340,7 +17624,7 @@ impl<'a, C, A> QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut QuestMilestoneClaimCall<'a, C, A> { self._milestone_id = new_value.to_string(); @@ -17350,7 +17634,7 @@ impl<'a, C, A> QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut QuestMilestoneClaimCall<'a, C, A> { self._request_id = new_value.to_string(); @@ -17368,12 +17652,12 @@ impl<'a, C, A> QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> QuestMilestoneClaimCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> QuestMilestoneClaimCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17435,8 +17719,8 @@ impl<'a, C, A> QuestMilestoneClaimCall<'a, C, A> where C: BorrowMut AchievementDefinitionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "games.achievementDefinitions.list", + dlg.begin(MethodInfo { id: "games.achievementDefinitions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -17496,7 +17780,7 @@ impl<'a, C, A> AchievementDefinitionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17532,7 +17816,7 @@ impl<'a, C, A> AchievementDefinitionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17542,10 +17826,10 @@ impl<'a, C, A> AchievementDefinitionListCall<'a, C, A> where C: BorrowMut AchievementDefinitionListCall<'a, C, A> where C: BorrowMut AchievementDefinitionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementDefinitionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementDefinitionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/gamesconfiguration1_configuration-cli/Cargo.toml b/gen/gamesconfiguration1_configuration-cli/Cargo.toml index 942e35a3d5..07fe038618 100644 --- a/gen/gamesconfiguration1_configuration-cli/Cargo.toml +++ b/gen/gamesconfiguration1_configuration-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gamesconfiguration1_configuration-cli" -version = "0.3.2+20151012" +version = "0.3.3+20160126" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games Configuration (protocol v1configuration)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesconfiguration1_configuration-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/gamesconfiguration1_configuration-cli/LICENSE.md b/gen/gamesconfiguration1_configuration-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/gamesconfiguration1_configuration-cli/LICENSE.md +++ b/gen/gamesconfiguration1_configuration-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/gamesconfiguration1_configuration-cli/README.md b/gen/gamesconfiguration1_configuration-cli/README.md index f4402ca212..2c0d9152e4 100644 --- a/gen/gamesconfiguration1_configuration-cli/README.md +++ b/gen/gamesconfiguration1_configuration-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Games Configuration* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/gamesconfiguration1-configuration.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/gamesconfiguration1-configuration.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/gamesconfiguration1-configuration.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/gamesconfiguration1-configuration.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/gamesconfiguration1_configuration-cli). # Usage -This documentation was generated from the *Games Configuration* API at revision *20151012*. The CLI is at version *0.3.2*. +This documentation was generated from the *Games Configuration* API at revision *20160126*. The CLI is at version *0.3.3*. ```bash gamesconfiguration1-configuration [options] @@ -48,18 +48,18 @@ gamesconfiguration1-configuration [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/gamesconfiguration1_configuration-cli/mkdocs.yml b/gen/gamesconfiguration1_configuration-cli/mkdocs.yml index f6bf35c744..27c57cc5a3 100644 --- a/gen/gamesconfiguration1_configuration-cli/mkdocs.yml +++ b/gen/gamesconfiguration1_configuration-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games Configuration v0.3.2+20151012 +site_name: Games Configuration v0.3.3+20160126 site_url: http://byron.github.io/google-apis-rs/google-gamesconfiguration1_configuration-cli site_description: Write integrating applications with bcore @@ -25,5 +25,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/gamesconfiguration1_configuration-cli/src/main.rs b/gen/gamesconfiguration1_configuration-cli/src/main.rs index e322133388..8142d5479d 100644 --- a/gen/gamesconfiguration1_configuration-cli/src/main.rs +++ b/gen/gamesconfiguration1_configuration-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::GamesConfiguration>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _achievement_configurations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _achievement_configurations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievement_configurations().delete(opt.value_of("achievement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -89,10 +89,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievement_configurations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievement_configurations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievement_configurations().get(opt.value_of("achievement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -105,7 +105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -141,13 +141,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievement_configurations_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievement_configurations_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -161,8 +161,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "achievement-type" => Some(("achievementType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "steps-to-unlock" => Some(("stepsToUnlock", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -194,7 +194,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AchievementConfiguration = json::value::from_value(object).unwrap(); let mut call = self.hub.achievement_configurations().insert(request, opt.value_of("application-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -207,7 +207,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -220,7 +220,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -243,10 +243,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievement_configurations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievement_configurations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievement_configurations().list(opt.value_of("application-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -265,7 +265,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -279,7 +279,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -302,13 +302,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievement_configurations_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievement_configurations_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -322,8 +322,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "achievement-type" => Some(("achievementType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "steps-to-unlock" => Some(("stepsToUnlock", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -355,7 +355,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AchievementConfiguration = json::value::from_value(object).unwrap(); let mut call = self.hub.achievement_configurations().patch(request, opt.value_of("achievement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -368,7 +368,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -381,7 +381,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -404,13 +404,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievement_configurations_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievement_configurations_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -424,8 +424,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "achievement-type" => Some(("achievementType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "steps-to-unlock" => Some(("stepsToUnlock", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -457,7 +457,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AchievementConfiguration = json::value::from_value(object).unwrap(); let mut call = self.hub.achievement_configurations().update(request, opt.value_of("achievement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -470,7 +470,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -483,7 +483,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -506,10 +506,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _image_configurations_upload(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _image_configurations_upload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.image_configurations().upload(opt.value_of("resource-id").unwrap_or(""), opt.value_of("image-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -522,7 +522,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -530,7 +530,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -538,7 +538,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -562,10 +562,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _leaderboard_configurations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _leaderboard_configurations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.leaderboard_configurations().delete(opt.value_of("leaderboard-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -578,7 +578,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -591,7 +591,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -606,10 +606,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _leaderboard_configurations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _leaderboard_configurations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.leaderboard_configurations().get(opt.value_of("leaderboard-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -622,7 +622,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -635,7 +635,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -658,13 +658,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _leaderboard_configurations_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _leaderboard_configurations_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -678,8 +678,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "score-order" => Some(("scoreOrder", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -725,7 +725,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LeaderboardConfiguration = json::value::from_value(object).unwrap(); let mut call = self.hub.leaderboard_configurations().insert(request, opt.value_of("application-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -738,7 +738,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -751,7 +751,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -774,10 +774,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _leaderboard_configurations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _leaderboard_configurations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.leaderboard_configurations().list(opt.value_of("application-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -796,7 +796,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -810,7 +810,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -833,13 +833,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _leaderboard_configurations_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _leaderboard_configurations_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -853,8 +853,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "score-order" => Some(("scoreOrder", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -900,7 +900,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LeaderboardConfiguration = json::value::from_value(object).unwrap(); let mut call = self.hub.leaderboard_configurations().patch(request, opt.value_of("leaderboard-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -913,7 +913,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -926,7 +926,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -949,13 +949,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _leaderboard_configurations_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _leaderboard_configurations_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -969,8 +969,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "score-order" => Some(("scoreOrder", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1016,7 +1016,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LeaderboardConfiguration = json::value::from_value(object).unwrap(); let mut call = self.hub.leaderboard_configurations().update(request, opt.value_of("leaderboard-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1029,7 +1029,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1042,7 +1042,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1150,14 +1150,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "gamesconfiguration1-configuration-secret.json", + match cmn::application_secret_from_directory(&config_dir, "gamesconfiguration1-configuration-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1177,7 +1177,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1217,7 +1217,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("achievement-configurations", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Delete the achievement configuration with the given ID."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/achievement-configurations_delete", vec![ @@ -1233,7 +1233,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves the metadata of the achievement configuration with the given ID."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/achievement-configurations_get", vec![ @@ -1255,7 +1255,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Insert a new achievement configuration in this application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/achievement-configurations_insert", vec![ @@ -1283,7 +1283,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of the achievement configurations in this application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/achievement-configurations_list", vec![ @@ -1305,7 +1305,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update the metadata of the achievement configuration with the given ID. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/achievement-configurations_patch", vec![ @@ -1333,7 +1333,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update the metadata of the achievement configuration with the given ID."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/achievement-configurations_update", vec![ @@ -1364,7 +1364,7 @@ fn main() { ]), ("image-configurations", "methods: 'upload'", vec![ - ("upload", + ("upload", Some(r##"Uploads an image for a resource with the given ID and image type."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/image-configurations_upload", vec![ @@ -1401,7 +1401,7 @@ fn main() { ]), ("leaderboard-configurations", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Delete the leaderboard configuration with the given ID."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/leaderboard-configurations_delete", vec![ @@ -1417,7 +1417,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves the metadata of the leaderboard configuration with the given ID."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/leaderboard-configurations_get", vec![ @@ -1439,7 +1439,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Insert a new leaderboard configuration in this application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/leaderboard-configurations_insert", vec![ @@ -1467,7 +1467,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of the leaderboard configurations in this application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/leaderboard-configurations_list", vec![ @@ -1489,7 +1489,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update the metadata of the leaderboard configuration with the given ID. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/leaderboard-configurations_patch", vec![ @@ -1517,7 +1517,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update the metadata of the leaderboard configuration with the given ID."##), "Details at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli/leaderboard-configurations_update", vec![ @@ -1551,7 +1551,7 @@ fn main() { let mut app = App::new("gamesconfiguration1-configuration") .author("Sebastian Thiel ") - .version("0.3.2+20151012") + .version("0.3.3+20160126") .about("The Publishing API for Google Play Game Services.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_gamesconfiguration1_configuration_cli") .arg(Arg::with_name("url") @@ -1575,7 +1575,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1586,7 +1586,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/gamesconfiguration1_configuration/Cargo.toml b/gen/gamesconfiguration1_configuration/Cargo.toml index 4ba224d29f..720af9b91f 100644 --- a/gen/gamesconfiguration1_configuration/Cargo.toml +++ b/gen/gamesconfiguration1_configuration/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gamesconfiguration1_configuration" -version = "0.1.10+20151012" +version = "0.1.11+20160126" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games Configuration (protocol v1configuration)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesconfiguration1_configuration" diff --git a/gen/gamesconfiguration1_configuration/LICENSE.md b/gen/gamesconfiguration1_configuration/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/gamesconfiguration1_configuration/LICENSE.md +++ b/gen/gamesconfiguration1_configuration/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/gamesconfiguration1_configuration/README.md b/gen/gamesconfiguration1_configuration/README.md index ed4abc4ee0..b89145b721 100644 --- a/gen/gamesconfiguration1_configuration/README.md +++ b/gen/gamesconfiguration1_configuration/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-gamesconfiguration1_configuration` library allows access to all features of the *Google Games Configuration* service. -This documentation was generated from *Games Configuration* crate version *0.1.10+20151012*, where *20151012* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Games Configuration* crate version *0.1.11+20160126*, where *20160126* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Games Configuration* *v1_configuration* API can be found at the [official documentation site](https://developers.google.com/games/services). diff --git a/gen/gamesconfiguration1_configuration/src/cmn.rs b/gen/gamesconfiguration1_configuration/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/gamesconfiguration1_configuration/src/cmn.rs +++ b/gen/gamesconfiguration1_configuration/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/gamesconfiguration1_configuration/src/lib.rs b/gen/gamesconfiguration1_configuration/src/lib.rs index 107e2413d6..08a950c9a1 100644 --- a/gen/gamesconfiguration1_configuration/src/lib.rs +++ b/gen/gamesconfiguration1_configuration/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Games Configuration* crate version *0.1.10+20151012*, where *20151012* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Games Configuration* crate version *0.1.11+20160126*, where *20160126* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Games Configuration* *v1_configuration* API can be found at the //! [official documentation site](https://developers.google.com/games/services). diff --git a/gen/gamesconfiguration1_configuration/src/lib.rs.in b/gen/gamesconfiguration1_configuration/src/lib.rs.in index 994377be00..01c6119e49 100644 --- a/gen/gamesconfiguration1_configuration/src/lib.rs.in +++ b/gen/gamesconfiguration1_configuration/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -128,7 +129,7 @@ impl<'a, C, A> GamesConfiguration GamesConfiguration { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -143,7 +144,7 @@ impl<'a, C, A> GamesConfiguration } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -885,7 +886,7 @@ impl<'a, C, A> ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.imageConfigurations.upload", + dlg.begin(MethodInfo { id: "gamesConfiguration.imageConfigurations.upload", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resourceId", self._resource_id.to_string())); @@ -902,13 +903,13 @@ impl<'a, C, A> ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1000,7 +1001,7 @@ impl<'a, C, A> ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1010,10 +1011,10 @@ impl<'a, C, A> ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut ImageConfigurationUploadCall<'a, C, A> { self._resource_id = new_value.to_string(); @@ -1127,7 +1128,7 @@ impl<'a, C, A> ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut ImageConfigurationUploadCall<'a, C, A> { self._image_type = new_value.to_string(); @@ -1145,12 +1146,12 @@ impl<'a, C, A> ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut ImageConfigurationUploadCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ImageConfigurationUploadCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ImageConfigurationUploadCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1243,7 +1244,7 @@ impl<'a, C, A> AchievementConfigurationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.list", + dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("applicationId", self._application_id.to_string())); @@ -1291,7 +1292,7 @@ impl<'a, C, A> AchievementConfigurationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1327,7 +1328,7 @@ impl<'a, C, A> AchievementConfigurationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1337,10 +1338,10 @@ impl<'a, C, A> AchievementConfigurationListCall<'a, C, A> where C: BorrowMut AchievementConfigurationListCall<'a, C, A> where C: BorrowMut AchievementConfigurationListCall<'a, C, A> { self._application_id = new_value.to_string(); @@ -1405,12 +1406,12 @@ impl<'a, C, A> AchievementConfigurationListCall<'a, C, A> where C: BorrowMut AchievementConfigurationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementConfigurationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementConfigurationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1506,7 +1507,7 @@ impl<'a, C, A> AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.update", + dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("achievementId", self._achievement_id.to_string())); @@ -1548,14 +1549,14 @@ impl<'a, C, A> AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1599,7 +1600,7 @@ impl<'a, C, A> AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1609,10 +1610,10 @@ impl<'a, C, A> AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut AchievementConfigurationUpdateCall<'a, C, A> { self._request = new_value; @@ -1654,7 +1655,7 @@ impl<'a, C, A> AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut AchievementConfigurationUpdateCall<'a, C, A> { self._achievement_id = new_value.to_string(); @@ -1672,12 +1673,12 @@ impl<'a, C, A> AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut AchievementConfigurationUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementConfigurationUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementConfigurationUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1773,7 +1774,7 @@ impl<'a, C, A> AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.insert", + dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("applicationId", self._application_id.to_string())); @@ -1815,14 +1816,14 @@ impl<'a, C, A> AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1866,7 +1867,7 @@ impl<'a, C, A> AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1876,10 +1877,10 @@ impl<'a, C, A> AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut AchievementConfigurationInsertCall<'a, C, A> { self._request = new_value; @@ -1921,7 +1922,7 @@ impl<'a, C, A> AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut AchievementConfigurationInsertCall<'a, C, A> { self._application_id = new_value.to_string(); @@ -1939,12 +1940,12 @@ impl<'a, C, A> AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut AchievementConfigurationInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementConfigurationInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementConfigurationInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2033,7 +2034,7 @@ impl<'a, C, A> AchievementConfigurationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.get", + dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("achievementId", self._achievement_id.to_string())); @@ -2075,7 +2076,7 @@ impl<'a, C, A> AchievementConfigurationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2111,7 +2112,7 @@ impl<'a, C, A> AchievementConfigurationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2121,10 +2122,10 @@ impl<'a, C, A> AchievementConfigurationGetCall<'a, C, A> where C: BorrowMut AchievementConfigurationGetCall<'a, C, A> where C: BorrowMut AchievementConfigurationGetCall<'a, C, A> { self._achievement_id = new_value.to_string(); @@ -2175,12 +2176,12 @@ impl<'a, C, A> AchievementConfigurationGetCall<'a, C, A> where C: BorrowMut AchievementConfigurationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementConfigurationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementConfigurationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2276,7 +2277,7 @@ impl<'a, C, A> AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.patch", + dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("achievementId", self._achievement_id.to_string())); @@ -2318,14 +2319,14 @@ impl<'a, C, A> AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2369,7 +2370,7 @@ impl<'a, C, A> AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2379,10 +2380,10 @@ impl<'a, C, A> AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut AchievementConfigurationPatchCall<'a, C, A> { self._request = new_value; @@ -2424,7 +2425,7 @@ impl<'a, C, A> AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut AchievementConfigurationPatchCall<'a, C, A> { self._achievement_id = new_value.to_string(); @@ -2442,12 +2443,12 @@ impl<'a, C, A> AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut AchievementConfigurationPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementConfigurationPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementConfigurationPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2536,7 +2537,7 @@ impl<'a, C, A> AchievementConfigurationDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.delete", + dlg.begin(MethodInfo { id: "gamesConfiguration.achievementConfigurations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("achievementId", self._achievement_id.to_string())); @@ -2577,7 +2578,7 @@ impl<'a, C, A> AchievementConfigurationDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2613,7 +2614,7 @@ impl<'a, C, A> AchievementConfigurationDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2623,10 +2624,10 @@ impl<'a, C, A> AchievementConfigurationDeleteCall<'a, C, A> where C: BorrowMut AchievementConfigurationDeleteCall<'a, C, A> where C: BorrowMut AchievementConfigurationDeleteCall<'a, C, A> { self._achievement_id = new_value.to_string(); @@ -2667,12 +2668,12 @@ impl<'a, C, A> AchievementConfigurationDeleteCall<'a, C, A> where C: BorrowMut AchievementConfigurationDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementConfigurationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementConfigurationDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2768,7 +2769,7 @@ impl<'a, C, A> LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.insert", + dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("applicationId", self._application_id.to_string())); @@ -2810,14 +2811,14 @@ impl<'a, C, A> LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2861,7 +2862,7 @@ impl<'a, C, A> LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2871,10 +2872,10 @@ impl<'a, C, A> LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationInsertCall<'a, C, A> { self._request = new_value; @@ -2916,7 +2917,7 @@ impl<'a, C, A> LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationInsertCall<'a, C, A> { self._application_id = new_value.to_string(); @@ -2934,12 +2935,12 @@ impl<'a, C, A> LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LeaderboardConfigurationInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LeaderboardConfigurationInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3028,7 +3029,7 @@ impl<'a, C, A> LeaderboardConfigurationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.get", + dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("leaderboardId", self._leaderboard_id.to_string())); @@ -3070,7 +3071,7 @@ impl<'a, C, A> LeaderboardConfigurationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3106,7 +3107,7 @@ impl<'a, C, A> LeaderboardConfigurationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3116,10 +3117,10 @@ impl<'a, C, A> LeaderboardConfigurationGetCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationGetCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationGetCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -3170,12 +3171,12 @@ impl<'a, C, A> LeaderboardConfigurationGetCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LeaderboardConfigurationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LeaderboardConfigurationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3271,7 +3272,7 @@ impl<'a, C, A> LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.patch", + dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("leaderboardId", self._leaderboard_id.to_string())); @@ -3313,14 +3314,14 @@ impl<'a, C, A> LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3364,7 +3365,7 @@ impl<'a, C, A> LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3374,10 +3375,10 @@ impl<'a, C, A> LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationPatchCall<'a, C, A> { self._request = new_value; @@ -3419,7 +3420,7 @@ impl<'a, C, A> LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationPatchCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -3437,12 +3438,12 @@ impl<'a, C, A> LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LeaderboardConfigurationPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LeaderboardConfigurationPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3538,7 +3539,7 @@ impl<'a, C, A> LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.update", + dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("leaderboardId", self._leaderboard_id.to_string())); @@ -3580,14 +3581,14 @@ impl<'a, C, A> LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3631,7 +3632,7 @@ impl<'a, C, A> LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3641,10 +3642,10 @@ impl<'a, C, A> LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationUpdateCall<'a, C, A> { self._request = new_value; @@ -3686,7 +3687,7 @@ impl<'a, C, A> LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationUpdateCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -3704,12 +3705,12 @@ impl<'a, C, A> LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LeaderboardConfigurationUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LeaderboardConfigurationUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3802,7 +3803,7 @@ impl<'a, C, A> LeaderboardConfigurationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.list", + dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("applicationId", self._application_id.to_string())); @@ -3850,7 +3851,7 @@ impl<'a, C, A> LeaderboardConfigurationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3886,7 +3887,7 @@ impl<'a, C, A> LeaderboardConfigurationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3896,10 +3897,10 @@ impl<'a, C, A> LeaderboardConfigurationListCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationListCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationListCall<'a, C, A> { self._application_id = new_value.to_string(); @@ -3964,12 +3965,12 @@ impl<'a, C, A> LeaderboardConfigurationListCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LeaderboardConfigurationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LeaderboardConfigurationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4058,7 +4059,7 @@ impl<'a, C, A> LeaderboardConfigurationDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.delete", + dlg.begin(MethodInfo { id: "gamesConfiguration.leaderboardConfigurations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("leaderboardId", self._leaderboard_id.to_string())); @@ -4099,7 +4100,7 @@ impl<'a, C, A> LeaderboardConfigurationDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4135,7 +4136,7 @@ impl<'a, C, A> LeaderboardConfigurationDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4145,10 +4146,10 @@ impl<'a, C, A> LeaderboardConfigurationDeleteCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationDeleteCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationDeleteCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -4189,12 +4190,12 @@ impl<'a, C, A> LeaderboardConfigurationDeleteCall<'a, C, A> where C: BorrowMut LeaderboardConfigurationDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LeaderboardConfigurationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LeaderboardConfigurationDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/gamesmanagement1_management-cli/Cargo.toml b/gen/gamesmanagement1_management-cli/Cargo.toml index 72dcdcd8da..bbf0803967 100644 --- a/gen/gamesmanagement1_management-cli/Cargo.toml +++ b/gen/gamesmanagement1_management-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gamesmanagement1_management-cli" -version = "0.3.2+20151012" +version = "0.3.3+20160126" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games Management (protocol v1management)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesmanagement1_management-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/gamesmanagement1_management-cli/LICENSE.md b/gen/gamesmanagement1_management-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/gamesmanagement1_management-cli/LICENSE.md +++ b/gen/gamesmanagement1_management-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/gamesmanagement1_management-cli/README.md b/gen/gamesmanagement1_management-cli/README.md index 534c138ea1..81f6d2bbc8 100644 --- a/gen/gamesmanagement1_management-cli/README.md +++ b/gen/gamesmanagement1_management-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Games Management* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/gamesmanagement1-management.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/gamesmanagement1-management.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/gamesmanagement1-management.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/gamesmanagement1-management.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/gamesmanagement1_management-cli). # Usage -This documentation was generated from the *Games Management* API at revision *20151012*. The CLI is at version *0.3.2*. +This documentation was generated from the *Games Management* API at revision *20160126*. The CLI is at version *0.3.3*. ```bash gamesmanagement1-management [options] @@ -67,18 +67,18 @@ gamesmanagement1-management [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/gamesmanagement1_management-cli/mkdocs.yml b/gen/gamesmanagement1_management-cli/mkdocs.yml index c0c0e34596..abf80299fa 100644 --- a/gen/gamesmanagement1_management-cli/mkdocs.yml +++ b/gen/gamesmanagement1_management-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games Management v0.3.2+20151012 +site_name: Games Management v0.3.3+20160126 site_url: http://byron.github.io/google-apis-rs/google-gamesmanagement1_management-cli site_description: Write integrating applications with bcore @@ -39,5 +39,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/gamesmanagement1_management-cli/src/main.rs b/gen/gamesmanagement1_management-cli/src/main.rs index 0073bdf07e..fc8e8804c4 100644 --- a/gen/gamesmanagement1_management-cli/src/main.rs +++ b/gen/gamesmanagement1_management-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::GamesManagement>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _achievements_reset(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _achievements_reset(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievements().reset(opt.value_of("achievement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievements_reset_all(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievements_reset_all(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievements().reset_all(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -149,10 +149,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievements_reset_all_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievements_reset_all_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievements().reset_all_for_all_players(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -165,7 +165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -178,7 +178,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -193,10 +193,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievements_reset_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievements_reset_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.achievements().reset_for_all_players(opt.value_of("achievement-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -209,7 +209,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -222,7 +222,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -237,13 +237,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _achievements_reset_multiple_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _achievements_reset_multiple_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -257,8 +257,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "achievement-ids" => Some(("achievement_ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -274,7 +274,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AchievementResetMultipleForAllRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.achievements().reset_multiple_for_all_players(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -287,7 +287,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -300,7 +300,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -315,10 +315,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _applications_list_hidden(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _applications_list_hidden(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.applications().list_hidden(opt.value_of("application-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -337,7 +337,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -351,7 +351,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -374,10 +374,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_reset(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_reset(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().reset(opt.value_of("event-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -390,7 +390,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -403,7 +403,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -418,10 +418,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_reset_all(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_reset_all(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().reset_all(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -434,7 +434,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -447,7 +447,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -462,10 +462,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_reset_all_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_reset_all_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().reset_all_for_all_players(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -478,7 +478,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -491,7 +491,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -506,10 +506,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_reset_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_reset_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().reset_for_all_players(opt.value_of("event-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -522,7 +522,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -535,7 +535,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -550,13 +550,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_reset_multiple_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_reset_multiple_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -570,8 +570,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "event-ids" => Some(("event_ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -587,7 +587,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::EventsResetMultipleForAllRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.events().reset_multiple_for_all_players(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -600,7 +600,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -613,7 +613,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -628,10 +628,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _players_hide(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _players_hide(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.players().hide(opt.value_of("application-id").unwrap_or(""), opt.value_of("player-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -644,7 +644,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -657,7 +657,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -672,10 +672,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _players_unhide(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _players_unhide(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.players().unhide(opt.value_of("application-id").unwrap_or(""), opt.value_of("player-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -688,7 +688,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -701,7 +701,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -716,10 +716,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _quests_reset(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _quests_reset(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.quests().reset(opt.value_of("quest-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -732,7 +732,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -745,7 +745,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -760,10 +760,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _quests_reset_all(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _quests_reset_all(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.quests().reset_all(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -776,7 +776,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -789,7 +789,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -804,10 +804,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _quests_reset_all_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _quests_reset_all_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.quests().reset_all_for_all_players(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -820,7 +820,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -833,7 +833,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -848,10 +848,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _quests_reset_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _quests_reset_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.quests().reset_for_all_players(opt.value_of("quest-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -864,7 +864,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -877,7 +877,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -892,13 +892,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _quests_reset_multiple_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _quests_reset_multiple_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -912,8 +912,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "quest-ids" => Some(("quest_ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -929,7 +929,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::QuestsResetMultipleForAllRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.quests().reset_multiple_for_all_players(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -942,7 +942,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -955,7 +955,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -970,10 +970,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rooms_reset(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rooms_reset(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rooms().reset(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -986,7 +986,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -999,7 +999,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1014,10 +1014,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rooms_reset_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rooms_reset_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rooms().reset_for_all_players(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1030,7 +1030,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1043,7 +1043,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1058,10 +1058,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _scores_reset(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _scores_reset(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.scores().reset(opt.value_of("leaderboard-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1074,7 +1074,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1087,7 +1087,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1110,10 +1110,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _scores_reset_all(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _scores_reset_all(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.scores().reset_all(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1126,7 +1126,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1139,7 +1139,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1162,10 +1162,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _scores_reset_all_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _scores_reset_all_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.scores().reset_all_for_all_players(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1178,7 +1178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1191,7 +1191,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1206,10 +1206,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _scores_reset_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _scores_reset_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.scores().reset_for_all_players(opt.value_of("leaderboard-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1222,7 +1222,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1235,7 +1235,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1250,13 +1250,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _scores_reset_multiple_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _scores_reset_multiple_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1270,8 +1270,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "leaderboard-ids" => Some(("leaderboard_ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1287,7 +1287,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ScoresResetMultipleForAllRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.scores().reset_multiple_for_all_players(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1300,7 +1300,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1313,7 +1313,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1328,10 +1328,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_reset(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_reset(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().reset(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1344,7 +1344,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1357,7 +1357,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1372,10 +1372,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _turn_based_matches_reset_for_all_players(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _turn_based_matches_reset_for_all_players(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.turn_based_matches().reset_for_all_players(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1388,7 +1388,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1401,7 +1401,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1583,14 +1583,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "gamesmanagement1-management-secret.json", + match cmn::application_secret_from_directory(&config_dir, "gamesmanagement1-management-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1610,7 +1610,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1649,7 +1649,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("achievements", "methods: 'reset', 'reset-all', 'reset-all-for-all-players', 'reset-for-all-players' and 'reset-multiple-for-all-players'", vec![ - ("reset", + ("reset", Some(r##"Resets the achievement with the given ID for the currently authenticated player. This method is only accessible to whitelisted tester accounts for your application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/achievements_reset", vec![ @@ -1671,7 +1671,7 @@ fn main() { Some(false), Some(false)), ]), - ("reset-all", + ("reset-all", Some(r##"Resets all achievements for the currently authenticated player for your application. This method is only accessible to whitelisted tester accounts for your application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/achievements_reset-all", vec![ @@ -1687,7 +1687,7 @@ fn main() { Some(false), Some(false)), ]), - ("reset-all-for-all-players", + ("reset-all-for-all-players", Some(r##"Resets all draft achievements for all players. This method is only available to user accounts for your developer console."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/achievements_reset-all-for-all-players", vec![ @@ -1697,7 +1697,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-for-all-players", + ("reset-for-all-players", Some(r##"Resets the achievement with the given ID for all players. This method is only available to user accounts for your developer console. Only draft achievements can be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/achievements_reset-for-all-players", vec![ @@ -1713,7 +1713,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-multiple-for-all-players", + ("reset-multiple-for-all-players", Some(r##"Resets achievements with the given IDs for all players. This method is only available to user accounts for your developer console. Only draft achievements may be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/achievements_reset-multiple-for-all-players", vec![ @@ -1732,7 +1732,7 @@ fn main() { ]), ("applications", "methods: 'list-hidden'", vec![ - ("list-hidden", + ("list-hidden", Some(r##"Get the list of players hidden from the given application. This method is only available to user accounts for your developer console."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/applications_list-hidden", vec![ @@ -1757,7 +1757,7 @@ fn main() { ]), ("events", "methods: 'reset', 'reset-all', 'reset-all-for-all-players', 'reset-for-all-players' and 'reset-multiple-for-all-players'", vec![ - ("reset", + ("reset", Some(r##"Resets all player progress on the event with the given ID for the currently authenticated player. This method is only accessible to whitelisted tester accounts for your application. All quests for this player that use the event will also be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/events_reset", vec![ @@ -1773,7 +1773,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-all", + ("reset-all", Some(r##"Resets all player progress on all events for the currently authenticated player. This method is only accessible to whitelisted tester accounts for your application. All quests for this player will also be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/events_reset-all", vec![ @@ -1783,7 +1783,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-all-for-all-players", + ("reset-all-for-all-players", Some(r##"Resets all draft events for all players. This method is only available to user accounts for your developer console. All quests that use any of these events will also be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/events_reset-all-for-all-players", vec![ @@ -1793,7 +1793,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-for-all-players", + ("reset-for-all-players", Some(r##"Resets the event with the given ID for all players. This method is only available to user accounts for your developer console. Only draft events can be reset. All quests that use the event will also be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/events_reset-for-all-players", vec![ @@ -1809,7 +1809,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-multiple-for-all-players", + ("reset-multiple-for-all-players", Some(r##"Resets events with the given IDs for all players. This method is only available to user accounts for your developer console. Only draft events may be reset. All quests that use any of the events will also be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/events_reset-multiple-for-all-players", vec![ @@ -1828,7 +1828,7 @@ fn main() { ]), ("players", "methods: 'hide' and 'unhide'", vec![ - ("hide", + ("hide", Some(r##"Hide the given player's leaderboard scores from the given application. This method is only available to user accounts for your developer console."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/players_hide", vec![ @@ -1850,7 +1850,7 @@ fn main() { Some(false), Some(true)), ]), - ("unhide", + ("unhide", Some(r##"Unhide the given player's leaderboard scores from the given application. This method is only available to user accounts for your developer console."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/players_unhide", vec![ @@ -1875,7 +1875,7 @@ fn main() { ]), ("quests", "methods: 'reset', 'reset-all', 'reset-all-for-all-players', 'reset-for-all-players' and 'reset-multiple-for-all-players'", vec![ - ("reset", + ("reset", Some(r##"Resets all player progress on the quest with the given ID for the currently authenticated player. This method is only accessible to whitelisted tester accounts for your application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/quests_reset", vec![ @@ -1891,7 +1891,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-all", + ("reset-all", Some(r##"Resets all player progress on all quests for the currently authenticated player. This method is only accessible to whitelisted tester accounts for your application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/quests_reset-all", vec![ @@ -1901,7 +1901,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-all-for-all-players", + ("reset-all-for-all-players", Some(r##"Resets all draft quests for all players. This method is only available to user accounts for your developer console."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/quests_reset-all-for-all-players", vec![ @@ -1911,7 +1911,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-for-all-players", + ("reset-for-all-players", Some(r##"Resets all player progress on the quest with the given ID for all players. This method is only available to user accounts for your developer console. Only draft quests can be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/quests_reset-for-all-players", vec![ @@ -1927,7 +1927,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-multiple-for-all-players", + ("reset-multiple-for-all-players", Some(r##"Resets quests with the given IDs for all players. This method is only available to user accounts for your developer console. Only draft quests may be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/quests_reset-multiple-for-all-players", vec![ @@ -1946,7 +1946,7 @@ fn main() { ]), ("rooms", "methods: 'reset' and 'reset-for-all-players'", vec![ - ("reset", + ("reset", Some(r##"Reset all rooms for the currently authenticated player for your application. This method is only accessible to whitelisted tester accounts for your application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/rooms_reset", vec![ @@ -1956,7 +1956,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-for-all-players", + ("reset-for-all-players", Some(r##"Deletes rooms where the only room participants are from whitelisted tester accounts for your application. This method is only available to user accounts for your developer console."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/rooms_reset-for-all-players", vec![ @@ -1969,7 +1969,7 @@ fn main() { ]), ("scores", "methods: 'reset', 'reset-all', 'reset-all-for-all-players', 'reset-for-all-players' and 'reset-multiple-for-all-players'", vec![ - ("reset", + ("reset", Some(r##"Resets scores for the leaderboard with the given ID for the currently authenticated player. This method is only accessible to whitelisted tester accounts for your application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/scores_reset", vec![ @@ -1991,7 +1991,7 @@ fn main() { Some(false), Some(false)), ]), - ("reset-all", + ("reset-all", Some(r##"Resets all scores for all leaderboards for the currently authenticated players. This method is only accessible to whitelisted tester accounts for your application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/scores_reset-all", vec![ @@ -2007,7 +2007,7 @@ fn main() { Some(false), Some(false)), ]), - ("reset-all-for-all-players", + ("reset-all-for-all-players", Some(r##"Resets scores for all draft leaderboards for all players. This method is only available to user accounts for your developer console."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/scores_reset-all-for-all-players", vec![ @@ -2017,7 +2017,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-for-all-players", + ("reset-for-all-players", Some(r##"Resets scores for the leaderboard with the given ID for all players. This method is only available to user accounts for your developer console. Only draft leaderboards can be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/scores_reset-for-all-players", vec![ @@ -2033,7 +2033,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-multiple-for-all-players", + ("reset-multiple-for-all-players", Some(r##"Resets scores for the leaderboards with the given IDs for all players. This method is only available to user accounts for your developer console. Only draft leaderboards may be reset."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/scores_reset-multiple-for-all-players", vec![ @@ -2052,7 +2052,7 @@ fn main() { ]), ("turn-based-matches", "methods: 'reset' and 'reset-for-all-players'", vec![ - ("reset", + ("reset", Some(r##"Reset all turn-based match data for a user. This method is only accessible to whitelisted tester accounts for your application."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/turn-based-matches_reset", vec![ @@ -2062,7 +2062,7 @@ fn main() { Some(false), Some(true)), ]), - ("reset-for-all-players", + ("reset-for-all-players", Some(r##"Deletes turn-based matches where the only match participants are from whitelisted tester accounts for your application. This method is only available to user accounts for your developer console."##), "Details at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli/turn-based-matches_reset-for-all-players", vec![ @@ -2078,7 +2078,7 @@ fn main() { let mut app = App::new("gamesmanagement1-management") .author("Sebastian Thiel ") - .version("0.3.2+20151012") + .version("0.3.3+20160126") .about("The Management API for Google Play Game Services.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_gamesmanagement1_management_cli") .arg(Arg::with_name("url") @@ -2102,7 +2102,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -2113,7 +2113,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/gamesmanagement1_management/Cargo.toml b/gen/gamesmanagement1_management/Cargo.toml index 4bdfaf84f4..bcd5382dd3 100644 --- a/gen/gamesmanagement1_management/Cargo.toml +++ b/gen/gamesmanagement1_management/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gamesmanagement1_management" -version = "0.1.10+20151012" +version = "0.1.11+20160126" authors = ["Sebastian Thiel "] description = "A complete library to interact with Games Management (protocol v1management)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gamesmanagement1_management" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/gamesmanagement1_management/LICENSE.md b/gen/gamesmanagement1_management/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/gamesmanagement1_management/LICENSE.md +++ b/gen/gamesmanagement1_management/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/gamesmanagement1_management/README.md b/gen/gamesmanagement1_management/README.md index 9ecef1714f..4f69d0fedd 100644 --- a/gen/gamesmanagement1_management/README.md +++ b/gen/gamesmanagement1_management/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-gamesmanagement1_management` library allows access to all features of the *Google Games Management* service. -This documentation was generated from *Games Management* crate version *0.1.10+20151012*, where *20151012* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Games Management* crate version *0.1.11+20160126*, where *20160126* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Games Management* *v1_management* API can be found at the [official documentation site](https://developers.google.com/games/services). diff --git a/gen/gamesmanagement1_management/src/cmn.rs b/gen/gamesmanagement1_management/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/gamesmanagement1_management/src/cmn.rs +++ b/gen/gamesmanagement1_management/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/gamesmanagement1_management/src/lib.rs b/gen/gamesmanagement1_management/src/lib.rs index e607e407b2..26816a0547 100644 --- a/gen/gamesmanagement1_management/src/lib.rs +++ b/gen/gamesmanagement1_management/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Games Management* crate version *0.1.10+20151012*, where *20151012* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Games Management* crate version *0.1.11+20160126*, where *20160126* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Games Management* *v1_management* API can be found at the //! [official documentation site](https://developers.google.com/games/services). diff --git a/gen/gamesmanagement1_management/src/lib.rs.in b/gen/gamesmanagement1_management/src/lib.rs.in index 1c96936535..8cb6f960ab 100644 --- a/gen/gamesmanagement1_management/src/lib.rs.in +++ b/gen/gamesmanagement1_management/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -130,7 +131,7 @@ impl<'a, C, A> GamesManagement GamesManagement { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -160,7 +161,7 @@ impl<'a, C, A> GamesManagement } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -335,6 +336,9 @@ impl ResponseResult for PlayerScoreResetAllResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Player { + /// The player ID that was used for this player the first time they signed into the game in question. This is only populated for calls to player.get for the requesting player, only if the player ID has subsequently changed, and only to clients that support remapping player IDs. + #[serde(rename="originalPlayerId")] + pub original_player_id: Option, /// Uniquely identifies the type of this resource. Value is always the fixed string gamesManagement#player. pub kind: Option, /// The name to display for the player. @@ -342,17 +346,23 @@ pub struct Player { pub display_name: Option, /// An object representation of the individual components of the player's name. For some players, these fields may not be present. pub name: Option, - /// The player's title rewarded for their game activities. - pub title: Option, - /// The ID of the player. - #[serde(rename="playerId")] - pub player_id: Option, /// Details about the last time this player played a multiplayer game with the currently authenticated player. Populated for PLAYED_WITH player collection members. #[serde(rename="lastPlayedWith")] pub last_played_with: Option, + /// The ID of the player. + #[serde(rename="playerId")] + pub player_id: Option, + /// The url to the portrait mode player banner image. + #[serde(rename="bannerUrlPortrait")] + pub banner_url_portrait: Option, + /// The player's title rewarded for their game activities. + pub title: Option, /// An object to represent Play Game experience information for the player. #[serde(rename="experienceInfo")] pub experience_info: Option, + /// The url to the landscape mode player banner image. + #[serde(rename="bannerUrlLandscape")] + pub banner_url_landscape: Option, /// The base URL for the image that represents the player. #[serde(rename="avatarImageUrl")] pub avatar_image_url: Option, @@ -1306,7 +1316,7 @@ impl<'a, C, A> AchievementResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.achievements.resetAllForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.achievements.resetAllForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -1325,7 +1335,7 @@ impl<'a, C, A> AchievementResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut< self._scopes.insert(Scope::Game.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1361,7 +1371,7 @@ impl<'a, C, A> AchievementResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1371,10 +1381,10 @@ impl<'a, C, A> AchievementResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1405,12 +1415,12 @@ impl<'a, C, A> AchievementResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1427,17 +1437,17 @@ impl<'a, C, A> AchievementResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AchievementResetAllForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementResetAllForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1499,7 +1509,7 @@ impl<'a, C, A> AchievementResetForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.achievements.resetForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.achievements.resetForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("achievementId", self._achievement_id.to_string())); @@ -1540,7 +1550,7 @@ impl<'a, C, A> AchievementResetForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1576,7 +1586,7 @@ impl<'a, C, A> AchievementResetForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1586,10 +1596,10 @@ impl<'a, C, A> AchievementResetForAllPlayerCall<'a, C, A> where C: BorrowMut AchievementResetForAllPlayerCall<'a, C, A> where C: BorrowMut AchievementResetForAllPlayerCall<'a, C, A> { self._achievement_id = new_value.to_string(); @@ -1630,12 +1640,12 @@ impl<'a, C, A> AchievementResetForAllPlayerCall<'a, C, A> where C: BorrowMut AchievementResetForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementResetForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementResetForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1724,7 +1734,7 @@ impl<'a, C, A> AchievementResetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.achievements.reset", + dlg.begin(MethodInfo { id: "gamesManagement.achievements.reset", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("achievementId", self._achievement_id.to_string())); @@ -1766,7 +1776,7 @@ impl<'a, C, A> AchievementResetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1802,7 +1812,7 @@ impl<'a, C, A> AchievementResetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1812,10 +1822,10 @@ impl<'a, C, A> AchievementResetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1848,7 +1858,7 @@ impl<'a, C, A> AchievementResetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *achievement id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn achievement_id(mut self, new_value: &str) -> AchievementResetCall<'a, C, A> { self._achievement_id = new_value.to_string(); @@ -1866,12 +1876,12 @@ impl<'a, C, A> AchievementResetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1888,17 +1898,17 @@ impl<'a, C, A> AchievementResetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AchievementResetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementResetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1966,7 +1976,7 @@ impl<'a, C, A> AchievementResetMultipleForAllPlayerCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.achievements.resetMultipleForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.achievements.resetMultipleForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in [].iter() { @@ -1985,14 +1995,14 @@ impl<'a, C, A> AchievementResetMultipleForAllPlayerCall<'a, C, A> where C: Borro self._scopes.insert(Scope::Game.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2036,7 +2046,7 @@ impl<'a, C, A> AchievementResetMultipleForAllPlayerCall<'a, C, A> where C: Borro match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2046,10 +2056,10 @@ impl<'a, C, A> AchievementResetMultipleForAllPlayerCall<'a, C, A> where C: Borro if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2071,7 +2081,7 @@ impl<'a, C, A> AchievementResetMultipleForAllPlayerCall<'a, C, A> where C: Borro /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: AchievementResetMultipleForAllRequest) -> AchievementResetMultipleForAllPlayerCall<'a, C, A> { self._request = new_value; @@ -2089,12 +2099,12 @@ impl<'a, C, A> AchievementResetMultipleForAllPlayerCall<'a, C, A> where C: Borro } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2111,17 +2121,17 @@ impl<'a, C, A> AchievementResetMultipleForAllPlayerCall<'a, C, A> where C: Borro } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AchievementResetMultipleForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementResetMultipleForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2182,7 +2192,7 @@ impl<'a, C, A> AchievementResetAllCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.achievements.resetAll", + dlg.begin(MethodInfo { id: "gamesManagement.achievements.resetAll", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2202,7 +2212,7 @@ impl<'a, C, A> AchievementResetAllCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2238,7 +2248,7 @@ impl<'a, C, A> AchievementResetAllCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2248,10 +2258,10 @@ impl<'a, C, A> AchievementResetAllCall<'a, C, A> where C: BorrowMut AchievementResetAllCall<'a, C, A> where C: BorrowMut AchievementResetAllCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AchievementResetAllCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AchievementResetAllCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2387,7 +2397,7 @@ impl<'a, C, A> PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.players.hide", + dlg.begin(MethodInfo { id: "gamesManagement.players.hide", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("applicationId", self._application_id.to_string())); @@ -2429,7 +2439,7 @@ impl<'a, C, A> PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2465,7 +2475,7 @@ impl<'a, C, A> PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2475,10 +2485,10 @@ impl<'a, C, A> PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2501,7 +2511,7 @@ impl<'a, C, A> PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *application id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn application_id(mut self, new_value: &str) -> PlayerHideCall<'a, C, A> { self._application_id = new_value.to_string(); @@ -2511,7 +2521,7 @@ impl<'a, C, A> PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *player id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn player_id(mut self, new_value: &str) -> PlayerHideCall<'a, C, A> { self._player_id = new_value.to_string(); @@ -2529,12 +2539,12 @@ impl<'a, C, A> PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2551,17 +2561,17 @@ impl<'a, C, A> PlayerHideCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlayerHideCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlayerHideCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2624,7 +2634,7 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.players.unhide", + dlg.begin(MethodInfo { id: "gamesManagement.players.unhide", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("applicationId", self._application_id.to_string())); @@ -2666,7 +2676,7 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2702,7 +2712,7 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2712,10 +2722,10 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2738,7 +2748,7 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *application id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn application_id(mut self, new_value: &str) -> PlayerUnhideCall<'a, C, A> { self._application_id = new_value.to_string(); @@ -2748,7 +2758,7 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *player id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn player_id(mut self, new_value: &str) -> PlayerUnhideCall<'a, C, A> { self._player_id = new_value.to_string(); @@ -2766,12 +2776,12 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2788,17 +2798,17 @@ impl<'a, C, A> PlayerUnhideCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlayerUnhideCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlayerUnhideCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2866,7 +2876,7 @@ impl<'a, C, A> ScoreResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.scores.resetMultipleForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.scores.resetMultipleForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in [].iter() { @@ -2885,14 +2895,14 @@ impl<'a, C, A> ScoreResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2936,7 +2946,7 @@ impl<'a, C, A> ScoreResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2946,10 +2956,10 @@ impl<'a, C, A> ScoreResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetMultipleForAllPlayerCall<'a, C, A> { self._request = new_value; @@ -2989,12 +2999,12 @@ impl<'a, C, A> ScoreResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ScoreResetMultipleForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScoreResetMultipleForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3082,7 +3092,7 @@ impl<'a, C, A> ScoreResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.scores.resetAllForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.scores.resetAllForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -3101,7 +3111,7 @@ impl<'a, C, A> ScoreResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3137,7 +3147,7 @@ impl<'a, C, A> ScoreResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3147,10 +3157,10 @@ impl<'a, C, A> ScoreResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ScoreResetAllForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScoreResetAllForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3274,7 +3284,7 @@ impl<'a, C, A> ScoreResetAllCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.scores.resetAll", + dlg.begin(MethodInfo { id: "gamesManagement.scores.resetAll", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3294,7 +3304,7 @@ impl<'a, C, A> ScoreResetAllCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Game.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3330,7 +3340,7 @@ impl<'a, C, A> ScoreResetAllCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3340,10 +3350,10 @@ impl<'a, C, A> ScoreResetAllCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3384,12 +3394,12 @@ impl<'a, C, A> ScoreResetAllCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3406,17 +3416,17 @@ impl<'a, C, A> ScoreResetAllCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ScoreResetAllCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScoreResetAllCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3478,7 +3488,7 @@ impl<'a, C, A> ScoreResetForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.scores.resetForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.scores.resetForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("leaderboardId", self._leaderboard_id.to_string())); @@ -3519,7 +3529,7 @@ impl<'a, C, A> ScoreResetForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3555,7 +3565,7 @@ impl<'a, C, A> ScoreResetForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3565,10 +3575,10 @@ impl<'a, C, A> ScoreResetForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetForAllPlayerCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -3609,12 +3619,12 @@ impl<'a, C, A> ScoreResetForAllPlayerCall<'a, C, A> where C: BorrowMut ScoreResetForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ScoreResetForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScoreResetForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3703,7 +3713,7 @@ impl<'a, C, A> ScoreResetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.scores.reset", + dlg.begin(MethodInfo { id: "gamesManagement.scores.reset", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("leaderboardId", self._leaderboard_id.to_string())); @@ -3745,7 +3755,7 @@ impl<'a, C, A> ScoreResetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3781,7 +3791,7 @@ impl<'a, C, A> ScoreResetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3791,10 +3801,10 @@ impl<'a, C, A> ScoreResetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3827,7 +3837,7 @@ impl<'a, C, A> ScoreResetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *leaderboard id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn leaderboard_id(mut self, new_value: &str) -> ScoreResetCall<'a, C, A> { self._leaderboard_id = new_value.to_string(); @@ -3845,12 +3855,12 @@ impl<'a, C, A> ScoreResetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3867,17 +3877,17 @@ impl<'a, C, A> ScoreResetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ScoreResetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScoreResetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3938,7 +3948,7 @@ impl<'a, C, A> TurnBasedMatcheResetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.turnBasedMatches.reset", + dlg.begin(MethodInfo { id: "gamesManagement.turnBasedMatches.reset", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -3957,7 +3967,7 @@ impl<'a, C, A> TurnBasedMatcheResetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3993,7 +4003,7 @@ impl<'a, C, A> TurnBasedMatcheResetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4003,10 +4013,10 @@ impl<'a, C, A> TurnBasedMatcheResetCall<'a, C, A> where C: BorrowMut TurnBasedMatcheResetCall<'a, C, A> where C: BorrowMut TurnBasedMatcheResetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TurnBasedMatcheResetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheResetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4130,7 +4140,7 @@ impl<'a, C, A> TurnBasedMatcheResetForAllPlayerCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.turnBasedMatches.resetForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.turnBasedMatches.resetForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -4149,7 +4159,7 @@ impl<'a, C, A> TurnBasedMatcheResetForAllPlayerCall<'a, C, A> where C: BorrowMut self._scopes.insert(Scope::Game.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4185,7 +4195,7 @@ impl<'a, C, A> TurnBasedMatcheResetForAllPlayerCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4195,10 +4205,10 @@ impl<'a, C, A> TurnBasedMatcheResetForAllPlayerCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4229,12 +4239,12 @@ impl<'a, C, A> TurnBasedMatcheResetForAllPlayerCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4251,17 +4261,17 @@ impl<'a, C, A> TurnBasedMatcheResetForAllPlayerCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TurnBasedMatcheResetForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TurnBasedMatcheResetForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4327,7 +4337,7 @@ impl<'a, C, A> ApplicationListHiddenCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.applications.listHidden", + dlg.begin(MethodInfo { id: "gamesManagement.applications.listHidden", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("applicationId", self._application_id.to_string())); @@ -4375,7 +4385,7 @@ impl<'a, C, A> ApplicationListHiddenCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4411,7 +4421,7 @@ impl<'a, C, A> ApplicationListHiddenCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4421,10 +4431,10 @@ impl<'a, C, A> ApplicationListHiddenCall<'a, C, A> where C: BorrowMut ApplicationListHiddenCall<'a, C, A> where C: BorrowMut ApplicationListHiddenCall<'a, C, A> { self._application_id = new_value.to_string(); @@ -4489,12 +4499,12 @@ impl<'a, C, A> ApplicationListHiddenCall<'a, C, A> where C: BorrowMut ApplicationListHiddenCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ApplicationListHiddenCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ApplicationListHiddenCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4582,7 +4592,7 @@ impl<'a, C, A> RoomResetForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.rooms.resetForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.rooms.resetForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -4601,7 +4611,7 @@ impl<'a, C, A> RoomResetForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4637,7 +4647,7 @@ impl<'a, C, A> RoomResetForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4647,10 +4657,10 @@ impl<'a, C, A> RoomResetForAllPlayerCall<'a, C, A> where C: BorrowMut RoomResetForAllPlayerCall<'a, C, A> where C: BorrowMut RoomResetForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RoomResetForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RoomResetForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4774,7 +4784,7 @@ impl<'a, C, A> RoomResetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.rooms.reset", + dlg.begin(MethodInfo { id: "gamesManagement.rooms.reset", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -4793,7 +4803,7 @@ impl<'a, C, A> RoomResetCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Game.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4829,7 +4839,7 @@ impl<'a, C, A> RoomResetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4839,10 +4849,10 @@ impl<'a, C, A> RoomResetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4873,12 +4883,12 @@ impl<'a, C, A> RoomResetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4895,17 +4905,17 @@ impl<'a, C, A> RoomResetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RoomResetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RoomResetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4966,7 +4976,7 @@ impl<'a, C, A> QuestResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.quests.resetAllForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.quests.resetAllForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -4985,7 +4995,7 @@ impl<'a, C, A> QuestResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5021,7 +5031,7 @@ impl<'a, C, A> QuestResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5031,10 +5041,10 @@ impl<'a, C, A> QuestResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> QuestResetAllForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> QuestResetAllForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5165,7 +5175,7 @@ impl<'a, C, A> QuestResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.quests.resetMultipleForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.quests.resetMultipleForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in [].iter() { @@ -5184,14 +5194,14 @@ impl<'a, C, A> QuestResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5235,7 +5245,7 @@ impl<'a, C, A> QuestResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5245,10 +5255,10 @@ impl<'a, C, A> QuestResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetMultipleForAllPlayerCall<'a, C, A> { self._request = new_value; @@ -5288,12 +5298,12 @@ impl<'a, C, A> QuestResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> QuestResetMultipleForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> QuestResetMultipleForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5381,7 +5391,7 @@ impl<'a, C, A> QuestResetAllCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.quests.resetAll", + dlg.begin(MethodInfo { id: "gamesManagement.quests.resetAll", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -5400,7 +5410,7 @@ impl<'a, C, A> QuestResetAllCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Game.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5436,7 +5446,7 @@ impl<'a, C, A> QuestResetAllCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5446,10 +5456,10 @@ impl<'a, C, A> QuestResetAllCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5480,12 +5490,12 @@ impl<'a, C, A> QuestResetAllCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5502,17 +5512,17 @@ impl<'a, C, A> QuestResetAllCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> QuestResetAllCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> QuestResetAllCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5574,7 +5584,7 @@ impl<'a, C, A> QuestResetForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.quests.resetForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.quests.resetForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("questId", self._quest_id.to_string())); @@ -5615,7 +5625,7 @@ impl<'a, C, A> QuestResetForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5651,7 +5661,7 @@ impl<'a, C, A> QuestResetForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5661,10 +5671,10 @@ impl<'a, C, A> QuestResetForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetForAllPlayerCall<'a, C, A> { self._quest_id = new_value.to_string(); @@ -5705,12 +5715,12 @@ impl<'a, C, A> QuestResetForAllPlayerCall<'a, C, A> where C: BorrowMut QuestResetForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> QuestResetForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> QuestResetForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5799,7 +5809,7 @@ impl<'a, C, A> QuestResetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.quests.reset", + dlg.begin(MethodInfo { id: "gamesManagement.quests.reset", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("questId", self._quest_id.to_string())); @@ -5840,7 +5850,7 @@ impl<'a, C, A> QuestResetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5876,7 +5886,7 @@ impl<'a, C, A> QuestResetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5886,10 +5896,10 @@ impl<'a, C, A> QuestResetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5912,7 +5922,7 @@ impl<'a, C, A> QuestResetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *quest id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn quest_id(mut self, new_value: &str) -> QuestResetCall<'a, C, A> { self._quest_id = new_value.to_string(); @@ -5930,12 +5940,12 @@ impl<'a, C, A> QuestResetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5952,17 +5962,17 @@ impl<'a, C, A> QuestResetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> QuestResetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> QuestResetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6023,7 +6033,7 @@ impl<'a, C, A> EventResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.events.resetAllForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.events.resetAllForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -6042,7 +6052,7 @@ impl<'a, C, A> EventResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6078,7 +6088,7 @@ impl<'a, C, A> EventResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6088,10 +6098,10 @@ impl<'a, C, A> EventResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetAllForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EventResetAllForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventResetAllForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6216,7 +6226,7 @@ impl<'a, C, A> EventResetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.events.reset", + dlg.begin(MethodInfo { id: "gamesManagement.events.reset", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("eventId", self._event_id.to_string())); @@ -6257,7 +6267,7 @@ impl<'a, C, A> EventResetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6293,7 +6303,7 @@ impl<'a, C, A> EventResetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6303,10 +6313,10 @@ impl<'a, C, A> EventResetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6329,7 +6339,7 @@ impl<'a, C, A> EventResetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *event id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn event_id(mut self, new_value: &str) -> EventResetCall<'a, C, A> { self._event_id = new_value.to_string(); @@ -6347,12 +6357,12 @@ impl<'a, C, A> EventResetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6369,17 +6379,17 @@ impl<'a, C, A> EventResetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventResetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventResetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6440,7 +6450,7 @@ impl<'a, C, A> EventResetAllCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.events.resetAll", + dlg.begin(MethodInfo { id: "gamesManagement.events.resetAll", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((1 + self._additional_params.len())); for &field in [].iter() { @@ -6459,7 +6469,7 @@ impl<'a, C, A> EventResetAllCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Game.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6495,7 +6505,7 @@ impl<'a, C, A> EventResetAllCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6505,10 +6515,10 @@ impl<'a, C, A> EventResetAllCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6539,12 +6549,12 @@ impl<'a, C, A> EventResetAllCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6561,17 +6571,17 @@ impl<'a, C, A> EventResetAllCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Game`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> EventResetAllCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventResetAllCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6639,7 +6649,7 @@ impl<'a, C, A> EventResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.events.resetMultipleForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.events.resetMultipleForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in [].iter() { @@ -6658,14 +6668,14 @@ impl<'a, C, A> EventResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6709,7 +6719,7 @@ impl<'a, C, A> EventResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6719,10 +6729,10 @@ impl<'a, C, A> EventResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetMultipleForAllPlayerCall<'a, C, A> { self._request = new_value; @@ -6762,12 +6772,12 @@ impl<'a, C, A> EventResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetMultipleForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EventResetMultipleForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventResetMultipleForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6856,7 +6866,7 @@ impl<'a, C, A> EventResetForAllPlayerCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gamesManagement.events.resetForAllPlayers", + dlg.begin(MethodInfo { id: "gamesManagement.events.resetForAllPlayers", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("eventId", self._event_id.to_string())); @@ -6897,7 +6907,7 @@ impl<'a, C, A> EventResetForAllPlayerCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6933,7 +6943,7 @@ impl<'a, C, A> EventResetForAllPlayerCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6943,10 +6953,10 @@ impl<'a, C, A> EventResetForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetForAllPlayerCall<'a, C, A> { self._event_id = new_value.to_string(); @@ -6987,12 +6997,12 @@ impl<'a, C, A> EventResetForAllPlayerCall<'a, C, A> where C: BorrowMut EventResetForAllPlayerCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> EventResetForAllPlayerCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> EventResetForAllPlayerCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/gan1_beta1-cli/Cargo.toml b/gen/gan1_beta1-cli/Cargo.toml index 4f9cbcb971..5a586096e1 100644 --- a/gen/gan1_beta1-cli/Cargo.toml +++ b/gen/gan1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gan1_beta1-cli" -version = "0.3.2+20130205" +version = "0.3.3+20130205" authors = ["Sebastian Thiel "] description = "A complete library to interact with gan (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gan1_beta1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/gan1_beta1-cli/LICENSE.md b/gen/gan1_beta1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/gan1_beta1-cli/LICENSE.md +++ b/gen/gan1_beta1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/gan1_beta1-cli/README.md b/gen/gan1_beta1-cli/README.md index c53b45a74e..aead160222 100644 --- a/gen/gan1_beta1-cli/README.md +++ b/gen/gan1_beta1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *gan* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/gan1-beta1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/gan1-beta1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/gan1-beta1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/gan1-beta1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/gan1_beta1-cli). # Usage -This documentation was generated from the *gan* API at revision *20130205*. The CLI is at version *0.3.2*. +This documentation was generated from the *gan* API at revision *20130205*. The CLI is at version *0.3.3*. ```bash gan1-beta1 [options] @@ -48,14 +48,14 @@ gan1-beta1 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/gan1_beta1-cli/mkdocs.yml b/gen/gan1_beta1-cli/mkdocs.yml index 3e92511233..aa9bbf0dd0 100644 --- a/gen/gan1_beta1-cli/mkdocs.yml +++ b/gen/gan1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: gan v0.3.2+20130205 +site_name: gan v0.3.3+20130205 site_url: http://byron.github.io/google-apis-rs/google-gan1_beta1-cli site_description: Write integrating applications with bcore @@ -22,5 +22,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/gan1_beta1-cli/src/main.rs b/gen/gan1_beta1-cli/src/main.rs index 5b8622521a..20a1e11191 100644 --- a/gen/gan1_beta1-cli/src/main.rs +++ b/gen/gan1_beta1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Gan>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _advertisers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _advertisers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertisers().get(opt.value_of("role").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "advertiser-id" => { @@ -64,7 +64,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["advertiser-id"].iter().map(|v|*v)); @@ -98,10 +98,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _advertisers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _advertisers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.advertisers().list(opt.value_of("role").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "relationship-status" => { @@ -135,7 +135,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["relationship-status", "min-seven-day-epc", "advertiser-category", "max-results", "page-token", "min-ninety-day-epc", "min-payout-rank"].iter().map(|v|*v)); @@ -169,10 +169,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _cc_offers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _cc_offers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.cc_offers().list(opt.value_of("publisher").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -191,7 +191,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["advertiser", "projection"].iter().map(|v|*v)); @@ -225,10 +225,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _events_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _events_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.events().list(opt.value_of("role").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "type" => { @@ -289,7 +289,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "sku", "modify-date-max", "type", "link-id", "event-date-min", "member-id", "product-category", "order-id", "page-token", "advertiser-id", "max-results", "charge-type", "modify-date-min", "event-date-max", "publisher-id"].iter().map(|v|*v)); @@ -323,10 +323,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _links_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _links_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.links().get(opt.value_of("role").unwrap_or(""), opt.value_of("role-id").unwrap_or(""), opt.value_of("link-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -339,7 +339,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -372,13 +372,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _links_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _links_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -392,8 +392,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "link-type" => Some(("linkType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -441,7 +441,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Link = json::value::from_value(object).unwrap(); let mut call = self.hub.links().insert(request, opt.value_of("role").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -454,7 +454,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -487,10 +487,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _links_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _links_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.links().list(opt.value_of("role").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-date-min" => { @@ -542,7 +542,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-date-min", "link-type", "relationship-status", "search-text", "create-date-max", "create-date-min", "asset-size", "start-date-max", "advertiser-id", "page-token", "max-results", "promotion-type", "authorship"].iter().map(|v|*v)); @@ -576,10 +576,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _publishers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _publishers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.publishers().get(opt.value_of("role").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "publisher-id" => { @@ -595,7 +595,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["publisher-id"].iter().map(|v|*v)); @@ -629,10 +629,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _publishers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _publishers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.publishers().list(opt.value_of("role").unwrap_or(""), opt.value_of("role-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "relationship-status" => { @@ -666,7 +666,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["publisher-category", "relationship-status", "min-seven-day-epc", "min-ninety-day-epc", "page-token", "max-results", "min-payout-rank"].iter().map(|v|*v)); @@ -700,10 +700,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().get(opt.value_of("role").unwrap_or(""), opt.value_of("role-id").unwrap_or(""), opt.value_of("report-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "status" => { @@ -749,7 +749,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "start-date", "end-date", "advertiser-id", "link-id", "max-results", "order-id", "start-index", "event-type", "calculate-totals", "publisher-id"].iter().map(|v|*v)); @@ -883,14 +883,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "gan1-beta1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "gan1-beta1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -910,7 +910,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -949,7 +949,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("advertisers", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves data about a single advertiser if that the requesting advertiser/publisher has access to it. Only publishers can lookup advertisers. Advertisers can request information about themselves by omitting the advertiserId query parameter."##), "Details at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli/advertisers_get", vec![ @@ -977,7 +977,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves data about all advertisers that the requesting advertiser/publisher has access to."##), "Details at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli/advertisers_list", vec![ @@ -1008,7 +1008,7 @@ fn main() { ]), ("cc-offers", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves credit card offers for the given publisher."##), "Details at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli/cc-offers_list", vec![ @@ -1033,7 +1033,7 @@ fn main() { ]), ("events", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves event data for a given advertiser/publisher."##), "Details at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli/events_list", vec![ @@ -1064,7 +1064,7 @@ fn main() { ]), ("links", "methods: 'get', 'insert' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves data about a single link if the requesting advertiser/publisher has access to it. Advertisers can look up their own links. Publishers can look up visible links or links belonging to advertisers they are in a relationship with."##), "Details at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli/links_get", vec![ @@ -1098,7 +1098,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new link."##), "Details at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli/links_insert", vec![ @@ -1132,7 +1132,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves all links that match the query parameters."##), "Details at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli/links_list", vec![ @@ -1163,7 +1163,7 @@ fn main() { ]), ("publishers", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves data about a single advertiser if that the requesting advertiser/publisher has access to it. Only advertisers can look up publishers. Publishers can request information about themselves by omitting the publisherId query parameter."##), "Details at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli/publishers_get", vec![ @@ -1191,7 +1191,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves data about all publishers that the requesting advertiser/publisher has access to."##), "Details at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli/publishers_list", vec![ @@ -1222,7 +1222,7 @@ fn main() { ]), ("reports", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Retrieves a report of the specified type."##), "Details at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli/reports_get", vec![ @@ -1262,7 +1262,7 @@ fn main() { let mut app = App::new("gan1-beta1") .author("Sebastian Thiel ") - .version("0.3.2+20130205") + .version("0.3.3+20130205") .about("Lets you have programmatic access to your Google Affiliate Network data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_gan1_beta1_cli") .arg(Arg::with_name("folder") @@ -1281,7 +1281,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1292,7 +1292,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/gan1_beta1/Cargo.toml b/gen/gan1_beta1/Cargo.toml index d97d3dae3b..af52c3717f 100644 --- a/gen/gan1_beta1/Cargo.toml +++ b/gen/gan1_beta1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gan1_beta1" -version = "0.1.10+20130205" +version = "0.1.11+20130205" authors = ["Sebastian Thiel "] description = "A complete library to interact with gan (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gan1_beta1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/gan1_beta1/LICENSE.md b/gen/gan1_beta1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/gan1_beta1/LICENSE.md +++ b/gen/gan1_beta1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/gan1_beta1/README.md b/gen/gan1_beta1/README.md index fa1c65df41..757ff3e602 100644 --- a/gen/gan1_beta1/README.md +++ b/gen/gan1_beta1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-gan1_beta1` library allows access to all features of the *Google gan* service. -This documentation was generated from *gan* crate version *0.1.10+20130205*, where *20130205* is the exact revision of the *gan:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *gan* crate version *0.1.11+20130205*, where *20130205* is the exact revision of the *gan:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *gan* *v1_beta1* API can be found at the [official documentation site](https://developers.google.com/affiliate-network/). diff --git a/gen/gan1_beta1/src/cmn.rs b/gen/gan1_beta1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/gan1_beta1/src/cmn.rs +++ b/gen/gan1_beta1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/gan1_beta1/src/lib.rs b/gen/gan1_beta1/src/lib.rs index 5538b223b2..90db5cf6c3 100644 --- a/gen/gan1_beta1/src/lib.rs +++ b/gen/gan1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *gan* crate version *0.1.10+20130205*, where *20130205* is the exact revision of the *gan:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *gan* crate version *0.1.11+20130205*, where *20130205* is the exact revision of the *gan:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *gan* *v1_beta1* API can be found at the //! [official documentation site](https://developers.google.com/affiliate-network/). diff --git a/gen/gan1_beta1/src/lib.rs.in b/gen/gan1_beta1/src/lib.rs.in index 987d268028..31fd250538 100644 --- a/gen/gan1_beta1/src/lib.rs.in +++ b/gen/gan1_beta1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -117,7 +118,7 @@ impl<'a, C, A> Gan Gan { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -141,7 +142,7 @@ impl<'a, C, A> Gan } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1483,7 +1484,7 @@ impl<'a, C, A> PublisherListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gan.publishers.list", + dlg.begin(MethodInfo { id: "gan.publishers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("role", self._role.to_string())); @@ -1556,7 +1557,7 @@ impl<'a, C, A> PublisherListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1577,7 +1578,7 @@ impl<'a, C, A> PublisherListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1587,10 +1588,10 @@ impl<'a, C, A> PublisherListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1623,7 +1624,7 @@ impl<'a, C, A> PublisherListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *role* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role(mut self, new_value: &str) -> PublisherListCall<'a, C, A> { self._role = new_value.to_string(); @@ -1633,7 +1634,7 @@ impl<'a, C, A> PublisherListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *role id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role_id(mut self, new_value: &str) -> PublisherListCall<'a, C, A> { self._role_id = new_value.to_string(); @@ -1700,12 +1701,12 @@ impl<'a, C, A> PublisherListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1780,7 +1781,7 @@ impl<'a, C, A> PublisherGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gan.publishers.get", + dlg.begin(MethodInfo { id: "gan.publishers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("role", self._role.to_string())); @@ -1835,7 +1836,7 @@ impl<'a, C, A> PublisherGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1856,7 +1857,7 @@ impl<'a, C, A> PublisherGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1866,10 +1867,10 @@ impl<'a, C, A> PublisherGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1902,7 +1903,7 @@ impl<'a, C, A> PublisherGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *role* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role(mut self, new_value: &str) -> PublisherGetCall<'a, C, A> { self._role = new_value.to_string(); @@ -1912,7 +1913,7 @@ impl<'a, C, A> PublisherGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *role id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role_id(mut self, new_value: &str) -> PublisherGetCall<'a, C, A> { self._role_id = new_value.to_string(); @@ -1937,12 +1938,12 @@ impl<'a, C, A> PublisherGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2022,7 +2023,7 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gan.links.insert", + dlg.begin(MethodInfo { id: "gan.links.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("role", self._role.to_string())); @@ -2074,14 +2075,14 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2110,7 +2111,7 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2120,10 +2121,10 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2155,7 +2156,7 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Link) -> LinkInsertCall<'a, C, A> { self._request = new_value; @@ -2165,7 +2166,7 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *role* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role(mut self, new_value: &str) -> LinkInsertCall<'a, C, A> { self._role = new_value.to_string(); @@ -2175,7 +2176,7 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *role id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role_id(mut self, new_value: &str) -> LinkInsertCall<'a, C, A> { self._role_id = new_value.to_string(); @@ -2193,12 +2194,12 @@ impl<'a, C, A> LinkInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2272,7 +2273,7 @@ impl<'a, C, A> LinkGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gan.links.get", + dlg.begin(MethodInfo { id: "gan.links.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("role", self._role.to_string())); @@ -2325,7 +2326,7 @@ impl<'a, C, A> LinkGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2346,7 +2347,7 @@ impl<'a, C, A> LinkGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2356,10 +2357,10 @@ impl<'a, C, A> LinkGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2392,7 +2393,7 @@ impl<'a, C, A> LinkGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *role* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role(mut self, new_value: &str) -> LinkGetCall<'a, C, A> { self._role = new_value.to_string(); @@ -2402,7 +2403,7 @@ impl<'a, C, A> LinkGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *role id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role_id(mut self, new_value: &str) -> LinkGetCall<'a, C, A> { self._role_id = new_value.to_string(); @@ -2412,7 +2413,7 @@ impl<'a, C, A> LinkGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *link id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn link_id(mut self, new_value: &str) -> LinkGetCall<'a, C, A> { self._link_id = new_value.to_string(); @@ -2430,12 +2431,12 @@ impl<'a, C, A> LinkGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2534,7 +2535,7 @@ impl<'a, C, A> LinkListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gan.links.list", + dlg.begin(MethodInfo { id: "gan.links.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((17 + self._additional_params.len())); params.push(("role", self._role.to_string())); @@ -2637,7 +2638,7 @@ impl<'a, C, A> LinkListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2658,7 +2659,7 @@ impl<'a, C, A> LinkListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2668,10 +2669,10 @@ impl<'a, C, A> LinkListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2704,7 +2705,7 @@ impl<'a, C, A> LinkListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *role* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role(mut self, new_value: &str) -> LinkListCall<'a, C, A> { self._role = new_value.to_string(); @@ -2714,7 +2715,7 @@ impl<'a, C, A> LinkListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *role id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role_id(mut self, new_value: &str) -> LinkListCall<'a, C, A> { self._role_id = new_value.to_string(); @@ -2826,12 +2827,12 @@ impl<'a, C, A> LinkListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2927,7 +2928,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gan.reports.get", + dlg.begin(MethodInfo { id: "gan.reports.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((16 + self._additional_params.len())); params.push(("role", self._role.to_string())); @@ -3029,7 +3030,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3050,7 +3051,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3060,10 +3061,10 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3096,7 +3097,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *role* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { self._role = new_value.to_string(); @@ -3106,7 +3107,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *role id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role_id(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { self._role_id = new_value.to_string(); @@ -3116,7 +3117,7 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *report type* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_type(mut self, new_value: &str) -> ReportGetCall<'a, C, A> { self._report_type = new_value.to_string(); @@ -3215,12 +3216,12 @@ impl<'a, C, A> ReportGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3296,7 +3297,7 @@ impl<'a, C, A> CcOfferListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gan.ccOffers.list", + dlg.begin(MethodInfo { id: "gan.ccOffers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("publisher", self._publisher.to_string())); @@ -3357,7 +3358,7 @@ impl<'a, C, A> CcOfferListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3378,7 +3379,7 @@ impl<'a, C, A> CcOfferListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3388,10 +3389,10 @@ impl<'a, C, A> CcOfferListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3424,7 +3425,7 @@ impl<'a, C, A> CcOfferListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *publisher* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn publisher(mut self, new_value: &str) -> CcOfferListCall<'a, C, A> { self._publisher = new_value.to_string(); @@ -3457,12 +3458,12 @@ impl<'a, C, A> CcOfferListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3537,7 +3538,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gan.advertisers.get", + dlg.begin(MethodInfo { id: "gan.advertisers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("role", self._role.to_string())); @@ -3592,7 +3593,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3613,7 +3614,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3623,10 +3624,10 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3659,7 +3660,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *role* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { self._role = new_value.to_string(); @@ -3669,7 +3670,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *role id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role_id(mut self, new_value: &str) -> AdvertiserGetCall<'a, C, A> { self._role_id = new_value.to_string(); @@ -3694,12 +3695,12 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3786,7 +3787,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gan.advertisers.list", + dlg.begin(MethodInfo { id: "gan.advertisers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("role", self._role.to_string())); @@ -3859,7 +3860,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3880,7 +3881,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3890,10 +3891,10 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3926,7 +3927,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *role* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { self._role = new_value.to_string(); @@ -3936,7 +3937,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *role id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role_id(mut self, new_value: &str) -> AdvertiserListCall<'a, C, A> { self._role_id = new_value.to_string(); @@ -4003,12 +4004,12 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4113,7 +4114,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gan.events.list", + dlg.begin(MethodInfo { id: "gan.events.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((20 + self._additional_params.len())); params.push(("role", self._role.to_string())); @@ -4213,7 +4214,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4234,7 +4235,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4244,10 +4245,10 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4280,7 +4281,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *role* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role(mut self, new_value: &str) -> EventListCall<'a, C, A> { self._role = new_value.to_string(); @@ -4290,7 +4291,7 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *role id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn role_id(mut self, new_value: &str) -> EventListCall<'a, C, A> { self._role_id = new_value.to_string(); @@ -4420,12 +4421,12 @@ impl<'a, C, A> EventListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/genomics1-cli/Cargo.toml b/gen/genomics1-cli/Cargo.toml index fae5179c7d..e35ab56218 100644 --- a/gen/genomics1-cli/Cargo.toml +++ b/gen/genomics1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-genomics1-cli" -version = "0.3.2+20151014" +version = "0.3.3+20160124" authors = ["Sebastian Thiel "] description = "A complete library to interact with genomics (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1-cli" @@ -20,10 +20,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/genomics1-cli/LICENSE.md b/gen/genomics1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/genomics1-cli/LICENSE.md +++ b/gen/genomics1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/genomics1-cli/README.md b/gen/genomics1-cli/README.md index 553a7e3581..0bbf0629b9 100644 --- a/gen/genomics1-cli/README.md +++ b/gen/genomics1-cli/README.md @@ -14,14 +14,14 @@ If data-structures are requested, these will be returned as pretty-printed JSON, You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/genomics1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/genomics1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/genomics1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/genomics1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1-cli). # Usage -This documentation was generated from the *genomics* API at revision *20151014*. The CLI is at version *0.3.2*. +This documentation was generated from the *genomics* API at revision *20160124*. The CLI is at version *0.3.3*. ```bash genomics1 [options] @@ -43,7 +43,6 @@ genomics1 [options] undelete (-r )... [-p ]... [-o ] operations cancel (-r )... [-p ]... [-o ] - delete [-p ]... [-o ] get [-p ]... [-o ] list [-p ]... [-o ] readgroupsets @@ -56,6 +55,7 @@ genomics1 [options] search (-r )... [-p ]... [-o ] reads search (-r )... [-p ]... [-o ] + stream (-r )... [-p ]... [-o ] references bases-list [-p ]... [-o ] get [-p ]... [-o ] @@ -70,6 +70,7 @@ genomics1 [options] import (-r )... [-p ]... [-o ] patch (-r )... [-p ]... [-o ] search (-r )... [-p ]... [-o ] + stream (-r )... [-p ]... [-o ] variantsets create (-r )... [-p ]... [-o ] delete [-p ]... [-o ] @@ -81,18 +82,18 @@ genomics1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/genomics1-cli/mkdocs.yml b/gen/genomics1-cli/mkdocs.yml index fbe033a251..3c0ce11999 100644 --- a/gen/genomics1-cli/mkdocs.yml +++ b/gen/genomics1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: genomics v0.3.2+20151014 +site_name: genomics v0.3.3+20160124 site_url: http://byron.github.io/google-apis-rs/google-genomics1-cli site_description: Write integrating applications with bcore @@ -24,7 +24,6 @@ pages: - ['datasets_test-iam-permissions.md', 'Datasets', 'Test Iam Permissions'] - ['datasets_undelete.md', 'Datasets', 'Undelete'] - ['operations_cancel.md', 'Operations', 'Cancel'] -- ['operations_delete.md', 'Operations', 'Delete'] - ['operations_get.md', 'Operations', 'Get'] - ['operations_list.md', 'Operations', 'List'] - ['readgroupsets_coveragebuckets-list.md', 'Readgroupsets', 'Coveragebuckets List'] @@ -35,6 +34,7 @@ pages: - ['readgroupsets_patch.md', 'Readgroupsets', 'Patch'] - ['readgroupsets_search.md', 'Readgroupsets', 'Search'] - ['reads_search.md', 'Reads', 'Search'] +- ['reads_stream.md', 'Reads', 'Stream'] - ['references_bases-list.md', 'References', 'Bases List'] - ['references_get.md', 'References', 'Get'] - ['references_search.md', 'References', 'Search'] @@ -46,6 +46,7 @@ pages: - ['variants_import.md', 'Variants', 'Import'] - ['variants_patch.md', 'Variants', 'Patch'] - ['variants_search.md', 'Variants', 'Search'] +- ['variants_stream.md', 'Variants', 'Stream'] - ['variantsets_create.md', 'Variantsets', 'Create'] - ['variantsets_delete.md', 'Variantsets', 'Delete'] - ['variantsets_export.md', 'Variantsets', 'Export'] @@ -55,5 +56,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/genomics1-cli/src/main.rs b/gen/genomics1-cli/src/main.rs index 5512bcb42c..7c4c87992d 100644 --- a/gen/genomics1-cli/src/main.rs +++ b/gen/genomics1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Genomics>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _callsets_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _callsets_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "sample-id" => Some(("sampleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -85,7 +85,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CallSet = json::value::from_value(object).unwrap(); let mut call = self.hub.callsets().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -98,7 +98,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -111,7 +111,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -134,10 +134,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _callsets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _callsets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.callsets().delete(opt.value_of("call-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -150,7 +150,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -163,7 +163,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -186,10 +186,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _callsets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _callsets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.callsets().get(opt.value_of("call-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -202,7 +202,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -215,7 +215,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -238,13 +238,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _callsets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _callsets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -258,8 +258,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "sample-id" => Some(("sampleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -278,7 +278,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CallSet = json::value::from_value(object).unwrap(); let mut call = self.hub.callsets().patch(request, opt.value_of("call-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "update-mask" => { @@ -294,7 +294,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["update-mask"].iter().map(|v|*v)); @@ -308,7 +308,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -331,13 +331,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _callsets_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _callsets_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -351,8 +351,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "variant-set-ids" => Some(("variantSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -370,7 +370,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SearchCallSetsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.callsets().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -383,7 +383,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -396,7 +396,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -419,13 +419,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -439,8 +439,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -458,7 +458,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Dataset = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -471,7 +471,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -484,7 +484,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -507,10 +507,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datasets().delete(opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -523,7 +523,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -536,7 +536,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -559,10 +559,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datasets().get(opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -575,7 +575,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -588,7 +588,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -611,13 +611,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_get_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -631,8 +631,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -646,7 +646,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::GetIamPolicyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().get_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -659,7 +659,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -672,7 +672,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -695,10 +695,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.datasets().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "project-id" => { @@ -720,7 +720,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["project-id", "page-size", "page-token"].iter().map(|v|*v)); @@ -734,7 +734,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -757,13 +757,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -777,8 +777,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -796,7 +796,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Dataset = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().patch(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "update-mask" => { @@ -812,7 +812,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["update-mask"].iter().map(|v|*v)); @@ -826,7 +826,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -849,13 +849,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_set_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -869,8 +869,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -886,7 +886,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -899,7 +899,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -912,7 +912,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -935,13 +935,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_test_iam_permissions(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -955,8 +955,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -971,7 +971,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -984,7 +984,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -997,7 +997,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1020,13 +1020,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _datasets_undelete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _datasets_undelete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1040,8 +1040,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -1055,7 +1055,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UndeleteDatasetRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.datasets().undelete(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1068,7 +1068,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1081,7 +1081,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1104,13 +1104,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operations_cancel(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1124,8 +1124,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -1139,7 +1139,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CancelOperationRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.operations().cancel(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1152,7 +1152,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1165,7 +1165,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1188,62 +1188,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.operations().delete(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operations().get(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1256,7 +1204,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1269,7 +1217,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1292,10 +1240,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operations().list(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1317,7 +1265,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); @@ -1331,7 +1279,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1354,10 +1302,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _readgroupsets_coveragebuckets_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _readgroupsets_coveragebuckets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.readgroupsets().coveragebuckets_list(opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "target-bucket-width" => { @@ -1388,7 +1336,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["end", "page-size", "page-token", "start", "target-bucket-width", "reference-name"].iter().map(|v|*v)); @@ -1402,7 +1350,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1425,10 +1373,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _readgroupsets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _readgroupsets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.readgroupsets().delete(opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1441,7 +1389,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1454,7 +1402,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1477,13 +1425,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _readgroupsets_export(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _readgroupsets_export(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1497,8 +1445,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reference-names" => Some(("referenceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1515,7 +1463,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ExportReadGroupSetRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.readgroupsets().export(request, opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1528,7 +1476,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1541,7 +1489,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1564,10 +1512,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _readgroupsets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _readgroupsets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.readgroupsets().get(opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1580,7 +1528,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1593,7 +1541,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1616,13 +1564,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _readgroupsets_import(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _readgroupsets_import(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1636,8 +1584,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "source-uris" => Some(("sourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1655,7 +1603,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ImportReadGroupSetsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.readgroupsets().import(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1668,7 +1616,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1681,7 +1629,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1704,13 +1652,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _readgroupsets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _readgroupsets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1724,8 +1672,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filename" => Some(("filename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1744,7 +1692,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ReadGroupSet = json::value::from_value(object).unwrap(); let mut call = self.hub.readgroupsets().patch(request, opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "update-mask" => { @@ -1760,7 +1708,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["update-mask"].iter().map(|v|*v)); @@ -1774,7 +1722,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1797,13 +1745,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _readgroupsets_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _readgroupsets_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1817,8 +1765,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dataset-ids" => Some(("datasetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1836,7 +1784,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SearchReadGroupSetsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.readgroupsets().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1849,7 +1797,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1862,7 +1810,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1885,13 +1833,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reads_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reads_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1905,8 +1853,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "read-group-ids" => Some(("readGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1927,7 +1875,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SearchReadsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.reads().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1940,7 +1888,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1953,7 +1901,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1976,10 +1924,99 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _references_bases_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reads_stream(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "read-group-set-id" => Some(("readGroupSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["end", "project-id", "read-group-set-id", "reference-name", "start"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StreamReadsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.reads().stream(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _references_bases_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.references().bases_list(opt.value_of("reference-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start" => { @@ -2004,7 +2041,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start", "end", "page-size", "page-token"].iter().map(|v|*v)); @@ -2018,7 +2055,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2041,10 +2078,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _references_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _references_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.references().get(opt.value_of("reference-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2057,7 +2094,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2070,7 +2107,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2093,13 +2130,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _references_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _references_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2113,8 +2150,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "md5checksums" => Some(("md5checksums", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2133,7 +2170,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SearchReferencesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.references().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2146,7 +2183,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2159,7 +2196,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2182,10 +2219,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _referencesets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _referencesets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.referencesets().get(opt.value_of("reference-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2198,7 +2235,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2211,7 +2248,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2234,13 +2271,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _referencesets_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _referencesets_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2254,8 +2291,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "md5checksums" => Some(("md5checksums", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "assembly-id" => Some(("assemblyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2274,7 +2311,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SearchReferenceSetsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.referencesets().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2287,7 +2324,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2300,7 +2337,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2323,13 +2360,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variants_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variants_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2343,8 +2380,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "variant-set-id" => Some(("variantSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2369,7 +2406,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Variant = json::value::from_value(object).unwrap(); let mut call = self.hub.variants().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2382,7 +2419,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2395,7 +2432,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2418,10 +2455,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variants_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variants_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.variants().delete(opt.value_of("variant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2434,7 +2471,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2447,7 +2484,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2470,10 +2507,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variants_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variants_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.variants().get(opt.value_of("variant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2486,7 +2523,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2499,7 +2536,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2522,13 +2559,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variants_import(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variants_import(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2542,8 +2579,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "variant-set-id" => Some(("variantSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "normalize-reference-names" => Some(("normalizeReferenceNames", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -2561,7 +2598,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ImportVariantsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.variants().import(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2574,7 +2611,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2587,7 +2624,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2610,13 +2647,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variants_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variants_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2630,8 +2667,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "variant-set-id" => Some(("variantSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2656,7 +2693,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Variant = json::value::from_value(object).unwrap(); let mut call = self.hub.variants().patch(request, opt.value_of("variant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "update-mask" => { @@ -2672,7 +2709,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["update-mask"].iter().map(|v|*v)); @@ -2686,7 +2723,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2709,13 +2746,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variants_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variants_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2729,8 +2766,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2753,7 +2790,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SearchVariantsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.variants().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2766,7 +2803,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2779,7 +2816,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2802,13 +2839,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variantsets_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variants_stream(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2822,13 +2859,104 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "variant-set-id" => Some(("variantSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "call-set-ids" => Some(("callSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["call-set-ids", "end", "project-id", "reference-name", "start", "variant-set-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::StreamVariantsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.variants().stream(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _variantsets_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id", "reference-set-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2839,7 +2967,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::VariantSet = json::value::from_value(object).unwrap(); let mut call = self.hub.variantsets().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2852,7 +2980,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2865,7 +2993,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2888,10 +3016,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variantsets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variantsets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.variantsets().delete(opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2904,7 +3032,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2917,7 +3045,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2940,13 +3068,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variantsets_export(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variantsets_export(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2960,8 +3088,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "bigquery-table" => Some(("bigqueryTable", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2980,7 +3108,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ExportVariantSetRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.variantsets().export(request, opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2993,7 +3121,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3006,7 +3134,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3029,10 +3157,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variantsets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variantsets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.variantsets().get(opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3045,7 +3173,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3058,7 +3186,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3081,13 +3209,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variantsets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variantsets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3101,13 +3229,14 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id", "reference-set-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -3118,7 +3247,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::VariantSet = json::value::from_value(object).unwrap(); let mut call = self.hub.variantsets().patch(request, opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "update-mask" => { @@ -3134,7 +3263,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["update-mask"].iter().map(|v|*v)); @@ -3148,7 +3277,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3171,13 +3300,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _variantsets_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _variantsets_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3191,8 +3320,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dataset-ids" => Some(("datasetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -3209,7 +3338,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SearchVariantSetsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.variantsets().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3222,7 +3351,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3235,7 +3364,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3326,9 +3455,6 @@ impl<'n, 'a> Engine<'n, 'a> { ("cancel", Some(opt)) => { call_result = self._operations_cancel(opt, dry_run, &mut err); }, - ("delete", Some(opt)) => { - call_result = self._operations_delete(opt, dry_run, &mut err); - }, ("get", Some(opt)) => { call_result = self._operations_get(opt, dry_run, &mut err); }, @@ -3375,6 +3501,9 @@ impl<'n, 'a> Engine<'n, 'a> { ("search", Some(opt)) => { call_result = self._reads_search(opt, dry_run, &mut err); }, + ("stream", Some(opt)) => { + call_result = self._reads_stream(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("reads".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -3432,6 +3561,9 @@ impl<'n, 'a> Engine<'n, 'a> { ("search", Some(opt)) => { call_result = self._variants_search(opt, dry_run, &mut err); }, + ("stream", Some(opt)) => { + call_result = self._variants_stream(opt, dry_run, &mut err); + }, _ => { err.issues.push(CLIError::MissingMethodError("variants".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); @@ -3481,14 +3613,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "genomics1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "genomics1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -3508,7 +3640,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -3551,8 +3683,8 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("callsets", "methods: 'create', 'delete', 'get', 'patch' and 'search'", vec![ - ("create", - Some(r##"Creates a new call set."##), + ("create", + Some(r##"Creates a new call set. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/callsets_create", vec![ (Some(r##"kv"##), @@ -3573,8 +3705,8 @@ fn main() { Some(false), Some(false)), ]), - ("delete", - Some(r##"Deletes a call set."##), + ("delete", + Some(r##"Deletes a call set. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/callsets_delete", vec![ (Some(r##"call-set-id"##), @@ -3595,8 +3727,8 @@ fn main() { Some(false), Some(false)), ]), - ("get", - Some(r##"Gets a call set by ID."##), + ("get", + Some(r##"Gets a call set by ID. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/callsets_get", vec![ (Some(r##"call-set-id"##), @@ -3617,8 +3749,8 @@ fn main() { Some(false), Some(false)), ]), - ("patch", - Some(r##"Updates a call set. This method supports patch semantics."##), + ("patch", + Some(r##"Updates a call set. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/callsets_patch", vec![ (Some(r##"call-set-id"##), @@ -3645,8 +3777,8 @@ fn main() { Some(false), Some(false)), ]), - ("search", - Some(r##"Gets a list of call sets matching the criteria. Implements [GlobalAllianceApi.searchCallSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L178)."##), + ("search", + Some(r##"Gets a list of call sets matching the criteria. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchCallSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L178)."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/callsets_search", vec![ (Some(r##"kv"##), @@ -3670,8 +3802,8 @@ fn main() { ]), ("datasets", "methods: 'create', 'delete', 'get', 'get-iam-policy', 'list', 'patch', 'set-iam-policy', 'test-iam-permissions' and 'undelete'", vec![ - ("create", - Some(r##"Creates a new dataset."##), + ("create", + Some(r##"Creates a new dataset. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_create", vec![ (Some(r##"kv"##), @@ -3692,8 +3824,8 @@ fn main() { Some(false), Some(false)), ]), - ("delete", - Some(r##"Deletes a dataset."##), + ("delete", + Some(r##"Deletes a dataset. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_delete", vec![ (Some(r##"dataset-id"##), @@ -3714,8 +3846,8 @@ fn main() { Some(false), Some(false)), ]), - ("get", - Some(r##"Gets a dataset by ID."##), + ("get", + Some(r##"Gets a dataset by ID. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_get", vec![ (Some(r##"dataset-id"##), @@ -3736,8 +3868,8 @@ fn main() { Some(false), Some(false)), ]), - ("get-iam-policy", - Some(r##"Gets the access control policy for the dataset. Is empty if the policy or the resource does not exist. See Getting a Policy for more information."##), + ("get-iam-policy", + Some(r##"Gets the access control policy for the dataset. This is empty if the policy or resource does not exist. See Getting a Policy for more information. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_get-iam-policy", vec![ (Some(r##"resource"##), @@ -3764,8 +3896,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Lists datasets within a project."##), + ("list", + Some(r##"Lists datasets within a project. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_list", vec![ (Some(r##"v"##), @@ -3780,8 +3912,8 @@ fn main() { Some(false), Some(false)), ]), - ("patch", - Some(r##"Updates a dataset. This method supports patch semantics."##), + ("patch", + Some(r##"Updates a dataset. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_patch", vec![ (Some(r##"dataset-id"##), @@ -3808,8 +3940,8 @@ fn main() { Some(false), Some(false)), ]), - ("set-iam-policy", - Some(r##"Sets the access control policy on the specified dataset. Replaces any existing policy. See Setting a Policy for more information."##), + ("set-iam-policy", + Some(r##"Sets the access control policy on the specified dataset. Replaces any existing policy. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) See Setting a Policy for more information."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_set-iam-policy", vec![ (Some(r##"resource"##), @@ -3836,8 +3968,8 @@ fn main() { Some(false), Some(false)), ]), - ("test-iam-permissions", - Some(r##"Returns permissions that a caller has on the specified resource. See Testing Permissions for more information."##), + ("test-iam-permissions", + Some(r##"Returns permissions that a caller has on the specified resource. See Testing Permissions for more information. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_test-iam-permissions", vec![ (Some(r##"resource"##), @@ -3864,8 +3996,8 @@ fn main() { Some(false), Some(false)), ]), - ("undelete", - Some(r##"Undeletes a dataset by restoring a dataset which was deleted via this API. This operation is only possible for a week after the deletion occurred."##), + ("undelete", + Some(r##"Undeletes a dataset by restoring a dataset which was deleted via this API. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This operation is only possible for a week after the deletion occurred."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/datasets_undelete", vec![ (Some(r##"dataset-id"##), @@ -3894,8 +4026,8 @@ fn main() { ]), ]), - ("operations", "methods: 'cancel', 'delete', 'get' and 'list'", vec![ - ("cancel", + ("operations", "methods: 'cancel', 'get' and 'list'", vec![ + ("cancel", Some(r##"Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. Clients may use Operations.GetOperation or Operations.ListOperations to check whether the cancellation succeeded or the operation completed despite cancellation."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/operations_cancel", vec![ @@ -3923,29 +4055,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", - Some(r##"This method is not implemented. To cancel an operation, please use Operations.CancelOperation."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/operations_delete", - vec![ - (Some(r##"name"##), - None, - Some(r##"The name of the operation resource to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", + ("get", Some(r##"Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/operations_get", vec![ @@ -3967,7 +4077,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists operations that match the specified filter in the request."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/operations_list", vec![ @@ -3992,8 +4102,8 @@ fn main() { ]), ("readgroupsets", "methods: 'coveragebuckets-list', 'delete', 'export', 'get', 'import', 'patch' and 'search'", vec![ - ("coveragebuckets-list", - Some(r##"Lists fixed width coverage buckets for a read group set, each of which correspond to a range of a reference sequence. Each bucket summarizes coverage information across its corresponding genomic range. Coverage is defined as the number of reads which are aligned to a given base in the reference sequence. Coverage buckets are available at several precomputed bucket widths, enabling retrieval of various coverage 'zoom levels'. The caller must have READ permissions for the target read group set."##), + ("coveragebuckets-list", + Some(r##"Lists fixed width coverage buckets for a read group set, each of which correspond to a range of a reference sequence. Each bucket summarizes coverage information across its corresponding genomic range. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Coverage is defined as the number of reads which are aligned to a given base in the reference sequence. Coverage buckets are available at several precomputed bucket widths, enabling retrieval of various coverage 'zoom levels'. The caller must have READ permissions for the target read group set."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_coveragebuckets-list", vec![ (Some(r##"read-group-set-id"##), @@ -4014,8 +4124,8 @@ fn main() { Some(false), Some(false)), ]), - ("delete", - Some(r##"Deletes a read group set."##), + ("delete", + Some(r##"Deletes a read group set. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_delete", vec![ (Some(r##"read-group-set-id"##), @@ -4036,13 +4146,13 @@ fn main() { Some(false), Some(false)), ]), - ("export", - Some(r##"Exports a read group set to a BAM file in Google Cloud Storage. Note that currently there may be some differences between exported BAM files and the original BAM file at the time of import. See [ImportReadGroupSets](google.genomics.v1.ReadServiceV1.ImportReadGroupSets) for caveats."##), + ("export", + Some(r##"Exports a read group set to a BAM file in Google Cloud Storage. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Note that currently there may be some differences between exported BAM files and the original BAM file at the time of import. See [ImportReadGroupSets](google.genomics.v1.ReadServiceV1.ImportReadGroupSets) for caveats."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_export", vec![ (Some(r##"read-group-set-id"##), None, - Some(r##"Required. The ID of the read group set to export."##), + Some(r##"Required. The ID of the read group set to export. The caller must have READ access to this read group set."##), Some(true), Some(false)), @@ -4064,8 +4174,8 @@ fn main() { Some(false), Some(false)), ]), - ("get", - Some(r##"Gets a read group set by ID."##), + ("get", + Some(r##"Gets a read group set by ID. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_get", vec![ (Some(r##"read-group-set-id"##), @@ -4086,8 +4196,8 @@ fn main() { Some(false), Some(false)), ]), - ("import", - Some(r##"Creates read group sets by asynchronously importing the provided information. The caller must have WRITE permissions to the dataset. ## Notes on [BAM](https://samtools.github.io/hts-specs/SAMv1.pdf) import - Tags will be converted to strings - tag types are not preserved - Comments (`@CO`) in the input file header will not be preserved - Original header order of references (`@SQ`) will not be preserved - Any reverse stranded unmapped reads will be reverse complemented, and their qualities (and "BQ" tag, if any) will be reversed - Unmapped reads will be stripped of positional information (reference name and position)"##), + ("import", + Some(r##"Creates read group sets by asynchronously importing the provided information. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) The caller must have WRITE permissions to the dataset. ## Notes on [BAM](https://samtools.github.io/hts-specs/SAMv1.pdf) import - Tags will be converted to strings - tag types are not preserved - Comments (`@CO`) in the input file header will not be preserved - Original header order of references (`@SQ`) will not be preserved - Any reverse stranded unmapped reads will be reverse complemented, and their qualities (also the "BQ" and "OQ" tags, if any) will be reversed - Unmapped reads will be stripped of positional information (reference name and position)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_import", vec![ (Some(r##"kv"##), @@ -4108,8 +4218,8 @@ fn main() { Some(false), Some(false)), ]), - ("patch", - Some(r##"Updates a read group set. This method supports patch semantics."##), + ("patch", + Some(r##"Updates a read group set. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_patch", vec![ (Some(r##"read-group-set-id"##), @@ -4136,8 +4246,8 @@ fn main() { Some(false), Some(false)), ]), - ("search", - Some(r##"Searches for read group sets matching the criteria. Implements [GlobalAllianceApi.searchReadGroupSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L135)."##), + ("search", + Some(r##"Searches for read group sets matching the criteria. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchReadGroupSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L135)."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/readgroupsets_search", vec![ (Some(r##"kv"##), @@ -4160,9 +4270,9 @@ fn main() { ]), ]), - ("reads", "methods: 'search'", vec![ - ("search", - Some(r##"Gets a list of reads for one or more read group sets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only read group set IDs yields all reads in those read group sets, including unmapped reads. All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order. Implements [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85)."##), + ("reads", "methods: 'search' and 'stream'", vec![ + ("search", + Some(r##"Gets a list of reads for one or more read group sets. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only read group set IDs yields all reads in those read group sets, including unmapped reads. All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (by reference sequence, then position). Reads with equivalent genomic coordinates are returned in an unspecified order. This order is consistent, such that two queries for the same content (regardless of page size) yield reads in the same order across their respective streams of paginated responses. Implements [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85)."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/reads_search", vec![ (Some(r##"kv"##), @@ -4177,6 +4287,28 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("stream", + Some(r##"Returns a stream of all the reads matching the search request, ordered by reference name, position, and ID."##), + "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/reads_stream", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -4186,8 +4318,8 @@ fn main() { ]), ("references", "methods: 'bases-list', 'get' and 'search'", vec![ - ("bases-list", - Some(r##"Lists the bases in a reference, optionally restricted to a range. Implements [GlobalAllianceApi.getReferenceBases](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L221)."##), + ("bases-list", + Some(r##"Lists the bases in a reference, optionally restricted to a range. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.getReferenceBases](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L221)."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/references_bases-list", vec![ (Some(r##"reference-id"##), @@ -4208,8 +4340,8 @@ fn main() { Some(false), Some(false)), ]), - ("get", - Some(r##"Gets a reference. Implements [GlobalAllianceApi.getReference](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L158)."##), + ("get", + Some(r##"Gets a reference. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.getReference](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L158)."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/references_get", vec![ (Some(r##"reference-id"##), @@ -4230,8 +4362,8 @@ fn main() { Some(false), Some(false)), ]), - ("search", - Some(r##"Searches for references which match the given criteria. Implements [GlobalAllianceApi.searchReferences](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L146)."##), + ("search", + Some(r##"Searches for references which match the given criteria. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchReferences](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L146)."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/references_search", vec![ (Some(r##"kv"##), @@ -4255,8 +4387,8 @@ fn main() { ]), ("referencesets", "methods: 'get' and 'search'", vec![ - ("get", - Some(r##"Gets a reference set. Implements [GlobalAllianceApi.getReferenceSet](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L83)."##), + ("get", + Some(r##"Gets a reference set. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.getReferenceSet](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L83)."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/referencesets_get", vec![ (Some(r##"reference-set-id"##), @@ -4277,8 +4409,8 @@ fn main() { Some(false), Some(false)), ]), - ("search", - Some(r##"Searches for reference sets which match the given criteria. Implements [GlobalAllianceApi.searchReferenceSets](http://ga4gh.org/documentation/api/v0.5.1/ga4gh_api.html#/schema/org.ga4gh.searchReferenceSets)."##), + ("search", + Some(r##"Searches for reference sets which match the given criteria. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchReferenceSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L71)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/referencesets_search", vec![ (Some(r##"kv"##), @@ -4301,9 +4433,9 @@ fn main() { ]), ]), - ("variants", "methods: 'create', 'delete', 'get', 'import', 'patch' and 'search'", vec![ - ("create", - Some(r##"Creates a new variant."##), + ("variants", "methods: 'create', 'delete', 'get', 'import', 'patch', 'search' and 'stream'", vec![ + ("create", + Some(r##"Creates a new variant. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_create", vec![ (Some(r##"kv"##), @@ -4324,8 +4456,8 @@ fn main() { Some(false), Some(false)), ]), - ("delete", - Some(r##"Deletes a variant."##), + ("delete", + Some(r##"Deletes a variant. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_delete", vec![ (Some(r##"variant-id"##), @@ -4346,8 +4478,8 @@ fn main() { Some(false), Some(false)), ]), - ("get", - Some(r##"Gets a variant by ID."##), + ("get", + Some(r##"Gets a variant by ID. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_get", vec![ (Some(r##"variant-id"##), @@ -4368,8 +4500,8 @@ fn main() { Some(false), Some(false)), ]), - ("import", - Some(r##"Creates variant data by asynchronously importing the provided information. The variants for import will be merged with any existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created. When variants are merged, the call information from the new variant is added to the existing variant, and other fields (such as key/value pairs) are discarded. In particular, this means for merged VCF variants that have conflicting INFO fields, some data will be arbitrarily discarded. As a special case, for single-sample VCF files, QUAL and FILTER fields will be moved to the call level; these are sometimes interpreted in a call-specific context. Imported VCF headers are appended to the metadata already in a variant set."##), + ("import", + Some(r##"Creates variant data by asynchronously importing the provided information. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) The variants for import will be merged with any existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created. When variants are merged, the call information from the new variant is added to the existing variant, and other fields (such as key/value pairs) are discarded. In particular, this means for merged VCF variants that have conflicting INFO fields, some data will be arbitrarily discarded. As a special case, for single-sample VCF files, QUAL and FILTER fields will be moved to the call level; these are sometimes interpreted in a call-specific context. Imported VCF headers are appended to the metadata already in a variant set."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_import", vec![ (Some(r##"kv"##), @@ -4390,8 +4522,8 @@ fn main() { Some(false), Some(false)), ]), - ("patch", - Some(r##"Updates a variant. This method supports patch semantics. Returns the modified variant without its calls."##), + ("patch", + Some(r##"Updates a variant. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This method supports patch semantics. Returns the modified variant without its calls."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_patch", vec![ (Some(r##"variant-id"##), @@ -4418,8 +4550,8 @@ fn main() { Some(false), Some(false)), ]), - ("search", - Some(r##"Gets a list of variants matching the criteria. Implements [GlobalAllianceApi.searchVariants](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L126)."##), + ("search", + Some(r##"Gets a list of variants matching the criteria. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchVariants](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L126)."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_search", vec![ (Some(r##"kv"##), @@ -4434,6 +4566,28 @@ fn main() { Some(false), Some(true)), + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("stream", + Some(r##"Returns a stream of all the variants matching the search request, ordered by reference name, position, and ID."##), + "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variants_stream", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + (Some(r##"out"##), Some(r##"o"##), Some(r##"Specify the file into which to write the program's output"##), @@ -4443,8 +4597,8 @@ fn main() { ]), ("variantsets", "methods: 'create', 'delete', 'export', 'get', 'patch' and 'search'", vec![ - ("create", - Some(r##"Creates a new variant set. The provided variant set must have a valid `datasetId` set - all other fields are optional. Note that the `id` field will be ignored, as this is assigned by the server."##), + ("create", + Some(r##"Creates a new variant set. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) The provided variant set must have a valid `datasetId` set - all other fields are optional. Note that the `id` field will be ignored, as this is assigned by the server."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_create", vec![ (Some(r##"kv"##), @@ -4465,8 +4619,8 @@ fn main() { Some(false), Some(false)), ]), - ("delete", - Some(r##"Deletes the contents of a variant set. The variant set object is not deleted."##), + ("delete", + Some(r##"Deletes the contents of a variant set. The variant set object is not deleted. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_delete", vec![ (Some(r##"variant-set-id"##), @@ -4487,8 +4641,8 @@ fn main() { Some(false), Some(false)), ]), - ("export", - Some(r##"Exports variant set data to an external destination."##), + ("export", + Some(r##"Exports variant set data to an external destination. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_export", vec![ (Some(r##"variant-set-id"##), @@ -4515,8 +4669,8 @@ fn main() { Some(false), Some(false)), ]), - ("get", - Some(r##"Gets a variant set by ID."##), + ("get", + Some(r##"Gets a variant set by ID. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_get", vec![ (Some(r##"variant-set-id"##), @@ -4537,8 +4691,8 @@ fn main() { Some(false), Some(false)), ]), - ("patch", - Some(r##"Updates a variant set. This method supports patch semantics."##), + ("patch", + Some(r##"Updates a variant set using patch semantics. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)"##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_patch", vec![ (Some(r##"variant-set-id"##), @@ -4565,8 +4719,8 @@ fn main() { Some(false), Some(false)), ]), - ("search", - Some(r##"Returns a list of all variant sets matching search criteria. Implements [GlobalAllianceApi.searchVariantSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L49)."##), + ("search", + Some(r##"Returns a list of all variant sets matching search criteria. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchVariantSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L49)."##), "Details at http://byron.github.io/google-apis-rs/google_genomics1_cli/variantsets_search", vec![ (Some(r##"kv"##), @@ -4593,8 +4747,8 @@ fn main() { let mut app = App::new("genomics1") .author("Sebastian Thiel ") - .version("0.3.2+20151014") - .about("An API to store, process, explore, and share DNA sequence reads, reference-based alignments, and variant calls.") + .version("0.3.3+20160124") + .about("An API to store, process, explore, and share genomic data. It supports reference-based alignments, genetic variants, and reference genomes. This API provides an implementation of the Global Alliance for Genomics and Health (GA4GH) v0.5.1 API as well as several extensions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_genomics1_cli") .arg(Arg::with_name("url") .long("scope") @@ -4617,7 +4771,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -4628,7 +4782,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/genomics1/Cargo.toml b/gen/genomics1/Cargo.toml index 06342ec0a2..f51ba79b2e 100644 --- a/gen/genomics1/Cargo.toml +++ b/gen/genomics1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-genomics1" -version = "0.1.10+20151014" +version = "0.1.11+20160124" authors = ["Sebastian Thiel "] description = "A complete library to interact with genomics (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1" @@ -19,7 +19,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/genomics1/LICENSE.md b/gen/genomics1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/genomics1/LICENSE.md +++ b/gen/genomics1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/genomics1/README.md b/gen/genomics1/README.md index 95a67c4fc1..10d3022094 100644 --- a/gen/genomics1/README.md +++ b/gen/genomics1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-genomics1` library allows access to all features of the *Google genomics* service. -This documentation was generated from *genomics* crate version *0.1.10+20151014*, where *20151014* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *genomics* crate version *0.1.11+20160124*, where *20160124* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. # Features Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_genomics1/struct.Genomics.html) ... @@ -15,17 +15,17 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [datasets](http://byron.github.io/google-apis-rs/google_genomics1/struct.Dataset.html) * [*create*](http://byron.github.io/google-apis-rs/google_genomics1/struct.DatasetCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1/struct.DatasetDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1/struct.DatasetGetCall.html), [*get iam policy*](http://byron.github.io/google-apis-rs/google_genomics1/struct.DatasetGetIamPolicyCall.html), [*list*](http://byron.github.io/google-apis-rs/google_genomics1/struct.DatasetListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1/struct.DatasetPatchCall.html), [*set iam policy*](http://byron.github.io/google-apis-rs/google_genomics1/struct.DatasetSetIamPolicyCall.html), [*test iam permissions*](http://byron.github.io/google-apis-rs/google_genomics1/struct.DatasetTestIamPermissionCall.html) and [*undelete*](http://byron.github.io/google-apis-rs/google_genomics1/struct.DatasetUndeleteCall.html) * [operations](http://byron.github.io/google-apis-rs/google_genomics1/struct.Operation.html) - * [*cancel*](http://byron.github.io/google-apis-rs/google_genomics1/struct.OperationCancelCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1/struct.OperationDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1/struct.OperationGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_genomics1/struct.OperationListCall.html) + * [*cancel*](http://byron.github.io/google-apis-rs/google_genomics1/struct.OperationCancelCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1/struct.OperationGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_genomics1/struct.OperationListCall.html) * readgroupsets * [*coveragebuckets list*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReadgroupsetCoveragebucketListCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReadgroupsetDeleteCall.html), [*export*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReadgroupsetExportCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReadgroupsetGetCall.html), [*import*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReadgroupsetImportCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReadgroupsetPatchCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReadgroupsetSearchCall.html) * [reads](http://byron.github.io/google-apis-rs/google_genomics1/struct.Read.html) - * [*search*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReadSearchCall.html) + * [*search*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReadSearchCall.html) and [*stream*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReadStreamCall.html) * [references](http://byron.github.io/google-apis-rs/google_genomics1/struct.Reference.html) * [*bases list*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReferenceBaseListCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReferenceGetCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReferenceSearchCall.html) * referencesets * [*get*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReferencesetGetCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_genomics1/struct.ReferencesetSearchCall.html) * [variants](http://byron.github.io/google-apis-rs/google_genomics1/struct.Variant.html) - * [*create*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantGetCall.html), [*import*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantImportCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantPatchCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantSearchCall.html) + * [*create*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantGetCall.html), [*import*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantImportCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantPatchCall.html), [*search*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantSearchCall.html) and [*stream*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantStreamCall.html) * variantsets * [*create*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantsetCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantsetDeleteCall.html), [*export*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantsetExportCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantsetGetCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantsetPatchCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_genomics1/struct.VariantsetSearchCall.html) diff --git a/gen/genomics1/src/cmn.rs b/gen/genomics1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/genomics1/src/cmn.rs +++ b/gen/genomics1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/genomics1/src/lib.rs b/gen/genomics1/src/lib.rs index 8387dedbf2..c4e8cd6bcc 100644 --- a/gen/genomics1/src/lib.rs +++ b/gen/genomics1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *genomics* crate version *0.1.10+20151014*, where *20151014* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *genomics* crate version *0.1.11+20160124*, where *20160124* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1). //! # Features //! @@ -13,17 +13,17 @@ //! * [datasets](struct.Dataset.html) //! * [*create*](struct.DatasetCreateCall.html), [*delete*](struct.DatasetDeleteCall.html), [*get*](struct.DatasetGetCall.html), [*get iam policy*](struct.DatasetGetIamPolicyCall.html), [*list*](struct.DatasetListCall.html), [*patch*](struct.DatasetPatchCall.html), [*set iam policy*](struct.DatasetSetIamPolicyCall.html), [*test iam permissions*](struct.DatasetTestIamPermissionCall.html) and [*undelete*](struct.DatasetUndeleteCall.html) //! * [operations](struct.Operation.html) -//! * [*cancel*](struct.OperationCancelCall.html), [*delete*](struct.OperationDeleteCall.html), [*get*](struct.OperationGetCall.html) and [*list*](struct.OperationListCall.html) +//! * [*cancel*](struct.OperationCancelCall.html), [*get*](struct.OperationGetCall.html) and [*list*](struct.OperationListCall.html) //! * readgroupsets //! * [*coveragebuckets list*](struct.ReadgroupsetCoveragebucketListCall.html), [*delete*](struct.ReadgroupsetDeleteCall.html), [*export*](struct.ReadgroupsetExportCall.html), [*get*](struct.ReadgroupsetGetCall.html), [*import*](struct.ReadgroupsetImportCall.html), [*patch*](struct.ReadgroupsetPatchCall.html) and [*search*](struct.ReadgroupsetSearchCall.html) //! * [reads](struct.Read.html) -//! * [*search*](struct.ReadSearchCall.html) +//! * [*search*](struct.ReadSearchCall.html) and [*stream*](struct.ReadStreamCall.html) //! * [references](struct.Reference.html) //! * [*bases list*](struct.ReferenceBaseListCall.html), [*get*](struct.ReferenceGetCall.html) and [*search*](struct.ReferenceSearchCall.html) //! * referencesets //! * [*get*](struct.ReferencesetGetCall.html) and [*search*](struct.ReferencesetSearchCall.html) //! * [variants](struct.Variant.html) -//! * [*create*](struct.VariantCreateCall.html), [*delete*](struct.VariantDeleteCall.html), [*get*](struct.VariantGetCall.html), [*import*](struct.VariantImportCall.html), [*patch*](struct.VariantPatchCall.html) and [*search*](struct.VariantSearchCall.html) +//! * [*create*](struct.VariantCreateCall.html), [*delete*](struct.VariantDeleteCall.html), [*get*](struct.VariantGetCall.html), [*import*](struct.VariantImportCall.html), [*patch*](struct.VariantPatchCall.html), [*search*](struct.VariantSearchCall.html) and [*stream*](struct.VariantStreamCall.html) //! * variantsets //! * [*create*](struct.VariantsetCreateCall.html), [*delete*](struct.VariantsetDeleteCall.html), [*export*](struct.VariantsetExportCall.html), [*get*](struct.VariantsetGetCall.html), [*patch*](struct.VariantsetPatchCall.html) and [*search*](struct.VariantsetSearchCall.html) //! @@ -121,7 +121,7 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.datasets().patch(req, "datasetId") -//! .update_mask("amet") +//! .update_mask("et") //! .doit(); //! //! match result { diff --git a/gen/genomics1/src/lib.rs.in b/gen/genomics1/src/lib.rs.in index c4dba519fd..2026b40263 100644 --- a/gen/genomics1/src/lib.rs.in +++ b/gen/genomics1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -149,7 +150,7 @@ impl<'a, C, A> Genomics Genomics { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -182,7 +183,7 @@ impl<'a, C, A> Genomics } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -215,7 +216,7 @@ pub struct SearchReadGroupSetsRequest { pub dataset_ids: Option>, /// Only return read group sets for which a substring of the name matches this string. pub name: Option, - /// Specifies number of results to return in a single page. If unspecified, it will default to 256. The maximum value is 1024. + /// The maximum number of results to return in a single page. If unspecified, defaults to 256. The maximum value is 1024. #[serde(rename="pageSize")] pub page_size: Option, } @@ -223,38 +224,22 @@ pub struct SearchReadGroupSetsRequest { impl RequestValue for SearchReadGroupSetsRequest {} -/// This resource represents a long-running operation that is the result of a network API call. +/// There is no detailed description. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [delete operations](struct.OperationDeleteCall.html) (none) -/// * [cancel operations](struct.OperationCancelCall.html) (none) -/// * [export variantsets](struct.VariantsetExportCall.html) (response) -/// * [export readgroupsets](struct.ReadgroupsetExportCall.html) (response) -/// * [import variants](struct.VariantImportCall.html) (response) -/// * [import readgroupsets](struct.ReadgroupsetImportCall.html) (response) -/// * [get operations](struct.OperationGetCall.html) (response) -/// * [list operations](struct.OperationListCall.html) (none) +/// * [stream variants](struct.VariantStreamCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Operation { - /// An OperationMetadata object. This will always be returned with the Operation. - pub metadata: Option>, - /// 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. - pub done: Option, - /// If importing ReadGroupSets, an ImportReadGroupSetsResponse is returned. If importing Variants, an ImportVariantsResponse is returned. For exports, an empty response is returned. - pub response: Option>, - /// The server-assigned name, which is only unique within the same service that originally returns it. For example: `operations/CJHU7Oi_ChDrveSpBRjfuL-qzoWAgEw` - pub name: Option, - /// The error result of the operation in case of failure. - pub error: Option, +pub struct StreamVariantsResponse { + /// no description provided + pub variants: Option>, } -impl Resource for Operation {} -impl ResponseResult for Operation {} +impl ResponseResult for StreamVariantsResponse {} /// Request message for `SetIamPolicy` method. @@ -283,7 +268,7 @@ impl RequestValue for SetIamPolicyRequest {} pub struct Binding { /// Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required pub role: Option, - /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following formats: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. + /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. pub members: Option>, } @@ -307,7 +292,7 @@ pub struct SearchVariantSetsRequest { /// Exactly one dataset ID must be provided here. Only variant sets which belong to this dataset will be returned. #[serde(rename="datasetIds")] pub dataset_ids: Option>, - /// The maximum number of variant sets to return in a request. + /// The maximum number of results to return in a single page. If unspecified, defaults to 1024. #[serde(rename="pageSize")] pub page_size: Option, } @@ -347,7 +332,7 @@ pub struct ReferenceBound { /// An upper bound (inclusive) on the starting coordinate of any variant in the reference sequence. #[serde(rename="upperBound")] pub upper_bound: Option, - /// The reference the bound is associate with. + /// The name of the reference associated with this ReferenceBound. #[serde(rename="referenceName")] pub reference_name: Option, } @@ -366,7 +351,7 @@ impl Part for ReferenceBound {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ExportReadGroupSetRequest { - /// Required. The Google Developers Console project ID that owns this export. + /// Required. The Google Developers Console project ID that owns this export. The caller must have WRITE access to this project. #[serde(rename="projectId")] pub project_id: Option, /// The reference names to export. If this is not specified, all reference sequences, including unmapped reads, are exported. Use `*` to export only unmapped reads. @@ -393,7 +378,7 @@ pub struct Program { pub version: Option, /// The user specified locally unique ID of the program. Used along with `prevProgramId` to define an ordering between programs. pub id: Option, - /// The name of the program. + /// The display name of the program. This is typically the colloquial name of the tool used, for example 'bwa' or 'picard'. pub name: Option, /// The ID of the program run before this one. #[serde(rename="prevProgramId")] @@ -403,6 +388,25 @@ pub struct Program { impl Part for Program {} +/// An abstraction for referring to a genomic position, in relation to some already known reference. For now, represents a genomic position as a reference name, a base number on that reference (0-based), and a determination of forward or reverse strand. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Position { + /// The 0-based offset from the start of the forward strand for that reference. + pub position: Option, + /// Whether this position is on the reverse strand, as opposed to the forward strand. + #[serde(rename="reverseStrand")] + pub reverse_strand: Option, + /// The name of the reference in whatever reference set is being used. + #[serde(rename="referenceName")] + pub reference_name: Option, +} + +impl Part for Position {} + + /// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com"] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). /// /// # Activities @@ -419,7 +423,7 @@ pub struct Policy { pub bindings: Option>, /// Version of the `Policy`. The default version is 0. pub version: Option, - /// Can be used to perform a read-modify-write. + /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly. pub etag: Option, } @@ -460,7 +464,6 @@ impl RequestValue for ImportVariantsRequest {} /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [delete operations](struct.OperationDeleteCall.html) (response) /// * [delete datasets](struct.DatasetDeleteCall.html) (response) /// * [cancel operations](struct.OperationCancelCall.html) (response) /// * [delete readgroupsets](struct.ReadgroupsetDeleteCall.html) (response) @@ -534,7 +537,23 @@ pub struct TestIamPermissionsResponse { impl ResponseResult for TestIamPermissionsResponse {} -/// A read alignment describes a linear alignment of a string of DNA to a reference sequence, in addition to metadata about the fragment (the molecule of DNA sequenced) and the read (the bases which were read by the sequencer). A read is equivalent to a line in a SAM file. A read belongs to exactly one read group and exactly one read group set. ### Generating a reference-aligned sequence string When interacting with mapped reads, it's often useful to produce a string representing the local alignment of the read to reference. The following pseudocode demonstrates one way of doing this: out = "" offset = 0 for c in read.alignment.cigar { switch c.operation { case "ALIGNMENT_MATCH", "SEQUENCE_MATCH", "SEQUENCE_MISMATCH": out += read.alignedSequence[offset:offset+c.operationLength] offset += c.operationLength break case "CLIP_SOFT", "INSERT": offset += c.operationLength break case "PAD": out += repeat("*", c.operationLength) break case "DELETE": out += repeat("-", c.operationLength) break case "SKIP": out += repeat(" ", c.operationLength) break case "CLIP_HARD": break } } return out ### Converting to SAM's CIGAR string The following pseudocode generates a SAM CIGAR string from the `cigar` field. Note that this is a lossy conversion (`cigar.referenceSequence` is lost). cigarMap = { "ALIGNMENT_MATCH": "M", "INSERT": "I", "DELETE": "D", "SKIP": "N", "CLIP_SOFT": "S", "CLIP_HARD": "H", "PAD": "P", "SEQUENCE_MATCH": "=", "SEQUENCE_MISMATCH": "X", } cigarStr = "" for c in read.alignment.cigar { cigarStr += c.operationLength + cigarMap[c.operation] } return cigarStr +/// A bucket over which read coverage has been precomputed. A bucket corresponds to a specific range of the reference sequence. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CoverageBucket { + /// The average number of reads which are aligned to each individual reference base in this bucket. + #[serde(rename="meanCoverage")] + pub mean_coverage: Option, + /// The genomic coordinate range spanned by this bucket. + pub range: Option, +} + +impl Part for CoverageBucket {} + + +/// A read alignment describes a linear alignment of a string of DNA to a reference sequence, in addition to metadata about the fragment (the molecule of DNA sequenced) and the read (the bases which were read by the sequencer). A read is equivalent to a line in a SAM file. A read belongs to exactly one read group and exactly one read group set. For more genomics resource definitions, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) ### Reverse-stranded reads Mapped reads (reads having a non-null `alignment`) can be aligned to either the forward or the reverse strand of their associated reference. Strandedness of a mapped read is encoded by `alignment.position.reverseStrand`. If we consider the reference to be a forward-stranded coordinate space of `[0, reference.length)` with `0` as the left-most position and `reference.length` as the right-most position, reads are always aligned left to right. That is, `alignment.position.position` always refers to the left-most reference coordinate and `alignment.cigar` describes the alignment of this read to the reference from left to right. All per-base fields such as `alignedSequence` and `alignedQuality` share this same left-to-right orientation; this is true of reads which are aligned to either strand. For reverse-stranded reads, this means that `alignedSequence` is the reverse complement of the bases that were originally reported by the sequencing machine. ### Generating a reference-aligned sequence string When interacting with mapped reads, it's often useful to produce a string representing the local alignment of the read to reference. The following pseudocode demonstrates one way of doing this: out = "" offset = 0 for c in read.alignment.cigar { switch c.operation { case "ALIGNMENT_MATCH", "SEQUENCE_MATCH", "SEQUENCE_MISMATCH": out += read.alignedSequence[offset:offset+c.operationLength] offset += c.operationLength break case "CLIP_SOFT", "INSERT": offset += c.operationLength break case "PAD": out += repeat("*", c.operationLength) break case "DELETE": out += repeat("-", c.operationLength) break case "SKIP": out += repeat(" ", c.operationLength) break case "CLIP_HARD": break } } return out ### Converting to SAM's CIGAR string The following pseudocode generates a SAM CIGAR string from the `cigar` field. Note that this is a lossy conversion (`cigar.referenceSequence` is lost). cigarMap = { "ALIGNMENT_MATCH": "M", "INSERT": "I", "DELETE": "D", "SKIP": "N", "CLIP_SOFT": "S", "CLIP_HARD": "H", "PAD": "P", "SEQUENCE_MATCH": "=", "SEQUENCE_MISMATCH": "X", } cigarStr = "" for c in read.alignment.cigar { cigarStr += c.operationLength + cigarMap[c.operation] } return cigarStr /// /// # Activities /// @@ -542,13 +561,14 @@ impl ResponseResult for TestIamPermissionsResponse {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [search reads](struct.ReadSearchCall.html) (none) +/// * [stream reads](struct.ReadStreamCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Read { - /// The ID of the read group set this read belongs to. (Every read must belong to exactly one read group set.) + /// The ID of the read group set this read belongs to. A read belongs to exactly one read group set. #[serde(rename="readGroupSetId")] pub read_group_set_id: Option, - /// SAM flag 0x200 + /// Whether this read did not pass filters, such as platform or vendor quality controls (SAM flag 0x200). #[serde(rename="failedVendorQualityChecks")] pub failed_vendor_quality_checks: Option, /// The fragment name. Equivalent to QNAME (query template name) in SAM. @@ -565,11 +585,11 @@ pub struct Read { pub fragment_length: Option, /// The server-generated read ID, unique across all reads. This is different from the `fragmentName`. pub id: Option, - /// The linear alignment for this alignment record. This field will be null if the read is unmapped. + /// The linear alignment for this alignment record. This field is null for unmapped reads. pub alignment: Option, /// A map of additional read alignment information. This must be of the form map (string key mapping to a list of string values). pub info: Option>>, - /// The fragment is a PCR or optical duplicate (SAM flag 0x400) + /// The fragment is a PCR or optical duplicate (SAM flag 0x400). #[serde(rename="duplicateFragment")] pub duplicate_fragment: Option, /// The number of reads in the fragment (extension to SAM flag 0x1). @@ -578,16 +598,16 @@ pub struct Read { /// The read number in sequencing. 0-based and less than numberReads. This field replaces SAM flag 0x40 and 0x80. #[serde(rename="readNumber")] pub read_number: Option, - /// The orientation and the distance between reads from the fragment are consistent with the sequencing protocol (SAM flag 0x2) + /// The orientation and the distance between reads from the fragment are consistent with the sequencing protocol (SAM flag 0x2). #[serde(rename="properPlacement")] pub proper_placement: Option, - /// The ID of the read group this read belongs to. (Every read must belong to exactly one read group.) + /// The ID of the read group this read belongs to. A read belongs to exactly one read group. This is a server-generated ID which is distinct from SAM's RG tag (for that value, see ReadGroup.name). #[serde(rename="readGroupId")] pub read_group_id: Option, - /// The quality of the read sequence contained in this alignment record. `alignedSequence` and `alignedQuality` may be shorter than the full read sequence and quality. This will occur if the alignment is part of a chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR for this read will begin/end with a hard clip operator that will indicate the length of the excised sequence. + /// The quality of the read sequence contained in this alignment record (equivalent to QUAL in SAM). `alignedSequence` and `alignedQuality` may be shorter than the full read sequence and quality. This will occur if the alignment is part of a chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR for this read will begin/end with a hard clip operator that will indicate the length of the excised sequence. #[serde(rename="alignedQuality")] pub aligned_quality: Option>, - /// The bases of the read sequence contained in this alignment record, *without CIGAR operations applied*. `alignedSequence` and `alignedQuality` may be shorter than the full read sequence and quality. This will occur if the alignment is part of a chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR for this read will begin/end with a hard clip operator that will indicate the length of the excised sequence. + /// The bases of the read sequence contained in this alignment record, **without CIGAR operations applied** (equivalent to SEQ in SAM). `alignedSequence` and `alignedQuality` may be shorter than the full read sequence and quality. This will occur if the alignment is part of a chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR for this read will begin/end with a hard clip operator that will indicate the length of the excised sequence. #[serde(rename="alignedSequence")] pub aligned_sequence: Option, /// Whether this alignment is secondary. Equivalent to SAM flag 0x100. A secondary alignment represents an alternative to the primary alignment for this read. Aligners may return secondary alignments if a read can map ambiguously to multiple coordinates in the genome. By convention, each read has one and only one alignment where both `secondaryAlignment` and `supplementaryAlignment` are false. @@ -598,19 +618,20 @@ pub struct Read { impl Resource for Read {} -/// A variant represents a change in DNA sequence relative to a reference sequence. For example, a variant could represent a SNP or an insertion. Variants belong to a variant set. Each of the calls on a variant represent a determination of genotype with respect to that variant. For example, a call might assign probability of 0.32 to the occurrence of a SNP named rs1234 in a sample named NA12345. A call belongs to a call set, which contains related calls typically from one sample. +/// A variant represents a change in DNA sequence relative to a reference sequence. For example, a variant could represent a SNP or an insertion. Variants belong to a variant set. For more genomics resource definitions, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Each of the calls on a variant represent a determination of genotype with respect to that variant. For example, a call might assign probability of 0.32 to the occurrence of a SNP named rs1234 in a sample named NA12345. A call belongs to a call set, which contains related calls typically from one sample. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [patch variants](struct.VariantPatchCall.html) (request|response) +/// * [import variants](struct.VariantImportCall.html) (none) /// * [delete variants](struct.VariantDeleteCall.html) (none) /// * [create variants](struct.VariantCreateCall.html) (request|response) /// * [get variants](struct.VariantGetCall.html) (response) -/// * [import variants](struct.VariantImportCall.html) (none) +/// * [patch variants](struct.VariantPatchCall.html) (request|response) /// * [search variants](struct.VariantSearchCall.html) (none) +/// * [stream variants](struct.VariantStreamCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Variant { @@ -651,6 +672,34 @@ impl Resource for Variant {} impl ResponseResult for Variant {} +/// The read group set import request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [import readgroupsets](struct.ReadgroupsetImportCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ImportReadGroupSetsRequest { + /// The reference set to which the imported read group sets are aligned to, if any. The reference names of this reference set must be a superset of those found in the imported file headers. If no reference set id is provided, a best effort is made to associate with a matching reference set. + #[serde(rename="referenceSetId")] + pub reference_set_id: Option, + /// A list of URIs pointing at [BAM files](https://samtools.github.io/hts-specs/SAMv1.pdf) in Google Cloud Storage. + #[serde(rename="sourceUris")] + pub source_uris: Option>, + /// The partition strategy describes how read groups are partitioned into read group sets. + #[serde(rename="partitionStrategy")] + pub partition_strategy: Option, + /// Required. The ID of the dataset these read group sets will belong to. The caller must have WRITE permissions to this dataset. + #[serde(rename="datasetId")] + pub dataset_id: Option, +} + +impl RequestValue for ImportReadGroupSetsRequest {} + + /// The variant data export request. /// /// # Activities @@ -718,7 +767,34 @@ pub struct GetIamPolicyRequest; impl RequestValue for GetIamPolicyRequest {} -/// A reference set is a set of references which typically comprise a reference assembly for a species, such as `GRCh38` which is representative of the human genome. A reference set defines a common coordinate space for comparing reference-aligned experimental data. A reference set contains 1 or more references. +/// The call set search request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search callsets](struct.CallsetSearchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SearchCallSetsRequest { + /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of `nextPageToken` from the previous response. + #[serde(rename="pageToken")] + pub page_token: Option, + /// Restrict the query to call sets within the given variant sets. At least one ID must be provided. + #[serde(rename="variantSetIds")] + pub variant_set_ids: Option>, + /// Only return call sets for which a substring of the name matches this string. + pub name: Option, + /// The maximum number of results to return in a single page. If unspecified, defaults to 1024. + #[serde(rename="pageSize")] + pub page_size: Option, +} + +impl RequestValue for SearchCallSetsRequest {} + + +/// A reference set is a set of references which typically comprise a reference assembly for a species, such as `GRCh38` which is representative of the human genome. A reference set defines a common coordinate space for comparing reference-aligned experimental data. A reference set contains 1 or more references. For more genomics resource definitions, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Activities /// @@ -743,7 +819,7 @@ pub struct ReferenceSet { /// All known corresponding accession IDs in INSDC (GenBank/ENA/DDBJ) ideally with a version number, for example `NC_000001.11`. #[serde(rename="sourceAccessions")] pub source_accessions: Option>, - /// ID from http://www.ncbi.nlm.nih.gov/taxonomy (e.g. 9606->human) indicating the species which this assembly is intended to model. Note that contained references may specify a different `ncbiTaxonId`, as assemblies may contain reference sequences which do not belong to the modeled species, e.g. EBV in a human reference genome. + /// ID from http://www.ncbi.nlm.nih.gov/taxonomy (for example, 9606 for human) indicating the species which this reference set is intended to model. Note that contained references may specify a different `ncbiTaxonId`, as assemblies may contain reference sequences which do not belong to the modeled species, for example EBV in a human reference genome. #[serde(rename="ncbiTaxonId")] pub ncbi_taxon_id: Option, /// The server-generated reference set ID, unique across all reference sets. @@ -756,7 +832,7 @@ impl Resource for ReferenceSet {} impl ResponseResult for ReferenceSet {} -/// A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset. +/// A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset. For more genomics resource definitions, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Activities /// @@ -772,6 +848,9 @@ pub struct VariantSet { /// A list of all references used by the variants in a variant set with associated coordinate upper bounds for each one. #[serde(rename="referenceBounds")] pub reference_bounds: Option>, + /// The reference set to which the variant set is mapped. The reference set describes the alignment provenance of the variant set, while the `referenceBounds` describe the shape of the actual variant data. The reference set's reference names are a superset of those found in the `referenceBounds`. For example, given a variant set that is mapped to the GRCh38 reference set and contains a single variant on reference 'X', `referenceBounds` would contain only an entry for 'X', while the associated reference set enumerates all possible references: '1', '2', 'X', 'Y', 'MT', etc. + #[serde(rename="referenceSetId")] + pub reference_set_id: Option, /// The server-generated variant set ID, unique across all variant sets. pub id: Option, /// The dataset to which this variant set belongs. @@ -914,22 +993,28 @@ pub struct SearchVariantSetsResponse { impl ResponseResult for SearchVariantSetsResponse {} -/// There is no detailed description. +/// The read search response. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [undelete datasets](struct.DatasetUndeleteCall.html) (request) +/// * [search reads](struct.ReadSearchCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UndeleteDatasetRequest; +pub struct SearchReadsResponse { + /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of matching alignments sorted by mapped genomic coordinate, if any, ascending in position within the same reference. Unmapped reads, which have no position, are returned contiguously and are sorted in ascending lexicographic order by fragment name. + pub alignments: Option>, +} -impl RequestValue for UndeleteDatasetRequest {} +impl ResponseResult for SearchReadsResponse {} -/// A call set is a collection of variant calls, typically for one sample. It belongs to a variant set. +/// A call set is a collection of variant calls, typically for one sample. It belongs to a variant set. For more genomics resource definitions, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Activities /// @@ -963,23 +1048,22 @@ impl Resource for CallSet {} impl ResponseResult for CallSet {} -/// An abstraction for referring to a genomic position, in relation to some already known reference. For now, represents a genomic position as a reference name, a base number on that reference (0-based), and a determination of forward or reverse strand. +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [stream reads](struct.ReadStreamCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Position { - /// The 0-based offset from the start of the forward strand for that reference. - pub position: Option, - /// Whether this position is on the reverse strand, as opposed to the forward strand. - #[serde(rename="reverseStrand")] - pub reverse_strand: Option, - /// The name of the reference in whatever reference set is being used. - #[serde(rename="referenceName")] - pub reference_name: Option, +pub struct StreamReadsResponse { + /// no description provided + pub alignments: Option>, } -impl Part for Position {} +impl ResponseResult for StreamReadsResponse {} /// There is no detailed description. @@ -1003,47 +1087,69 @@ pub struct SearchReferencesResponse { impl ResponseResult for SearchReferencesResponse {} -/// The call set search request. +/// The stream variants request. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [search callsets](struct.CallsetSearchCall.html) (request) +/// * [stream variants](struct.VariantStreamCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchCallSetsRequest { - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of `nextPageToken` from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// Restrict the query to call sets within the given variant sets. At least one ID must be provided. - #[serde(rename="variantSetIds")] - pub variant_set_ids: Option>, - /// Only return call sets for which a substring of the name matches this string. +pub struct StreamVariantsRequest { + /// The beginning of the window (0-based, inclusive) for which overlapping variants should be returned. + pub start: Option, + /// The variant set ID from which to stream variants. + #[serde(rename="variantSetId")] + pub variant_set_id: Option, + /// The end of the window (0-based, exclusive) for which overlapping variants should be returned. + pub end: Option, + /// Required. Only return variants in this reference sequence. + #[serde(rename="referenceName")] + pub reference_name: Option, + /// The Google Developers Console project ID or number which will be billed for this access. The caller must have WRITE access to this project. Required. + #[serde(rename="projectId")] + pub project_id: Option, + /// Only return variant calls which belong to call sets with these IDs. Leaving this blank returns all variant calls. + #[serde(rename="callSetIds")] + pub call_set_ids: Option>, +} + +impl RequestValue for StreamVariantsRequest {} + + +/// This resource represents a long-running operation that is the result of a network API call. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [cancel operations](struct.OperationCancelCall.html) (none) +/// * [export variantsets](struct.VariantsetExportCall.html) (response) +/// * [export readgroupsets](struct.ReadgroupsetExportCall.html) (response) +/// * [import variants](struct.VariantImportCall.html) (response) +/// * [import readgroupsets](struct.ReadgroupsetImportCall.html) (response) +/// * [get operations](struct.OperationGetCall.html) (response) +/// * [list operations](struct.OperationListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// An OperationMetadata object. This will always be returned with the Operation. + pub metadata: Option>, + /// 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. + pub done: Option, + /// If importing ReadGroupSets, an ImportReadGroupSetsResponse is returned. If importing Variants, an ImportVariantsResponse is returned. For exports, an empty response is returned. + pub response: Option>, + /// The server-assigned name, which is only unique within the same service that originally returns it. For example: `operations/CJHU7Oi_ChDrveSpBRjfuL-qzoWAgEw` pub name: Option, - /// The maximum number of call sets to return. If unspecified, defaults to 1000. - #[serde(rename="pageSize")] - pub page_size: Option, + /// The error result of the operation in case of failure. + pub error: Option, } -impl RequestValue for SearchCallSetsRequest {} - - -/// A bucket over which read coverage has been precomputed. A bucket corresponds to a specific range of the reference sequence. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CoverageBucket { - /// The average number of reads which are aligned to each individual reference base in this bucket. - #[serde(rename="meanCoverage")] - pub mean_coverage: Option, - /// The genomic coordinate range spanned by this bucket. - pub range: Option, -} - -impl Part for CoverageBucket {} +impl Resource for Operation {} +impl ResponseResult for Operation {} /// The dataset list response. @@ -1067,7 +1173,7 @@ pub struct ListDatasetsResponse { impl ResponseResult for ListDatasetsResponse {} -/// A read group set is a logical collection of read groups, which are collections of reads produced by a sequencer. A read group set typically models reads corresponding to one sample, sequenced one way, and aligned one way. * A read group set belongs to one dataset. * A read group belongs to one read group set. * A read belongs to one read group. +/// A read group set is a logical collection of read groups, which are collections of reads produced by a sequencer. A read group set typically models reads corresponding to one sample, sequenced one way, and aligned one way. * A read group set belongs to one dataset. * A read group belongs to one read group set. * A read belongs to one read group. For more genomics resource definitions, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Activities /// @@ -1081,12 +1187,12 @@ impl ResponseResult for ListDatasetsResponse {} pub struct ReadGroupSet { /// A map of additional read group set information. pub info: Option>>, - /// The dataset ID. + /// The dataset to which this read group set belongs. #[serde(rename="datasetId")] pub dataset_id: Option, /// The read group set name. By default this will be initialized to the sample name of the sequenced data contained in this set. pub name: Option, - /// The reference set the reads in this read group set are aligned to. + /// The reference set to which the reads in this read group set are aligned. #[serde(rename="referenceSetId")] pub reference_set_id: Option, /// The server-generated read group set ID, unique for all read group sets. @@ -1103,32 +1209,33 @@ impl Resource for ReadGroupSet {} impl ResponseResult for ReadGroupSet {} -/// The read group set import request. +/// The stream reads request. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [import readgroupsets](struct.ReadgroupsetImportCall.html) (request) +/// * [stream reads](struct.ReadStreamCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImportReadGroupSetsRequest { - /// The reference set to which the imported read group sets are aligned to, if any. The reference names of this reference set must be a superset of those found in the imported file headers. If no reference set id is provided, a best effort is made to associate with a matching reference set. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// A list of URIs pointing at [BAM files](https://samtools.github.io/hts-specs/SAMv1.pdf) in Google Cloud Storage. - #[serde(rename="sourceUris")] - pub source_uris: Option>, - /// The partition strategy describes how read groups are partitioned into read group sets. - #[serde(rename="partitionStrategy")] - pub partition_strategy: Option, - /// Required. The ID of the dataset these read group sets will belong to. The caller must have WRITE permissions to this dataset. - #[serde(rename="datasetId")] - pub dataset_id: Option, +pub struct StreamReadsRequest { + /// The Google Developers Console project ID or number which will be billed for this access. The caller must have WRITE access to this project. Required. + #[serde(rename="projectId")] + pub project_id: Option, + /// The reference sequence name, for example `chr1`, `1`, or `chrX`. If set to *, only unmapped reads are returned. + #[serde(rename="referenceName")] + pub reference_name: Option, + /// The end position of the range on the reference, 0-based exclusive. If specified, `referenceName` must also be specified. + pub end: Option, + /// The ID of the read group set from which to stream reads. + #[serde(rename="readGroupSetId")] + pub read_group_set_id: Option, + /// The start position of the range on the reference, 0-based inclusive. If specified, `referenceName` must also be specified. + pub start: Option, } -impl RequestValue for ImportReadGroupSetsRequest {} +impl RequestValue for StreamReadsRequest {} /// The response message for Operations.ListOperations. @@ -1152,7 +1259,7 @@ pub struct ListOperationsResponse { impl ResponseResult for ListOperationsResponse {} -/// A reference is a canonical assembled DNA sequence, intended to act as a reference coordinate space for other genomic annotations. A single reference might represent the human chromosome 1 or mitochandrial DNA, for instance. A reference belongs to one or more reference sets. +/// A reference is a canonical assembled DNA sequence, intended to act as a reference coordinate space for other genomic annotations. A single reference might represent the human chromosome 1 or mitochandrial DNA, for instance. A reference belongs to one or more reference sets. For more genomics resource definitions, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Activities /// @@ -1171,7 +1278,7 @@ pub struct Reference { pub length: Option, /// The name of this reference, for example `22`. pub name: Option, - /// The URI from which the sequence was obtained. Specifies a FASTA format file/string with one name, sequence pair. + /// The URI from which the sequence was obtained. Typically specifies a FASTA format file. #[serde(rename="sourceUri")] pub source_uri: Option, /// All known corresponding accession IDs in INSDC (GenBank/ENA/DDBJ) ideally with a version number, for example `GCF_000001405.26`. @@ -1179,7 +1286,7 @@ pub struct Reference { pub source_accessions: Option>, /// The server-generated reference ID, unique across all references. pub id: Option, - /// ID from http://www.ncbi.nlm.nih.gov/taxonomy (e.g. 9606->human) if not specified by the containing reference set. + /// ID from http://www.ncbi.nlm.nih.gov/taxonomy. For example, 9606 for human. #[serde(rename="ncbiTaxonId")] pub ncbi_taxon_id: Option, } @@ -1198,7 +1305,7 @@ pub struct LinearAlignment { pub position: Option, /// Represents the local alignment of this sequence (alignment matches, indels, etc) against the reference. pub cigar: Option>, - /// The mapping quality of this alignment. Represents how likely the read maps to this position as opposed to other locations. + /// The mapping quality of this alignment. Represents how likely the read maps to this position as opposed to other locations. Specifically, this is -10 log10 Pr(mapping position is wrong), rounded to the nearest integer. #[serde(rename="mappingQuality")] pub mapping_quality: Option, } @@ -1261,7 +1368,7 @@ impl Part for Range {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SearchReferencesRequest { - /// If present, return references for which the `md5checksum` matches. See `Reference.md5checksum` for construction details. + /// If present, return references for which the md5checksum matches exactly. pub md5checksums: Option>, /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of `nextPageToken` from the previous response. #[serde(rename="pageToken")] @@ -1269,9 +1376,9 @@ pub struct SearchReferencesRequest { /// If present, return only references which belong to this reference set. #[serde(rename="referenceSetId")] pub reference_set_id: Option, - /// If present, return references for which the accession matches this string. Best to give a version number, for example `GCF_000001405.26`. If only the main accession number is given then all records with that main accession will be returned, whichever version. Note that different versions will have different sequences. + /// If present, return references for which a prefix of any of sourceAccessions match any of these strings. Accession numbers typically have a main number and a version, for example `GCF_000001405.26`. pub accessions: Option>, - /// Specifies the maximum number of results to return in a single page. + /// The maximum number of results to return in a single page. If unspecified, defaults to 1024. The maximum value is 4096. #[serde(rename="pageSize")] pub page_size: Option, } @@ -1279,7 +1386,7 @@ pub struct SearchReferencesRequest { impl RequestValue for SearchReferencesRequest {} -/// A Dataset is a collection of genomic data. +/// A Dataset is a collection of genomic data. For more genomics resource definitions, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Activities /// @@ -1324,13 +1431,13 @@ pub struct Experiment { /// The sequencing center used as part of this experiment. #[serde(rename="sequencingCenter")] pub sequencing_center: Option, - /// The library used as part of this experiment. Note: This is not an actual ID within this repository, but rather an identifier for a library which may be meaningful to some external system. + /// A client-supplied library identifier; a library is a collection of DNA fragments which have been prepared for sequencing from a sample. This field is important for quality control as error or bias can be introduced during sample preparation. #[serde(rename="libraryId")] pub library_id: Option, - /// The instrument model used as part of this experiment. This maps to sequencing technology in BAM. + /// The instrument model used as part of this experiment. This maps to sequencing technology in the SAM spec. #[serde(rename="instrumentModel")] pub instrument_model: Option, - /// The platform unit used as part of this experiment e.g. flowcell-barcode.lane for Illumina or slide for SOLiD. Corresponds to the @RG PU field in the SAM spec. + /// The platform unit used as part of this experiment, for example flowcell-barcode.lane for Illumina or slide for SOLiD. Corresponds to the @RG PU field in the SAM spec. #[serde(rename="platformUnit")] pub platform_unit: Option, } @@ -1353,17 +1460,17 @@ pub struct ReadGroup { pub description: Option, /// The programs used to generate this read group. Programs are always identical for all read groups within a read group set. For this reason, only the first read group in a returned set will have this field populated. pub programs: Option>, - /// The sample this read group's data was generated from. Note: This is not an actual ID within this repository, but rather an identifier for a sample which may be meaningful to some external system. + /// A client-supplied sample identifier for the reads in this read group. #[serde(rename="sampleId")] pub sample_id: Option, /// The experiment used to generate this read group. pub experiment: Option, - /// The reference set the reads in this read group are aligned to. Required if there are any read alignments. + /// The reference set the reads in this read group are aligned to. #[serde(rename="referenceSetId")] pub reference_set_id: Option, - /// The server-generated read group ID, unique for all read groups. Note: This is different than the `@RG ID` field in the SAM spec. For that value, see the `name` field. + /// The server-generated read group ID, unique for all read groups. Note: This is different than the @RG ID field in the SAM spec. For that value, see name. pub id: Option, - /// The ID of the dataset this read group belongs to. + /// The dataset to which this read group belongs. #[serde(rename="datasetId")] pub dataset_id: Option, /// The read group name. This corresponds to the @RG ID field in the SAM spec. @@ -1407,7 +1514,7 @@ pub struct SearchReadsRequest { /// The IDs of the read groups within which to search for reads. All specified read groups must belong to the same read group sets. Must specify one of `readGroupSetIds` or `readGroupIds`. #[serde(rename="readGroupIds")] pub read_group_ids: Option>, - /// Specifies number of results to return in a single page. If unspecified, it will default to 256. The maximum value is 2048. + /// The maximum number of results to return in a single page. If unspecified, defaults to 256. The maximum value is 2048. #[serde(rename="pageSize")] pub page_size: Option, /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of `nextPageToken` from the previous response. @@ -1415,7 +1522,7 @@ pub struct SearchReadsRequest { pub page_token: Option, /// The end position of the range on the reference, 0-based exclusive. If specified, `referenceName` must also be specified. pub end: Option, - /// The reference sequence name, for example `chr1`, `1`, or `chrX`. If set to *, only unmapped reads are returned. + /// The reference sequence name, for example `chr1`, `1`, or `chrX`. If set to `*`, only unmapped reads are returned. If unspecified, all reads (mapped and unmapped) are returned. #[serde(rename="referenceName")] pub reference_name: Option, } @@ -1436,13 +1543,13 @@ impl RequestValue for SearchReadsRequest {} pub struct SearchVariantsRequest { /// The end of the window, 0-based exclusive. If unspecified or 0, defaults to the length of the reference. pub end: Option, - /// The maximum number of variants to return. If unspecified, defaults to 5000. + /// The maximum number of variants to return in a single page. If unspecified, defaults to 5000. The maximum value is 10000. #[serde(rename="pageSize")] pub page_size: Option, /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of `nextPageToken` from the previous response. #[serde(rename="pageToken")] pub page_token: Option, - /// The maximum number of calls to return. However, at least one variant will always be returned, even if it has more calls than this limit. If unspecified, defaults to 5000. + /// The maximum number of calls to return in a single page. Note that this limit may be exceeded; at least one variant is always returned per page, even if it has more calls than this limit. If unspecified, defaults to 5000. The maximum value is 10000. #[serde(rename="maxCalls")] pub max_calls: Option, /// The beginning of the window (0-based, inclusive) for which overlapping variants should be returned. If unspecified, defaults to 0. @@ -1497,14 +1604,14 @@ impl ResponseResult for SearchCallSetsResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SearchReferenceSetsRequest { - /// If present, return references for which the `md5checksum` matches. See `ReferenceSet.md5checksum` for details. + /// If present, return reference sets for which the md5checksum matches exactly. pub md5checksums: Option>, /// If present, return reference sets for which a substring of their `assemblyId` matches this string (case insensitive). #[serde(rename="assemblyId")] pub assembly_id: Option, - /// If present, return references for which the accession matches any of these strings. Best to give a version number, for example `GCF_000001405.26`. If only the main accession number is given then all records with that main accession will be returned, whichever version. Note that different versions will have different sequences. + /// If present, return reference sets for which a prefix of any of sourceAccessions match any of these strings. Accession numbers typically have a main number and a version, for example `NC_000001.11`. pub accessions: Option>, - /// Specifies the maximum number of results to return in a single page. + /// The maximum number of results to return in a single page. If unspecified, defaults to 1024. The maximum value is 4096. #[serde(rename="pageSize")] pub page_size: Option, /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of `nextPageToken` from the previous response. @@ -1515,25 +1622,19 @@ pub struct SearchReferenceSetsRequest { impl RequestValue for SearchReferenceSetsRequest {} -/// The read search response. +/// There is no detailed description. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [search reads](struct.ReadSearchCall.html) (response) +/// * [undelete datasets](struct.DatasetUndeleteCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReadsResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching alignments sorted by mapped genomic coordinate, if any, ascending in position within the same reference. Unmapped reads, which have no position, are returned contiguously and are sorted in ascending lexicographic order by fragment name. - pub alignments: Option>, -} +pub struct UndeleteDatasetRequest; -impl ResponseResult for SearchReadsResponse {} +impl RequestValue for UndeleteDatasetRequest {} @@ -1564,7 +1665,7 @@ impl ResponseResult for SearchReadsResponse {} /// ::default(), None); /// let mut hub = Genomics::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `cancel(...)`, `delete(...)`, `get(...)` and `list(...)` +/// // like `cancel(...)`, `get(...)` and `list(...)` /// // to build up your call. /// let rb = hub.operations(); /// # } @@ -1634,23 +1735,6 @@ impl<'a, C, A> OperationMethods<'a, C, A> { _additional_params: Default::default(), } } - - /// Create a builder to help you perform the following task: - /// - /// This method is not implemented. To cancel an operation, please use Operations.CancelOperation. - /// - /// # Arguments - /// - /// * `name` - The name of the operation resource to be deleted. - pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, C, A> { - OperationDeleteCall { - hub: self.hub, - _name: name.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } } @@ -1695,7 +1779,7 @@ impl<'a, C, A> DatasetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a new dataset. + /// Creates a new dataset. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -1712,7 +1796,7 @@ impl<'a, C, A> DatasetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a dataset. + /// Deletes a dataset. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -1729,7 +1813,7 @@ impl<'a, C, A> DatasetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Undeletes a dataset by restoring a dataset which was deleted via this API. This operation is only possible for a week after the deletion occurred. + /// Undeletes a dataset by restoring a dataset which was deleted via this API. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This operation is only possible for a week after the deletion occurred. /// /// # Arguments /// @@ -1748,7 +1832,7 @@ impl<'a, C, A> DatasetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Sets the access control policy on the specified dataset. Replaces any existing policy. See Setting a Policy for more information. + /// Sets the access control policy on the specified dataset. Replaces any existing policy. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) See Setting a Policy for more information. /// /// # Arguments /// @@ -1767,7 +1851,7 @@ impl<'a, C, A> DatasetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns permissions that a caller has on the specified resource. See Testing Permissions for more information. + /// Returns permissions that a caller has on the specified resource. See Testing Permissions for more information. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -1786,7 +1870,7 @@ impl<'a, C, A> DatasetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a dataset by ID. + /// Gets a dataset by ID. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -1803,7 +1887,7 @@ impl<'a, C, A> DatasetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists datasets within a project. + /// Lists datasets within a project. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) pub fn list(&self) -> DatasetListCall<'a, C, A> { DatasetListCall { hub: self.hub, @@ -1818,7 +1902,7 @@ impl<'a, C, A> DatasetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets the access control policy for the dataset. Is empty if the policy or the resource does not exist. See Getting a Policy for more information. + /// Gets the access control policy for the dataset. This is empty if the policy or resource does not exist. See Getting a Policy for more information. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -1837,7 +1921,7 @@ impl<'a, C, A> DatasetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a dataset. This method supports patch semantics. + /// Updates a dataset. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This method supports patch semantics. /// /// # Arguments /// @@ -1898,7 +1982,7 @@ impl<'a, C, A> ReferencesetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Searches for reference sets which match the given criteria. Implements [GlobalAllianceApi.searchReferenceSets](http://ga4gh.org/documentation/api/v0.5.1/ga4gh_api.html#/schema/org.ga4gh.searchReferenceSets). + /// Searches for reference sets which match the given criteria. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchReferenceSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L71) /// /// # Arguments /// @@ -1915,7 +1999,7 @@ impl<'a, C, A> ReferencesetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a reference set. Implements [GlobalAllianceApi.getReferenceSet](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L83). + /// Gets a reference set. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.getReferenceSet](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L83). /// /// # Arguments /// @@ -1973,7 +2057,7 @@ impl<'a, C, A> CallsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a list of call sets matching the criteria. Implements [GlobalAllianceApi.searchCallSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L178). + /// Gets a list of call sets matching the criteria. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchCallSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L178). /// /// # Arguments /// @@ -1990,7 +2074,7 @@ impl<'a, C, A> CallsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a call set. This method supports patch semantics. + /// Updates a call set. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This method supports patch semantics. /// /// # Arguments /// @@ -2010,7 +2094,7 @@ impl<'a, C, A> CallsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a new call set. + /// Creates a new call set. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2027,7 +2111,7 @@ impl<'a, C, A> CallsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a call set. + /// Deletes a call set. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2044,7 +2128,7 @@ impl<'a, C, A> CallsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a call set by ID. + /// Gets a call set by ID. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2085,7 +2169,7 @@ impl<'a, C, A> CallsetMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Genomics::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `search(...)` +/// // like `search(...)` and `stream(...)` /// // to build up your call. /// let rb = hub.reads(); /// # } @@ -2102,7 +2186,7 @@ impl<'a, C, A> ReadMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a list of reads for one or more read group sets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only read group set IDs yields all reads in those read group sets, including unmapped reads. All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order. Implements [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85). + /// Gets a list of reads for one or more read group sets. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only read group set IDs yields all reads in those read group sets, including unmapped reads. All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (by reference sequence, then position). Reads with equivalent genomic coordinates are returned in an unspecified order. This order is consistent, such that two queries for the same content (regardless of page size) yield reads in the same order across their respective streams of paginated responses. Implements [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85). /// /// # Arguments /// @@ -2116,6 +2200,23 @@ impl<'a, C, A> ReadMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Returns a stream of all the reads matching the search request, ordered by reference name, position, and ID. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn stream(&self, request: StreamReadsRequest) -> ReadStreamCall<'a, C, A> { + ReadStreamCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -2160,12 +2261,12 @@ impl<'a, C, A> ReadgroupsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Exports a read group set to a BAM file in Google Cloud Storage. Note that currently there may be some differences between exported BAM files and the original BAM file at the time of import. See [ImportReadGroupSets](google.genomics.v1.ReadServiceV1.ImportReadGroupSets) for caveats. + /// Exports a read group set to a BAM file in Google Cloud Storage. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Note that currently there may be some differences between exported BAM files and the original BAM file at the time of import. See [ImportReadGroupSets](google.genomics.v1.ReadServiceV1.ImportReadGroupSets) for caveats. /// /// # Arguments /// /// * `request` - No description provided. - /// * `readGroupSetId` - Required. The ID of the read group set to export. + /// * `readGroupSetId` - Required. The ID of the read group set to export. The caller must have READ access to this read group set. pub fn export(&self, request: ExportReadGroupSetRequest, read_group_set_id: &str) -> ReadgroupsetExportCall<'a, C, A> { ReadgroupsetExportCall { hub: self.hub, @@ -2179,7 +2280,7 @@ impl<'a, C, A> ReadgroupsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates read group sets by asynchronously importing the provided information. The caller must have WRITE permissions to the dataset. ## Notes on [BAM](https://samtools.github.io/hts-specs/SAMv1.pdf) import - Tags will be converted to strings - tag types are not preserved - Comments (`@CO`) in the input file header will not be preserved - Original header order of references (`@SQ`) will not be preserved - Any reverse stranded unmapped reads will be reverse complemented, and their qualities (and "BQ" tag, if any) will be reversed - Unmapped reads will be stripped of positional information (reference name and position) + /// Creates read group sets by asynchronously importing the provided information. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) The caller must have WRITE permissions to the dataset. ## Notes on [BAM](https://samtools.github.io/hts-specs/SAMv1.pdf) import - Tags will be converted to strings - tag types are not preserved - Comments (`@CO`) in the input file header will not be preserved - Original header order of references (`@SQ`) will not be preserved - Any reverse stranded unmapped reads will be reverse complemented, and their qualities (also the "BQ" and "OQ" tags, if any) will be reversed - Unmapped reads will be stripped of positional information (reference name and position) /// /// # Arguments /// @@ -2196,7 +2297,7 @@ impl<'a, C, A> ReadgroupsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a read group set. This method supports patch semantics. + /// Updates a read group set. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This method supports patch semantics. /// /// # Arguments /// @@ -2216,7 +2317,7 @@ impl<'a, C, A> ReadgroupsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a read group set by ID. + /// Gets a read group set by ID. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2233,7 +2334,7 @@ impl<'a, C, A> ReadgroupsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists fixed width coverage buckets for a read group set, each of which correspond to a range of a reference sequence. Each bucket summarizes coverage information across its corresponding genomic range. Coverage is defined as the number of reads which are aligned to a given base in the reference sequence. Coverage buckets are available at several precomputed bucket widths, enabling retrieval of various coverage 'zoom levels'. The caller must have READ permissions for the target read group set. + /// Lists fixed width coverage buckets for a read group set, each of which correspond to a range of a reference sequence. Each bucket summarizes coverage information across its corresponding genomic range. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Coverage is defined as the number of reads which are aligned to a given base in the reference sequence. Coverage buckets are available at several precomputed bucket widths, enabling retrieval of various coverage 'zoom levels'. The caller must have READ permissions for the target read group set. /// /// # Arguments /// @@ -2256,7 +2357,7 @@ impl<'a, C, A> ReadgroupsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a read group set. + /// Deletes a read group set. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2273,7 +2374,7 @@ impl<'a, C, A> ReadgroupsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Searches for read group sets matching the criteria. Implements [GlobalAllianceApi.searchReadGroupSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L135). + /// Searches for read group sets matching the criteria. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchReadGroupSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L135). /// /// # Arguments /// @@ -2331,7 +2432,7 @@ impl<'a, C, A> ReferenceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the bases in a reference, optionally restricted to a range. Implements [GlobalAllianceApi.getReferenceBases](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L221). + /// Lists the bases in a reference, optionally restricted to a range. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.getReferenceBases](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L221). /// /// # Arguments /// @@ -2352,7 +2453,7 @@ impl<'a, C, A> ReferenceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Searches for references which match the given criteria. Implements [GlobalAllianceApi.searchReferences](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L146). + /// Searches for references which match the given criteria. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchReferences](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L146). /// /// # Arguments /// @@ -2369,7 +2470,7 @@ impl<'a, C, A> ReferenceMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a reference. Implements [GlobalAllianceApi.getReference](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L158). + /// Gets a reference. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.getReference](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L158). /// /// # Arguments /// @@ -2410,7 +2511,7 @@ impl<'a, C, A> ReferenceMethods<'a, C, A> { /// ::default(), None); /// let mut hub = Genomics::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `delete(...)`, `get(...)`, `import(...)`, `patch(...)` and `search(...)` +/// // like `create(...)`, `delete(...)`, `get(...)`, `import(...)`, `patch(...)`, `search(...)` and `stream(...)` /// // to build up your call. /// let rb = hub.variants(); /// # } @@ -2427,7 +2528,7 @@ impl<'a, C, A> VariantMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a list of variants matching the criteria. Implements [GlobalAllianceApi.searchVariants](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L126). + /// Gets a list of variants matching the criteria. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchVariants](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L126). /// /// # Arguments /// @@ -2444,7 +2545,7 @@ impl<'a, C, A> VariantMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a variant. + /// Deletes a variant. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2461,7 +2562,7 @@ impl<'a, C, A> VariantMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a variant by ID. + /// Gets a variant by ID. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2478,7 +2579,7 @@ impl<'a, C, A> VariantMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a new variant. + /// Creates a new variant. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2495,7 +2596,7 @@ impl<'a, C, A> VariantMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates variant data by asynchronously importing the provided information. The variants for import will be merged with any existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created. When variants are merged, the call information from the new variant is added to the existing variant, and other fields (such as key/value pairs) are discarded. In particular, this means for merged VCF variants that have conflicting INFO fields, some data will be arbitrarily discarded. As a special case, for single-sample VCF files, QUAL and FILTER fields will be moved to the call level; these are sometimes interpreted in a call-specific context. Imported VCF headers are appended to the metadata already in a variant set. + /// Creates variant data by asynchronously importing the provided information. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) The variants for import will be merged with any existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created. When variants are merged, the call information from the new variant is added to the existing variant, and other fields (such as key/value pairs) are discarded. In particular, this means for merged VCF variants that have conflicting INFO fields, some data will be arbitrarily discarded. As a special case, for single-sample VCF files, QUAL and FILTER fields will be moved to the call level; these are sometimes interpreted in a call-specific context. Imported VCF headers are appended to the metadata already in a variant set. /// /// # Arguments /// @@ -2512,7 +2613,7 @@ impl<'a, C, A> VariantMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a variant. This method supports patch semantics. Returns the modified variant without its calls. + /// Updates a variant. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This method supports patch semantics. Returns the modified variant without its calls. /// /// # Arguments /// @@ -2529,6 +2630,23 @@ impl<'a, C, A> VariantMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Returns a stream of all the variants matching the search request, ordered by reference name, position, and ID. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn stream(&self, request: StreamVariantsRequest) -> VariantStreamCall<'a, C, A> { + VariantStreamCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -2573,7 +2691,7 @@ impl<'a, C, A> VariantsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Creates a new variant set. The provided variant set must have a valid `datasetId` set - all other fields are optional. Note that the `id` field will be ignored, as this is assigned by the server. + /// Creates a new variant set. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) The provided variant set must have a valid `datasetId` set - all other fields are optional. Note that the `id` field will be ignored, as this is assigned by the server. /// /// # Arguments /// @@ -2590,7 +2708,24 @@ impl<'a, C, A> VariantsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Exports variant set data to an external destination. + /// Deletes the contents of a variant set. The variant set object is not deleted. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) + /// + /// # Arguments + /// + /// * `variantSetId` - The ID of the variant set to be deleted. + pub fn delete(&self, variant_set_id: &str) -> VariantsetDeleteCall<'a, C, A> { + VariantsetDeleteCall { + hub: self.hub, + _variant_set_id: variant_set_id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Exports variant set data to an external destination. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2609,7 +2744,7 @@ impl<'a, C, A> VariantsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Updates a variant set. This method supports patch semantics. + /// Updates a variant set using patch semantics. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2629,7 +2764,7 @@ impl<'a, C, A> VariantsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns a list of all variant sets matching search criteria. Implements [GlobalAllianceApi.searchVariantSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L49). + /// Returns a list of all variant sets matching search criteria. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchVariantSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L49). /// /// # Arguments /// @@ -2646,7 +2781,7 @@ impl<'a, C, A> VariantsetMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Gets a variant set by ID. + /// Gets a variant set by ID. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// # Arguments /// @@ -2660,23 +2795,6 @@ impl<'a, C, A> VariantsetMethods<'a, C, A> { _additional_params: Default::default(), } } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the contents of a variant set. The variant set object is not deleted. - /// - /// # Arguments - /// - /// * `variantSetId` - The ID of the variant set to be deleted. - pub fn delete(&self, variant_set_id: &str) -> VariantsetDeleteCall<'a, C, A> { - VariantsetDeleteCall { - hub: self.hub, - _variant_set_id: variant_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } } @@ -2749,7 +2867,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.operations.cancel", + dlg.begin(MethodInfo { id: "genomics.operations.cancel", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -2794,14 +2912,14 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2845,7 +2963,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2855,10 +2973,10 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2890,7 +3008,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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, C, A> { self._request = new_value; @@ -2900,7 +3018,7 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, /// /// Sets the *name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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, C, A> { self._name = new_value.to_string(); @@ -2918,12 +3036,12 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2946,17 +3064,17 @@ impl<'a, C, A> OperationCancelCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OperationCancelCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationCancelCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3019,7 +3137,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.operations.get", + dlg.begin(MethodInfo { id: "genomics.operations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -3064,7 +3182,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3100,7 +3218,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3110,10 +3228,10 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3146,7 +3264,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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, A> { self._name = new_value.to_string(); @@ -3164,12 +3282,12 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3192,17 +3310,17 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3271,7 +3389,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.operations.list", + dlg.begin(MethodInfo { id: "genomics.operations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -3325,7 +3443,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3361,7 +3479,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3371,10 +3489,10 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3407,7 +3525,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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, C, A> { self._name = new_value.to_string(); @@ -3446,12 +3564,12 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3474,17 +3592,17 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3492,253 +3610,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } -/// This method is not implemented. To cancel an operation, please use Operations.CancelOperation. -/// -/// A builder for the *delete* method supported by a *operation* resource. -/// It is not used directly, but through a `OperationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.operations().delete("name") -/// .doit(); -/// # } -/// ``` -pub struct OperationDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _name: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for OperationDeleteCall<'a, C, A> {} - -impl<'a, C, A> OperationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.operations.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("name", self._name.to_string())); - for &field in ["alt", "name"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://genomics.googleapis.com/v1/{+name}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{+name}", "name")].iter() { - let mut replace_with = String::new(); - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = value.to_string(); - break; - } - } - if find_this.as_bytes()[1] == '+' as u8 { - replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); - } - url = url.replace(find_this, &replace_with); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["name"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The name of the operation resource to be deleted. - /// - /// Sets the *name* path property to the given value. - /// - /// 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, C, A> { - self._name = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> OperationDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *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. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> OperationDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> OperationDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a new dataset. +/// Creates a new dataset. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *create* method supported by a *dataset* resource. /// It is not used directly, but through a `DatasetMethods` instance. @@ -3798,7 +3670,7 @@ impl<'a, C, A> DatasetCreateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.datasets.create", + dlg.begin(MethodInfo { id: "genomics.datasets.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3818,14 +3690,14 @@ impl<'a, C, A> DatasetCreateCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3869,7 +3741,7 @@ impl<'a, C, A> DatasetCreateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3879,10 +3751,10 @@ impl<'a, C, A> DatasetCreateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3914,7 +3786,7 @@ impl<'a, C, A> DatasetCreateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Dataset) -> DatasetCreateCall<'a, C, A> { self._request = new_value; @@ -3932,12 +3804,12 @@ impl<'a, C, A> DatasetCreateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3960,17 +3832,17 @@ impl<'a, C, A> DatasetCreateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3978,7 +3850,7 @@ impl<'a, C, A> DatasetCreateCall<'a, C, A> where C: BorrowMut, A: } -/// Deletes a dataset. +/// Deletes a dataset. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *delete* method supported by a *dataset* resource. /// It is not used directly, but through a `DatasetMethods` instance. @@ -4032,7 +3904,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.datasets.delete", + dlg.begin(MethodInfo { id: "genomics.datasets.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("datasetId", self._dataset_id.to_string())); @@ -4074,7 +3946,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4110,7 +3982,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4120,10 +3992,10 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4156,7 +4028,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetDeleteCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -4174,12 +4046,12 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4202,17 +4074,17 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4220,7 +4092,7 @@ impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: } -/// Undeletes a dataset by restoring a dataset which was deleted via this API. This operation is only possible for a week after the deletion occurred. +/// Undeletes a dataset by restoring a dataset which was deleted via this API. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This operation is only possible for a week after the deletion occurred. /// /// A builder for the *undelete* method supported by a *dataset* resource. /// It is not used directly, but through a `DatasetMethods` instance. @@ -4281,7 +4153,7 @@ impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.datasets.undelete", + dlg.begin(MethodInfo { id: "genomics.datasets.undelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("datasetId", self._dataset_id.to_string())); @@ -4323,14 +4195,14 @@ impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4374,7 +4246,7 @@ impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4384,10 +4256,10 @@ impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4419,7 +4291,7 @@ impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UndeleteDatasetRequest) -> DatasetUndeleteCall<'a, C, A> { self._request = new_value; @@ -4429,7 +4301,7 @@ impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetUndeleteCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -4447,12 +4319,12 @@ impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4475,17 +4347,17 @@ impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetUndeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetUndeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4493,7 +4365,7 @@ impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, } -/// Sets the access control policy on the specified dataset. Replaces any existing policy. See Setting a Policy for more information. +/// Sets the access control policy on the specified dataset. Replaces any existing policy. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) See Setting a Policy for more information. /// /// A builder for the *setIamPolicy* method supported by a *dataset* resource. /// It is not used directly, but through a `DatasetMethods` instance. @@ -4555,7 +4427,7 @@ impl<'a, C, A> DatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.datasets.setIamPolicy", + dlg.begin(MethodInfo { id: "genomics.datasets.setIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -4600,14 +4472,14 @@ impl<'a, C, A> DatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4651,7 +4523,7 @@ impl<'a, C, A> DatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4661,10 +4533,10 @@ impl<'a, C, A> DatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetSetIamPolicyCall<'a, C, A> { self._request = new_value; @@ -4706,7 +4578,7 @@ impl<'a, C, A> DatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetSetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -4724,12 +4596,12 @@ impl<'a, C, A> DatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DatasetSetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetSetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4770,7 +4642,7 @@ impl<'a, C, A> DatasetSetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.datasets.testIamPermissions", + dlg.begin(MethodInfo { id: "genomics.datasets.testIamPermissions", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -4877,14 +4749,14 @@ impl<'a, C, A> DatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4928,7 +4800,7 @@ impl<'a, C, A> DatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4938,10 +4810,10 @@ impl<'a, C, A> DatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut DatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut DatasetTestIamPermissionCall<'a, C, A> { self._request = new_value; @@ -4983,7 +4855,7 @@ impl<'a, C, A> DatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut DatasetTestIamPermissionCall<'a, C, A> { self._resource = new_value.to_string(); @@ -5001,12 +4873,12 @@ impl<'a, C, A> DatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut DatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DatasetTestIamPermissionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetTestIamPermissionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5047,7 +4919,7 @@ impl<'a, C, A> DatasetTestIamPermissionCall<'a, C, A> where C: BorrowMut DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.datasets.get", + dlg.begin(MethodInfo { id: "genomics.datasets.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("datasetId", self._dataset_id.to_string())); @@ -5143,7 +5015,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5179,7 +5051,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5189,10 +5061,10 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5225,7 +5097,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetGetCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -5243,12 +5115,12 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -5271,17 +5143,17 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5289,7 +5161,7 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Lists datasets within a project. +/// Lists datasets within a project. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *list* method supported by a *dataset* resource. /// It is not used directly, but through a `DatasetMethods` instance. @@ -5316,9 +5188,9 @@ impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.datasets().list() -/// .project_id("gubergren") -/// .page_token("sadipscing") -/// .page_size(-31) +/// .project_id("dolores") +/// .page_token("gubergren") +/// .page_size(-95) /// .doit(); /// # } /// ``` @@ -5348,7 +5220,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.datasets.list", + dlg.begin(MethodInfo { id: "genomics.datasets.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._project_id { @@ -5377,7 +5249,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5413,7 +5285,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5423,10 +5295,10 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5469,7 +5341,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o self._page_token = Some(new_value.to_string()); self } - /// The maximum number of results returned by this request. If unspecified, defaults to 50. The maximum value is 1024. + /// The maximum number of results to return in a single page. If unspecified, defaults to 50. The maximum value is 1024. /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> DatasetListCall<'a, C, A> { @@ -5488,12 +5360,12 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -5516,17 +5388,17 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5534,7 +5406,7 @@ impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: o } -/// Gets the access control policy for the dataset. Is empty if the policy or the resource does not exist. See Getting a Policy for more information. +/// Gets the access control policy for the dataset. This is empty if the policy or resource does not exist. See Getting a Policy for more information. For the definitions of datasets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *getIamPolicy* method supported by a *dataset* resource. /// It is not used directly, but through a `DatasetMethods` instance. @@ -5596,7 +5468,7 @@ impl<'a, C, A> DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.datasets.getIamPolicy", + dlg.begin(MethodInfo { id: "genomics.datasets.getIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -5641,14 +5513,14 @@ impl<'a, C, A> DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5692,7 +5564,7 @@ impl<'a, C, A> DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5702,10 +5574,10 @@ impl<'a, C, A> DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetGetIamPolicyCall<'a, C, A> { self._request = new_value; @@ -5747,7 +5619,7 @@ impl<'a, C, A> DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetGetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -5765,12 +5637,12 @@ impl<'a, C, A> DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DatasetGetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetGetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5811,7 +5683,7 @@ impl<'a, C, A> DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetGetIamPolicyCall<'a, C, A> where C: BorrowMut DatasetPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.datasets.patch", + dlg.begin(MethodInfo { id: "genomics.datasets.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("datasetId", self._dataset_id.to_string())); @@ -5919,14 +5791,14 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5970,7 +5842,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5980,10 +5852,10 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6015,7 +5887,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Dataset) -> DatasetPatchCall<'a, C, A> { self._request = new_value; @@ -6025,7 +5897,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *dataset id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn dataset_id(mut self, new_value: &str) -> DatasetPatchCall<'a, C, A> { self._dataset_id = new_value.to_string(); @@ -6050,12 +5922,12 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -6078,17 +5950,17 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatasetPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatasetPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6096,7 +5968,7 @@ impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: } -/// Searches for reference sets which match the given criteria. Implements [GlobalAllianceApi.searchReferenceSets](http://ga4gh.org/documentation/api/v0.5.1/ga4gh_api.html#/schema/org.ga4gh.searchReferenceSets). +/// Searches for reference sets which match the given criteria. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchReferenceSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L71) /// /// A builder for the *search* method supported by a *referenceset* resource. /// It is not used directly, but through a `ReferencesetMethods` instance. @@ -6156,7 +6028,7 @@ impl<'a, C, A> ReferencesetSearchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.referencesets.search", + dlg.begin(MethodInfo { id: "genomics.referencesets.search", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -6176,14 +6048,14 @@ impl<'a, C, A> ReferencesetSearchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6227,7 +6099,7 @@ impl<'a, C, A> ReferencesetSearchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6237,10 +6109,10 @@ impl<'a, C, A> ReferencesetSearchCall<'a, C, A> where C: BorrowMut ReferencesetSearchCall<'a, C, A> where C: BorrowMut ReferencesetSearchCall<'a, C, A> { self._request = new_value; @@ -6290,12 +6162,12 @@ impl<'a, C, A> ReferencesetSearchCall<'a, C, A> where C: BorrowMut ReferencesetSearchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ReferencesetSearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReferencesetSearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6336,7 +6208,7 @@ impl<'a, C, A> ReferencesetSearchCall<'a, C, A> where C: BorrowMut ReferencesetGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.referencesets.get", + dlg.begin(MethodInfo { id: "genomics.referencesets.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("referenceSetId", self._reference_set_id.to_string())); @@ -6432,7 +6304,7 @@ impl<'a, C, A> ReferencesetGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6468,7 +6340,7 @@ impl<'a, C, A> ReferencesetGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6478,10 +6350,10 @@ impl<'a, C, A> ReferencesetGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6514,7 +6386,7 @@ impl<'a, C, A> ReferencesetGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *reference set id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn reference_set_id(mut self, new_value: &str) -> ReferencesetGetCall<'a, C, A> { self._reference_set_id = new_value.to_string(); @@ -6532,12 +6404,12 @@ impl<'a, C, A> ReferencesetGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -6560,17 +6432,17 @@ impl<'a, C, A> ReferencesetGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReferencesetGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReferencesetGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6578,7 +6450,7 @@ impl<'a, C, A> ReferencesetGetCall<'a, C, A> where C: BorrowMut, } -/// Gets a list of call sets matching the criteria. Implements [GlobalAllianceApi.searchCallSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L178). +/// Gets a list of call sets matching the criteria. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchCallSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L178). /// /// A builder for the *search* method supported by a *callset* resource. /// It is not used directly, but through a `CallsetMethods` instance. @@ -6638,7 +6510,7 @@ impl<'a, C, A> CallsetSearchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.callsets.search", + dlg.begin(MethodInfo { id: "genomics.callsets.search", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -6658,14 +6530,14 @@ impl<'a, C, A> CallsetSearchCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6709,7 +6581,7 @@ impl<'a, C, A> CallsetSearchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6719,10 +6591,10 @@ impl<'a, C, A> CallsetSearchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6754,7 +6626,7 @@ impl<'a, C, A> CallsetSearchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SearchCallSetsRequest) -> CallsetSearchCall<'a, C, A> { self._request = new_value; @@ -6772,12 +6644,12 @@ impl<'a, C, A> CallsetSearchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -6800,17 +6672,17 @@ impl<'a, C, A> CallsetSearchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CallsetSearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CallsetSearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6818,7 +6690,7 @@ impl<'a, C, A> CallsetSearchCall<'a, C, A> where C: BorrowMut, A: } -/// Updates a call set. This method supports patch semantics. +/// Updates a call set. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This method supports patch semantics. /// /// A builder for the *patch* method supported by a *callset* resource. /// It is not used directly, but through a `CallsetMethods` instance. @@ -6881,7 +6753,7 @@ impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.callsets.patch", + dlg.begin(MethodInfo { id: "genomics.callsets.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("callSetId", self._call_set_id.to_string())); @@ -6926,14 +6798,14 @@ impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6977,7 +6849,7 @@ impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6987,10 +6859,10 @@ impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7022,7 +6894,7 @@ impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CallSet) -> CallsetPatchCall<'a, C, A> { self._request = new_value; @@ -7032,7 +6904,7 @@ impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *call set id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn call_set_id(mut self, new_value: &str) -> CallsetPatchCall<'a, C, A> { self._call_set_id = new_value.to_string(); @@ -7057,12 +6929,12 @@ impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -7085,17 +6957,17 @@ impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CallsetPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CallsetPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7103,7 +6975,7 @@ impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: } -/// Creates a new call set. +/// Creates a new call set. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *create* method supported by a *callset* resource. /// It is not used directly, but through a `CallsetMethods` instance. @@ -7163,7 +7035,7 @@ impl<'a, C, A> CallsetCreateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.callsets.create", + dlg.begin(MethodInfo { id: "genomics.callsets.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -7183,14 +7055,14 @@ impl<'a, C, A> CallsetCreateCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7234,7 +7106,7 @@ impl<'a, C, A> CallsetCreateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7244,10 +7116,10 @@ impl<'a, C, A> CallsetCreateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7279,7 +7151,7 @@ impl<'a, C, A> CallsetCreateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CallSet) -> CallsetCreateCall<'a, C, A> { self._request = new_value; @@ -7297,12 +7169,12 @@ impl<'a, C, A> CallsetCreateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -7325,17 +7197,17 @@ impl<'a, C, A> CallsetCreateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CallsetCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CallsetCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7343,7 +7215,7 @@ impl<'a, C, A> CallsetCreateCall<'a, C, A> where C: BorrowMut, A: } -/// Deletes a call set. +/// Deletes a call set. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *delete* method supported by a *callset* resource. /// It is not used directly, but through a `CallsetMethods` instance. @@ -7397,7 +7269,7 @@ impl<'a, C, A> CallsetDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.callsets.delete", + dlg.begin(MethodInfo { id: "genomics.callsets.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("callSetId", self._call_set_id.to_string())); @@ -7439,7 +7311,7 @@ impl<'a, C, A> CallsetDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7475,7 +7347,7 @@ impl<'a, C, A> CallsetDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7485,10 +7357,10 @@ impl<'a, C, A> CallsetDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7521,7 +7393,7 @@ impl<'a, C, A> CallsetDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *call set id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn call_set_id(mut self, new_value: &str) -> CallsetDeleteCall<'a, C, A> { self._call_set_id = new_value.to_string(); @@ -7539,12 +7411,12 @@ impl<'a, C, A> CallsetDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -7567,17 +7439,17 @@ impl<'a, C, A> CallsetDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CallsetDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CallsetDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7585,7 +7457,7 @@ impl<'a, C, A> CallsetDeleteCall<'a, C, A> where C: BorrowMut, A: } -/// Gets a call set by ID. +/// Gets a call set by ID. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *get* method supported by a *callset* resource. /// It is not used directly, but through a `CallsetMethods` instance. @@ -7639,7 +7511,7 @@ impl<'a, C, A> CallsetGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.callsets.get", + dlg.begin(MethodInfo { id: "genomics.callsets.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("callSetId", self._call_set_id.to_string())); @@ -7681,7 +7553,7 @@ impl<'a, C, A> CallsetGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7717,7 +7589,7 @@ impl<'a, C, A> CallsetGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7727,10 +7599,10 @@ impl<'a, C, A> CallsetGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7763,7 +7635,7 @@ impl<'a, C, A> CallsetGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *call set id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn call_set_id(mut self, new_value: &str) -> CallsetGetCall<'a, C, A> { self._call_set_id = new_value.to_string(); @@ -7781,12 +7653,12 @@ impl<'a, C, A> CallsetGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -7809,17 +7681,17 @@ impl<'a, C, A> CallsetGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CallsetGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CallsetGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7827,7 +7699,7 @@ impl<'a, C, A> CallsetGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Gets a list of reads for one or more read group sets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only read group set IDs yields all reads in those read group sets, including unmapped reads. All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order. Implements [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85). +/// Gets a list of reads for one or more read group sets. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only read group set IDs yields all reads in those read group sets, including unmapped reads. All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (by reference sequence, then position). Reads with equivalent genomic coordinates are returned in an unspecified order. This order is consistent, such that two queries for the same content (regardless of page size) yield reads in the same order across their respective streams of paginated responses. Implements [GlobalAllianceApi.searchReads](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/readmethods.avdl#L85). /// /// A builder for the *search* method supported by a *read* resource. /// It is not used directly, but through a `ReadMethods` instance. @@ -7887,7 +7759,7 @@ impl<'a, C, A> ReadSearchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.reads.search", + dlg.begin(MethodInfo { id: "genomics.reads.search", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -7907,14 +7779,14 @@ impl<'a, C, A> ReadSearchCall<'a, C, A> where C: BorrowMut, A: oa self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7958,7 +7830,7 @@ impl<'a, C, A> ReadSearchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7968,10 +7840,10 @@ impl<'a, C, A> ReadSearchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8003,7 +7875,7 @@ impl<'a, C, A> ReadSearchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SearchReadsRequest) -> ReadSearchCall<'a, C, A> { self._request = new_value; @@ -8021,12 +7893,12 @@ impl<'a, C, A> ReadSearchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -8049,17 +7921,17 @@ impl<'a, C, A> ReadSearchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReadSearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReadSearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8067,7 +7939,247 @@ impl<'a, C, A> ReadSearchCall<'a, C, A> where C: BorrowMut, A: oa } -/// Exports a read group set to a BAM file in Google Cloud Storage. Note that currently there may be some differences between exported BAM files and the original BAM file at the time of import. See [ImportReadGroupSets](google.genomics.v1.ReadServiceV1.ImportReadGroupSets) for caveats. +/// Returns a stream of all the reads matching the search request, ordered by reference name, position, and ID. +/// +/// A builder for the *stream* method supported by a *read* resource. +/// It is not used directly, but through a `ReadMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_genomics1 as genomics1; +/// use genomics1::StreamReadsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use genomics1::Genomics; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! +/// let mut req = StreamReadsRequest::default(); +/// +/// // 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 ! +/// let result = hub.reads().stream(req) +/// .doit(); +/// # } +/// ``` +pub struct ReadStreamCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Genomics, + _request: StreamReadsRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ReadStreamCall<'a, C, A> {} + +impl<'a, C, A> ReadStreamCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StreamReadsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "genomics.reads.stream", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://genomics.googleapis.com/v1/reads:stream".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: StreamReadsRequest) -> ReadStreamCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ReadStreamCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ReadStreamCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ReadStreamCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Exports a read group set to a BAM file in Google Cloud Storage. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Note that currently there may be some differences between exported BAM files and the original BAM file at the time of import. See [ImportReadGroupSets](google.genomics.v1.ReadServiceV1.ImportReadGroupSets) for caveats. /// /// A builder for the *export* method supported by a *readgroupset* resource. /// It is not used directly, but through a `ReadgroupsetMethods` instance. @@ -8128,7 +8240,7 @@ impl<'a, C, A> ReadgroupsetExportCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.export", + dlg.begin(MethodInfo { id: "genomics.readgroupsets.export", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("readGroupSetId", self._read_group_set_id.to_string())); @@ -8170,14 +8282,14 @@ impl<'a, C, A> ReadgroupsetExportCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8221,7 +8333,7 @@ impl<'a, C, A> ReadgroupsetExportCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8231,10 +8343,10 @@ impl<'a, C, A> ReadgroupsetExportCall<'a, C, A> where C: BorrowMut ReadgroupsetExportCall<'a, C, A> where C: BorrowMut ReadgroupsetExportCall<'a, C, A> { self._request = new_value; self } - /// Required. The ID of the read group set to export. + /// Required. The ID of the read group set to export. The caller must have READ access to this read group set. /// /// Sets the *read group set id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetExportCall<'a, C, A> { self._read_group_set_id = new_value.to_string(); @@ -8294,12 +8406,12 @@ impl<'a, C, A> ReadgroupsetExportCall<'a, C, A> where C: BorrowMut ReadgroupsetExportCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ReadgroupsetExportCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReadgroupsetExportCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8340,7 +8452,7 @@ impl<'a, C, A> ReadgroupsetExportCall<'a, C, A> where C: BorrowMut ReadgroupsetImportCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.import", + dlg.begin(MethodInfo { id: "genomics.readgroupsets.import", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -8420,14 +8532,14 @@ impl<'a, C, A> ReadgroupsetImportCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8471,7 +8583,7 @@ impl<'a, C, A> ReadgroupsetImportCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8481,10 +8593,10 @@ impl<'a, C, A> ReadgroupsetImportCall<'a, C, A> where C: BorrowMut ReadgroupsetImportCall<'a, C, A> where C: BorrowMut ReadgroupsetImportCall<'a, C, A> { self._request = new_value; @@ -8534,12 +8646,12 @@ impl<'a, C, A> ReadgroupsetImportCall<'a, C, A> where C: BorrowMut ReadgroupsetImportCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ReadgroupsetImportCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReadgroupsetImportCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8580,7 +8692,7 @@ impl<'a, C, A> ReadgroupsetImportCall<'a, C, A> where C: BorrowMut ReadgroupsetImportCall<'a, C, A> where C: BorrowMut ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.patch", + dlg.begin(MethodInfo { id: "genomics.readgroupsets.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("readGroupSetId", self._read_group_set_id.to_string())); @@ -8688,14 +8800,14 @@ impl<'a, C, A> ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8739,7 +8851,7 @@ impl<'a, C, A> ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8749,10 +8861,10 @@ impl<'a, C, A> ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8784,7 +8896,7 @@ impl<'a, C, A> ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ReadGroupSet) -> ReadgroupsetPatchCall<'a, C, A> { self._request = new_value; @@ -8794,13 +8906,13 @@ impl<'a, C, A> ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut /// /// Sets the *read group set id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetPatchCall<'a, C, A> { self._read_group_set_id = new_value.to_string(); self } - /// An optional mask specifying which fields to update. At this time, mutable fields are referenceSetId and name. Acceptable values are "referenceSetId" and "name". If unspecified, all mutable fields will be updated. + /// An optional mask specifying which fields to update. Supported fields: * name. * referenceSetId. Leaving `updateMask` unset is equivalent to specifying all mutable fields. /// /// Sets the *update mask* query property to the given value. pub fn update_mask(mut self, new_value: &str) -> ReadgroupsetPatchCall<'a, C, A> { @@ -8819,12 +8931,12 @@ impl<'a, C, A> ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -8847,17 +8959,17 @@ impl<'a, C, A> ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReadgroupsetPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReadgroupsetPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8865,7 +8977,7 @@ impl<'a, C, A> ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut } -/// Gets a read group set by ID. +/// Gets a read group set by ID. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *get* method supported by a *readgroupset* resource. /// It is not used directly, but through a `ReadgroupsetMethods` instance. @@ -8919,7 +9031,7 @@ impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.get", + dlg.begin(MethodInfo { id: "genomics.readgroupsets.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("readGroupSetId", self._read_group_set_id.to_string())); @@ -8961,7 +9073,7 @@ impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8997,7 +9109,7 @@ impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9007,10 +9119,10 @@ impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9043,7 +9155,7 @@ impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *read group set id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetGetCall<'a, C, A> { self._read_group_set_id = new_value.to_string(); @@ -9061,12 +9173,12 @@ impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -9089,17 +9201,17 @@ impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReadgroupsetGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReadgroupsetGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9107,7 +9219,7 @@ impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, } -/// Lists fixed width coverage buckets for a read group set, each of which correspond to a range of a reference sequence. Each bucket summarizes coverage information across its corresponding genomic range. Coverage is defined as the number of reads which are aligned to a given base in the reference sequence. Coverage buckets are available at several precomputed bucket widths, enabling retrieval of various coverage 'zoom levels'. The caller must have READ permissions for the target read group set. +/// Lists fixed width coverage buckets for a read group set, each of which correspond to a range of a reference sequence. Each bucket summarizes coverage information across its corresponding genomic range. For the definitions of read group sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Coverage is defined as the number of reads which are aligned to a given base in the reference sequence. Coverage buckets are available at several precomputed bucket widths, enabling retrieval of various coverage 'zoom levels'. The caller must have READ permissions for the target read group set. /// /// A builder for the *coveragebuckets.list* method supported by a *readgroupset* resource. /// It is not used directly, but through a `ReadgroupsetMethods` instance. @@ -9134,12 +9246,12 @@ impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.readgroupsets().coveragebuckets_list("readGroupSetId") -/// .target_bucket_width("Lorem") -/// .start("eos") -/// .reference_name("erat") -/// .page_token("sadipscing") -/// .page_size(-48) -/// .end("eirmod") +/// .target_bucket_width("sea") +/// .start("Lorem") +/// .reference_name("eos") +/// .page_token("erat") +/// .page_size(-95) +/// .end("dolor") /// .doit(); /// # } /// ``` @@ -9173,7 +9285,7 @@ impl<'a, C, A> ReadgroupsetCoveragebucketListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.coveragebuckets.list", + dlg.begin(MethodInfo { id: "genomics.readgroupsets.coveragebuckets.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("readGroupSetId", self._read_group_set_id.to_string())); @@ -9233,7 +9345,7 @@ impl<'a, C, A> ReadgroupsetCoveragebucketListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9269,7 +9381,7 @@ impl<'a, C, A> ReadgroupsetCoveragebucketListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9279,10 +9391,10 @@ impl<'a, C, A> ReadgroupsetCoveragebucketListCall<'a, C, A> where C: BorrowMut ReadgroupsetCoveragebucketListCall<'a, C, A> where C: BorrowMut ReadgroupsetCoveragebucketListCall<'a, C, A> { self._read_group_set_id = new_value.to_string(); @@ -9375,12 +9487,12 @@ impl<'a, C, A> ReadgroupsetCoveragebucketListCall<'a, C, A> where C: BorrowMut ReadgroupsetCoveragebucketListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ReadgroupsetCoveragebucketListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReadgroupsetCoveragebucketListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9421,7 +9533,7 @@ impl<'a, C, A> ReadgroupsetCoveragebucketListCall<'a, C, A> where C: BorrowMut ReadgroupsetDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.delete", + dlg.begin(MethodInfo { id: "genomics.readgroupsets.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("readGroupSetId", self._read_group_set_id.to_string())); @@ -9517,7 +9629,7 @@ impl<'a, C, A> ReadgroupsetDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9553,7 +9665,7 @@ impl<'a, C, A> ReadgroupsetDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9563,10 +9675,10 @@ impl<'a, C, A> ReadgroupsetDeleteCall<'a, C, A> where C: BorrowMut ReadgroupsetDeleteCall<'a, C, A> where C: BorrowMut ReadgroupsetDeleteCall<'a, C, A> { self._read_group_set_id = new_value.to_string(); @@ -9617,12 +9729,12 @@ impl<'a, C, A> ReadgroupsetDeleteCall<'a, C, A> where C: BorrowMut ReadgroupsetDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ReadgroupsetDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReadgroupsetDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9663,7 +9775,7 @@ impl<'a, C, A> ReadgroupsetDeleteCall<'a, C, A> where C: BorrowMut ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.search", + dlg.begin(MethodInfo { id: "genomics.readgroupsets.search", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -9743,14 +9855,14 @@ impl<'a, C, A> ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9794,7 +9906,7 @@ impl<'a, C, A> ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9804,10 +9916,10 @@ impl<'a, C, A> ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut ReadgroupsetSearchCall<'a, C, A> { self._request = new_value; @@ -9857,12 +9969,12 @@ impl<'a, C, A> ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ReadgroupsetSearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReadgroupsetSearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9903,7 +10015,7 @@ impl<'a, C, A> ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut ReferenceBaseListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.references.bases.list", + dlg.begin(MethodInfo { id: "genomics.references.bases.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("referenceId", self._reference_id.to_string())); @@ -10019,7 +10131,7 @@ impl<'a, C, A> ReferenceBaseListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10055,7 +10167,7 @@ impl<'a, C, A> ReferenceBaseListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10065,10 +10177,10 @@ impl<'a, C, A> ReferenceBaseListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10101,7 +10213,7 @@ impl<'a, C, A> ReferenceBaseListCall<'a, C, A> where C: BorrowMut /// /// Sets the *reference id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn reference_id(mut self, new_value: &str) -> ReferenceBaseListCall<'a, C, A> { self._reference_id = new_value.to_string(); @@ -10121,7 +10233,7 @@ impl<'a, C, A> ReferenceBaseListCall<'a, C, A> where C: BorrowMut self._page_token = Some(new_value.to_string()); self } - /// Specifies the maximum number of bases to return in a single page. + /// The maximum number of bases to return in a single page. If unspecified, defaults to 200Kbp (kilo base pairs). The maximum value is 10Mbp (mega base pairs). /// /// Sets the *page size* query property to the given value. pub fn page_size(mut self, new_value: i32) -> ReferenceBaseListCall<'a, C, A> { @@ -10147,12 +10259,12 @@ impl<'a, C, A> ReferenceBaseListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -10175,17 +10287,17 @@ impl<'a, C, A> ReferenceBaseListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReferenceBaseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReferenceBaseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10193,7 +10305,7 @@ impl<'a, C, A> ReferenceBaseListCall<'a, C, A> where C: BorrowMut } -/// Searches for references which match the given criteria. Implements [GlobalAllianceApi.searchReferences](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L146). +/// Searches for references which match the given criteria. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchReferences](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L146). /// /// A builder for the *search* method supported by a *reference* resource. /// It is not used directly, but through a `ReferenceMethods` instance. @@ -10253,7 +10365,7 @@ impl<'a, C, A> ReferenceSearchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.references.search", + dlg.begin(MethodInfo { id: "genomics.references.search", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -10273,14 +10385,14 @@ impl<'a, C, A> ReferenceSearchCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10324,7 +10436,7 @@ impl<'a, C, A> ReferenceSearchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10334,10 +10446,10 @@ impl<'a, C, A> ReferenceSearchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10369,7 +10481,7 @@ impl<'a, C, A> ReferenceSearchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SearchReferencesRequest) -> ReferenceSearchCall<'a, C, A> { self._request = new_value; @@ -10387,12 +10499,12 @@ impl<'a, C, A> ReferenceSearchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -10415,17 +10527,17 @@ impl<'a, C, A> ReferenceSearchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReferenceSearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReferenceSearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10433,7 +10545,7 @@ impl<'a, C, A> ReferenceSearchCall<'a, C, A> where C: BorrowMut, } -/// Gets a reference. Implements [GlobalAllianceApi.getReference](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L158). +/// Gets a reference. For the definitions of references and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.getReference](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/referencemethods.avdl#L158). /// /// A builder for the *get* method supported by a *reference* resource. /// It is not used directly, but through a `ReferenceMethods` instance. @@ -10487,7 +10599,7 @@ impl<'a, C, A> ReferenceGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.references.get", + dlg.begin(MethodInfo { id: "genomics.references.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("referenceId", self._reference_id.to_string())); @@ -10529,7 +10641,7 @@ impl<'a, C, A> ReferenceGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10565,7 +10677,7 @@ impl<'a, C, A> ReferenceGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10575,10 +10687,10 @@ impl<'a, C, A> ReferenceGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10611,7 +10723,7 @@ impl<'a, C, A> ReferenceGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *reference id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn reference_id(mut self, new_value: &str) -> ReferenceGetCall<'a, C, A> { self._reference_id = new_value.to_string(); @@ -10629,12 +10741,12 @@ impl<'a, C, A> ReferenceGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -10657,17 +10769,17 @@ impl<'a, C, A> ReferenceGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReferenceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReferenceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10675,7 +10787,7 @@ impl<'a, C, A> ReferenceGetCall<'a, C, A> where C: BorrowMut, A: } -/// Gets a list of variants matching the criteria. Implements [GlobalAllianceApi.searchVariants](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L126). +/// Gets a list of variants matching the criteria. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchVariants](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L126). /// /// A builder for the *search* method supported by a *variant* resource. /// It is not used directly, but through a `VariantMethods` instance. @@ -10735,7 +10847,7 @@ impl<'a, C, A> VariantSearchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variants.search", + dlg.begin(MethodInfo { id: "genomics.variants.search", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -10755,14 +10867,14 @@ impl<'a, C, A> VariantSearchCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10806,7 +10918,7 @@ impl<'a, C, A> VariantSearchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10816,10 +10928,10 @@ impl<'a, C, A> VariantSearchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10851,7 +10963,7 @@ impl<'a, C, A> VariantSearchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SearchVariantsRequest) -> VariantSearchCall<'a, C, A> { self._request = new_value; @@ -10869,12 +10981,12 @@ impl<'a, C, A> VariantSearchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -10897,17 +11009,17 @@ impl<'a, C, A> VariantSearchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantSearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantSearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10915,7 +11027,7 @@ impl<'a, C, A> VariantSearchCall<'a, C, A> where C: BorrowMut, A: } -/// Deletes a variant. +/// Deletes a variant. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *delete* method supported by a *variant* resource. /// It is not used directly, but through a `VariantMethods` instance. @@ -10969,7 +11081,7 @@ impl<'a, C, A> VariantDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variants.delete", + dlg.begin(MethodInfo { id: "genomics.variants.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("variantId", self._variant_id.to_string())); @@ -11011,7 +11123,7 @@ impl<'a, C, A> VariantDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11047,7 +11159,7 @@ impl<'a, C, A> VariantDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11057,10 +11169,10 @@ impl<'a, C, A> VariantDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11093,7 +11205,7 @@ impl<'a, C, A> VariantDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *variant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn variant_id(mut self, new_value: &str) -> VariantDeleteCall<'a, C, A> { self._variant_id = new_value.to_string(); @@ -11111,12 +11223,12 @@ impl<'a, C, A> VariantDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -11139,17 +11251,17 @@ impl<'a, C, A> VariantDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11157,7 +11269,7 @@ impl<'a, C, A> VariantDeleteCall<'a, C, A> where C: BorrowMut, A: } -/// Gets a variant by ID. +/// Gets a variant by ID. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *get* method supported by a *variant* resource. /// It is not used directly, but through a `VariantMethods` instance. @@ -11211,7 +11323,7 @@ impl<'a, C, A> VariantGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variants.get", + dlg.begin(MethodInfo { id: "genomics.variants.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("variantId", self._variant_id.to_string())); @@ -11253,7 +11365,7 @@ impl<'a, C, A> VariantGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11289,7 +11401,7 @@ impl<'a, C, A> VariantGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11299,10 +11411,10 @@ impl<'a, C, A> VariantGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11335,7 +11447,7 @@ impl<'a, C, A> VariantGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *variant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn variant_id(mut self, new_value: &str) -> VariantGetCall<'a, C, A> { self._variant_id = new_value.to_string(); @@ -11353,12 +11465,12 @@ impl<'a, C, A> VariantGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -11381,17 +11493,17 @@ impl<'a, C, A> VariantGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11399,7 +11511,7 @@ impl<'a, C, A> VariantGetCall<'a, C, A> where C: BorrowMut, A: oa } -/// Creates a new variant. +/// Creates a new variant. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *create* method supported by a *variant* resource. /// It is not used directly, but through a `VariantMethods` instance. @@ -11459,7 +11571,7 @@ impl<'a, C, A> VariantCreateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variants.create", + dlg.begin(MethodInfo { id: "genomics.variants.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -11479,14 +11591,14 @@ impl<'a, C, A> VariantCreateCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11530,7 +11642,7 @@ impl<'a, C, A> VariantCreateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11540,10 +11652,10 @@ impl<'a, C, A> VariantCreateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11575,7 +11687,7 @@ impl<'a, C, A> VariantCreateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Variant) -> VariantCreateCall<'a, C, A> { self._request = new_value; @@ -11593,12 +11705,12 @@ impl<'a, C, A> VariantCreateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -11621,17 +11733,17 @@ impl<'a, C, A> VariantCreateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11639,7 +11751,7 @@ impl<'a, C, A> VariantCreateCall<'a, C, A> where C: BorrowMut, A: } -/// Creates variant data by asynchronously importing the provided information. The variants for import will be merged with any existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created. When variants are merged, the call information from the new variant is added to the existing variant, and other fields (such as key/value pairs) are discarded. In particular, this means for merged VCF variants that have conflicting INFO fields, some data will be arbitrarily discarded. As a special case, for single-sample VCF files, QUAL and FILTER fields will be moved to the call level; these are sometimes interpreted in a call-specific context. Imported VCF headers are appended to the metadata already in a variant set. +/// Creates variant data by asynchronously importing the provided information. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) The variants for import will be merged with any existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created. When variants are merged, the call information from the new variant is added to the existing variant, and other fields (such as key/value pairs) are discarded. In particular, this means for merged VCF variants that have conflicting INFO fields, some data will be arbitrarily discarded. As a special case, for single-sample VCF files, QUAL and FILTER fields will be moved to the call level; these are sometimes interpreted in a call-specific context. Imported VCF headers are appended to the metadata already in a variant set. /// /// A builder for the *import* method supported by a *variant* resource. /// It is not used directly, but through a `VariantMethods` instance. @@ -11699,7 +11811,7 @@ impl<'a, C, A> VariantImportCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variants.import", + dlg.begin(MethodInfo { id: "genomics.variants.import", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -11719,14 +11831,14 @@ impl<'a, C, A> VariantImportCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11770,7 +11882,7 @@ impl<'a, C, A> VariantImportCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11780,10 +11892,10 @@ impl<'a, C, A> VariantImportCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11815,7 +11927,7 @@ impl<'a, C, A> VariantImportCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ImportVariantsRequest) -> VariantImportCall<'a, C, A> { self._request = new_value; @@ -11833,12 +11945,12 @@ impl<'a, C, A> VariantImportCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -11861,17 +11973,17 @@ impl<'a, C, A> VariantImportCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantImportCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantImportCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11879,7 +11991,7 @@ impl<'a, C, A> VariantImportCall<'a, C, A> where C: BorrowMut, A: } -/// Updates a variant. This method supports patch semantics. Returns the modified variant without its calls. +/// Updates a variant. For the definitions of variants and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) This method supports patch semantics. Returns the modified variant without its calls. /// /// A builder for the *patch* method supported by a *variant* resource. /// It is not used directly, but through a `VariantMethods` instance. @@ -11912,7 +12024,7 @@ impl<'a, C, A> VariantImportCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.variants().patch(req, "variantId") -/// .update_mask("sea") +/// .update_mask("Lorem") /// .doit(); /// # } /// ``` @@ -11942,7 +12054,7 @@ impl<'a, C, A> VariantPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variants.patch", + dlg.begin(MethodInfo { id: "genomics.variants.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("variantId", self._variant_id.to_string())); @@ -11987,14 +12099,14 @@ impl<'a, C, A> VariantPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12038,7 +12150,7 @@ impl<'a, C, A> VariantPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12048,10 +12160,10 @@ impl<'a, C, A> VariantPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12083,7 +12195,7 @@ impl<'a, C, A> VariantPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Variant) -> VariantPatchCall<'a, C, A> { self._request = new_value; @@ -12093,7 +12205,7 @@ impl<'a, C, A> VariantPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *variant id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn variant_id(mut self, new_value: &str) -> VariantPatchCall<'a, C, A> { self._variant_id = new_value.to_string(); @@ -12118,12 +12230,12 @@ impl<'a, C, A> VariantPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -12146,17 +12258,17 @@ impl<'a, C, A> VariantPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12164,7 +12276,247 @@ impl<'a, C, A> VariantPatchCall<'a, C, A> where C: BorrowMut, A: } -/// Creates a new variant set. The provided variant set must have a valid `datasetId` set - all other fields are optional. Note that the `id` field will be ignored, as this is assigned by the server. +/// Returns a stream of all the variants matching the search request, ordered by reference name, position, and ID. +/// +/// A builder for the *stream* method supported by a *variant* resource. +/// It is not used directly, but through a `VariantMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_genomics1 as genomics1; +/// use genomics1::StreamVariantsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use genomics1::Genomics; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! +/// let mut req = StreamVariantsRequest::default(); +/// +/// // 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 ! +/// let result = hub.variants().stream(req) +/// .doit(); +/// # } +/// ``` +pub struct VariantStreamCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Genomics, + _request: StreamVariantsRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VariantStreamCall<'a, C, A> {} + +impl<'a, C, A> VariantStreamCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, StreamVariantsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "genomics.variants.stream", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://genomics.googleapis.com/v1/variants:stream".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: StreamVariantsRequest) -> VariantStreamCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> VariantStreamCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> VariantStreamCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> VariantStreamCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a new variant set. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) The provided variant set must have a valid `datasetId` set - all other fields are optional. Note that the `id` field will be ignored, as this is assigned by the server. /// /// A builder for the *create* method supported by a *variantset* resource. /// It is not used directly, but through a `VariantsetMethods` instance. @@ -12224,7 +12576,7 @@ impl<'a, C, A> VariantsetCreateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variantsets.create", + dlg.begin(MethodInfo { id: "genomics.variantsets.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -12244,14 +12596,14 @@ impl<'a, C, A> VariantsetCreateCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12295,7 +12647,7 @@ impl<'a, C, A> VariantsetCreateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12305,10 +12657,10 @@ impl<'a, C, A> VariantsetCreateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12340,7 +12692,7 @@ impl<'a, C, A> VariantsetCreateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: VariantSet) -> VariantsetCreateCall<'a, C, A> { self._request = new_value; @@ -12358,12 +12710,12 @@ impl<'a, C, A> VariantsetCreateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -12386,17 +12738,17 @@ impl<'a, C, A> VariantsetCreateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantsetCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantsetCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12404,7 +12756,249 @@ impl<'a, C, A> VariantsetCreateCall<'a, C, A> where C: BorrowMut, } -/// Exports variant set data to an external destination. +/// Deletes the contents of a variant set. The variant set object is not deleted. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) +/// +/// A builder for the *delete* method supported by a *variantset* resource. +/// It is not used directly, but through a `VariantsetMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_genomics1 as genomics1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use genomics1::Genomics; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! +/// let result = hub.variantsets().delete("variantSetId") +/// .doit(); +/// # } +/// ``` +pub struct VariantsetDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Genomics, + _variant_set_id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VariantsetDeleteCall<'a, C, A> {} + +impl<'a, C, A> VariantsetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "genomics.variantsets.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("variantSetId", self._variant_set_id.to_string())); + for &field in ["alt", "variantSetId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://genomics.googleapis.com/v1/variantsets/{variantSetId}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["variantSetId"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The ID of the variant set to be deleted. + /// + /// Sets the *variant set id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn variant_set_id(mut self, new_value: &str) -> VariantsetDeleteCall<'a, C, A> { + self._variant_set_id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> VariantsetDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> VariantsetDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> VariantsetDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Exports variant set data to an external destination. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *export* method supported by a *variantset* resource. /// It is not used directly, but through a `VariantsetMethods` instance. @@ -12465,7 +13059,7 @@ impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variantsets.export", + dlg.begin(MethodInfo { id: "genomics.variantsets.export", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("variantSetId", self._variant_set_id.to_string())); @@ -12507,14 +13101,14 @@ impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12558,7 +13152,7 @@ impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12568,10 +13162,10 @@ impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12603,7 +13197,7 @@ impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ExportVariantSetRequest) -> VariantsetExportCall<'a, C, A> { self._request = new_value; @@ -12613,7 +13207,7 @@ impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, /// /// Sets the *variant set id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn variant_set_id(mut self, new_value: &str) -> VariantsetExportCall<'a, C, A> { self._variant_set_id = new_value.to_string(); @@ -12631,12 +13225,12 @@ impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -12659,17 +13253,17 @@ impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Bigquery`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantsetExportCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantsetExportCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12677,7 +13271,7 @@ impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, } -/// Updates a variant set. This method supports patch semantics. +/// Updates a variant set using patch semantics. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *patch* method supported by a *variantset* resource. /// It is not used directly, but through a `VariantsetMethods` instance. @@ -12740,7 +13334,7 @@ impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variantsets.patch", + dlg.begin(MethodInfo { id: "genomics.variantsets.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("variantSetId", self._variant_set_id.to_string())); @@ -12785,14 +13379,14 @@ impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12836,7 +13430,7 @@ impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12846,10 +13440,10 @@ impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12881,7 +13475,7 @@ impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: VariantSet) -> VariantsetPatchCall<'a, C, A> { self._request = new_value; @@ -12891,13 +13485,13 @@ impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *variant set id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn variant_set_id(mut self, new_value: &str) -> VariantsetPatchCall<'a, C, A> { self._variant_set_id = new_value.to_string(); self } - /// An optional mask specifying which fields to update. At this time, the only mutable field is metadata. The only acceptable value is "metadata". If unspecified, all mutable fields will be updated. + /// An optional mask specifying which fields to update. Supported fields: * metadata. Leaving `updateMask` unset is equivalent to specifying all mutable fields. /// /// Sets the *update mask* query property to the given value. pub fn update_mask(mut self, new_value: &str) -> VariantsetPatchCall<'a, C, A> { @@ -12916,12 +13510,12 @@ impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -12944,17 +13538,17 @@ impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantsetPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantsetPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12962,7 +13556,7 @@ impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, } -/// Returns a list of all variant sets matching search criteria. Implements [GlobalAllianceApi.searchVariantSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L49). +/// Returns a list of all variant sets matching search criteria. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) Implements [GlobalAllianceApi.searchVariantSets](https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/variantmethods.avdl#L49). /// /// A builder for the *search* method supported by a *variantset* resource. /// It is not used directly, but through a `VariantsetMethods` instance. @@ -13022,7 +13616,7 @@ impl<'a, C, A> VariantsetSearchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variantsets.search", + dlg.begin(MethodInfo { id: "genomics.variantsets.search", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -13042,14 +13636,14 @@ impl<'a, C, A> VariantsetSearchCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13093,7 +13687,7 @@ impl<'a, C, A> VariantsetSearchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13103,10 +13697,10 @@ impl<'a, C, A> VariantsetSearchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13138,7 +13732,7 @@ impl<'a, C, A> VariantsetSearchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SearchVariantSetsRequest) -> VariantsetSearchCall<'a, C, A> { self._request = new_value; @@ -13156,12 +13750,12 @@ impl<'a, C, A> VariantsetSearchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -13184,17 +13778,17 @@ impl<'a, C, A> VariantsetSearchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantsetSearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantsetSearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13202,7 +13796,7 @@ impl<'a, C, A> VariantsetSearchCall<'a, C, A> where C: BorrowMut, } -/// Gets a variant set by ID. +/// Gets a variant set by ID. For the definitions of variant sets and other genomics resources, see [Fundamentals of Google Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics) /// /// A builder for the *get* method supported by a *variantset* resource. /// It is not used directly, but through a `VariantsetMethods` instance. @@ -13256,7 +13850,7 @@ impl<'a, C, A> VariantsetGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "genomics.variantsets.get", + dlg.begin(MethodInfo { id: "genomics.variantsets.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("variantSetId", self._variant_set_id.to_string())); @@ -13298,7 +13892,7 @@ impl<'a, C, A> VariantsetGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13334,7 +13928,7 @@ impl<'a, C, A> VariantsetGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13344,10 +13938,10 @@ impl<'a, C, A> VariantsetGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13380,7 +13974,7 @@ impl<'a, C, A> VariantsetGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *variant set id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn variant_set_id(mut self, new_value: &str) -> VariantsetGetCall<'a, C, A> { self._variant_set_id = new_value.to_string(); @@ -13398,12 +13992,12 @@ impl<'a, C, A> VariantsetGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -13426,259 +14020,17 @@ impl<'a, C, A> VariantsetGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VariantsetGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes the contents of a variant set. The variant set object is not deleted. -/// -/// A builder for the *delete* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1 as genomics1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.variantsets().delete("variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetDeleteCall<'a, C, A> {} - -impl<'a, C, A> VariantsetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["alt", "variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://genomics.googleapis.com/v1/variantsets/{variantSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the variant set to be deleted. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetDeleteCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantsetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *bearer_token* (query-string) - OAuth bearer token. - /// * *pp* (query-boolean) - Pretty-print response. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - /// * *access_token* (query-string) - OAuth access token. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *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. - /// * *callback* (query-string) - JSONP - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *alt* (query-string) - Data format for response. - /// * *$.xgafv* (query-string) - V1 error format. - pub fn param(mut self, name: T, value: T) -> VariantsetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::CloudPlatform`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantsetDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VariantsetGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/genomics1_beta2-cli/Cargo.toml b/gen/genomics1_beta2-cli/Cargo.toml deleted file mode 100644 index 169009b37d..0000000000 --- a/gen/genomics1_beta2-cli/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -# DO NOT EDIT ! -# This file was generated automatically from 'src/mako/Cargo.toml.mako' -# DO NOT EDIT ! -[package] - -name = "google-genomics1_beta2-cli" -version = "0.3.0+20150326" -authors = ["Sebastian Thiel "] -description = "A complete library to interact with genomics (protocol v1beta2)" -repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1_beta2-cli" -homepage = "https://developers.google.com/genomics/v1beta2/reference" -documentation = "http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli" -license = "MIT" -keywords = ["genomics", "google", "cli"] - -[[bin]] -name = "genomics1-beta2" - -[dependencies] -hyper = ">= 0.5.2" -mime = "0.0.11" -serde = ">= 0.4.1" -yup-oauth2 = "*" -strsim = "*" -yup-hyper-mock = ">=1.0.0" -clap = ">= 0.9.1" - -[build-dependencies] -syntex = { version = "*" } -serde_codegen = { version = "*" } - - -[dependencies.google-genomics1_beta2] -path = "../genomics1_beta2" diff --git a/gen/genomics1_beta2-cli/LICENSE.md b/gen/genomics1_beta2-cli/LICENSE.md deleted file mode 100644 index ae22e6ec52..0000000000 --- a/gen/genomics1_beta2-cli/LICENSE.md +++ /dev/null @@ -1,30 +0,0 @@ - -The MIT License (MIT) -===================== - -Copyright © `2015` `Sebastian Thiel` - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the “Software”), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/genomics1_beta2-cli/README.md b/gen/genomics1_beta2-cli/README.md deleted file mode 100644 index d4c3866203..0000000000 --- a/gen/genomics1_beta2-cli/README.md +++ /dev/null @@ -1,184 +0,0 @@ - -The `genomics1-beta2` command-line interface *(CLI)* allows to use most features of the *Google genomics* service from the comfort of your terminal. - -By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's -capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. - -If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. - -Everything else about the *genomics* API can be found at the -[official documentation site](https://developers.google.com/genomics/v1beta2/reference). - -# Downloads - -You can download the pre-compiled 64bit binaries for the following platforms: - -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.0/ubuntu/genomics1-beta2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.0/osx/genomics1-beta2.tar.gz) - -Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1_beta2-cli). - -# Usage - -This documentation was generated from the *genomics* API at revision *20150326*. The CLI is at version *0.3.0*. - -```bash -genomics1-beta2 [options] - annotation-sets - create (-r )... [-p ]... [-o ] - delete [-p ]... - get [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - update (-r )... [-p ]... [-o ] - annotations - batch-create (-r )... [-p ]... [-o ] - create (-r )... [-p ]... [-o ] - delete [-p ]... - get [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - update (-r )... [-p ]... [-o ] - callsets - create (-r )... [-p ]... [-o ] - delete [-p ]... - get [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - update (-r )... [-p ]... [-o ] - datasets - create (-r )... [-p ]... [-o ] - delete [-p ]... - get [-p ]... [-o ] - list [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - undelete [-p ]... [-o ] - update (-r )... [-p ]... [-o ] - experimental - jobs-create (-r )... [-p ]... [-o ] - jobs - cancel [-p ]... - get [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - readgroupsets - align (-r )... [-p ]... [-o ] - call (-r )... [-p ]... [-o ] - coveragebuckets-list [-p ]... [-o ] - delete [-p ]... - export (-r )... [-p ]... [-o ] - get [-p ]... [-o ] - import (-r )... [-p ]... [-o ] - patch (-r )... [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - update (-r )... [-p ]... [-o ] - reads - search (-r )... [-p ]... [-o ] - references - bases-list [-p ]... [-o ] - get [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - referencesets - get [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - streaming-readstore - streamreads (-r )... [-p ]... [-o ] - variants - create (-r )... [-p ]... [-o ] - delete [-p ]... - get [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - update (-r )... [-p ]... [-o ] - variantsets - delete [-p ]... - export (-r )... [-p ]... [-o ] - get [-p ]... [-o ] - import-variants (-r )... [-p ]... [-o ] - merge-variants (-r )... [-p ]... - patch (-r )... [-p ]... [-o ] - search (-r )... [-p ]... [-o ] - update (-r )... [-p ]... [-o ] - genomics1-beta2 --help - -Configuration: - [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. - If unset, it defaults to the shortest scope url for a particular method. - --config-dir - A directory into which we will store our persistent data. Defaults to - a user-writable directory that we will create during the first invocation. - [default: ~/.google-service-cli] - --debug - Output all server communication to standard error. `tx` and `rx` are placed - into the same stream. - --debug-auth - Output all communication related to authentication to standard error. `tx` - and `rx` are placed into the same stream. - -``` - -# Configuration - -The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `genomics1-beta2-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. - -More information about the various kinds of persistent data are given in the following paragraphs. - -# Authentication - -Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the -set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. - -If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a -method that is read-only, it will ask only for a read-only scope. -You may use the `--scope` flag to specify a scope directly. -All applicable scopes are documented in the respective method's CLI documentation. - -The first time a scope is used, the user is asked for permission. Follow the instructions given -by the CLI to grant permissions, or to decline. - -If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration -directory, e.g. `~/.google-service-cli/genomics1-beta2-token-.json`. No manual management of these tokens -is necessary. - -To revoke granted authentication, please refer to the [official documentation][revoke-access]. - -# Application Secrets - -In order to allow any application to use Google services, it will need to be registered using the -[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it -one by one. Most APIs can be used for free and have a daily quota. - -To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI -comes with a default application secret that is configured accordingly. This also means that heavy usage -all around the world may deplete the daily quota. - -You can workaround this limitation by putting your own secrets file at this location: -`~/.google-service-cli/genomics1-beta2-secret.json`, assuming that the required *genomics* API -was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at -*APIs & auth -> Credentials -> Download JSON* and used as is. - -Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. - - -# Debugging - -Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know -what exactly led to a particular issue. This is done by allowing all client-server communication to be -output to standard error *as-is*. - -The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag -will cause all communication related to authentication to standard error. -If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the -issue at hand. - -You may consider redirecting standard error into a file for ease of use, e.g. `genomics1-beta2 --debug [options] 2>debug.txt`. - - -[scopes]: https://developers.google.com/+/api/oauth#scopes -[revoke-access]: http://webapps.stackexchange.com/a/30849 -[google-dev-console]: https://console.developers.google.com/ -[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/genomics1_beta2-cli/mkdocs.yml b/gen/genomics1_beta2-cli/mkdocs.yml deleted file mode 100644 index fd85b6d8ff..0000000000 --- a/gen/genomics1_beta2-cli/mkdocs.yml +++ /dev/null @@ -1,76 +0,0 @@ -site_name: genomics v0.3.0+20150326 -site_url: http://byron.github.io/google-apis-rs/google-genomics1_beta2-cli -site_description: Write integrating applications with bcore - -repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1_beta2-cli - -docs_dir: docs -site_dir: build_html - -pages: -- ['index.md', 'Home'] -- ['annotation-sets_create.md', 'Annotation Sets', 'Create'] -- ['annotation-sets_delete.md', 'Annotation Sets', 'Delete'] -- ['annotation-sets_get.md', 'Annotation Sets', 'Get'] -- ['annotation-sets_patch.md', 'Annotation Sets', 'Patch'] -- ['annotation-sets_search.md', 'Annotation Sets', 'Search'] -- ['annotation-sets_update.md', 'Annotation Sets', 'Update'] -- ['annotations_batch-create.md', 'Annotations', 'Batch Create'] -- ['annotations_create.md', 'Annotations', 'Create'] -- ['annotations_delete.md', 'Annotations', 'Delete'] -- ['annotations_get.md', 'Annotations', 'Get'] -- ['annotations_patch.md', 'Annotations', 'Patch'] -- ['annotations_search.md', 'Annotations', 'Search'] -- ['annotations_update.md', 'Annotations', 'Update'] -- ['callsets_create.md', 'Callsets', 'Create'] -- ['callsets_delete.md', 'Callsets', 'Delete'] -- ['callsets_get.md', 'Callsets', 'Get'] -- ['callsets_patch.md', 'Callsets', 'Patch'] -- ['callsets_search.md', 'Callsets', 'Search'] -- ['callsets_update.md', 'Callsets', 'Update'] -- ['datasets_create.md', 'Datasets', 'Create'] -- ['datasets_delete.md', 'Datasets', 'Delete'] -- ['datasets_get.md', 'Datasets', 'Get'] -- ['datasets_list.md', 'Datasets', 'List'] -- ['datasets_patch.md', 'Datasets', 'Patch'] -- ['datasets_undelete.md', 'Datasets', 'Undelete'] -- ['datasets_update.md', 'Datasets', 'Update'] -- ['experimental_jobs-create.md', 'Experimental', 'Jobs Create'] -- ['jobs_cancel.md', 'Jobs', 'Cancel'] -- ['jobs_get.md', 'Jobs', 'Get'] -- ['jobs_search.md', 'Jobs', 'Search'] -- ['readgroupsets_align.md', 'Readgroupsets', 'Align'] -- ['readgroupsets_call.md', 'Readgroupsets', 'Call'] -- ['readgroupsets_coveragebuckets-list.md', 'Readgroupsets', 'Coveragebuckets List'] -- ['readgroupsets_delete.md', 'Readgroupsets', 'Delete'] -- ['readgroupsets_export.md', 'Readgroupsets', 'Export'] -- ['readgroupsets_get.md', 'Readgroupsets', 'Get'] -- ['readgroupsets_import.md', 'Readgroupsets', 'Import'] -- ['readgroupsets_patch.md', 'Readgroupsets', 'Patch'] -- ['readgroupsets_search.md', 'Readgroupsets', 'Search'] -- ['readgroupsets_update.md', 'Readgroupsets', 'Update'] -- ['reads_search.md', 'Reads', 'Search'] -- ['references_bases-list.md', 'References', 'Bases List'] -- ['references_get.md', 'References', 'Get'] -- ['references_search.md', 'References', 'Search'] -- ['referencesets_get.md', 'Referencesets', 'Get'] -- ['referencesets_search.md', 'Referencesets', 'Search'] -- ['streaming-readstore_streamreads.md', 'Streaming Readstore', 'Streamreads'] -- ['variants_create.md', 'Variants', 'Create'] -- ['variants_delete.md', 'Variants', 'Delete'] -- ['variants_get.md', 'Variants', 'Get'] -- ['variants_search.md', 'Variants', 'Search'] -- ['variants_update.md', 'Variants', 'Update'] -- ['variantsets_delete.md', 'Variantsets', 'Delete'] -- ['variantsets_export.md', 'Variantsets', 'Export'] -- ['variantsets_get.md', 'Variantsets', 'Get'] -- ['variantsets_import-variants.md', 'Variantsets', 'Import Variants'] -- ['variantsets_merge-variants.md', 'Variantsets', 'Merge Variants'] -- ['variantsets_patch.md', 'Variantsets', 'Patch'] -- ['variantsets_search.md', 'Variantsets', 'Search'] -- ['variantsets_update.md', 'Variantsets', 'Update'] - -theme: readthedocs - -copyright: Copyright © 2015, `Sebastian Thiel` - diff --git a/gen/genomics1_beta2-cli/src/main.rs b/gen/genomics1_beta2-cli/src/main.rs deleted file mode 100644 index 84cdf18ba2..0000000000 --- a/gen/genomics1_beta2-cli/src/main.rs +++ /dev/null @@ -1,6438 +0,0 @@ -// DO NOT EDIT ! -// This file was generated automatically from 'src/mako/cli/main.rs.mako' -// DO NOT EDIT ! -#![allow(unused_variables, unused_imports, dead_code, unused_mut)] - -#[macro_use] -extern crate clap; -extern crate yup_oauth2 as oauth2; -extern crate yup_hyper_mock as mock; -extern crate serde; -extern crate hyper; -extern crate mime; -extern crate strsim; -extern crate google_genomics1_beta2 as api; - -use std::env; -use std::io::{self, Write}; -use clap::{App, SubCommand, Arg}; - -mod cmn; - -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, - input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, - calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; - -use std::default::Default; -use std::str::FromStr; - -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; -use serde::json; -use clap::ArgMatches; - -enum DoitError { - IoError(String, io::Error), - ApiError(api::Error), -} - -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, - hub: api::Genomics>, - gp: Vec<&'static str>, - gpm: Vec<(&'static str, &'static str)>, -} - - -impl<'n, 'a> Engine<'n, 'a> { - fn _annotation_sets_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "source-uri" => Some(("sourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id", "name", "reference-set-id", "source-uri", "type"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::AnnotationSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotation_sets().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _annotation_sets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.annotation_sets().delete(opt.value_of("annotation-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _annotation_sets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.annotation_sets().get(opt.value_of("annotation-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _annotation_sets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "source-uri" => Some(("sourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id", "name", "reference-set-id", "source-uri", "type"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::AnnotationSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotation_sets().patch(request, opt.value_of("annotation-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _annotation_sets_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "dataset-ids" => Some(("datasetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "types" => Some(("types", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-ids", "name", "page-size", "page-token", "reference-set-id", "types"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchAnnotationSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotation_sets().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _annotation_sets_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "source-uri" => Some(("sourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id", "name", "reference-set-id", "source-uri", "type"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::AnnotationSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotation_sets().update(request, opt.value_of("annotation-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_batch_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::BatchCreateAnnotationsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotations().batch_create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.coding-sequence.start" => Some(("transcript.codingSequence.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.coding-sequence.end" => Some(("transcript.codingSequence.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.gene-id" => Some(("transcript.geneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.effect" => Some(("variant.effect", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.transcript-ids" => Some(("variant.transcriptIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "variant.alternate-bases" => Some(("variant.alternateBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.clinical-significance" => Some(("variant.clinicalSignificance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.type" => Some(("variant.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.gene-id" => Some(("variant.geneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "annotation-set-id" => Some(("annotationSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.start" => Some(("position.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.reference-id" => Some(("position.referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.end" => Some(("position.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.reverse-strand" => Some(("position.reverseStrand", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "position.reference-name" => Some(("position.referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-bases", "annotation-set-id", "clinical-significance", "coding-sequence", "effect", "end", "gene-id", "id", "name", "position", "reference-id", "reference-name", "reverse-strand", "start", "transcript", "transcript-ids", "type", "variant"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Annotation = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotations().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.annotations().delete(opt.value_of("annotation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _annotations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.annotations().get(opt.value_of("annotation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.coding-sequence.start" => Some(("transcript.codingSequence.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.coding-sequence.end" => Some(("transcript.codingSequence.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.gene-id" => Some(("transcript.geneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.effect" => Some(("variant.effect", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.transcript-ids" => Some(("variant.transcriptIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "variant.alternate-bases" => Some(("variant.alternateBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.clinical-significance" => Some(("variant.clinicalSignificance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.type" => Some(("variant.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.gene-id" => Some(("variant.geneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "annotation-set-id" => Some(("annotationSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.start" => Some(("position.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.reference-id" => Some(("position.referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.end" => Some(("position.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.reverse-strand" => Some(("position.reverseStrand", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "position.reference-name" => Some(("position.referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-bases", "annotation-set-id", "clinical-significance", "coding-sequence", "effect", "end", "gene-id", "id", "name", "position", "reference-id", "reference-name", "reverse-strand", "start", "transcript", "transcript-ids", "type", "variant"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Annotation = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotations().patch(request, opt.value_of("annotation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "range.start" => Some(("range.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "range.reference-id" => Some(("range.referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "range.end" => Some(("range.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "range.reference-name" => Some(("range.referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "annotation-set-ids" => Some(("annotationSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["annotation-set-ids", "end", "page-size", "page-token", "range", "reference-id", "reference-name", "start"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchAnnotationsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotations().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _annotations_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.coding-sequence.start" => Some(("transcript.codingSequence.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.coding-sequence.end" => Some(("transcript.codingSequence.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "transcript.gene-id" => Some(("transcript.geneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.effect" => Some(("variant.effect", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.transcript-ids" => Some(("variant.transcriptIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "variant.alternate-bases" => Some(("variant.alternateBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.clinical-significance" => Some(("variant.clinicalSignificance", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.type" => Some(("variant.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant.gene-id" => Some(("variant.geneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "annotation-set-id" => Some(("annotationSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.start" => Some(("position.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.reference-id" => Some(("position.referenceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.end" => Some(("position.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "position.reverse-strand" => Some(("position.reverseStrand", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "position.reference-name" => Some(("position.referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-bases", "annotation-set-id", "clinical-significance", "coding-sequence", "effect", "end", "gene-id", "id", "name", "position", "reference-id", "reference-name", "reverse-strand", "start", "transcript", "transcript-ids", "type", "variant"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Annotation = json::value::from_value(object).unwrap(); - let mut call = self.hub.annotations().update(request, opt.value_of("annotation-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _callsets_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "sample-id" => Some(("sampleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant-set-ids" => Some(("variantSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "created" => Some(("created", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["created", "id", "name", "sample-id", "variant-set-ids"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::CallSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.callsets().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _callsets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.callsets().delete(opt.value_of("call-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _callsets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.callsets().get(opt.value_of("call-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _callsets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "sample-id" => Some(("sampleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant-set-ids" => Some(("variantSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "created" => Some(("created", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["created", "id", "name", "sample-id", "variant-set-ids"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::CallSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.callsets().patch(request, opt.value_of("call-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _callsets_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant-set-ids" => Some(("variantSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["name", "page-size", "page-token", "variant-set-ids"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchCallSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.callsets().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _callsets_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "sample-id" => Some(("sampleId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant-set-ids" => Some(("variantSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "created" => Some(("created", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["created", "id", "name", "sample-id", "variant-set-ids"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::CallSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.callsets().update(request, opt.value_of("call-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "is-public" => Some(("isPublic", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "is-public", "name", "project-number"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Dataset = json::value::from_value(object).unwrap(); - let mut call = self.hub.datasets().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.datasets().delete(opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _datasets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.datasets().get(opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.datasets().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "project-number" => { - call = call.project_number(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "project-number", "page-size"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "is-public" => Some(("isPublic", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "is-public", "name", "project-number"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Dataset = json::value::from_value(object).unwrap(); - let mut call = self.hub.datasets().patch(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_undelete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.datasets().undelete(opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _datasets_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "is-public" => Some(("isPublic", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["id", "is-public", "name", "project-number"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Dataset = json::value::from_value(object).unwrap(); - let mut call = self.hub.datasets().update(request, opt.value_of("dataset-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _experimental_jobs_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "paired-source-uris" => Some(("pairedSourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "align" => Some(("align", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "call-variants" => Some(("callVariants", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "source-uris" => Some(("sourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "gcs-output-path" => Some(("gcsOutputPath", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["align", "call-variants", "gcs-output-path", "paired-source-uris", "project-number", "source-uris"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ExperimentalCreateJobRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.experimental().jobs_create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _jobs_cancel(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.jobs().cancel(opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _jobs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.jobs().get(opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _jobs_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "created-after" => Some(("createdAfter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "created-before" => Some(("createdBefore", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["created-after", "created-before", "page-size", "page-token", "project-number", "status"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchJobsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.jobs().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_align(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "interleaved-fastq-source.source-uris" => Some(("interleavedFastqSource.sourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "interleaved-fastq-source.metadata.read-group-name" => Some(("interleavedFastqSource.metadata.readGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "interleaved-fastq-source.metadata.sample-name" => Some(("interleavedFastqSource.metadata.sampleName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "interleaved-fastq-source.metadata.library-name" => Some(("interleavedFastqSource.metadata.libraryName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "interleaved-fastq-source.metadata.platform-name" => Some(("interleavedFastqSource.metadata.platformName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "interleaved-fastq-source.metadata.platform-unit" => Some(("interleavedFastqSource.metadata.platformUnit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "bam-source-uris" => Some(("bamSourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "paired-fastq-source.second-source-uris" => Some(("pairedFastqSource.secondSourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "paired-fastq-source.metadata.read-group-name" => Some(("pairedFastqSource.metadata.readGroupName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "paired-fastq-source.metadata.sample-name" => Some(("pairedFastqSource.metadata.sampleName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "paired-fastq-source.metadata.library-name" => Some(("pairedFastqSource.metadata.libraryName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "paired-fastq-source.metadata.platform-name" => Some(("pairedFastqSource.metadata.platformName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "paired-fastq-source.metadata.platform-unit" => Some(("pairedFastqSource.metadata.platformUnit", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "paired-fastq-source.first-source-uris" => Some(("pairedFastqSource.firstSourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "read-group-set-id" => Some(("readGroupSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bam-source-uris", "dataset-id", "first-source-uris", "interleaved-fastq-source", "library-name", "metadata", "paired-fastq-source", "platform-name", "platform-unit", "read-group-name", "read-group-set-id", "sample-name", "second-source-uris", "source-uris"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::AlignReadGroupSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().align(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_call(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "source-uris" => Some(("sourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "read-group-set-id" => Some(("readGroupSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "read-group-set-id", "source-uris"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::CallReadGroupSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().call(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_coveragebuckets_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.readgroupsets().coveragebuckets_list(opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "target-bucket-width" => { - call = call.target_bucket_width(value.unwrap_or("")); - }, - "range-start" => { - call = call.range_start(value.unwrap_or("")); - }, - "range-reference-name" => { - call = call.range_reference_name(value.unwrap_or("")); - }, - "range-end" => { - call = call.range_end(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-size", "range-start", "range-end", "range-reference-name", "page-token", "target-bucket-width"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.readgroupsets().delete(opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _readgroupsets_export(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "export-uri" => Some(("exportUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-names" => Some(("referenceNames", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "read-group-set-ids" => Some(("readGroupSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["export-uri", "project-number", "read-group-set-ids", "reference-names"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ExportReadGroupSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().export(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.readgroupsets().get(opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_import(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "source-uris" => Some(("sourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "partition-strategy" => Some(("partitionStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "partition-strategy", "reference-set-id", "source-uris"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ImportReadGroupSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().import(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "filename" => Some(("filename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "filename", "id", "name", "reference-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ReadGroupSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().patch(request, opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-ids" => Some(("datasetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-ids", "name", "page-size", "page-token"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchReadGroupSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _readgroupsets_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "filename" => Some(("filename", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "filename", "id", "name", "reference-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ReadGroupSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.readgroupsets().update(request, opt.value_of("read-group-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _reads_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "read-group-set-ids" => Some(("readGroupSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "read-group-ids" => Some(("readGroupIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["end", "page-size", "page-token", "read-group-ids", "read-group-set-ids", "reference-name", "start"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchReadsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.reads().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _references_bases_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.references().bases_list(opt.value_of("reference-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "start" => { - call = call.start(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "page-size" => { - call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); - }, - "end" => { - call = call.end(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["start", "end", "page-size", "page-token"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _references_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.references().get(opt.value_of("reference-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _references_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "md5checksums" => Some(("md5checksums", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-set-id" => Some(("referenceSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "accessions" => Some(("accessions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["accessions", "md5checksums", "page-size", "page-token", "reference-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchReferencesRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.references().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _referencesets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.referencesets().get(opt.value_of("reference-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _referencesets_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "md5checksums" => Some(("md5checksums", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "assembly-id" => Some(("assemblyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "accessions" => Some(("accessions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["accessions", "assembly-id", "md5checksums", "page-size", "page-token"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchReferenceSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.referencesets().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _streaming_readstore_streamreads(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "read-group-set-ids" => Some(("readGroupSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["end", "read-group-set-ids", "reference-name", "start"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::StreamReadsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.streaming_readstore().streamreads(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _variants_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "variant-set-id" => Some(("variantSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "created" => Some(("created", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-bases" => Some(("referenceBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "names" => Some(("names", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "alternate-bases" => Some(("alternateBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "quality" => Some(("quality", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-bases", "created", "end", "filter", "id", "names", "quality", "reference-bases", "reference-name", "start", "variant-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Variant = json::value::from_value(object).unwrap(); - let mut call = self.hub.variants().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _variants_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.variants().delete(opt.value_of("variant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _variants_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.variants().get(opt.value_of("variant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _variants_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "max-calls" => Some(("maxCalls", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "call-set-ids" => Some(("callSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "variant-name" => Some(("variantName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "variant-set-ids" => Some(("variantSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["call-set-ids", "end", "max-calls", "page-size", "page-token", "reference-name", "start", "variant-name", "variant-set-ids"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchVariantsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.variants().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _variants_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "variant-set-id" => Some(("variantSetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "end" => Some(("end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "created" => Some(("created", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "reference-bases" => Some(("referenceBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "start" => Some(("start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "names" => Some(("names", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "alternate-bases" => Some(("alternateBases", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "reference-name" => Some(("referenceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "quality" => Some(("quality", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["alternate-bases", "created", "end", "filter", "id", "names", "quality", "reference-bases", "reference-name", "start", "variant-set-id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Variant = json::value::from_value(object).unwrap(); - let mut call = self.hub.variants().update(request, opt.value_of("variant-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.variantsets().delete(opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _variantsets_export(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "bigquery-dataset" => Some(("bigqueryDataset", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "call-set-ids" => Some(("callSetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "project-number" => Some(("projectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "bigquery-table" => Some(("bigqueryTable", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bigquery-dataset", "bigquery-table", "call-set-ids", "format", "project-number"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ExportVariantSetRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.variantsets().export(request, opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.variantsets().get(opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_import_variants(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "source-uris" => Some(("sourceUris", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "format" => Some(("format", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["format", "source-uris"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::ImportVariantsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.variantsets().import_variants(request, opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_merge_variants(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec![]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::MergeVariantsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.variantsets().merge_variants(request, opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok(mut response) => { - Ok(()) - } - } - } - } - - fn _variantsets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::VariantSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.variantsets().patch(request, opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-ids" => Some(("datasetIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-ids", "page-size", "page-token"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::SearchVariantSetsRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.variantsets().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _variantsets_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "dataset-id" => Some(("datasetId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["dataset-id", "id"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::VariantSet = json::value::from_value(object).unwrap(); - let mut call = self.hub.variantsets().update(request, opt.value_of("variant-set-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _doit(&self, dry_run: bool) -> Result, Option> { - let mut err = InvalidOptionsError::new(); - let mut call_result: Result<(), DoitError> = Ok(()); - let mut err_opt: Option = None; - match self.opt.subcommand() { - ("annotation-sets", Some(opt)) => { - match opt.subcommand() { - ("create", Some(opt)) => { - call_result = self._annotation_sets_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._annotation_sets_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._annotation_sets_get(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._annotation_sets_patch(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._annotation_sets_search(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._annotation_sets_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("annotation-sets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("annotations", Some(opt)) => { - match opt.subcommand() { - ("batch-create", Some(opt)) => { - call_result = self._annotations_batch_create(opt, dry_run, &mut err); - }, - ("create", Some(opt)) => { - call_result = self._annotations_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._annotations_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._annotations_get(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._annotations_patch(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._annotations_search(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._annotations_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("annotations".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("callsets", Some(opt)) => { - match opt.subcommand() { - ("create", Some(opt)) => { - call_result = self._callsets_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._callsets_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._callsets_get(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._callsets_patch(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._callsets_search(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._callsets_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("callsets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("datasets", Some(opt)) => { - match opt.subcommand() { - ("create", Some(opt)) => { - call_result = self._datasets_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._datasets_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._datasets_get(opt, dry_run, &mut err); - }, - ("list", Some(opt)) => { - call_result = self._datasets_list(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._datasets_patch(opt, dry_run, &mut err); - }, - ("undelete", Some(opt)) => { - call_result = self._datasets_undelete(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._datasets_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("datasets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("experimental", Some(opt)) => { - match opt.subcommand() { - ("jobs-create", Some(opt)) => { - call_result = self._experimental_jobs_create(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("experimental".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("jobs", Some(opt)) => { - match opt.subcommand() { - ("cancel", Some(opt)) => { - call_result = self._jobs_cancel(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._jobs_get(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._jobs_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("jobs".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("readgroupsets", Some(opt)) => { - match opt.subcommand() { - ("align", Some(opt)) => { - call_result = self._readgroupsets_align(opt, dry_run, &mut err); - }, - ("call", Some(opt)) => { - call_result = self._readgroupsets_call(opt, dry_run, &mut err); - }, - ("coveragebuckets-list", Some(opt)) => { - call_result = self._readgroupsets_coveragebuckets_list(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._readgroupsets_delete(opt, dry_run, &mut err); - }, - ("export", Some(opt)) => { - call_result = self._readgroupsets_export(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._readgroupsets_get(opt, dry_run, &mut err); - }, - ("import", Some(opt)) => { - call_result = self._readgroupsets_import(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._readgroupsets_patch(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._readgroupsets_search(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._readgroupsets_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("readgroupsets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("reads", Some(opt)) => { - match opt.subcommand() { - ("search", Some(opt)) => { - call_result = self._reads_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("reads".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("references", Some(opt)) => { - match opt.subcommand() { - ("bases-list", Some(opt)) => { - call_result = self._references_bases_list(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._references_get(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._references_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("references".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("referencesets", Some(opt)) => { - match opt.subcommand() { - ("get", Some(opt)) => { - call_result = self._referencesets_get(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._referencesets_search(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("referencesets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("streaming-readstore", Some(opt)) => { - match opt.subcommand() { - ("streamreads", Some(opt)) => { - call_result = self._streaming_readstore_streamreads(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("streaming-readstore".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("variants", Some(opt)) => { - match opt.subcommand() { - ("create", Some(opt)) => { - call_result = self._variants_create(opt, dry_run, &mut err); - }, - ("delete", Some(opt)) => { - call_result = self._variants_delete(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._variants_get(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._variants_search(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._variants_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("variants".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("variantsets", Some(opt)) => { - match opt.subcommand() { - ("delete", Some(opt)) => { - call_result = self._variantsets_delete(opt, dry_run, &mut err); - }, - ("export", Some(opt)) => { - call_result = self._variantsets_export(opt, dry_run, &mut err); - }, - ("get", Some(opt)) => { - call_result = self._variantsets_get(opt, dry_run, &mut err); - }, - ("import-variants", Some(opt)) => { - call_result = self._variantsets_import_variants(opt, dry_run, &mut err); - }, - ("merge-variants", Some(opt)) => { - call_result = self._variantsets_merge_variants(opt, dry_run, &mut err); - }, - ("patch", Some(opt)) => { - call_result = self._variantsets_patch(opt, dry_run, &mut err); - }, - ("search", Some(opt)) => { - call_result = self._variantsets_search(opt, dry_run, &mut err); - }, - ("update", Some(opt)) => { - call_result = self._variantsets_update(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("variantsets".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - _ => { - err.issues.push(CLIError::MissingCommandError); - writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); - } - } - - if dry_run { - if err.issues.len() > 0 { - err_opt = Some(err); - } - Err(err_opt) - } else { - Ok(call_result) - } - } - - // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { - let (config_dir, secret) = { - let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { - Err(e) => return Err(InvalidOptionsError::single(e, 3)), - Ok(p) => p, - }; - - match cmn::application_secret_from_directory(&config_dir, "genomics1-beta2-secret.json", - "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { - Ok(secret) => (config_dir, secret), - Err(e) => return Err(InvalidOptionsError::single(e, 4)) - } - }; - - let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, - if opt.is_present("debug-auth") { - hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) - }) - } else { - hyper::Client::new() - }, - JsonTokenStorage { - program_name: "genomics1-beta2", - db_dir: config_dir.clone(), - }, None); - - let client = - if opt.is_present("debug") { - hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) - }) - } else { - hyper::Client::new() - }; - let engine = Engine { - opt: opt, - hub: api::Genomics::new(client, auth), - gp: vec!["alt", "fields", "key", "oauth-token", "pretty-print", "quota-user", "user-ip"], - gpm: vec![ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ] - }; - - match engine._doit(true) { - Err(Some(err)) => Err(err), - Err(None) => Ok(engine), - Ok(_) => unreachable!(), - } - } - - fn doit(&self) -> Result<(), DoitError> { - match self._doit(false) { - Ok(res) => res, - Err(_) => unreachable!(), - } - } -} - -fn main() { - let mut exit_status = 0i32; - let arg_data = [ - ("annotation-sets", "methods: 'create', 'delete', 'get', 'patch', 'search' and 'update'", vec![ - ("create", - Some(r##"Creates a new annotation set. Caller must have WRITE permission for the associated dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotation-sets_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes an annotation set. Caller must have WRITE permission for the associated annotation set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotation-sets_delete", - vec![ - (Some(r##"annotation-set-id"##), - None, - Some(r##"The ID of the annotation set to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("get", - Some(r##"Gets an annotation set. Caller must have READ permission for the associated dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotation-sets_get", - vec![ - (Some(r##"annotation-set-id"##), - None, - Some(r##"The ID of the annotation set to be retrieved."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Updates an annotation set. The update must respect all mutability restrictions and other invariants described on the annotation set resource. Caller must have WRITE permission for the associated dataset. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotation-sets_patch", - vec![ - (Some(r##"annotation-set-id"##), - None, - Some(r##"The ID of the annotation set to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Searches for annotation sets that match the given criteria. Results are returned in a deterministic order. Caller must have READ permission for the queried datasets."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotation-sets_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - Some(r##"Updates an annotation set. The update must respect all mutability restrictions and other invariants described on the annotation set resource. Caller must have WRITE permission for the associated dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotation-sets_update", - vec![ - (Some(r##"annotation-set-id"##), - None, - Some(r##"The ID of the annotation set to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("annotations", "methods: 'batch-create', 'create', 'delete', 'get', 'patch', 'search' and 'update'", vec![ - ("batch-create", - Some(r##"Creates one or more new annotations atomically. All annotations must belong to the same annotation set. Caller must have WRITE permission for this annotation set. For optimal performance, batch positionally adjacent annotations together. - - - If the request has a systemic issue, such as an attempt to write to an inaccessible annotation set, the entire RPC will fail accordingly. For lesser data issues, when possible an error will be isolated to the corresponding batch entry in the response; the remaining well formed annotations will be created normally."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotations_batch-create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("create", - Some(r##"Creates a new annotation. Caller must have WRITE permission for the associated annotation set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotations_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes an annotation. Caller must have WRITE permission for the associated annotation set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotations_delete", - vec![ - (Some(r##"annotation-id"##), - None, - Some(r##"The ID of the annotation set to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("get", - Some(r##"Gets an annotation. Caller must have READ permission for the associated annotation set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotations_get", - vec![ - (Some(r##"annotation-id"##), - None, - Some(r##"The ID of the annotation set to be retrieved."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Updates an annotation. The update must respect all mutability restrictions and other invariants described on the annotation resource. Caller must have WRITE permission for the associated dataset. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotations_patch", - vec![ - (Some(r##"annotation-id"##), - None, - Some(r##"The ID of the annotation set to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Searches for annotations that match the given criteria. Results are returned ordered by start position. Annotations that have matching start positions are ordered deterministically. Caller must have READ permission for the queried annotation sets."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotations_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - Some(r##"Updates an annotation. The update must respect all mutability restrictions and other invariants described on the annotation resource. Caller must have WRITE permission for the associated dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/annotations_update", - vec![ - (Some(r##"annotation-id"##), - None, - Some(r##"The ID of the annotation set to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("callsets", "methods: 'create', 'delete', 'get', 'patch', 'search' and 'update'", vec![ - ("create", - Some(r##"Creates a new call set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/callsets_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes a call set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/callsets_delete", - vec![ - (Some(r##"call-set-id"##), - None, - Some(r##"The ID of the call set to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("get", - Some(r##"Gets a call set by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/callsets_get", - vec![ - (Some(r##"call-set-id"##), - None, - Some(r##"The ID of the call set."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Updates a call set. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/callsets_patch", - vec![ - (Some(r##"call-set-id"##), - None, - Some(r##"The ID of the call set to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Gets a list of call sets matching the criteria. - - Implements GlobalAllianceApi.searchCallSets."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/callsets_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - Some(r##"Updates a call set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/callsets_update", - vec![ - (Some(r##"call-set-id"##), - None, - Some(r##"The ID of the call set to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("datasets", "methods: 'create', 'delete', 'get', 'list', 'patch', 'undelete' and 'update'", vec![ - ("create", - Some(r##"Creates a new dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/datasets_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes a dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/datasets_delete", - vec![ - (Some(r##"dataset-id"##), - None, - Some(r##"The ID of the dataset to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("get", - Some(r##"Gets a dataset by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/datasets_get", - vec![ - (Some(r##"dataset-id"##), - None, - Some(r##"The ID of the dataset."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("list", - Some(r##"Lists datasets within a project."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/datasets_list", - vec![ - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Updates a dataset. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/datasets_patch", - vec![ - (Some(r##"dataset-id"##), - None, - Some(r##"The ID of the dataset to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("undelete", - Some(r##"Undeletes a dataset by restoring a dataset which was deleted via this API. This operation is only possible for a week after the deletion occurred."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/datasets_undelete", - vec![ - (Some(r##"dataset-id"##), - None, - Some(r##"The ID of the dataset to be undeleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - Some(r##"Updates a dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/datasets_update", - vec![ - (Some(r##"dataset-id"##), - None, - Some(r##"The ID of the dataset to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("experimental", "methods: 'jobs-create'", vec![ - ("jobs-create", - Some(r##"Creates and asynchronously runs an ad-hoc job. This is an experimental call and may be removed or changed at any time."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/experimental_jobs-create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("jobs", "methods: 'cancel', 'get' and 'search'", vec![ - ("cancel", - Some(r##"Cancels a job by ID. Note that it is possible for partial results to be generated and stored for cancelled jobs."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/jobs_cancel", - vec![ - (Some(r##"job-id"##), - None, - Some(r##"Required. The ID of the job."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("get", - Some(r##"Gets a job by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/jobs_get", - vec![ - (Some(r##"job-id"##), - None, - Some(r##"Required. The ID of the job."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Gets a list of jobs matching the criteria."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/jobs_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("readgroupsets", "methods: 'align', 'call', 'coveragebuckets-list', 'delete', 'export', 'get', 'import', 'patch', 'search' and 'update'", vec![ - ("align", - Some(r##"Aligns read data from existing read group sets or files from Google Cloud Storage. See the alignment and variant calling documentation for more details."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/readgroupsets_align", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("call", - Some(r##"Calls variants on read data from existing read group sets or files from Google Cloud Storage. See the alignment and variant calling documentation for more details."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/readgroupsets_call", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("coveragebuckets-list", - Some(r##"Lists fixed width coverage buckets for a read group set, each of which correspond to a range of a reference sequence. Each bucket summarizes coverage information across its corresponding genomic range. - - Coverage is defined as the number of reads which are aligned to a given base in the reference sequence. Coverage buckets are available at several precomputed bucket widths, enabling retrieval of various coverage 'zoom levels'. The caller must have READ permissions for the target read group set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/readgroupsets_coveragebuckets-list", - vec![ - (Some(r##"read-group-set-id"##), - None, - Some(r##"Required. The ID of the read group set over which coverage is requested."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes a read group set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/readgroupsets_delete", - vec![ - (Some(r##"read-group-set-id"##), - None, - Some(r##"The ID of the read group set to be deleted. The caller must have WRITE permissions to the dataset associated with this read group set."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("export", - Some(r##"Exports read group sets to a BAM file in Google Cloud Storage. - - Note that currently there may be some differences between exported BAM files and the original BAM file at the time of import. In particular, comments in the input file header will not be preserved, some custom tags will be converted to strings, and original reference sequence order is not necessarily preserved."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/readgroupsets_export", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets a read group set by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/readgroupsets_get", - vec![ - (Some(r##"read-group-set-id"##), - None, - Some(r##"The ID of the read group set."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("import", - Some(r##"Creates read group sets by asynchronously importing the provided information. - - Note that currently comments in the input file header are not imported and some custom tags will be converted to strings, rather than preserving tag types. The caller must have WRITE permissions to the dataset."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/readgroupsets_import", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("patch", - Some(r##"Updates a read group set. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/readgroupsets_patch", - vec![ - (Some(r##"read-group-set-id"##), - None, - Some(r##"The ID of the read group set to be updated. The caller must have WRITE permissions to the dataset associated with this read group set."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Searches for read group sets matching the criteria. - - Implements GlobalAllianceApi.searchReadGroupSets."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/readgroupsets_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - Some(r##"Updates a read group set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/readgroupsets_update", - vec![ - (Some(r##"read-group-set-id"##), - None, - Some(r##"The ID of the read group set to be updated. The caller must have WRITE permissions to the dataset associated with this read group set."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("reads", "methods: 'search'", vec![ - ("search", - Some(r##"Gets a list of reads for one or more read group sets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. - - If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only read group set IDs yields all reads in those read group sets, including unmapped reads. - - All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order. - - Implements GlobalAllianceApi.searchReads."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/reads_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("references", "methods: 'bases-list', 'get' and 'search'", vec![ - ("bases-list", - Some(r##"Lists the bases in a reference, optionally restricted to a range. - - Implements GlobalAllianceApi.getReferenceBases."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/references_bases-list", - vec![ - (Some(r##"reference-id"##), - None, - Some(r##"The ID of the reference."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets a reference. - - Implements GlobalAllianceApi.getReference."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/references_get", - vec![ - (Some(r##"reference-id"##), - None, - Some(r##"The ID of the reference."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Searches for references which match the given criteria. - - Implements GlobalAllianceApi.searchReferences."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/references_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("referencesets", "methods: 'get' and 'search'", vec![ - ("get", - Some(r##"Gets a reference set. - - Implements GlobalAllianceApi.getReferenceSet."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/referencesets_get", - vec![ - (Some(r##"reference-set-id"##), - None, - Some(r##"The ID of the reference set."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Searches for reference sets which match the given criteria. - - Implements GlobalAllianceApi.searchReferenceSets."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/referencesets_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("streaming-readstore", "methods: 'streamreads'", vec![ - ("streamreads", - Some(r##"Gets a stream of reads for one or more read group sets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. - - If a target positional range is specified, all reads whose alignment to the reference genome overlap the range are returned. - - All reads returned are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/streaming-readstore_streamreads", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("variants", "methods: 'create', 'delete', 'get', 'search' and 'update'", vec![ - ("create", - Some(r##"Creates a new variant."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variants_create", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("delete", - Some(r##"Deletes a variant."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variants_delete", - vec![ - (Some(r##"variant-id"##), - None, - Some(r##"The ID of the variant to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("get", - Some(r##"Gets a variant by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variants_get", - vec![ - (Some(r##"variant-id"##), - None, - Some(r##"The ID of the variant."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Gets a list of variants matching the criteria. - - Implements GlobalAllianceApi.searchVariants."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variants_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - Some(r##"Updates a variant's names and info fields. All other modifications are silently ignored. Returns the modified variant without its calls."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variants_update", - vec![ - (Some(r##"variant-id"##), - None, - Some(r##"The ID of the variant to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("variantsets", "methods: 'delete', 'export', 'get', 'import-variants', 'merge-variants', 'patch', 'search' and 'update'", vec![ - ("delete", - Some(r##"Deletes the contents of a variant set. The variant set object is not deleted."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variantsets_delete", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"The ID of the variant set to be deleted."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("export", - Some(r##"Exports variant set data to an external destination."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variantsets_export", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"Required. The ID of the variant set that contains variant data which should be exported. The caller must have READ access to this variant set."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("get", - Some(r##"Gets a variant set by ID."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variantsets_get", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"Required. The ID of the variant set."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("import-variants", - Some(r##"Creates variant data by asynchronously importing the provided information. - - The variants for import will be merged with any existing data and each other according to the behavior of mergeVariants. In particular, this means for merged VCF variants that have conflicting INFO fields, some data will be arbitrarily discarded. As a special case, for single-sample VCF files, QUAL and FILTER fields will be moved to the call level; these are sometimes interpreted in a call-specific context. Imported VCF headers are appended to the metadata already in a variant set."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variantsets_import-variants", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"Required. The variant set to which variant data should be imported."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("merge-variants", - Some(r##"Merges the given variants with existing variants. Each variant will be merged with an existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created. - - When variants are merged, the call information from the new variant is added to the existing variant, and other fields (such as key/value pairs) are discarded."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variantsets_merge-variants", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"The destination variant set."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - ]), - ("patch", - Some(r##"Updates a variant set's metadata. All other modifications are silently ignored. This method supports patch semantics."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variantsets_patch", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"The ID of the variant to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("search", - Some(r##"Returns a list of all variant sets matching search criteria. - - Implements GlobalAllianceApi.searchVariantSets."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variantsets_search", - vec![ - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("update", - Some(r##"Updates a variant set's metadata. All other modifications are silently ignored."##), - "Details at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli/variantsets_update", - vec![ - (Some(r##"variant-set-id"##), - None, - Some(r##"The ID of the variant to be updated."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ]; - - let mut app = App::new("genomics1-beta2") - .author("Sebastian Thiel ") - .version("0.3.0+20150326") - .about("Provides access to Genomics data.") - .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_genomics1_beta2_cli") - .arg(Arg::with_name("url") - .long("scope") - .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") - .multiple(true) - .takes_value(true)) - .arg(Arg::with_name("folder") - .long("config-dir") - .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") - .multiple(false) - .takes_value(true)) - .arg(Arg::with_name("debug") - .long("debug") - .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") - .multiple(false) - .takes_value(false)) - .arg(Arg::with_name("debug-auth") - .long("debug-auth") - .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") - .multiple(false) - .takes_value(false)); - - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { - let mut mcmd = SubCommand::new(main_command_name).about(about); - - for &(sub_command_name, ref desc, url_info, ref args) in subcommands { - let mut scmd = SubCommand::new(sub_command_name); - if let &Some(desc) = desc { - scmd = scmd.about(desc); - } - scmd = scmd.after_help(url_info); - - for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = - match (arg_name, flag) { - (&Some(an), _ ) => an, - (_ , &Some(f)) => f, - _ => unreachable!(), - }; - let mut arg = Arg::with_name(arg_name_str) - .empty_values(false); - if let &Some(short_flag) = flag { - arg = arg.short(short_flag); - } - if let &Some(desc) = desc { - arg = arg.help(desc); - } - if arg_name.is_some() && flag.is_some() { - arg = arg.takes_value(true); - } - if let &Some(required) = required { - arg = arg.required(required); - } - if let &Some(multi) = multi { - arg = arg.multiple(multi); - } - scmd = scmd.arg(arg); - } - mcmd = mcmd.subcommand(scmd); - } - app = app.subcommand(mcmd); - } - - let matches = app.get_matches(); - - let debug = matches.is_present("debug"); - match Engine::new(matches) { - Err(err) => { - exit_status = err.exit_code; - writeln!(io::stderr(), "{}", err).ok(); - }, - Ok(engine) => { - if let Err(doit_err) = engine.doit() { - exit_status = 1; - match doit_err { - DoitError::IoError(path, err) => { - writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); - }, - DoitError::ApiError(err) => { - if debug { - writeln!(io::stderr(), "{:?}", err).ok(); - } else { - writeln!(io::stderr(), "{}", err).ok(); - } - } - } - } - } - } - - std::process::exit(exit_status); -} \ No newline at end of file diff --git a/gen/genomics1_beta2/Cargo.toml b/gen/genomics1_beta2/Cargo.toml deleted file mode 100644 index 8e025256eb..0000000000 --- a/gen/genomics1_beta2/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -# DO NOT EDIT ! -# This file was generated automatically from 'src/mako/Cargo.toml.mako' -# DO NOT EDIT ! -[package] - -name = "google-genomics1_beta2" -version = "0.1.8+20150326" -authors = ["Sebastian Thiel "] -description = "A complete library to interact with genomics (protocol v1beta2)" -repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/genomics1_beta2" -homepage = "https://developers.google.com/genomics/v1beta2/reference" -documentation = "http://byron.github.io/google-apis-rs/google_genomics1_beta2" -license = "MIT" -keywords = ["genomics", "google", "protocol", "web", "api"] -build = "src/build.rs" - - -[dependencies] -hyper = ">= 0.5.2" -mime = "0.0.11" -serde = ">= 0.4.1" -yup-oauth2 = "*" -url = "*" - -[build-dependencies] -syntex = { version = "*" } -serde_codegen = { version = "*" } - diff --git a/gen/genomics1_beta2/LICENSE.md b/gen/genomics1_beta2/LICENSE.md deleted file mode 100644 index ae22e6ec52..0000000000 --- a/gen/genomics1_beta2/LICENSE.md +++ /dev/null @@ -1,30 +0,0 @@ - -The MIT License (MIT) -===================== - -Copyright © `2015` `Sebastian Thiel` - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the “Software”), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/genomics1_beta2/README.md b/gen/genomics1_beta2/README.md deleted file mode 100644 index 96347ed83c..0000000000 --- a/gen/genomics1_beta2/README.md +++ /dev/null @@ -1,209 +0,0 @@ - -The `google-genomics1_beta2` library allows access to all features of the *Google genomics* service. - -This documentation was generated from *genomics* crate version *0.1.8+20150326*, where *20150326* is the exact revision of the *genomics:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.8*. - -Everything else about the *genomics* *v1_beta2* API can be found at the -[official documentation site](https://developers.google.com/genomics/v1beta2/reference). -# Features - -Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.Genomics.html) ... - -* [annotation sets](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationSet.html) - * [*create*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationSetCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationSetDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationSetGetCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationSetPatchCall.html), [*search*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationSetSearchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationSetUpdateCall.html) -* [annotations](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.Annotation.html) - * [*batch create*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationBatchCreateCall.html), [*create*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationGetCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationPatchCall.html), [*search*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationSearchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.AnnotationUpdateCall.html) -* callsets - * [*create*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.CallsetCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.CallsetDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.CallsetGetCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.CallsetPatchCall.html), [*search*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.CallsetSearchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.CallsetUpdateCall.html) -* [datasets](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.Dataset.html) - * [*create*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.DatasetCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.DatasetDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.DatasetGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.DatasetListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.DatasetPatchCall.html), [*undelete*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.DatasetUndeleteCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.DatasetUpdateCall.html) -* experimental - * [*jobs create*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ExperimentalJobCreateCall.html) -* [jobs](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.Job.html) - * [*cancel*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.JobCancelCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.JobGetCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.JobSearchCall.html) -* readgroupsets - * [*align*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadgroupsetAlignCall.html), [*call*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadgroupsetCallCall.html), [*coveragebuckets list*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadgroupsetCoveragebucketListCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadgroupsetDeleteCall.html), [*export*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadgroupsetExportCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadgroupsetGetCall.html), [*import*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadgroupsetImportCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadgroupsetPatchCall.html), [*search*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadgroupsetSearchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadgroupsetUpdateCall.html) -* [reads](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.Read.html) - * [*search*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReadSearchCall.html) -* [references](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.Reference.html) - * [*bases list*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReferenceBaseListCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReferenceGetCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReferenceSearchCall.html) -* referencesets - * [*get*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReferencesetGetCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.ReferencesetSearchCall.html) -* streaming readstore - * [*streamreads*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.StreamingReadstoreStreamreadCall.html) -* [variants](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.Variant.html) - * [*create*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantCreateCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantGetCall.html), [*search*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantSearchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantUpdateCall.html) -* variantsets - * [*delete*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantsetDeleteCall.html), [*export*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantsetExportCall.html), [*get*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantsetGetCall.html), [*import variants*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantsetImportVariantCall.html), [*merge variants*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantsetMergeVariantCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantsetPatchCall.html), [*search*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantsetSearchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.VariantsetUpdateCall.html) - - - - -# Structure of this Library - -The API is structured into the following primary items: - -* **[Hub](http://byron.github.io/google-apis-rs/google_genomics1_beta2/struct.Genomics.html)** - * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.CallBuilder.html) -* **[Resources](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.Resource.html)** - * primary types that you can apply *Activities* to - * a collection of properties and *Parts* - * **[Parts](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.Part.html)** - * a collection of properties - * never directly used in *Activities* -* **[Activities](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.CallBuilder.html)** - * operations to apply to *Resources* - -All *structures* are marked with applicable traits to further categorize them and ease browsing. - -Generally speaking, you can invoke *Activities* like this: - -```Rust,ignore -let r = hub.resource().activity(...).doit() -``` - -Or specifically ... - -```ignore -let r = hub.annotations().search(...).doit() -let r = hub.annotations().patch(...).doit() -let r = hub.annotations().create(...).doit() -let r = hub.annotations().delete(...).doit() -let r = hub.annotations().update(...).doit() -let r = hub.annotations().get(...).doit() -let r = hub.annotations().batch_create(...).doit() -``` - -The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` -supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be -specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. -The `doit()` method performs the actual communication with the server and returns the respective result. - -# Usage - -## Setting up your Project - -To use this library, you would put the following lines into your `Cargo.toml` file: - -```toml -[dependencies] -google-genomics1_beta2 = "*" -``` - -## A complete example - -```Rust -extern crate hyper; -extern crate yup_oauth2 as oauth2; -extern crate google_genomics1_beta2 as genomics1_beta2; -use genomics1_beta2::Annotation; -use genomics1_beta2::{Result, Error}; -use std::default::Default; -use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -use genomics1_beta2::Genomics; - -// Get an ApplicationSecret instance by some means. It contains the `client_id` and -// `client_secret`, among other things. -let secret: ApplicationSecret = Default::default(); -// Instantiate the authenticator. It will choose a suitable authentication flow for you, -// unless you replace `None` with the desired Flow. -// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about -// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and -// retrieve them from storage. -let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, - hyper::Client::new(), - ::default(), None); -let mut hub = Genomics::new(hyper::Client::new(), 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 ! -let mut req = Annotation::default(); - -// 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 ! -let result = hub.annotations().patch(req, "annotationId") - .doit(); - -match result { - Err(e) => match e { - // The Error enum provides details about what exactly happened. - // You can also just use its `Debug`, `Display` or `Error` traits - Error::HttpError(_) - |Error::MissingAPIKey - |Error::MissingToken(_) - |Error::Cancelled - |Error::UploadSizeLimitExceeded(_, _) - |Error::Failure(_) - |Error::BadRequest(_) - |Error::FieldClash(_) - |Error::JsonDecodeError(_, _) => println!("{}", e), - }, - Ok(res) => println!("Success: {:?}", res), -} - -``` -## Handling Errors - -All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_genomics1_beta2/enum.Result.html) enumeration as return value of -the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_genomics1_beta2/../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](http://byron.github.io/google-apis-rs/google_genomics1_beta2/enum.Result.html), should be -read by you to obtain the media. -If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.ResponseResult.html), 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")`. - -Methods supporting uploads can do so using up to 2 different protocols: -*simple* and *resumable*. The distinctiveness of each is represented by customized -`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. - -## Customization and Callbacks - -You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.Delegate.html) to the -[Method Builder](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.CallBuilder.html) 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](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.Delegate.html) 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 [enocodable](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.RequestValue.html) and -[decodable](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses -are valid. -Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.Part.html) 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](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.CallBuilder.html), 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](http://byron.github.io/google-apis-rs/google_genomics1_beta2/trait.RequestValue.html) are moved - -Arguments will always be copied or cloned into the builder, to make them independent of their original life times. - -[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure -[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern -[google-go-api]: https://github.com/google/google-api-go-client - -# License -The **genomics1_beta2** 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-rs/LICENSE.md diff --git a/gen/genomics1_beta2/src/lib.rs.in b/gen/genomics1_beta2/src/lib.rs.in deleted file mode 100644 index 61037dee8b..0000000000 --- a/gen/genomics1_beta2/src/lib.rs.in +++ /dev/null @@ -1,18512 +0,0 @@ -// DO NOT EDIT ! -// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' -// DO NOT EDIT ! - -extern crate hyper; -extern crate serde; -extern crate yup_oauth2 as oauth2; -extern crate mime; -extern crate url; - -mod cmn; - -use std::collections::HashMap; -use std::cell::RefCell; -use std::borrow::BorrowMut; -use std::default::Default; -use std::collections::BTreeMap; -use serde::json; -use std::io; -use std::fs; -use std::thread::sleep_ms; - -pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, - Resource, ErrorResponse, remove_json_null_values}; - - -// ############## -// UTILITIES ### -// ############ - -/// Identifies the an OAuth2 authorization scope. -/// A scope is needed when requesting an -/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). -#[derive(PartialEq, Eq, Hash)] -pub enum Scope { - /// Manage your data in Google Cloud Storage - DevstorageReadWrite, - - /// View Genomics data - Readonly, - - /// View and manage Genomics data - Full, - - /// View and manage your data in Google BigQuery - Bigquery, -} - -impl AsRef for Scope { - fn as_ref(&self) -> &str { - match *self { - Scope::DevstorageReadWrite => "https://www.googleapis.com/auth/devstorage.read_write", - Scope::Readonly => "https://www.googleapis.com/auth/genomics.readonly", - Scope::Full => "https://www.googleapis.com/auth/genomics", - Scope::Bigquery => "https://www.googleapis.com/auth/bigquery", - } - } -} - -impl Default for Scope { - fn default() -> Scope { - Scope::Readonly - } -} - - - -// ######## -// HUB ### -// ###### - -/// Central instance to access all Genomics related resource activities -/// -/// # Examples -/// -/// Instantiate a new hub -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::Annotation; -/// use genomics1_beta2::{Result, Error}; -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and -/// // `client_secret`, among other things. -/// let secret: ApplicationSecret = Default::default(); -/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, -/// // unless you replace `None` with the desired Flow. -/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about -/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and -/// // retrieve them from storage. -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = Annotation::default(); -/// -/// // 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 ! -/// let result = hub.annotations().patch(req, "annotationId") -/// .doit(); -/// -/// match result { -/// Err(e) => match e { -/// // The Error enum provides details about what exactly happened. -/// // You can also just use its `Debug`, `Display` or `Error` traits -/// Error::HttpError(_) -/// |Error::MissingAPIKey -/// |Error::MissingToken(_) -/// |Error::Cancelled -/// |Error::UploadSizeLimitExceeded(_, _) -/// |Error::Failure(_) -/// |Error::BadRequest(_) -/// |Error::FieldClash(_) -/// |Error::JsonDecodeError(_, _) => println!("{}", e), -/// }, -/// Ok(res) => println!("Success: {:?}", res), -/// } -/// # } -/// ``` -pub struct Genomics { - client: RefCell, - auth: RefCell, - _user_agent: String, -} - -impl<'a, C, A> Hub for Genomics {} - -impl<'a, C, A> Genomics - where C: BorrowMut, A: oauth2::GetToken { - - pub fn new(client: C, authenticator: A) -> Genomics { - Genomics { - client: RefCell::new(client), - auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.8".to_string(), - } - } - - pub fn annotation_sets(&'a self) -> AnnotationSetMethods<'a, C, A> { - AnnotationSetMethods { hub: &self } - } - pub fn annotations(&'a self) -> AnnotationMethods<'a, C, A> { - AnnotationMethods { hub: &self } - } - pub fn callsets(&'a self) -> CallsetMethods<'a, C, A> { - CallsetMethods { hub: &self } - } - pub fn datasets(&'a self) -> DatasetMethods<'a, C, A> { - DatasetMethods { hub: &self } - } - pub fn experimental(&'a self) -> ExperimentalMethods<'a, C, A> { - ExperimentalMethods { hub: &self } - } - pub fn jobs(&'a self) -> JobMethods<'a, C, A> { - JobMethods { hub: &self } - } - pub fn readgroupsets(&'a self) -> ReadgroupsetMethods<'a, C, A> { - ReadgroupsetMethods { hub: &self } - } - pub fn reads(&'a self) -> ReadMethods<'a, C, A> { - ReadMethods { hub: &self } - } - pub fn references(&'a self) -> ReferenceMethods<'a, C, A> { - ReferenceMethods { hub: &self } - } - pub fn referencesets(&'a self) -> ReferencesetMethods<'a, C, A> { - ReferencesetMethods { hub: &self } - } - pub fn streaming_readstore(&'a self) -> StreamingReadstoreMethods<'a, C, A> { - StreamingReadstoreMethods { hub: &self } - } - pub fn variants(&'a self) -> VariantMethods<'a, C, A> { - VariantMethods { hub: &self } - } - pub fn variantsets(&'a self) -> VariantsetMethods<'a, C, A> { - VariantsetMethods { hub: &self } - } - - /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.8`. - /// - /// Returns the previously set user-agent. - pub fn user_agent(&mut self, agent_name: String) -> String { - let prev = self._user_agent.clone(); - self._user_agent = agent_name; - prev - } -} - - -// ############ -// SCHEMAS ### -// ########## -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [batch create annotations](struct.AnnotationBatchCreateCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchAnnotationsResponse { - /// The resulting per-annotation entries, ordered consistently with the original request. - pub entries: Option>, -} - -impl ResponseResult for BatchAnnotationsResponse {} - - -/// The search variant sets request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search variantsets](struct.VariantsetSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchVariantSetsRequest { - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// Exactly one dataset ID must be provided here. Only variant sets which belong to this dataset will be returned. - #[serde(rename="datasetIds")] - pub dataset_ids: Option>, - /// The maximum number of variant sets to return in a request. - #[serde(rename="pageSize")] - pub page_size: Option, -} - -impl RequestValue for SearchVariantSetsRequest {} - - -/// Wrapper message for int32. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Int32Value { - /// The int32 value. - pub value: Option, -} - -impl Part for Int32Value {} - - -/// The job search response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search jobs](struct.JobSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchJobsResponse { - /// The continuation token which is used to page through large result sets. Provide this value is a subsequent request to return the next page of results. This field will be empty if there are no more results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of jobs results, ordered newest to oldest. - pub jobs: Option>, -} - -impl ResponseResult for SearchJobsResponse {} - - -/// A Variant annotation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VariantAnnotation { - /// Google annotation IDs of the transcripts affected by this variant. These should be provided when the variant is created. - #[serde(rename="transcriptIds")] - pub transcript_ids: Option>, - /// The alternate allele for this variant. If multiple alternate alleles exist at this location, create a separate variant for each one, as they may represent distinct conditions. - #[serde(rename="alternateBases")] - pub alternate_bases: Option, - /// Describes the clinical significance of a variant. It is adapted from the ClinVar controlled vocabulary for clinical significance described at: http://www.ncbi.nlm.nih.gov/clinvar/docs/clinsig/ - #[serde(rename="clinicalSignificance")] - pub clinical_significance: Option, - /// The set of conditions associated with this variant. A condition describes the way a variant influences human health. - pub conditions: Option>, - /// Type has been adapted from ClinVar's list of variant types. - #[serde(rename="type")] - pub type_: Option, - /// Effect of the variant on the coding sequence. - pub effect: Option, - /// Google annotation ID of the gene affected by this variant. This should be provided when the variant is created. - #[serde(rename="geneId")] - pub gene_id: Option, -} - -impl Part for VariantAnnotation {} - - -/// -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VariantAnnotationCondition { - /// The MedGen concept id associated with this gene. Search for these IDs at http://www.ncbi.nlm.nih.gov/medgen/ - #[serde(rename="conceptId")] - pub concept_id: Option, - /// The OMIM id for this condition. Search for these IDs at http://omim.org/ - #[serde(rename="omimId")] - pub omim_id: Option, - /// The set of external IDs for this condition. - #[serde(rename="externalIds")] - pub external_ids: Option>, - /// A set of names for the condition. - pub names: Option>, -} - -impl Part for VariantAnnotationCondition {} - - -/// The variant data import request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [import variants variantsets](struct.VariantsetImportVariantCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImportVariantsRequest { - /// A list of URIs pointing at VCF files in Google Cloud Storage. See the VCF Specification for more details on the input format. - #[serde(rename="sourceUris")] - pub source_uris: Option>, - /// The format of the variant data being imported. - pub format: Option, -} - -impl RequestValue for ImportVariantsRequest {} - - -/// Metadata describes a single piece of variant call metadata. These data include a top level key and either a single value string (value) or a list of key-value pairs (info.) Value and info are mutually exclusive. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Metadata { - /// Remaining structured metadata key-value pairs. - pub info: Option>>, - /// A textual description of this metadata. - pub description: Option, - /// The top-level key. - pub key: Option, - /// The type of data. Possible types include: Integer, Float, Flag, Character, and String. - #[serde(rename="type")] - pub type_: Option, - /// The number of values that can be included in a field described by this metadata. - pub number: Option, - /// The value field for simple metadata - pub value: Option, - /// User-provided ID field, not enforced by this API. Two or more pieces of structured metadata with identical id and key fields are considered equivalent. - pub id: Option, -} - -impl Part for Metadata {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [coveragebuckets list readgroupsets](struct.ReadgroupsetCoveragebucketListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListCoverageBucketsResponse { - /// The coverage buckets. The list of buckets is sparse; a bucket with 0 overlapping reads is not returned. A bucket never crosses more than one reference sequence. Each bucket has width bucketWidth, unless its end is the end of the reference sequence. - #[serde(rename="coverageBuckets")] - pub coverage_buckets: Option>, - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The length of each coverage bucket in base pairs. Note that buckets at the end of a reference sequence may be shorter. This value is omitted if the bucket width is infinity (the default behaviour, with no range or targetBucketWidth). - #[serde(rename="bucketWidth")] - pub bucket_width: Option, -} - -impl ResponseResult for ListCoverageBucketsResponse {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct FastqMetadata { - /// Optionally specifies the platform unit for alignment from FASTQ. For example: flowcell-barcode.lane for Illumina or slide for SOLID. - #[serde(rename="platformUnit")] - pub platform_unit: Option, - /// Optionally specifies the read group name for alignment from FASTQ. - #[serde(rename="readGroupName")] - pub read_group_name: Option, - /// Optionally specifies the library name for alignment from FASTQ. - #[serde(rename="libraryName")] - pub library_name: Option, - /// Optionally specifies the platform name for alignment from FASTQ. For example: CAPILLARY, LS454, ILLUMINA, SOLID, HELICOS, IONTORRENT, PACBIO. - #[serde(rename="platformName")] - pub platform_name: Option, - /// Optionally specifies the sample name for alignment from FASTQ. - #[serde(rename="sampleName")] - pub sample_name: Option, -} - -impl Part for FastqMetadata {} - - -/// The variant data export response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [export variantsets](struct.VariantsetExportCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExportVariantSetResponse { - /// A job ID that can be used to get status information. - #[serde(rename="jobId")] - pub job_id: Option, -} - -impl ResponseResult for ExportVariantSetResponse {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search annotations](struct.AnnotationSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchAnnotationsResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The matching annotations. - pub annotations: Option>, -} - -impl ResponseResult for SearchAnnotationsResponse {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReadGroupProgram { - /// The command line used to run this program. - #[serde(rename="commandLine")] - pub command_line: Option, - /// The version of the program run. - pub version: Option, - /// The user specified locally unique ID of the program. Used along with prevProgramId to define an ordering between programs. - pub id: Option, - /// The name of the program. - pub name: Option, - /// The ID of the program run before this one. - #[serde(rename="prevProgramId")] - pub prev_program_id: Option, -} - -impl Part for ReadGroupProgram {} - - -/// The read group set align request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [align readgroupsets](struct.ReadgroupsetAlignCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AlignReadGroupSetsRequest { - /// The interleaved FASTQ source files for alignment, where both members of each pair of reads are found on consecutive records within the same FASTQ file. Exactly one of readGroupSetId, bamSourceUris, interleavedFastqSource or pairedFastqSource must be provided. - #[serde(rename="interleavedFastqSource")] - pub interleaved_fastq_source: Option, - /// The BAM source files for alignment. Exactly one of readGroupSetId, bamSourceUris, interleavedFastqSource or pairedFastqSource must be provided. The caller must have READ permissions for these files. - #[serde(rename="bamSourceUris")] - pub bam_source_uris: Option>, - /// The paired end FASTQ source files for alignment, where each member of a pair of reads are found in separate files. Exactly one of readGroupSetId, bamSourceUris, interleavedFastqSource or pairedFastqSource must be provided. - #[serde(rename="pairedFastqSource")] - pub paired_fastq_source: Option, - /// Required. The ID of the dataset the newly aligned read group sets will belong to. The caller must have WRITE permissions to this dataset. - #[serde(rename="datasetId")] - pub dataset_id: Option, - /// The ID of the read group set which will be aligned. A new read group set will be generated to hold the aligned data, the originals will not be modified. The caller must have READ permissions for this read group set. Exactly one of readGroupSetId, bamSourceUris, interleavedFastqSource or pairedFastqSource must be provided. - #[serde(rename="readGroupSetId")] - pub read_group_set_id: Option, -} - -impl RequestValue for AlignReadGroupSetsRequest {} - - -/// A transcript represents the assertion that a particular region of the reference genome may be transcribed as RNA. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Transcript { - /// The range of the coding sequence for this transcript, if any. To determine the exact ranges of coding sequence, intersect this range with those of the exons, if any. If there are any exons, the codingSequence must start and end within them. - /// - /// Note that in some cases, the reference genome will not exactly match the observed mRNA transcript e.g. due to variance in the source genome from reference. In these cases, exon.frame will not necessarily match the expected reference reading frame and coding exon reference bases cannot necessarily be concatenated to produce the original transcript mRNA. - #[serde(rename="codingSequence")] - pub coding_sequence: Option, - /// The exons that compose this transcript. This field should be unset for genomes where transcript splicing does not occur, for example prokaryotes. - /// - /// - /// Introns are regions of the transcript that are not included in the spliced RNA product. Though not explicitly modeled here, intron ranges can be deduced; all regions of this transcript that are not exons are introns. - /// - /// - /// Exonic sequences do not necessarily code for a translational product (amino acids). Only the regions of exons bounded by the codingSequence correspond to coding DNA sequence. - /// - /// - /// Exons are ordered by start position and may not overlap. - pub exons: Option>, - /// The annotation ID of the gene from which this transcript is transcribed. - #[serde(rename="geneId")] - pub gene_id: Option, -} - -impl Part for Transcript {} - - -/// An annotation describes a region of reference genome. The value of an annotation may be one of several canonical types, supplemented by arbitrary info tags. A variant annotation is represented by one or more of these canonical types. An annotation is not inherently associated with a specific sample or individual (though a client could choose to use annotations in this way). Example canonical annotation types are 'Gene' and 'Variant'. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search annotations](struct.AnnotationSearchCall.html) (none) -/// * [patch annotations](struct.AnnotationPatchCall.html) (request|response) -/// * [create annotations](struct.AnnotationCreateCall.html) (request|response) -/// * [delete annotations](struct.AnnotationDeleteCall.html) (none) -/// * [update annotations](struct.AnnotationUpdateCall.html) (request|response) -/// * [get annotations](struct.AnnotationGetCall.html) (response) -/// * [batch create annotations](struct.AnnotationBatchCreateCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Annotation { - /// A map of additional data for this annotation. - pub info: Option>>, - /// The display name of this annotation. - pub name: Option, - /// A transcript value represents the assertion that a particular region of the reference genome may be transcribed as RNA. An alternative splicing pattern would be represented as a separate transcript object. This field is only set for annotations of type TRANSCRIPT. - pub transcript: Option, - /// A variant annotation, which describes the effect of a variant on the genome, the coding sequence, and/or higher level consequences at the organism level e.g. pathogenicity. This field is only set for annotations of type VARIANT. - pub variant: Option, - /// The ID of the containing annotation set. - #[serde(rename="annotationSetId")] - pub annotation_set_id: Option, - /// The position of this annotation on the reference sequence. - pub position: Option, - /// The data type for this annotation. Must match the containing annotation set's type. - #[serde(rename="type")] - pub type_: Option, - /// The generated unique ID for this annotation. - pub id: Option, -} - -impl RequestValue for Annotation {} -impl Resource for Annotation {} -impl ResponseResult for Annotation {} - - -/// A summary representation of the service request that spawned the job. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct JobRequest { - /// The data source of the request, for example, a Google Cloud Storage object path or Readset ID. - pub source: Option>, - /// The data destination of the request, for example, a Google BigQuery Table or Dataset ID. - pub destination: Option>, - /// The original request type. - #[serde(rename="type")] - pub type_: Option, -} - -impl Part for JobRequest {} - - -/// The variant search response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search variants](struct.VariantSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchVariantsResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching Variants. - pub variants: Option>, -} - -impl ResponseResult for SearchVariantsResponse {} - - -/// The jobs search request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search jobs](struct.JobSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchJobsRequest { - /// Only return jobs which have a matching status. - pub status: Option>, - /// The continuation token which is used to page through large result sets. To get the next page of results, set this parameter to the value of the nextPageToken from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// If specified, only jobs created on or after this date, given in milliseconds since Unix epoch, will be returned. - #[serde(rename="createdAfter")] - pub created_after: Option, - /// If specified, only jobs created prior to this date, given in milliseconds since Unix epoch, will be returned. - #[serde(rename="createdBefore")] - pub created_before: Option, - /// Specifies the number of results to return in a single page. Defaults to 128. The maximum value is 256. - #[serde(rename="pageSize")] - pub page_size: Option, - /// Required. Only return jobs which belong to this Google Developers Console project. - #[serde(rename="projectNumber")] - pub project_number: Option, -} - -impl RequestValue for SearchJobsRequest {} - - -/// A 0-based half-open genomic coordinate range over a reference sequence, for representing the position of a genomic resource. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RangePosition { - /// The start position of the range on the reference, 0-based inclusive. - pub start: Option, - /// The ID of the Google Genomics reference associated with this range. - #[serde(rename="referenceId")] - pub reference_id: Option, - /// The end position of the range on the reference, 0-based exclusive. - pub end: Option, - /// Whether this range refers to the reverse strand, as opposed to the forward strand. Note that regardless of this field, the start/end position of the range always refer to the forward strand. - #[serde(rename="reverseStrand")] - pub reverse_strand: Option, - /// The display name corresponding to the reference specified by referenceId, for example chr1, 1, or chrX. - #[serde(rename="referenceName")] - pub reference_name: Option, -} - -impl Part for RangePosition {} - - -/// -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExternalId { - /// The name of the source of this data. - #[serde(rename="sourceName")] - pub source_name: Option, - /// The id used by the source of this data. - pub id: Option, -} - -impl Part for ExternalId {} - - -/// A call set is a collection of variant calls, typically for one sample. It belongs to a variant set. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [create callsets](struct.CallsetCreateCall.html) (request|response) -/// * [patch callsets](struct.CallsetPatchCall.html) (request|response) -/// * [get callsets](struct.CallsetGetCall.html) (response) -/// * [update callsets](struct.CallsetUpdateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CallSet { - /// A map of additional call set information. - pub info: Option>>, - /// The IDs of the variant sets this call set belongs to. - #[serde(rename="variantSetIds")] - pub variant_set_ids: Option>, - /// The call set name. - pub name: Option, - /// The date this call set was created in milliseconds from the epoch. - pub created: Option, - /// The sample ID this call set corresponds to. - #[serde(rename="sampleId")] - pub sample_id: Option, - /// The Google generated ID of the call set, immutable. - pub id: Option, -} - -impl RequestValue for CallSet {} -impl Resource for CallSet {} -impl ResponseResult for CallSet {} - - -/// An abstraction for referring to a genomic position, in relation to some already known reference. For now, represents a genomic position as a reference name, a base number on that reference (0-based), and a determination of forward or reverse strand. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Position { - /// The 0-based offset from the start of the forward strand for that reference. - pub position: Option, - /// Whether this position is on the reverse strand, as opposed to the forward strand. - #[serde(rename="reverseStrand")] - pub reverse_strand: Option, - /// The name of the reference in whatever reference set is being used. - #[serde(rename="referenceName")] - pub reference_name: Option, -} - -impl Part for Position {} - - -/// The variant data import response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [import variants variantsets](struct.VariantsetImportVariantCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImportVariantsResponse { - /// A job ID that can be used to get status information. - #[serde(rename="jobId")] - pub job_id: Option, -} - -impl ResponseResult for ImportVariantsResponse {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReadGroupExperiment { - /// The sequencing center used as part of this experiment. - #[serde(rename="sequencingCenter")] - pub sequencing_center: Option, - /// The library used as part of this experiment. Note: This is not an actual ID within this repository, but rather an identifier for a library which may be meaningful to some external system. - #[serde(rename="libraryId")] - pub library_id: Option, - /// The instrument model used as part of this experiment. This maps to sequencing technology in BAM. - #[serde(rename="instrumentModel")] - pub instrument_model: Option, - /// The platform unit used as part of this experiment e.g. flowcell-barcode.lane for Illumina or slide for SOLiD. Corresponds to the - #[serde(rename="platformUnit")] - pub platform_unit: Option, -} - -impl Part for ReadGroupExperiment {} - - -/// The call set search request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search callsets](struct.CallsetSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchCallSetsRequest { - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// Restrict the query to call sets within the given variant sets. At least one ID must be provided. - #[serde(rename="variantSetIds")] - pub variant_set_ids: Option>, - /// Only return call sets for which a substring of the name matches this string. - pub name: Option, - /// The maximum number of call sets to return. If unspecified, defaults to 1000. - #[serde(rename="pageSize")] - pub page_size: Option, -} - -impl RequestValue for SearchCallSetsRequest {} - - -/// The dataset list response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list datasets](struct.DatasetListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListDatasetsResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching Datasets. - pub datasets: Option>, -} - -impl ResponseResult for ListDatasetsResponse {} - - -/// The read group set import request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [import readgroupsets](struct.ReadgroupsetImportCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImportReadGroupSetsRequest { - /// A list of URIs pointing at BAM files in Google Cloud Storage. - #[serde(rename="sourceUris")] - pub source_uris: Option>, - /// The reference set to which the imported read group sets are aligned to, if any. The reference names of this reference set must be a superset of those found in the imported file headers. If no reference set id is provided, a best effort is made to associate with a matching reference set. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// The partition strategy describes how read groups are partitioned into read group sets. - #[serde(rename="partitionStrategy")] - pub partition_strategy: Option, - /// Required. The ID of the dataset these read group sets will belong to. The caller must have WRITE permissions to this dataset. - #[serde(rename="datasetId")] - pub dataset_id: Option, -} - -impl RequestValue for ImportReadGroupSetsRequest {} - - -/// The read group set call response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [call readgroupsets](struct.ReadgroupsetCallCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CallReadGroupSetsResponse { - /// A job ID that can be used to get status information. - #[serde(rename="jobId")] - pub job_id: Option, -} - -impl ResponseResult for CallReadGroupSetsResponse {} - - -/// A reference is a canonical assembled DNA sequence, intended to act as a reference coordinate space for other genomic annotations. A single reference might represent the human chromosome 1 or mitochandrial DNA, for instance. A reference belongs to one or more reference sets. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [bases list references](struct.ReferenceBaseListCall.html) (none) -/// * [search references](struct.ReferenceSearchCall.html) (none) -/// * [get references](struct.ReferenceGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Reference { - /// The length of this reference's sequence. - pub length: Option, - /// The name of this reference, for example 22. - pub name: Option, - /// The URI from which the sequence was obtained. Specifies a FASTA format file/string with one name, sequence pair. - #[serde(rename="sourceURI")] - pub source_uri: Option, - /// ID from http://www.ncbi.nlm.nih.gov/taxonomy (e.g. 9606->human) if not specified by the containing reference set. - #[serde(rename="ncbiTaxonId")] - pub ncbi_taxon_id: Option, - /// All known corresponding accession IDs in INSDC (GenBank/ENA/DDBJ) ideally with a version number, for example GCF_000001405.26. - #[serde(rename="sourceAccessions")] - pub source_accessions: Option>, - /// The Google generated immutable ID of the reference. - pub id: Option, - /// MD5 of the upper-case sequence excluding all whitespace characters (this is equivalent to SQ:M5 in SAM). This value is represented in lower case hexadecimal format. - pub md5checksum: Option, -} - -impl Resource for Reference {} -impl ResponseResult for Reference {} - - -/// The variant data export request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [export variantsets](struct.VariantsetExportCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExportVariantSetRequest { - /// The BigQuery dataset to export data to. Note that this is distinct from the Genomics concept of "dataset". - #[serde(rename="bigqueryDataset")] - pub bigquery_dataset: Option, - /// The BigQuery table to export data to. If the table doesn't exist, it will be created. If it already exists, it will be overwritten. - #[serde(rename="bigqueryTable")] - pub bigquery_table: Option, - /// If provided, only variant call information from the specified call sets will be exported. By default all variant calls are exported. - #[serde(rename="callSetIds")] - pub call_set_ids: Option>, - /// The Google Cloud project number that owns the destination BigQuery dataset. The caller must have WRITE access to this project. This project will also own the resulting export job. - #[serde(rename="projectNumber")] - pub project_number: Option, - /// The format for the exported data. - pub format: Option, -} - -impl RequestValue for ExportVariantSetRequest {} - - -/// -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search references](struct.ReferenceSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReferencesRequest { - /// If present, return references for which the md5checksum matches. See Reference.md5checksum for construction details. - pub md5checksums: Option>, - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// If present, return only references which belong to this reference set. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// If present, return references for which the accession matches this string. Best to give a version number, for example GCF_000001405.26. If only the main accession number is given then all records with that main accession will be returned, whichever version. Note that different versions will have different sequences. - pub accessions: Option>, - /// Specifies the maximum number of results to return in a single page. - #[serde(rename="pageSize")] - pub page_size: Option, -} - -impl RequestValue for SearchReferencesRequest {} - - -/// A read group is all the data that's processed the same way by the sequencer. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReadGroup { - /// A map of additional read group information. - pub info: Option>>, - /// The predicted insert size of this read group. The insert size is the length the sequenced DNA fragment from end-to-end, not including the adapters. - #[serde(rename="predictedInsertSize")] - pub predicted_insert_size: Option, - /// The read group name. This corresponds to the @RG ID field in the SAM spec. - pub name: Option, - /// The programs used to generate this read group. Programs are always identical for all read groups within a read group set. For this reason, only the first read group in a returned set will have this field populated. - pub programs: Option>, - /// The sample this read group's data was generated from. Note: This is not an actual ID within this repository, but rather an identifier for a sample which may be meaningful to some external system. - #[serde(rename="sampleId")] - pub sample_id: Option, - /// The experiment used to generate this read group. - pub experiment: Option, - /// The reference set the reads in this read group are aligned to. Required if there are any read alignments. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// The generated unique read group ID. Note: This is different than the @RG ID field in the SAM spec. For that value, see the name field. - pub id: Option, - /// The ID of the dataset this read group belongs to. - #[serde(rename="datasetId")] - pub dataset_id: Option, - /// A free-form text description of this read group. - pub description: Option, -} - -impl Part for ReadGroup {} - - -/// The read group set search response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search readgroupsets](struct.ReadgroupsetSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReadGroupSetsResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching read group sets. - #[serde(rename="readGroupSets")] - pub read_group_sets: Option>, -} - -impl ResponseResult for SearchReadGroupSetsResponse {} - - -/// The read group set import response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [import readgroupsets](struct.ReadgroupsetImportCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImportReadGroupSetsResponse { - /// A job ID that can be used to get status information. - #[serde(rename="jobId")] - pub job_id: Option, -} - -impl ResponseResult for ImportReadGroupSetsResponse {} - - -/// The read group set export response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [export readgroupsets](struct.ReadgroupsetExportCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExportReadGroupSetsResponse { - /// A job ID that can be used to get status information. - #[serde(rename="jobId")] - pub job_id: Option, -} - -impl ResponseResult for ExportReadGroupSetsResponse {} - - -/// The read group set search request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search readgroupsets](struct.ReadgroupsetSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReadGroupSetsRequest { - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// Restricts this query to read group sets within the given datasets. At least one ID must be provided. - #[serde(rename="datasetIds")] - pub dataset_ids: Option>, - /// Only return read group sets for which a substring of the name matches this string. - pub name: Option, - /// Specifies number of results to return in a single page. If unspecified, it will default to 256. The maximum value is 1024. - #[serde(rename="pageSize")] - pub page_size: Option, -} - -impl RequestValue for SearchReadGroupSetsRequest {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchAnnotationsResponseEntry { - /// The resulting status for this annotation operation. - pub status: Option, - /// The annotation, if any. - pub annotation: Option, -} - -impl Part for BatchAnnotationsResponseEntry {} - - -/// -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchAnnotationsResponseEntryStatus { - /// Error message for this status, if any. - pub message: Option, - /// The HTTP status code for this operation. - pub code: Option, -} - -impl Part for BatchAnnotationsResponseEntryStatus {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [bases list references](struct.ReferenceBaseListCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListBasesResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The offset position (0-based) of the given sequence from the start of this Reference. This value will differ for each page in a paginated request. - pub offset: Option, - /// A substring of the bases that make up this reference. - pub sequence: Option, -} - -impl ResponseResult for ListBasesResponse {} - - -/// ReferenceBound records an upper bound for the starting coordinate of variants in a particular reference. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReferenceBound { - /// An upper bound (inclusive) on the starting coordinate of any variant in the reference sequence. - #[serde(rename="upperBound")] - pub upper_bound: Option, - /// The reference the bound is associate with. - #[serde(rename="referenceName")] - pub reference_name: Option, -} - -impl Part for ReferenceBound {} - - -/// A call represents the determination of genotype with respect to a particular variant. It may include associated information such as quality and phasing. For example, a call might assign a probability of 0.32 to the occurrence of a SNP named rs1234 in a call set with the name NA12345. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Call { - /// A map of additional variant call information. - pub info: Option>>, - /// The genotype of this variant call. Each value represents either the value of the referenceBases field or a 1-based index into alternateBases. If a variant had a referenceBases value of T and an alternateBases value of ["A", "C"], and the genotype was [2, 1], that would mean the call represented the heterozygous value CA for this variant. If the genotype was instead [0, 1], the represented value would be TA. Ordering of the genotype values is important if the phaseset is present. If a genotype is not called (that is, a . is present in the GT string) -1 is returned. - pub genotype: Option>, - /// The ID of the call set this variant call belongs to. - #[serde(rename="callSetId")] - pub call_set_id: Option, - /// If this field is present, this variant call's genotype ordering implies the phase of the bases and is consistent with any other variant calls in the same reference sequence which have the same phaseset value. When importing data from VCF, if the genotype data was phased but no phase set was specified this field will be set to *. - pub phaseset: Option, - /// The genotype likelihoods for this variant call. Each array entry represents how likely a specific genotype is for this call. The value ordering is defined by the GL tag in the VCF spec. If Phred-scaled genotype likelihood scores (PL) are available and log10(P) genotype likelihood scores (GL) are not, PL scores are converted to GL scores. If both are available, PL scores are stored in info. - #[serde(rename="genotypeLikelihood")] - pub genotype_likelihood: Option>, - /// The name of the call set this variant call belongs to. - #[serde(rename="callSetName")] - pub call_set_name: Option, -} - -impl Part for Call {} - - -/// The job creation response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [jobs create experimental](struct.ExperimentalJobCreateCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExperimentalCreateJobResponse { - /// A job ID that can be used to get status information. - #[serde(rename="jobId")] - pub job_id: Option, -} - -impl ResponseResult for ExperimentalCreateJobResponse {} - - -/// The variant search request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search variants](struct.VariantSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchVariantsRequest { - /// The end of the window, 0-based exclusive. If unspecified or 0, defaults to the length of the reference. - pub end: Option, - /// The maximum number of variants to return. If unspecified, defaults to 5000. - #[serde(rename="pageSize")] - pub page_size: Option, - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// The maximum number of calls to return. However, at least one variant will always be returned, even if it has more calls than this limit. If unspecified, defaults to 5000. - #[serde(rename="maxCalls")] - pub max_calls: Option, - /// The beginning of the window (0-based, inclusive) for which overlapping variants should be returned. If unspecified, defaults to 0. - pub start: Option, - /// Only return variant calls which belong to call sets with these ids. Leaving this blank returns all variant calls. If a variant has no calls belonging to any of these call sets, it won't be returned at all. Currently, variants with no calls from any call set will never be returned. - #[serde(rename="callSetIds")] - pub call_set_ids: Option>, - /// Only return variants which have exactly this name. - #[serde(rename="variantName")] - pub variant_name: Option, - /// Required. Only return variants in this reference sequence. - #[serde(rename="referenceName")] - pub reference_name: Option, - /// Exactly one variant set ID must be provided. Only variants from this variant set will be returned. - #[serde(rename="variantSetIds")] - pub variant_set_ids: Option>, -} - -impl RequestValue for SearchVariantsRequest {} - - -/// A Dataset is a collection of genomic data. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [delete datasets](struct.DatasetDeleteCall.html) (none) -/// * [get datasets](struct.DatasetGetCall.html) (response) -/// * [undelete datasets](struct.DatasetUndeleteCall.html) (response) -/// * [create datasets](struct.DatasetCreateCall.html) (request|response) -/// * [update datasets](struct.DatasetUpdateCall.html) (request|response) -/// * [patch datasets](struct.DatasetPatchCall.html) (request|response) -/// * [list datasets](struct.DatasetListCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Dataset { - /// Flag indicating whether or not a dataset is publicly viewable. If a dataset is not public, it inherits viewing permissions from its project. - #[serde(rename="isPublic")] - pub is_public: Option, - /// The Google generated ID of the dataset, immutable. - pub id: Option, - /// The dataset name. - pub name: Option, - /// The Google Developers Console project number that this dataset belongs to. - #[serde(rename="projectNumber")] - pub project_number: Option, -} - -impl RequestValue for Dataset {} -impl Resource for Dataset {} -impl ResponseResult for Dataset {} - - -/// A read alignment describes a linear alignment of a string of DNA to a reference sequence, in addition to metadata about the fragment (the molecule of DNA sequenced) and the read (the bases which were read by the sequencer). A read is equivalent to a line in a SAM file. A read belongs to exactly one read group and exactly one read group set. Generating a reference-aligned sequence string When interacting with mapped reads, it's often useful to produce a string representing the local alignment of the read to reference. The following pseudocode demonstrates one way of doing this: -/// out = "" offset = 0 for c in read.alignment.cigar { switch c.operation { case "ALIGNMENT_MATCH", "SEQUENCE_MATCH", "SEQUENCE_MISMATCH": out += read.alignedSequence[offset:offset+c.operationLength] offset += c.operationLength break case "CLIP_SOFT", "INSERT": offset += c.operationLength break case "PAD": out += repeat("*", c.operationLength) break case "DELETE": out += repeat("-", c.operationLength) break case "SKIP": out += repeat(" ", c.operationLength) break case "CLIP_HARD": break } } return out -/// Converting to SAM's CIGAR string The following pseudocode generates a SAM CIGAR string from the cigar field. Note that this is a lossy conversion (cigar.referenceSequence is lost). -/// cigarMap = { "ALIGNMENT_MATCH": "M", "INSERT": "I", "DELETE": "D", "SKIP": "N", "CLIP_SOFT": "S", "CLIP_HARD": "H", "PAD": "P", "SEQUENCE_MATCH": "=", "SEQUENCE_MISMATCH": "X", } cigarStr = "" for c in read.alignment.cigar { cigarStr += c.operationLength + cigarMap[c.operation] } return cigarStr -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search reads](struct.ReadSearchCall.html) (none) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Read { - /// The ID of the read group set this read belongs to. (Every read must belong to exactly one read group set.) - #[serde(rename="readGroupSetId")] - pub read_group_set_id: Option, - /// SAM flag 0x200 - #[serde(rename="failedVendorQualityChecks")] - pub failed_vendor_quality_checks: Option, - /// The fragment name. Equivalent to QNAME (query template name) in SAM. - #[serde(rename="fragmentName")] - pub fragment_name: Option, - /// The position of the primary alignment of the (readNumber+1)%numberReads read in the fragment. It replaces mate position and mate strand in SAM. This field will be unset if that read is unmapped or if the fragment only has a single read. - #[serde(rename="nextMatePosition")] - pub next_mate_position: Option, - /// Whether this alignment is supplementary. Equivalent to SAM flag 0x800. Supplementary alignments are used in the representation of a chimeric alignment. In a chimeric alignment, a read is split into multiple linear alignments that map to different reference contigs. The first linear alignment in the read will be designated as the representative alignment; the remaining linear alignments will be designated as supplementary alignments. These alignments may have different mapping quality scores. In each linear alignment in a chimeric alignment, the read will be hard clipped. The alignedSequence and alignedQuality fields in the alignment record will only represent the bases for its respective linear alignment. - #[serde(rename="supplementaryAlignment")] - pub supplementary_alignment: Option, - /// The observed length of the fragment, equivalent to TLEN in SAM. - #[serde(rename="fragmentLength")] - pub fragment_length: Option, - /// The unique ID for this read. This is a generated unique ID, not to be confused with fragmentName. - pub id: Option, - /// The linear alignment for this alignment record. This field will be unset if the read is unmapped. - pub alignment: Option, - /// A map of additional read alignment information. - pub info: Option>>, - /// The fragment is a PCR or optical duplicate (SAM flag 0x400) - #[serde(rename="duplicateFragment")] - pub duplicate_fragment: Option, - /// The quality of the read sequence contained in this alignment record. alignedSequence and alignedQuality may be shorter than the full read sequence and quality. This will occur if the alignment is part of a chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR for this read will begin/end with a hard clip operator that will indicate the length of the excised sequence. - #[serde(rename="alignedQuality")] - pub aligned_quality: Option>, - /// The read number in sequencing. 0-based and less than numberReads. This field replaces SAM flag 0x40 and 0x80. - #[serde(rename="readNumber")] - pub read_number: Option, - /// The orientation and the distance between reads from the fragment are consistent with the sequencing protocol (SAM flag 0x2) - #[serde(rename="properPlacement")] - pub proper_placement: Option, - /// The ID of the read group this read belongs to. (Every read must belong to exactly one read group.) - #[serde(rename="readGroupId")] - pub read_group_id: Option, - /// The number of reads in the fragment (extension to SAM flag 0x1). - #[serde(rename="numberReads")] - pub number_reads: Option, - /// The bases of the read sequence contained in this alignment record, without CIGAR operations applied. alignedSequence and alignedQuality may be shorter than the full read sequence and quality. This will occur if the alignment is part of a chimeric alignment, or if the read was trimmed. When this occurs, the CIGAR for this read will begin/end with a hard clip operator that will indicate the length of the excised sequence. - #[serde(rename="alignedSequence")] - pub aligned_sequence: Option, - /// Whether this alignment is secondary. Equivalent to SAM flag 0x100. A secondary alignment represents an alternative to the primary alignment for this read. Aligners may return secondary alignments if a read can map ambiguously to multiple coordinates in the genome. By convention, each read has one and only one alignment where both secondaryAlignment and supplementaryAlignment are false. - #[serde(rename="secondaryAlignment")] - pub secondary_alignment: Option, -} - -impl Resource for Read {} - - -/// The job creation request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [jobs create experimental](struct.ExperimentalJobCreateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExperimentalCreateJobRequest { - /// A list of Google Cloud Storage URIs of paired end .fastq files to operate upon. If specified, this represents the second file of each paired .fastq file. The first file of each pair should be specified in sourceUris. - #[serde(rename="pairedSourceUris")] - pub paired_source_uris: Option>, - /// A list of Google Cloud Storage URIs of data files to operate upon. These can be .bam, interleaved .fastq, or paired .fastq. If specifying paired .fastq files, the first of each pair of files should be listed here, and the second of each pair should be listed in pairedSourceUris. - #[serde(rename="sourceUris")] - pub source_uris: Option>, - /// Specifies whether or not to run the alignment pipeline. Either align or callVariants must be set. - pub align: Option, - /// Specifies where to copy the results of certain pipelines. This should be in the form of gs://bucket/path. - #[serde(rename="gcsOutputPath")] - pub gcs_output_path: Option, - /// Specifies whether or not to run the variant calling pipeline. Either align or callVariants must be set. - #[serde(rename="callVariants")] - pub call_variants: Option, - /// Required. The Google Cloud Project ID with which to associate the request. - #[serde(rename="projectNumber")] - pub project_number: Option, -} - -impl RequestValue for ExperimentalCreateJobRequest {} - - -/// A variant represents a change in DNA sequence relative to a reference sequence. For example, a variant could represent a SNP or an insertion. Variants belong to a variant set. Each of the calls on a variant represent a determination of genotype with respect to that variant. For example, a call might assign probability of 0.32 to the occurrence of a SNP named rs1234 in a sample named NA12345. A call belongs to a call set, which contains related calls typically from one sample. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get variants](struct.VariantGetCall.html) (response) -/// * [search variants](struct.VariantSearchCall.html) (none) -/// * [update variants](struct.VariantUpdateCall.html) (request|response) -/// * [delete variants](struct.VariantDeleteCall.html) (none) -/// * [create variants](struct.VariantCreateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Variant { - /// A map of additional variant information. - pub info: Option>>, - /// The ID of the variant set this variant belongs to. - #[serde(rename="variantSetId")] - pub variant_set_id: Option, - /// The end position (0-based) of this variant. This corresponds to the first base after the last base in the reference allele. So, the length of the reference allele is (end - start). This is useful for variants that don't explicitly give alternate bases, for example large deletions. - pub end: Option, - /// The variant calls for this particular variant. Each one represents the determination of genotype with respect to this variant. - pub calls: Option>, - /// The date this variant was created, in milliseconds from the epoch. - pub created: Option, - /// The Google generated ID of the variant, immutable. - pub id: Option, - /// A list of filters (normally quality filters) this variant has failed. PASS indicates this variant has passed all filters. - pub filter: Option>, - /// The position at which this variant occurs (0-based). This corresponds to the first base of the string of reference bases. - pub start: Option, - /// Names for the variant, for example a RefSNP ID. - pub names: Option>, - /// The bases that appear instead of the reference bases. - #[serde(rename="alternateBases")] - pub alternate_bases: Option>, - /// The reference on which this variant occurs. (such as chr20 or X) - #[serde(rename="referenceName")] - pub reference_name: Option, - /// A measure of how likely this variant is to be real. A higher value is better. - pub quality: Option, - /// The reference bases for this variant. They start at the given position. - #[serde(rename="referenceBases")] - pub reference_bases: Option, -} - -impl RequestValue for Variant {} -impl Resource for Variant {} -impl ResponseResult for Variant {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search annotation sets](struct.AnnotationSetSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchAnnotationSetsResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The matching annotation sets. - #[serde(rename="annotationSets")] - pub annotation_sets: Option>, -} - -impl ResponseResult for SearchAnnotationSetsResponse {} - - -/// A Job represents an ongoing process that can be monitored for status information. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [cancel jobs](struct.JobCancelCall.html) (none) -/// * [search jobs](struct.JobSearchCall.html) (none) -/// * [get jobs](struct.JobGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Job { - /// A more detailed description of this job's current status. - #[serde(rename="detailedStatus")] - pub detailed_status: Option, - /// The status of this job. - pub status: Option, - /// Any errors that occurred during processing. - pub errors: Option>, - /// Any warnings that occurred during processing. - pub warnings: Option>, - /// The date this job was created, in milliseconds from the epoch. - pub created: Option, - /// A summarized representation of the original service request. - pub request: Option, - /// The job ID. - pub id: Option, - /// If this Job represents an import, this field will contain the IDs of the objects that were successfully imported. - #[serde(rename="importedIds")] - pub imported_ids: Option>, - /// The Google Developers Console project number to which this job belongs. - #[serde(rename="projectNumber")] - pub project_number: Option, -} - -impl Resource for Job {} -impl ResponseResult for Job {} - - -/// The read group set call request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [call readgroupsets](struct.ReadgroupsetCallCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CallReadGroupSetsRequest { - /// A list of URIs pointing at BAM files in Google Cloud Storage which will be called. FASTQ files are not allowed. The caller must have READ permissions for these files. One of readGroupSetId or sourceUris must be provided. - #[serde(rename="sourceUris")] - pub source_uris: Option>, - /// Required. The ID of the dataset the called variants will belong to. The caller must have WRITE permissions to this dataset. - #[serde(rename="datasetId")] - pub dataset_id: Option, - /// The IDs of the read group sets which will be called. The caller must have READ permissions for these read group sets. One of readGroupSetId or sourceUris must be provided. - #[serde(rename="readGroupSetId")] - pub read_group_set_id: Option, -} - -impl RequestValue for CallReadGroupSetsRequest {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [merge variants variantsets](struct.VariantsetMergeVariantCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MergeVariantsRequest { - /// The variants to be merged with existing variants. - pub variants: Option>, -} - -impl RequestValue for MergeVariantsRequest {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [batch create annotations](struct.AnnotationBatchCreateCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchCreateAnnotationsRequest { - /// The annotations to be created. At most 4096 can be specified in a single request. - pub annotations: Option>, -} - -impl RequestValue for BatchCreateAnnotationsRequest {} - - -/// The read group set export request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [export readgroupsets](struct.ReadgroupsetExportCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ExportReadGroupSetsRequest { - /// A Google Cloud Storage URI for the exported BAM file. The currently authenticated user must have write access to the new file. An error will be returned if the URI already contains data. - #[serde(rename="exportUri")] - pub export_uri: Option, - /// The reference names to export. If this is not specified, all reference sequences, including unmapped reads, are exported. Use * to export only unmapped reads. - #[serde(rename="referenceNames")] - pub reference_names: Option>, - /// The IDs of the read group sets to export. - #[serde(rename="readGroupSetIds")] - pub read_group_set_ids: Option>, - /// The Google Developers Console project number that owns this export. - #[serde(rename="projectNumber")] - pub project_number: Option, -} - -impl RequestValue for ExportReadGroupSetsRequest {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search referencesets](struct.ReferencesetSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReferenceSetsResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The matching references sets. - #[serde(rename="referenceSets")] - pub reference_sets: Option>, -} - -impl ResponseResult for SearchReferenceSetsResponse {} - - -/// A reference set is a set of references which typically comprise a reference assembly for a species, such as GRCh38 which is representative of the human genome. A reference set defines a common coordinate space for comparing reference-aligned experimental data. A reference set contains 1 or more references. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get referencesets](struct.ReferencesetGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReferenceSet { - /// Free text description of this reference set. - pub description: Option, - /// The URI from which the references were obtained. - #[serde(rename="sourceURI")] - pub source_uri: Option, - /// The IDs of the reference objects that are part of this set. Reference.md5checksum must be unique within this set. - #[serde(rename="referenceIds")] - pub reference_ids: Option>, - /// Public id of this reference set, such as GRCh37. - #[serde(rename="assemblyId")] - pub assembly_id: Option, - /// All known corresponding accession IDs in INSDC (GenBank/ENA/DDBJ) ideally with a version number, for example NC_000001.11. - #[serde(rename="sourceAccessions")] - pub source_accessions: Option>, - /// ID from http://www.ncbi.nlm.nih.gov/taxonomy (e.g. 9606->human) indicating the species which this assembly is intended to model. Note that contained references may specify a different ncbiTaxonId, as assemblies may contain reference sequences which do not belong to the modeled species, e.g. EBV in a human reference genome. - #[serde(rename="ncbiTaxonId")] - pub ncbi_taxon_id: Option, - /// The Google generated immutable ID of the reference set. - pub id: Option, - /// Order-independent MD5 checksum which identifies this reference set. The checksum is computed by sorting all lower case hexidecimal string reference.md5checksum (for all reference in this set) in ascending lexicographic order, concatenating, and taking the MD5 of that value. The resulting value is represented in lower case hexadecimal format. - pub md5checksum: Option, -} - -impl Resource for ReferenceSet {} -impl ResponseResult for ReferenceSet {} - - -/// A variant set is a collection of call sets and variants. It contains summary statistics of those contents. A variant set belongs to a dataset. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [patch variantsets](struct.VariantsetPatchCall.html) (request|response) -/// * [get variantsets](struct.VariantsetGetCall.html) (response) -/// * [update variantsets](struct.VariantsetUpdateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VariantSet { - /// The metadata associated with this variant set. - pub metadata: Option>, - /// The Google-generated ID of the variant set. Immutable. - pub id: Option, - /// The dataset to which this variant set belongs. Immutable. - #[serde(rename="datasetId")] - pub dataset_id: Option, - /// A list of all references used by the variants in a variant set with associated coordinate upper bounds for each one. - #[serde(rename="referenceBounds")] - pub reference_bounds: Option>, -} - -impl RequestValue for VariantSet {} -impl Resource for VariantSet {} -impl ResponseResult for VariantSet {} - - -/// The read group set align response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [align readgroupsets](struct.ReadgroupsetAlignCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AlignReadGroupSetsResponse { - /// A job ID that can be used to get status information. - #[serde(rename="jobId")] - pub job_id: Option, -} - -impl ResponseResult for AlignReadGroupSetsResponse {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search annotations](struct.AnnotationSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchAnnotationsRequest { - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// If specified, this query matches only annotations that overlap this range. - pub range: Option, - /// The annotation sets to search within. The caller must have READ access to these annotation sets. Required. All queried annotation sets must have the same type. - #[serde(rename="annotationSetIds")] - pub annotation_set_ids: Option>, - /// Specifies number of results to return in a single page. If unspecified, it will default to 256. The maximum value is 2048. - #[serde(rename="pageSize")] - pub page_size: Option, -} - -impl RequestValue for SearchAnnotationsRequest {} - - -/// Describes a paired-end FASTQ file source for alignment. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PairedFastqSource { - /// A list of URIs pointing at paired end FASTQ files in Google Cloud Storage which will be aligned. The second of each paired file should be specified here, in an order that matches the first of each paired file specified in firstSourceUris. For example: firstSourceUris: [file1_1.fq, file2_1.fq], secondSourceUris: [file1_2.fq, file2_2.fq]. The caller must have READ permissions for these files. - #[serde(rename="secondSourceUris")] - pub second_source_uris: Option>, - /// A list of URIs pointing at paired end FASTQ files in Google Cloud Storage which will be aligned. The first of each paired file should be specified here, in an order that matches the second of each paired file specified in secondSourceUris. For example: firstSourceUris: [file1_1.fq, file2_1.fq], secondSourceUris: [file1_2.fq, file2_2.fq]. The caller must have READ permissions for these files. - #[serde(rename="firstSourceUris")] - pub first_source_uris: Option>, - /// Optionally specifies the metadata to be associated with the final aligned read group set. - pub metadata: Option, -} - -impl Part for PairedFastqSource {} - - -/// The read search request. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search reads](struct.ReadSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReadsRequest { - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// The end position of the range on the reference, 0-based exclusive. If specified, referenceName must also be specified. - pub end: Option, - /// The IDs of the read groups within which to search for reads. All specified read groups must belong to the same read group sets. Must specify one of readGroupSetIds or readGroupIds. - #[serde(rename="readGroupIds")] - pub read_group_ids: Option>, - /// Specifies number of results to return in a single page. If unspecified, it will default to 256. The maximum value is 2048. - #[serde(rename="pageSize")] - pub page_size: Option, - /// The start position of the range on the reference, 0-based inclusive. If specified, referenceName must also be specified. - pub start: Option, - /// The IDs of the read groups sets within which to search for reads. All specified read group sets must be aligned against a common set of reference sequences; this defines the genomic coordinates for the query. Must specify one of readGroupSetIds or readGroupIds. - #[serde(rename="readGroupSetIds")] - pub read_group_set_ids: Option>, - /// The reference sequence name, for example chr1, 1, or chrX. If set to *, only unmapped reads are returned. - #[serde(rename="referenceName")] - pub reference_name: Option, -} - -impl RequestValue for SearchReadsRequest {} - - -/// A 0-based half-open genomic coordinate range over a reference sequence. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Range { - /// The start position of the range on the reference, 0-based inclusive. If specified, referenceName must also be specified. - pub start: Option, - /// The end position of the range on the reference, 0-based exclusive. If specified, referenceName must also be specified. - pub end: Option, - /// The reference sequence name, for example chr1, 1, or chrX. - #[serde(rename="referenceName")] - pub reference_name: Option, -} - -impl Part for Range {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search annotation sets](struct.AnnotationSetSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchAnnotationSetsRequest { - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, - /// Only return annotations sets for which a substring of the name matches this string (case insensitive). - pub name: Option, - /// Specifies number of results to return in a single page. If unspecified, it will default to 128. The maximum value is 1024. - #[serde(rename="pageSize")] - pub page_size: Option, - /// The dataset IDs to search within. Caller must have READ access to these datasets. - #[serde(rename="datasetIds")] - pub dataset_ids: Option>, - /// If specified, only annotation sets associated with the given reference set are returned. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// If specified, only annotation sets that have any of these types are returned. - pub types: Option>, -} - -impl RequestValue for SearchAnnotationSetsRequest {} - - -/// The read search response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search reads](struct.ReadSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReadsResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching alignments sorted by mapped genomic coordinate, if any, ascending in position within the same reference. Unmapped reads, which have no position, are returned last and are further sorted in ascending lexicographic order by fragment name. - pub alignments: Option>, -} - -impl ResponseResult for SearchReadsResponse {} - - -/// Describes an interleaved FASTQ file source for alignment. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InterleavedFastqSource { - /// A list of URIs pointing at interleaved FASTQ files in Google Cloud Storage which will be aligned. The caller must have READ permissions for these files. - #[serde(rename="sourceUris")] - pub source_uris: Option>, - /// Optionally specifies the metadata to be associated with the final aligned read group set. - pub metadata: Option, -} - -impl Part for InterleavedFastqSource {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [streamreads streaming readstore](struct.StreamingReadstoreStreamreadCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StreamReadsResponse { - /// no description provided - pub alignments: Option>, -} - -impl ResponseResult for StreamReadsResponse {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search references](struct.ReferenceSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReferencesResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The matching references. - pub references: Option>, -} - -impl ResponseResult for SearchReferencesResponse {} - - -/// A read group set is a logical collection of read groups, which are collections of reads produced by a sequencer. A read group set typically models reads corresponding to one sample, sequenced one way, and aligned one way. -/// - A read group set belongs to one dataset. -/// - A read group belongs to one read group set. -/// - A read belongs to one read group. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [get readgroupsets](struct.ReadgroupsetGetCall.html) (response) -/// * [patch readgroupsets](struct.ReadgroupsetPatchCall.html) (request|response) -/// * [update readgroupsets](struct.ReadgroupsetUpdateCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReadGroupSet { - /// A map of additional read group set information. - pub info: Option>>, - /// The dataset ID. - #[serde(rename="datasetId")] - pub dataset_id: Option, - /// The read group set name. By default this will be initialized to the sample name of the sequenced data contained in this set. - pub name: Option, - /// The reference set the reads in this read group set are aligned to. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// The read group set ID. - pub id: Option, - /// The read groups in this set. There are typically 1-10 read groups in a read group set. - #[serde(rename="readGroups")] - pub read_groups: Option>, - /// The filename of the original source file for this read group set, if any. - pub filename: Option, -} - -impl RequestValue for ReadGroupSet {} -impl Resource for ReadGroupSet {} -impl ResponseResult for ReadGroupSet {} - - -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [streamreads streaming readstore](struct.StreamingReadstoreStreamreadCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StreamReadsRequest { - /// The end position of the range on the reference, 0-based exclusive. If specified, referenceName must also be specified. - pub end: Option, - /// The reference sequence name, for example chr1, 1, or chrX. If set to *, only unmapped reads are returned. - #[serde(rename="referenceName")] - pub reference_name: Option, - /// The ID of the read groups set within which to search for reads. Exactly one ID must be provided. - #[serde(rename="readGroupSetIds")] - pub read_group_set_ids: Option>, - /// The start position of the range on the reference, 0-based inclusive. If specified, referenceName must also be specified. - pub start: Option, -} - -impl RequestValue for StreamReadsRequest {} - - -/// A 0-based half-open genomic coordinate range for search requests. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct QueryRange { - /// The start position of the range on the reference, 0-based inclusive. If specified, referenceId or referenceName must also be specified. Defaults to 0. - pub start: Option, - /// The ID of the reference to query. At most one of referenceId and referenceName should be specified. - #[serde(rename="referenceId")] - pub reference_id: Option, - /// The end position of the range on the reference, 0-based exclusive. If specified, referenceId or referenceName must also be specified. If unset or 0, defaults to the length of the reference. - pub end: Option, - /// The name of the reference to query, within the reference set associated with this query. At most one of referenceId and referenceName pshould be specified. - #[serde(rename="referenceName")] - pub reference_name: Option, -} - -impl Part for QueryRange {} - - -/// A linear alignment can be represented by one CIGAR string. Describes the mapped position and local alignment of the read to the reference. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LinearAlignment { - /// The position of this alignment. - pub position: Option, - /// Represents the local alignment of this sequence (alignment matches, indels, etc) against the reference. - pub cigar: Option>, - /// The mapping quality of this alignment. Represents how likely the read maps to this position as opposed to other locations. - #[serde(rename="mappingQuality")] - pub mapping_quality: Option, -} - -impl Part for LinearAlignment {} - - -/// An annotation set is a logical grouping of annotations that share consistent type information and provenance. Examples of annotation sets include 'all genes from refseq', and 'all variant annotations from ClinVar'. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [update annotation sets](struct.AnnotationSetUpdateCall.html) (request|response) -/// * [create annotation sets](struct.AnnotationSetCreateCall.html) (request|response) -/// * [patch annotation sets](struct.AnnotationSetPatchCall.html) (request|response) -/// * [search annotation sets](struct.AnnotationSetSearchCall.html) (none) -/// * [delete annotation sets](struct.AnnotationSetDeleteCall.html) (none) -/// * [get annotation sets](struct.AnnotationSetGetCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AnnotationSet { - /// A map of additional data for this annotation set. - pub info: Option>>, - /// The display name for this annotation set. - pub name: Option, - /// The source URI describing the file from which this annotation set was generated, if any. - #[serde(rename="sourceUri")] - pub source_uri: Option, - /// The type of annotations contained within this set. - #[serde(rename="type")] - pub type_: Option, - /// The ID of the reference set that defines the coordinate space for this set's annotations. - #[serde(rename="referenceSetId")] - pub reference_set_id: Option, - /// The generated unique ID for this annotation set. - pub id: Option, - /// The ID of the containing dataset. - #[serde(rename="datasetId")] - pub dataset_id: Option, -} - -impl RequestValue for AnnotationSet {} -impl Resource for AnnotationSet {} -impl ResponseResult for AnnotationSet {} - - -/// A single CIGAR operation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CigarUnit { - /// referenceSequence is only used at mismatches (SEQUENCE_MISMATCH) and deletions (DELETE). Filling this field replaces SAM's MD tag. If the relevant information is not available, this field is unset. - #[serde(rename="referenceSequence")] - pub reference_sequence: Option, - /// no description provided - pub operation: Option, - /// The number of bases that the operation runs for. Required. - #[serde(rename="operationLength")] - pub operation_length: Option, -} - -impl Part for CigarUnit {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TranscriptCodingSequence { - /// The start of the coding sequence on this annotation's reference sequence, 0-based inclusive. Note that this position is relative to the reference start, and not the containing annotation start. - pub start: Option, - /// The end of the coding sequence on this annotation's reference sequence, 0-based exclusive. Note that this position is relative to the reference start, and not the containing annotation start. - pub end: Option, -} - -impl Part for TranscriptCodingSequence {} - - -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TranscriptExon { - /// The start position of the exon on this annotation's reference sequence, 0-based inclusive. Note that this is relative to the reference start, and not the containing annotation start. - pub start: Option, - /// The frame of this exon. Contains a value of 0, 1, or 2, which indicates the offset of the first coding base of the exon within the reading frame of the coding DNA sequence, if any. This field is dependent on the strandedness of this annotation (see Annotation.position.reverseStrand). For forward stranded annotations, this offset is relative to the exon.start. For reverse strand annotations, this offset is relative to the exon.end-1. - /// - /// Unset if this exon does not intersect the coding sequence. Upon creation of a transcript, the frame must be populated for all or none of the coding exons. - pub frame: Option, - /// The end position of the exon on this annotation's reference sequence, 0-based exclusive. Note that this is relative to the reference start, and not the containing annotation start. - pub end: Option, -} - -impl Part for TranscriptExon {} - - -/// The search variant sets response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search variantsets](struct.VariantsetSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchVariantSetsResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The variant sets belonging to the requested dataset. - #[serde(rename="variantSets")] - pub variant_sets: Option>, -} - -impl ResponseResult for SearchVariantSetsResponse {} - - -/// A bucket over which read coverage has been precomputed. A bucket corresponds to a specific range of the reference sequence. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CoverageBucket { - /// The average number of reads which are aligned to each individual reference base in this bucket. - #[serde(rename="meanCoverage")] - pub mean_coverage: Option, - /// The genomic coordinate range spanned by this bucket. - pub range: Option, -} - -impl Part for CoverageBucket {} - - -/// The call set search response. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search callsets](struct.CallsetSearchCall.html) (response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchCallSetsResponse { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. This field will be empty if there aren't any additional results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// The list of matching call sets. - #[serde(rename="callSets")] - pub call_sets: Option>, -} - -impl ResponseResult for SearchCallSetsResponse {} - - -/// -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [search referencesets](struct.ReferencesetSearchCall.html) (request) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SearchReferenceSetsRequest { - /// If present, return references for which the md5checksum matches. See ReferenceSet.md5checksum for details. - pub md5checksums: Option>, - /// If present, return reference sets for which a substring of their assemblyId matches this string (case insensitive). - #[serde(rename="assemblyId")] - pub assembly_id: Option, - /// If present, return references for which the accession matches any of these strings. Best to give a version number, for example GCF_000001405.26. If only the main accession number is given then all records with that main accession will be returned, whichever version. Note that different versions will have different sequences. - pub accessions: Option>, - /// Specifies the maximum number of results to return in a single page. - #[serde(rename="pageSize")] - pub page_size: Option, - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - #[serde(rename="pageToken")] - pub page_token: Option, -} - -impl RequestValue for SearchReferenceSetsRequest {} - - - -// ################### -// MethodBuilders ### -// ################# - -/// A builder providing access to all methods supported on *dataset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `patch(...)`, `undelete(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.datasets(); -/// # } -/// ``` -pub struct DatasetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for DatasetMethods<'a, C, A> {} - -impl<'a, C, A> DatasetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Updates a dataset. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `datasetId` - The ID of the dataset to be updated. - pub fn update(&self, request: Dataset, dataset_id: &str) -> DatasetUpdateCall<'a, C, A> { - DatasetUpdateCall { - hub: self.hub, - _request: request, - _dataset_id: dataset_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new dataset. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: Dataset) -> DatasetCreateCall<'a, C, A> { - DatasetCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a dataset. - /// - /// # Arguments - /// - /// * `datasetId` - The ID of the dataset to be deleted. - pub fn delete(&self, dataset_id: &str) -> DatasetDeleteCall<'a, C, A> { - DatasetDeleteCall { - hub: self.hub, - _dataset_id: dataset_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Undeletes a dataset by restoring a dataset which was deleted via this API. This operation is only possible for a week after the deletion occurred. - /// - /// # Arguments - /// - /// * `datasetId` - The ID of the dataset to be undeleted. - pub fn undelete(&self, dataset_id: &str) -> DatasetUndeleteCall<'a, C, A> { - DatasetUndeleteCall { - hub: self.hub, - _dataset_id: dataset_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a dataset by ID. - /// - /// # Arguments - /// - /// * `datasetId` - The ID of the dataset. - pub fn get(&self, dataset_id: &str) -> DatasetGetCall<'a, C, A> { - DatasetGetCall { - hub: self.hub, - _dataset_id: dataset_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists datasets within a project. - pub fn list(&self) -> DatasetListCall<'a, C, A> { - DatasetListCall { - hub: self.hub, - _project_number: Default::default(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a dataset. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `datasetId` - The ID of the dataset to be updated. - pub fn patch(&self, request: Dataset, dataset_id: &str) -> DatasetPatchCall<'a, C, A> { - DatasetPatchCall { - hub: self.hub, - _request: request, - _dataset_id: dataset_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *job* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `cancel(...)`, `get(...)` and `search(...)` -/// // to build up your call. -/// let rb = hub.jobs(); -/// # } -/// ``` -pub struct JobMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for JobMethods<'a, C, A> {} - -impl<'a, C, A> JobMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Cancels a job by ID. Note that it is possible for partial results to be generated and stored for cancelled jobs. - /// - /// # Arguments - /// - /// * `jobId` - Required. The ID of the job. - pub fn cancel(&self, job_id: &str) -> JobCancelCall<'a, C, A> { - JobCancelCall { - hub: self.hub, - _job_id: job_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a job by ID. - /// - /// # Arguments - /// - /// * `jobId` - Required. The ID of the job. - pub fn get(&self, job_id: &str) -> JobGetCall<'a, C, A> { - JobGetCall { - hub: self.hub, - _job_id: job_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a list of jobs matching the criteria. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchJobsRequest) -> JobSearchCall<'a, C, A> { - JobSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *referenceset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `get(...)` and `search(...)` -/// // to build up your call. -/// let rb = hub.referencesets(); -/// # } -/// ``` -pub struct ReferencesetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for ReferencesetMethods<'a, C, A> {} - -impl<'a, C, A> ReferencesetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Searches for reference sets which match the given criteria. - /// - /// Implements GlobalAllianceApi.searchReferenceSets. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchReferenceSetsRequest) -> ReferencesetSearchCall<'a, C, A> { - ReferencesetSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a reference set. - /// - /// Implements GlobalAllianceApi.getReferenceSet. - /// - /// # Arguments - /// - /// * `referenceSetId` - The ID of the reference set. - pub fn get(&self, reference_set_id: &str) -> ReferencesetGetCall<'a, C, A> { - ReferencesetGetCall { - hub: self.hub, - _reference_set_id: reference_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *callset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `delete(...)`, `get(...)`, `patch(...)`, `search(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.callsets(); -/// # } -/// ``` -pub struct CallsetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for CallsetMethods<'a, C, A> {} - -impl<'a, C, A> CallsetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Deletes a call set. - /// - /// # Arguments - /// - /// * `callSetId` - The ID of the call set to be deleted. - pub fn delete(&self, call_set_id: &str) -> CallsetDeleteCall<'a, C, A> { - CallsetDeleteCall { - hub: self.hub, - _call_set_id: call_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a list of call sets matching the criteria. - /// - /// Implements GlobalAllianceApi.searchCallSets. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchCallSetsRequest) -> CallsetSearchCall<'a, C, A> { - CallsetSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a call set. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `callSetId` - The ID of the call set to be updated. - pub fn patch(&self, request: CallSet, call_set_id: &str) -> CallsetPatchCall<'a, C, A> { - CallsetPatchCall { - hub: self.hub, - _request: request, - _call_set_id: call_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new call set. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: CallSet) -> CallsetCreateCall<'a, C, A> { - CallsetCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a call set by ID. - /// - /// # Arguments - /// - /// * `callSetId` - The ID of the call set. - pub fn get(&self, call_set_id: &str) -> CallsetGetCall<'a, C, A> { - CallsetGetCall { - hub: self.hub, - _call_set_id: call_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a call set. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `callSetId` - The ID of the call set to be updated. - pub fn update(&self, request: CallSet, call_set_id: &str) -> CallsetUpdateCall<'a, C, A> { - CallsetUpdateCall { - hub: self.hub, - _request: request, - _call_set_id: call_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *streamingReadstore* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `streamreads(...)` -/// // to build up your call. -/// let rb = hub.streaming_readstore(); -/// # } -/// ``` -pub struct StreamingReadstoreMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for StreamingReadstoreMethods<'a, C, A> {} - -impl<'a, C, A> StreamingReadstoreMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Gets a stream of reads for one or more read group sets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. - /// - /// If a target positional range is specified, all reads whose alignment to the reference genome overlap the range are returned. - /// - /// All reads returned are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn streamreads(&self, request: StreamReadsRequest) -> StreamingReadstoreStreamreadCall<'a, C, A> { - StreamingReadstoreStreamreadCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *read* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `search(...)` -/// // to build up your call. -/// let rb = hub.reads(); -/// # } -/// ``` -pub struct ReadMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for ReadMethods<'a, C, A> {} - -impl<'a, C, A> ReadMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Gets a list of reads for one or more read group sets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. - /// - /// If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only read group set IDs yields all reads in those read group sets, including unmapped reads. - /// - /// All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order. - /// - /// Implements GlobalAllianceApi.searchReads. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchReadsRequest) -> ReadSearchCall<'a, C, A> { - ReadSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *readgroupset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `align(...)`, `call(...)`, `coveragebuckets_list(...)`, `delete(...)`, `export(...)`, `get(...)`, `import(...)`, `patch(...)`, `search(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.readgroupsets(); -/// # } -/// ``` -pub struct ReadgroupsetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for ReadgroupsetMethods<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Exports read group sets to a BAM file in Google Cloud Storage. - /// - /// Note that currently there may be some differences between exported BAM files and the original BAM file at the time of import. In particular, comments in the input file header will not be preserved, some custom tags will be converted to strings, and original reference sequence order is not necessarily preserved. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn export(&self, request: ExportReadGroupSetsRequest) -> ReadgroupsetExportCall<'a, C, A> { - ReadgroupsetExportCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a read group set. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `readGroupSetId` - The ID of the read group set to be updated. The caller must have WRITE permissions to the dataset associated with this read group set. - pub fn patch(&self, request: ReadGroupSet, read_group_set_id: &str) -> ReadgroupsetPatchCall<'a, C, A> { - ReadgroupsetPatchCall { - hub: self.hub, - _request: request, - _read_group_set_id: read_group_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Calls variants on read data from existing read group sets or files from Google Cloud Storage. See the alignment and variant calling documentation for more details. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn call(&self, request: CallReadGroupSetsRequest) -> ReadgroupsetCallCall<'a, C, A> { - ReadgroupsetCallCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates read group sets by asynchronously importing the provided information. - /// - /// Note that currently comments in the input file header are not imported and some custom tags will be converted to strings, rather than preserving tag types. The caller must have WRITE permissions to the dataset. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn import(&self, request: ImportReadGroupSetsRequest) -> ReadgroupsetImportCall<'a, C, A> { - ReadgroupsetImportCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Aligns read data from existing read group sets or files from Google Cloud Storage. See the alignment and variant calling documentation for more details. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn align(&self, request: AlignReadGroupSetsRequest) -> ReadgroupsetAlignCall<'a, C, A> { - ReadgroupsetAlignCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a read group set by ID. - /// - /// # Arguments - /// - /// * `readGroupSetId` - The ID of the read group set. - pub fn get(&self, read_group_set_id: &str) -> ReadgroupsetGetCall<'a, C, A> { - ReadgroupsetGetCall { - hub: self.hub, - _read_group_set_id: read_group_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a read group set. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `readGroupSetId` - The ID of the read group set to be updated. The caller must have WRITE permissions to the dataset associated with this read group set. - pub fn update(&self, request: ReadGroupSet, read_group_set_id: &str) -> ReadgroupsetUpdateCall<'a, C, A> { - ReadgroupsetUpdateCall { - hub: self.hub, - _request: request, - _read_group_set_id: read_group_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Lists fixed width coverage buckets for a read group set, each of which correspond to a range of a reference sequence. Each bucket summarizes coverage information across its corresponding genomic range. - /// - /// Coverage is defined as the number of reads which are aligned to a given base in the reference sequence. Coverage buckets are available at several precomputed bucket widths, enabling retrieval of various coverage 'zoom levels'. The caller must have READ permissions for the target read group set. - /// - /// # Arguments - /// - /// * `readGroupSetId` - Required. The ID of the read group set over which coverage is requested. - pub fn coveragebuckets_list(&self, read_group_set_id: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - ReadgroupsetCoveragebucketListCall { - hub: self.hub, - _read_group_set_id: read_group_set_id.to_string(), - _target_bucket_width: Default::default(), - _range_start: Default::default(), - _range_reference_name: Default::default(), - _range_end: Default::default(), - _page_token: Default::default(), - _page_size: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a read group set. - /// - /// # Arguments - /// - /// * `readGroupSetId` - The ID of the read group set to be deleted. The caller must have WRITE permissions to the dataset associated with this read group set. - pub fn delete(&self, read_group_set_id: &str) -> ReadgroupsetDeleteCall<'a, C, A> { - ReadgroupsetDeleteCall { - hub: self.hub, - _read_group_set_id: read_group_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Searches for read group sets matching the criteria. - /// - /// Implements GlobalAllianceApi.searchReadGroupSets. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchReadGroupSetsRequest) -> ReadgroupsetSearchCall<'a, C, A> { - ReadgroupsetSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *reference* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `bases_list(...)`, `get(...)` and `search(...)` -/// // to build up your call. -/// let rb = hub.references(); -/// # } -/// ``` -pub struct ReferenceMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for ReferenceMethods<'a, C, A> {} - -impl<'a, C, A> ReferenceMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Lists the bases in a reference, optionally restricted to a range. - /// - /// Implements GlobalAllianceApi.getReferenceBases. - /// - /// # Arguments - /// - /// * `referenceId` - The ID of the reference. - pub fn bases_list(&self, reference_id: &str) -> ReferenceBaseListCall<'a, C, A> { - ReferenceBaseListCall { - hub: self.hub, - _reference_id: reference_id.to_string(), - _start: Default::default(), - _page_token: Default::default(), - _page_size: Default::default(), - _end: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Searches for references which match the given criteria. - /// - /// Implements GlobalAllianceApi.searchReferences. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchReferencesRequest) -> ReferenceSearchCall<'a, C, A> { - ReferenceSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a reference. - /// - /// Implements GlobalAllianceApi.getReference. - /// - /// # Arguments - /// - /// * `referenceId` - The ID of the reference. - pub fn get(&self, reference_id: &str) -> ReferenceGetCall<'a, C, A> { - ReferenceGetCall { - hub: self.hub, - _reference_id: reference_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *annotationSet* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `delete(...)`, `get(...)`, `patch(...)`, `search(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.annotation_sets(); -/// # } -/// ``` -pub struct AnnotationSetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for AnnotationSetMethods<'a, C, A> {} - -impl<'a, C, A> AnnotationSetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Gets an annotation set. Caller must have READ permission for the associated dataset. - /// - /// # Arguments - /// - /// * `annotationSetId` - The ID of the annotation set to be retrieved. - pub fn get(&self, annotation_set_id: &str) -> AnnotationSetGetCall<'a, C, A> { - AnnotationSetGetCall { - hub: self.hub, - _annotation_set_id: annotation_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates an annotation set. The update must respect all mutability restrictions and other invariants described on the annotation set resource. Caller must have WRITE permission for the associated dataset. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `annotationSetId` - The ID of the annotation set to be updated. - pub fn update(&self, request: AnnotationSet, annotation_set_id: &str) -> AnnotationSetUpdateCall<'a, C, A> { - AnnotationSetUpdateCall { - hub: self.hub, - _request: request, - _annotation_set_id: annotation_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new annotation set. Caller must have WRITE permission for the associated dataset. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: AnnotationSet) -> AnnotationSetCreateCall<'a, C, A> { - AnnotationSetCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Searches for annotation sets that match the given criteria. Results are returned in a deterministic order. Caller must have READ permission for the queried datasets. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchAnnotationSetsRequest) -> AnnotationSetSearchCall<'a, C, A> { - AnnotationSetSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates an annotation set. The update must respect all mutability restrictions and other invariants described on the annotation set resource. Caller must have WRITE permission for the associated dataset. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `annotationSetId` - The ID of the annotation set to be updated. - pub fn patch(&self, request: AnnotationSet, annotation_set_id: &str) -> AnnotationSetPatchCall<'a, C, A> { - AnnotationSetPatchCall { - hub: self.hub, - _request: request, - _annotation_set_id: annotation_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes an annotation set. Caller must have WRITE permission for the associated annotation set. - /// - /// # Arguments - /// - /// * `annotationSetId` - The ID of the annotation set to be deleted. - pub fn delete(&self, annotation_set_id: &str) -> AnnotationSetDeleteCall<'a, C, A> { - AnnotationSetDeleteCall { - hub: self.hub, - _annotation_set_id: annotation_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *variant* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create(...)`, `delete(...)`, `get(...)`, `search(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.variants(); -/// # } -/// ``` -pub struct VariantMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for VariantMethods<'a, C, A> {} - -impl<'a, C, A> VariantMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Gets a list of variants matching the criteria. - /// - /// Implements GlobalAllianceApi.searchVariants. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchVariantsRequest) -> VariantSearchCall<'a, C, A> { - VariantSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a variant. - /// - /// # Arguments - /// - /// * `variantId` - The ID of the variant to be deleted. - pub fn delete(&self, variant_id: &str) -> VariantDeleteCall<'a, C, A> { - VariantDeleteCall { - hub: self.hub, - _variant_id: variant_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a variant by ID. - /// - /// # Arguments - /// - /// * `variantId` - The ID of the variant. - pub fn get(&self, variant_id: &str) -> VariantGetCall<'a, C, A> { - VariantGetCall { - hub: self.hub, - _variant_id: variant_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new variant. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: Variant) -> VariantCreateCall<'a, C, A> { - VariantCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a variant's names and info fields. All other modifications are silently ignored. Returns the modified variant without its calls. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `variantId` - The ID of the variant to be updated. - pub fn update(&self, request: Variant, variant_id: &str) -> VariantUpdateCall<'a, C, A> { - VariantUpdateCall { - hub: self.hub, - _request: request, - _variant_id: variant_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *annotation* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `batch_create(...)`, `create(...)`, `delete(...)`, `get(...)`, `patch(...)`, `search(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.annotations(); -/// # } -/// ``` -pub struct AnnotationMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for AnnotationMethods<'a, C, A> {} - -impl<'a, C, A> AnnotationMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Updates an annotation. The update must respect all mutability restrictions and other invariants described on the annotation resource. Caller must have WRITE permission for the associated dataset. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `annotationId` - The ID of the annotation set to be updated. - pub fn update(&self, request: Annotation, annotation_id: &str) -> AnnotationUpdateCall<'a, C, A> { - AnnotationUpdateCall { - hub: self.hub, - _request: request, - _annotation_id: annotation_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets an annotation. Caller must have READ permission for the associated annotation set. - /// - /// # Arguments - /// - /// * `annotationId` - The ID of the annotation set to be retrieved. - pub fn get(&self, annotation_id: &str) -> AnnotationGetCall<'a, C, A> { - AnnotationGetCall { - hub: self.hub, - _annotation_id: annotation_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Searches for annotations that match the given criteria. Results are returned ordered by start position. Annotations that have matching start positions are ordered deterministically. Caller must have READ permission for the queried annotation sets. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchAnnotationsRequest) -> AnnotationSearchCall<'a, C, A> { - AnnotationSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes an annotation. Caller must have WRITE permission for the associated annotation set. - /// - /// # Arguments - /// - /// * `annotationId` - The ID of the annotation set to be deleted. - pub fn delete(&self, annotation_id: &str) -> AnnotationDeleteCall<'a, C, A> { - AnnotationDeleteCall { - hub: self.hub, - _annotation_id: annotation_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates an annotation. The update must respect all mutability restrictions and other invariants described on the annotation resource. Caller must have WRITE permission for the associated dataset. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `annotationId` - The ID of the annotation set to be updated. - pub fn patch(&self, request: Annotation, annotation_id: &str) -> AnnotationPatchCall<'a, C, A> { - AnnotationPatchCall { - hub: self.hub, - _request: request, - _annotation_id: annotation_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new annotation. Caller must have WRITE permission for the associated annotation set. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn create(&self, request: Annotation) -> AnnotationCreateCall<'a, C, A> { - AnnotationCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates one or more new annotations atomically. All annotations must belong to the same annotation set. Caller must have WRITE permission for this annotation set. For optimal performance, batch positionally adjacent annotations together. - /// - /// - /// If the request has a systemic issue, such as an attempt to write to an inaccessible annotation set, the entire RPC will fail accordingly. For lesser data issues, when possible an error will be isolated to the corresponding batch entry in the response; the remaining well formed annotations will be created normally. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn batch_create(&self, request: BatchCreateAnnotationsRequest) -> AnnotationBatchCreateCall<'a, C, A> { - AnnotationBatchCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *experimental* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `jobs_create(...)` -/// // to build up your call. -/// let rb = hub.experimental(); -/// # } -/// ``` -pub struct ExperimentalMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for ExperimentalMethods<'a, C, A> {} - -impl<'a, C, A> ExperimentalMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Creates and asynchronously runs an ad-hoc job. This is an experimental call and may be removed or changed at any time. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn jobs_create(&self, request: ExperimentalCreateJobRequest) -> ExperimentalJobCreateCall<'a, C, A> { - ExperimentalJobCreateCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *variantset* resources. -/// It is not used directly, but through the `Genomics` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_genomics1_beta2 as genomics1_beta2; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use genomics1_beta2::Genomics; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Genomics::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `export(...)`, `get(...)`, `import_variants(...)`, `merge_variants(...)`, `patch(...)`, `search(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.variantsets(); -/// # } -/// ``` -pub struct VariantsetMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, -} - -impl<'a, C, A> MethodsBuilder for VariantsetMethods<'a, C, A> {} - -impl<'a, C, A> VariantsetMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Updates a variant set's metadata. All other modifications are silently ignored. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `variantSetId` - The ID of the variant to be updated. - pub fn update(&self, request: VariantSet, variant_set_id: &str) -> VariantsetUpdateCall<'a, C, A> { - VariantsetUpdateCall { - hub: self.hub, - _request: request, - _variant_set_id: variant_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Exports variant set data to an external destination. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `variantSetId` - Required. The ID of the variant set that contains variant data which should be exported. The caller must have READ access to this variant set. - pub fn export(&self, request: ExportVariantSetRequest, variant_set_id: &str) -> VariantsetExportCall<'a, C, A> { - VariantsetExportCall { - hub: self.hub, - _request: request, - _variant_set_id: variant_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a variant set's metadata. All other modifications are silently ignored. This method supports patch semantics. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `variantSetId` - The ID of the variant to be updated. - pub fn patch(&self, request: VariantSet, variant_set_id: &str) -> VariantsetPatchCall<'a, C, A> { - VariantsetPatchCall { - hub: self.hub, - _request: request, - _variant_set_id: variant_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns a list of all variant sets matching search criteria. - /// - /// Implements GlobalAllianceApi.searchVariantSets. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn search(&self, request: SearchVariantSetsRequest) -> VariantsetSearchCall<'a, C, A> { - VariantsetSearchCall { - hub: self.hub, - _request: request, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Gets a variant set by ID. - /// - /// # Arguments - /// - /// * `variantSetId` - Required. The ID of the variant set. - pub fn get(&self, variant_set_id: &str) -> VariantsetGetCall<'a, C, A> { - VariantsetGetCall { - hub: self.hub, - _variant_set_id: variant_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Merges the given variants with existing variants. Each variant will be merged with an existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created. - /// - /// When variants are merged, the call information from the new variant is added to the existing variant, and other fields (such as key/value pairs) are discarded. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `variantSetId` - The destination variant set. - pub fn merge_variants(&self, request: MergeVariantsRequest, variant_set_id: &str) -> VariantsetMergeVariantCall<'a, C, A> { - VariantsetMergeVariantCall { - hub: self.hub, - _request: request, - _variant_set_id: variant_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes the contents of a variant set. The variant set object is not deleted. - /// - /// # Arguments - /// - /// * `variantSetId` - The ID of the variant set to be deleted. - pub fn delete(&self, variant_set_id: &str) -> VariantsetDeleteCall<'a, C, A> { - VariantsetDeleteCall { - hub: self.hub, - _variant_set_id: variant_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates variant data by asynchronously importing the provided information. - /// - /// The variants for import will be merged with any existing data and each other according to the behavior of mergeVariants. In particular, this means for merged VCF variants that have conflicting INFO fields, some data will be arbitrarily discarded. As a special case, for single-sample VCF files, QUAL and FILTER fields will be moved to the call level; these are sometimes interpreted in a call-specific context. Imported VCF headers are appended to the metadata already in a variant set. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `variantSetId` - Required. The variant set to which variant data should be imported. - pub fn import_variants(&self, request: ImportVariantsRequest, variant_set_id: &str) -> VariantsetImportVariantCall<'a, C, A> { - VariantsetImportVariantCall { - hub: self.hub, - _request: request, - _variant_set_id: variant_set_id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - - - -// ################### -// CallBuilders ### -// ################# - -/// Updates a dataset. -/// -/// A builder for the *update* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::Dataset; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = Dataset::default(); -/// -/// // 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 ! -/// let result = hub.datasets().update(req, "datasetId") -/// .doit(); -/// # } -/// ``` -pub struct DatasetUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Dataset, - _dataset_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetUpdateCall<'a, C, A> {} - -impl<'a, C, A> DatasetUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("datasetId", self._dataset_id.to_string())); - for &field in ["alt", "datasetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/datasets/{datasetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{datasetId}", "datasetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["datasetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Dataset) -> DatasetUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the dataset to be updated. - /// - /// Sets the *dataset id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn dataset_id(mut self, new_value: &str) -> DatasetUpdateCall<'a, C, A> { - self._dataset_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DatasetUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DatasetUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DatasetUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a new dataset. -/// -/// A builder for the *create* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::Dataset; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = Dataset::default(); -/// -/// // 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 ! -/// let result = hub.datasets().create(req) -/// .doit(); -/// # } -/// ``` -pub struct DatasetCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Dataset, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetCreateCall<'a, C, A> {} - -impl<'a, C, A> DatasetCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/datasets".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Dataset) -> DatasetCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DatasetCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DatasetCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DatasetCreateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a dataset. -/// -/// A builder for the *delete* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.datasets().delete("datasetId") -/// .doit(); -/// # } -/// ``` -pub struct DatasetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _dataset_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetDeleteCall<'a, C, A> {} - -impl<'a, C, A> DatasetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("datasetId", self._dataset_id.to_string())); - for &field in ["datasetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/genomics/v1beta2/datasets/{datasetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{datasetId}", "datasetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["datasetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the dataset to be deleted. - /// - /// Sets the *dataset id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn dataset_id(mut self, new_value: &str) -> DatasetDeleteCall<'a, C, A> { - self._dataset_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DatasetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DatasetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DatasetDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Undeletes a dataset by restoring a dataset which was deleted via this API. This operation is only possible for a week after the deletion occurred. -/// -/// A builder for the *undelete* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.datasets().undelete("datasetId") -/// .doit(); -/// # } -/// ``` -pub struct DatasetUndeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _dataset_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetUndeleteCall<'a, C, A> {} - -impl<'a, C, A> DatasetUndeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.undelete", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("datasetId", self._dataset_id.to_string())); - for &field in ["alt", "datasetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/datasets/{datasetId}/undelete".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{datasetId}", "datasetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["datasetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the dataset to be undeleted. - /// - /// Sets the *dataset id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn dataset_id(mut self, new_value: &str) -> DatasetUndeleteCall<'a, C, A> { - self._dataset_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DatasetUndeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DatasetUndeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DatasetUndeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a dataset by ID. -/// -/// A builder for the *get* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.datasets().get("datasetId") -/// .doit(); -/// # } -/// ``` -pub struct DatasetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _dataset_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetGetCall<'a, C, A> {} - -impl<'a, C, A> DatasetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("datasetId", self._dataset_id.to_string())); - for &field in ["alt", "datasetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/datasets/{datasetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{datasetId}", "datasetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["datasetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the dataset. - /// - /// Sets the *dataset id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn dataset_id(mut self, new_value: &str) -> DatasetGetCall<'a, C, A> { - self._dataset_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DatasetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DatasetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DatasetGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Lists datasets within a project. -/// -/// A builder for the *list* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.datasets().list() -/// .project_number("kasd") -/// .page_token("accusam") -/// .page_size(-8) -/// .doit(); -/// # } -/// ``` -pub struct DatasetListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _project_number: Option, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetListCall<'a, C, A> {} - -impl<'a, C, A> DatasetListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListDatasetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - if let Some(value) = self._project_number { - params.push(("projectNumber", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "projectNumber", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/datasets".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The project to list datasets for. - /// - /// Sets the *project number* query property to the given value. - pub fn project_number(mut self, new_value: &str) -> DatasetListCall<'a, C, A> { - self._project_number = Some(new_value.to_string()); - self - } - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> DatasetListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// The maximum number of results returned by this request. If unspecified, defaults to 50. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> DatasetListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DatasetListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DatasetListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DatasetListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a dataset. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *dataset* resource. -/// It is not used directly, but through a `DatasetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::Dataset; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = Dataset::default(); -/// -/// // 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 ! -/// let result = hub.datasets().patch(req, "datasetId") -/// .doit(); -/// # } -/// ``` -pub struct DatasetPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Dataset, - _dataset_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for DatasetPatchCall<'a, C, A> {} - -impl<'a, C, A> DatasetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Dataset)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.datasets.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("datasetId", self._dataset_id.to_string())); - for &field in ["alt", "datasetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/datasets/{datasetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{datasetId}", "datasetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["datasetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Dataset) -> DatasetPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the dataset to be updated. - /// - /// Sets the *dataset id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn dataset_id(mut self, new_value: &str) -> DatasetPatchCall<'a, C, A> { - self._dataset_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> DatasetPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> DatasetPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> DatasetPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Cancels a job by ID. Note that it is possible for partial results to be generated and stored for cancelled jobs. -/// -/// A builder for the *cancel* method supported by a *job* resource. -/// It is not used directly, but through a `JobMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.jobs().cancel("jobId") -/// .doit(); -/// # } -/// ``` -pub struct JobCancelCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _job_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for JobCancelCall<'a, C, A> {} - -impl<'a, C, A> JobCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.jobs.cancel", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("jobId", self._job_id.to_string())); - for &field in ["jobId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/genomics/v1beta2/jobs/{jobId}/cancel".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{jobId}", "jobId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["jobId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The ID of the job. - /// - /// Sets the *job id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn job_id(mut self, new_value: &str) -> JobCancelCall<'a, C, A> { - self._job_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> JobCancelCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> JobCancelCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> JobCancelCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a job by ID. -/// -/// A builder for the *get* method supported by a *job* resource. -/// It is not used directly, but through a `JobMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.jobs().get("jobId") -/// .doit(); -/// # } -/// ``` -pub struct JobGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _job_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for JobGetCall<'a, C, A> {} - -impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Job)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.jobs.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("jobId", self._job_id.to_string())); - for &field in ["alt", "jobId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/jobs/{jobId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{jobId}", "jobId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["jobId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The ID of the job. - /// - /// Sets the *job id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn job_id(mut self, new_value: &str) -> JobGetCall<'a, C, A> { - self._job_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> JobGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> JobGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> JobGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a list of jobs matching the criteria. -/// -/// A builder for the *search* method supported by a *job* resource. -/// It is not used directly, but through a `JobMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::SearchJobsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = SearchJobsRequest::default(); -/// -/// // 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 ! -/// let result = hub.jobs().search(req) -/// .doit(); -/// # } -/// ``` -pub struct JobSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchJobsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for JobSearchCall<'a, C, A> {} - -impl<'a, C, A> JobSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchJobsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.jobs.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/jobs/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: SearchJobsRequest) -> JobSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> JobSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> JobSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> JobSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Searches for reference sets which match the given criteria. -/// -/// Implements GlobalAllianceApi.searchReferenceSets. -/// -/// A builder for the *search* method supported by a *referenceset* resource. -/// It is not used directly, but through a `ReferencesetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::SearchReferenceSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = SearchReferenceSetsRequest::default(); -/// -/// // 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 ! -/// let result = hub.referencesets().search(req) -/// .doit(); -/// # } -/// ``` -pub struct ReferencesetSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchReferenceSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReferencesetSearchCall<'a, C, A> {} - -impl<'a, C, A> ReferencesetSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchReferenceSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.referencesets.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/referencesets/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: SearchReferenceSetsRequest) -> ReferencesetSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReferencesetSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReferencesetSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReferencesetSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a reference set. -/// -/// Implements GlobalAllianceApi.getReferenceSet. -/// -/// A builder for the *get* method supported by a *referenceset* resource. -/// It is not used directly, but through a `ReferencesetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.referencesets().get("referenceSetId") -/// .doit(); -/// # } -/// ``` -pub struct ReferencesetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _reference_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReferencesetGetCall<'a, C, A> {} - -impl<'a, C, A> ReferencesetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ReferenceSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.referencesets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("referenceSetId", self._reference_set_id.to_string())); - for &field in ["alt", "referenceSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/referencesets/{referenceSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{referenceSetId}", "referenceSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["referenceSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the reference set. - /// - /// Sets the *reference set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn reference_set_id(mut self, new_value: &str) -> ReferencesetGetCall<'a, C, A> { - self._reference_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReferencesetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReferencesetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReferencesetGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a call set. -/// -/// A builder for the *delete* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.callsets().delete("callSetId") -/// .doit(); -/// # } -/// ``` -pub struct CallsetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _call_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetDeleteCall<'a, C, A> {} - -impl<'a, C, A> CallsetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("callSetId", self._call_set_id.to_string())); - for &field in ["callSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/genomics/v1beta2/callsets/{callSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{callSetId}", "callSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["callSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the call set to be deleted. - /// - /// Sets the *call set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn call_set_id(mut self, new_value: &str) -> CallsetDeleteCall<'a, C, A> { - self._call_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CallsetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CallsetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CallsetDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a list of call sets matching the criteria. -/// -/// Implements GlobalAllianceApi.searchCallSets. -/// -/// A builder for the *search* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::SearchCallSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = SearchCallSetsRequest::default(); -/// -/// // 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 ! -/// let result = hub.callsets().search(req) -/// .doit(); -/// # } -/// ``` -pub struct CallsetSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchCallSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetSearchCall<'a, C, A> {} - -impl<'a, C, A> CallsetSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchCallSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/callsets/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: SearchCallSetsRequest) -> CallsetSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CallsetSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CallsetSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CallsetSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a call set. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::CallSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = CallSet::default(); -/// -/// // 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 ! -/// let result = hub.callsets().patch(req, "callSetId") -/// .doit(); -/// # } -/// ``` -pub struct CallsetPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: CallSet, - _call_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetPatchCall<'a, C, A> {} - -impl<'a, C, A> CallsetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CallSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("callSetId", self._call_set_id.to_string())); - for &field in ["alt", "callSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/callsets/{callSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{callSetId}", "callSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["callSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: CallSet) -> CallsetPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the call set to be updated. - /// - /// Sets the *call set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn call_set_id(mut self, new_value: &str) -> CallsetPatchCall<'a, C, A> { - self._call_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CallsetPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CallsetPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CallsetPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a new call set. -/// -/// A builder for the *create* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::CallSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = CallSet::default(); -/// -/// // 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 ! -/// let result = hub.callsets().create(req) -/// .doit(); -/// # } -/// ``` -pub struct CallsetCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: CallSet, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetCreateCall<'a, C, A> {} - -impl<'a, C, A> CallsetCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CallSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/callsets".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: CallSet) -> CallsetCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CallsetCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CallsetCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CallsetCreateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a call set by ID. -/// -/// A builder for the *get* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.callsets().get("callSetId") -/// .doit(); -/// # } -/// ``` -pub struct CallsetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _call_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetGetCall<'a, C, A> {} - -impl<'a, C, A> CallsetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CallSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("callSetId", self._call_set_id.to_string())); - for &field in ["alt", "callSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/callsets/{callSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{callSetId}", "callSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["callSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the call set. - /// - /// Sets the *call set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn call_set_id(mut self, new_value: &str) -> CallsetGetCall<'a, C, A> { - self._call_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CallsetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CallsetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CallsetGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a call set. -/// -/// A builder for the *update* method supported by a *callset* resource. -/// It is not used directly, but through a `CallsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::CallSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = CallSet::default(); -/// -/// // 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 ! -/// let result = hub.callsets().update(req, "callSetId") -/// .doit(); -/// # } -/// ``` -pub struct CallsetUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: CallSet, - _call_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CallsetUpdateCall<'a, C, A> {} - -impl<'a, C, A> CallsetUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CallSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.callsets.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("callSetId", self._call_set_id.to_string())); - for &field in ["alt", "callSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/callsets/{callSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{callSetId}", "callSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["callSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: CallSet) -> CallsetUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the call set to be updated. - /// - /// Sets the *call set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn call_set_id(mut self, new_value: &str) -> CallsetUpdateCall<'a, C, A> { - self._call_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CallsetUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CallsetUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CallsetUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a stream of reads for one or more read group sets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. -/// -/// If a target positional range is specified, all reads whose alignment to the reference genome overlap the range are returned. -/// -/// All reads returned are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order. -/// -/// A builder for the *streamreads* method supported by a *streamingReadstore* resource. -/// It is not used directly, but through a `StreamingReadstoreMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::StreamReadsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = StreamReadsRequest::default(); -/// -/// // 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 ! -/// let result = hub.streaming_readstore().streamreads(req) -/// .doit(); -/// # } -/// ``` -pub struct StreamingReadstoreStreamreadCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: StreamReadsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, -} - -impl<'a, C, A> CallBuilder for StreamingReadstoreStreamreadCall<'a, C, A> {} - -impl<'a, C, A> StreamingReadstoreStreamreadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, StreamReadsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.streamingReadstore.streamreads", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/streamingReadstore/streamreads".to_string(); - - let mut key = self.hub.auth.borrow_mut().api_key(); - if key.is_none() { - key = dlg.api_key(); - } - match key { - Some(value) => params.push(("key", value)), - None => { - dlg.finished(false); - return Err(Error::MissingAPIKey) - } - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: StreamReadsRequest) -> StreamingReadstoreStreamreadCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> StreamingReadstoreStreamreadCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> StreamingReadstoreStreamreadCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - -} - - -/// Gets a list of reads for one or more read group sets. Reads search operates over a genomic coordinate space of reference sequence & position defined over the reference sequences to which the requested read group sets are aligned. -/// -/// If a target positional range is specified, search returns all reads whose alignment to the reference genome overlap the range. A query which specifies only read group set IDs yields all reads in those read group sets, including unmapped reads. -/// -/// All reads returned (including reads on subsequent pages) are ordered by genomic coordinate (reference sequence & position). Reads with equivalent genomic coordinates are returned in a deterministic order. -/// -/// Implements GlobalAllianceApi.searchReads. -/// -/// A builder for the *search* method supported by a *read* resource. -/// It is not used directly, but through a `ReadMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::SearchReadsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = SearchReadsRequest::default(); -/// -/// // 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 ! -/// let result = hub.reads().search(req) -/// .doit(); -/// # } -/// ``` -pub struct ReadSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchReadsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadSearchCall<'a, C, A> {} - -impl<'a, C, A> ReadSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchReadsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.reads.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/reads/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: SearchReadsRequest) -> ReadSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Exports read group sets to a BAM file in Google Cloud Storage. -/// -/// Note that currently there may be some differences between exported BAM files and the original BAM file at the time of import. In particular, comments in the input file header will not be preserved, some custom tags will be converted to strings, and original reference sequence order is not necessarily preserved. -/// -/// A builder for the *export* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::ExportReadGroupSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = ExportReadGroupSetsRequest::default(); -/// -/// // 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 ! -/// let result = hub.readgroupsets().export(req) -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetExportCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ExportReadGroupSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetExportCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetExportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ExportReadGroupSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.export", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/readgroupsets/export".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DevstorageReadWrite.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ExportReadGroupSetsRequest) -> ReadgroupsetExportCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadgroupsetExportCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetExportCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DevstorageReadWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadgroupsetExportCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a read group set. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::ReadGroupSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = ReadGroupSet::default(); -/// -/// // 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 ! -/// let result = hub.readgroupsets().patch(req, "readGroupSetId") -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ReadGroupSet, - _read_group_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetPatchCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ReadGroupSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("readGroupSetId", self._read_group_set_id.to_string())); - for &field in ["alt", "readGroupSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/readgroupsets/{readGroupSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{readGroupSetId}", "readGroupSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["readGroupSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ReadGroupSet) -> ReadgroupsetPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the read group set to be updated. The caller must have WRITE permissions to the dataset associated with this read group set. - /// - /// Sets the *read group set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetPatchCall<'a, C, A> { - self._read_group_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadgroupsetPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadgroupsetPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Calls variants on read data from existing read group sets or files from Google Cloud Storage. See the alignment and variant calling documentation for more details. -/// -/// A builder for the *call* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::CallReadGroupSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = CallReadGroupSetsRequest::default(); -/// -/// // 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 ! -/// let result = hub.readgroupsets().call(req) -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetCallCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: CallReadGroupSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetCallCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetCallCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CallReadGroupSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.call", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/readgroupsets/call".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DevstorageReadWrite.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: CallReadGroupSetsRequest) -> ReadgroupsetCallCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadgroupsetCallCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetCallCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DevstorageReadWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadgroupsetCallCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates read group sets by asynchronously importing the provided information. -/// -/// Note that currently comments in the input file header are not imported and some custom tags will be converted to strings, rather than preserving tag types. The caller must have WRITE permissions to the dataset. -/// -/// A builder for the *import* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::ImportReadGroupSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = ImportReadGroupSetsRequest::default(); -/// -/// // 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 ! -/// let result = hub.readgroupsets().import(req) -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetImportCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ImportReadGroupSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetImportCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetImportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ImportReadGroupSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.import", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/readgroupsets/import".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DevstorageReadWrite.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ImportReadGroupSetsRequest) -> ReadgroupsetImportCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadgroupsetImportCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetImportCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DevstorageReadWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadgroupsetImportCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Aligns read data from existing read group sets or files from Google Cloud Storage. See the alignment and variant calling documentation for more details. -/// -/// A builder for the *align* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::AlignReadGroupSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = AlignReadGroupSetsRequest::default(); -/// -/// // 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 ! -/// let result = hub.readgroupsets().align(req) -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetAlignCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: AlignReadGroupSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetAlignCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetAlignCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AlignReadGroupSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.align", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/readgroupsets/align".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DevstorageReadWrite.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: AlignReadGroupSetsRequest) -> ReadgroupsetAlignCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadgroupsetAlignCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetAlignCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DevstorageReadWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadgroupsetAlignCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a read group set by ID. -/// -/// A builder for the *get* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.readgroupsets().get("readGroupSetId") -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _read_group_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetGetCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ReadGroupSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("readGroupSetId", self._read_group_set_id.to_string())); - for &field in ["alt", "readGroupSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/readgroupsets/{readGroupSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{readGroupSetId}", "readGroupSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["readGroupSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the read group set. - /// - /// Sets the *read group set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetGetCall<'a, C, A> { - self._read_group_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadgroupsetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadgroupsetGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a read group set. -/// -/// A builder for the *update* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::ReadGroupSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = ReadGroupSet::default(); -/// -/// // 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 ! -/// let result = hub.readgroupsets().update(req, "readGroupSetId") -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ReadGroupSet, - _read_group_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetUpdateCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ReadGroupSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("readGroupSetId", self._read_group_set_id.to_string())); - for &field in ["alt", "readGroupSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/readgroupsets/{readGroupSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{readGroupSetId}", "readGroupSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["readGroupSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ReadGroupSet) -> ReadgroupsetUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the read group set to be updated. The caller must have WRITE permissions to the dataset associated with this read group set. - /// - /// Sets the *read group set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetUpdateCall<'a, C, A> { - self._read_group_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadgroupsetUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadgroupsetUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Lists fixed width coverage buckets for a read group set, each of which correspond to a range of a reference sequence. Each bucket summarizes coverage information across its corresponding genomic range. -/// -/// Coverage is defined as the number of reads which are aligned to a given base in the reference sequence. Coverage buckets are available at several precomputed bucket widths, enabling retrieval of various coverage 'zoom levels'. The caller must have READ permissions for the target read group set. -/// -/// A builder for the *coveragebuckets.list* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.readgroupsets().coveragebuckets_list("readGroupSetId") -/// .target_bucket_width("justo") -/// .range_start("justo") -/// .range_reference_name("et") -/// .range_end("et") -/// .page_token("diam") -/// .page_size(-55) -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetCoveragebucketListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _read_group_set_id: String, - _target_bucket_width: Option, - _range_start: Option, - _range_reference_name: Option, - _range_end: Option, - _page_token: Option, - _page_size: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetCoveragebucketListCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetCoveragebucketListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListCoverageBucketsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.coveragebuckets.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); - params.push(("readGroupSetId", self._read_group_set_id.to_string())); - if let Some(value) = self._target_bucket_width { - params.push(("targetBucketWidth", value.to_string())); - } - if let Some(value) = self._range_start { - params.push(("range.start", value.to_string())); - } - if let Some(value) = self._range_reference_name { - params.push(("range.referenceName", value.to_string())); - } - if let Some(value) = self._range_end { - params.push(("range.end", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - for &field in ["alt", "readGroupSetId", "targetBucketWidth", "range.start", "range.referenceName", "range.end", "pageToken", "pageSize"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/readgroupsets/{readGroupSetId}/coveragebuckets".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{readGroupSetId}", "readGroupSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["readGroupSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The ID of the read group set over which coverage is requested. - /// - /// Sets the *read group set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._read_group_set_id = new_value.to_string(); - self - } - /// The desired width of each reported coverage bucket in base pairs. This will be rounded down to the nearest precomputed bucket width; the value of which is returned as bucketWidth in the response. Defaults to infinity (each bucket spans an entire reference sequence) or the length of the target range, if specified. The smallest precomputed bucketWidth is currently 2048 base pairs; this is subject to change. - /// - /// Sets the *target bucket width* query property to the given value. - pub fn target_bucket_width(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._target_bucket_width = Some(new_value.to_string()); - self - } - /// The start position of the range on the reference, 0-based inclusive. If specified, referenceName must also be specified. - /// - /// Sets the *range.start* query property to the given value. - pub fn range_start(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._range_start = Some(new_value.to_string()); - self - } - /// The reference sequence name, for example chr1, 1, or chrX. - /// - /// Sets the *range.reference name* query property to the given value. - pub fn range_reference_name(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._range_reference_name = Some(new_value.to_string()); - self - } - /// The end position of the range on the reference, 0-based exclusive. If specified, referenceName must also be specified. - /// - /// Sets the *range.end* query property to the given value. - pub fn range_end(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._range_end = Some(new_value.to_string()); - self - } - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// The maximum number of results to return in a single page. If unspecified, defaults to 1024. The maximum value is 2048. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadgroupsetCoveragebucketListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetCoveragebucketListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadgroupsetCoveragebucketListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a read group set. -/// -/// A builder for the *delete* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.readgroupsets().delete("readGroupSetId") -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _read_group_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetDeleteCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("readGroupSetId", self._read_group_set_id.to_string())); - for &field in ["readGroupSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/genomics/v1beta2/readgroupsets/{readGroupSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{readGroupSetId}", "readGroupSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["readGroupSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the read group set to be deleted. The caller must have WRITE permissions to the dataset associated with this read group set. - /// - /// Sets the *read group set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn read_group_set_id(mut self, new_value: &str) -> ReadgroupsetDeleteCall<'a, C, A> { - self._read_group_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadgroupsetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadgroupsetDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Searches for read group sets matching the criteria. -/// -/// Implements GlobalAllianceApi.searchReadGroupSets. -/// -/// A builder for the *search* method supported by a *readgroupset* resource. -/// It is not used directly, but through a `ReadgroupsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::SearchReadGroupSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = SearchReadGroupSetsRequest::default(); -/// -/// // 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 ! -/// let result = hub.readgroupsets().search(req) -/// .doit(); -/// # } -/// ``` -pub struct ReadgroupsetSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchReadGroupSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReadgroupsetSearchCall<'a, C, A> {} - -impl<'a, C, A> ReadgroupsetSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchReadGroupSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.readgroupsets.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/readgroupsets/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: SearchReadGroupSetsRequest) -> ReadgroupsetSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReadgroupsetSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReadgroupsetSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReadgroupsetSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Lists the bases in a reference, optionally restricted to a range. -/// -/// Implements GlobalAllianceApi.getReferenceBases. -/// -/// A builder for the *bases.list* method supported by a *reference* resource. -/// It is not used directly, but through a `ReferenceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.references().bases_list("referenceId") -/// .start("duo") -/// .page_token("aliquyam") -/// .page_size(-9) -/// .end("Lorem") -/// .doit(); -/// # } -/// ``` -pub struct ReferenceBaseListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _reference_id: String, - _start: Option, - _page_token: Option, - _page_size: Option, - _end: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReferenceBaseListCall<'a, C, A> {} - -impl<'a, C, A> ReferenceBaseListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ListBasesResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.references.bases.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); - params.push(("referenceId", self._reference_id.to_string())); - if let Some(value) = self._start { - params.push(("start", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._page_size { - params.push(("pageSize", value.to_string())); - } - if let Some(value) = self._end { - params.push(("end", value.to_string())); - } - for &field in ["alt", "referenceId", "start", "pageToken", "pageSize", "end"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/references/{referenceId}/bases".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{referenceId}", "referenceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["referenceId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the reference. - /// - /// Sets the *reference id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn reference_id(mut self, new_value: &str) -> ReferenceBaseListCall<'a, C, A> { - self._reference_id = new_value.to_string(); - self - } - /// The start position (0-based) of this query. Defaults to 0. - /// - /// Sets the *start* query property to the given value. - pub fn start(mut self, new_value: &str) -> ReferenceBaseListCall<'a, C, A> { - self._start = Some(new_value.to_string()); - self - } - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ReferenceBaseListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Specifies the maximum number of bases to return in a single page. - /// - /// Sets the *page size* query property to the given value. - pub fn page_size(mut self, new_value: i32) -> ReferenceBaseListCall<'a, C, A> { - self._page_size = Some(new_value); - self - } - /// The end position (0-based, exclusive) of this query. Defaults to the length of this reference. - /// - /// Sets the *end* query property to the given value. - pub fn end(mut self, new_value: &str) -> ReferenceBaseListCall<'a, C, A> { - self._end = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReferenceBaseListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReferenceBaseListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReferenceBaseListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Searches for references which match the given criteria. -/// -/// Implements GlobalAllianceApi.searchReferences. -/// -/// A builder for the *search* method supported by a *reference* resource. -/// It is not used directly, but through a `ReferenceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::SearchReferencesRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = SearchReferencesRequest::default(); -/// -/// // 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 ! -/// let result = hub.references().search(req) -/// .doit(); -/// # } -/// ``` -pub struct ReferenceSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchReferencesRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReferenceSearchCall<'a, C, A> {} - -impl<'a, C, A> ReferenceSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchReferencesResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.references.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/references/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: SearchReferencesRequest) -> ReferenceSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReferenceSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReferenceSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReferenceSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a reference. -/// -/// Implements GlobalAllianceApi.getReference. -/// -/// A builder for the *get* method supported by a *reference* resource. -/// It is not used directly, but through a `ReferenceMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.references().get("referenceId") -/// .doit(); -/// # } -/// ``` -pub struct ReferenceGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _reference_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ReferenceGetCall<'a, C, A> {} - -impl<'a, C, A> ReferenceGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Reference)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.references.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("referenceId", self._reference_id.to_string())); - for &field in ["alt", "referenceId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/references/{referenceId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{referenceId}", "referenceId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["referenceId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the reference. - /// - /// Sets the *reference id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn reference_id(mut self, new_value: &str) -> ReferenceGetCall<'a, C, A> { - self._reference_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ReferenceGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ReferenceGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ReferenceGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets an annotation set. Caller must have READ permission for the associated dataset. -/// -/// A builder for the *get* method supported by a *annotationSet* resource. -/// It is not used directly, but through a `AnnotationSetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.annotation_sets().get("annotationSetId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationSetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _annotation_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationSetGetCall<'a, C, A> {} - -impl<'a, C, A> AnnotationSetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AnnotationSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationSets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("annotationSetId", self._annotation_set_id.to_string())); - for &field in ["alt", "annotationSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotationSets/{annotationSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationSetId}", "annotationSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the annotation set to be retrieved. - /// - /// Sets the *annotation set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_set_id(mut self, new_value: &str) -> AnnotationSetGetCall<'a, C, A> { - self._annotation_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationSetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationSetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationSetGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates an annotation set. The update must respect all mutability restrictions and other invariants described on the annotation set resource. Caller must have WRITE permission for the associated dataset. -/// -/// A builder for the *update* method supported by a *annotationSet* resource. -/// It is not used directly, but through a `AnnotationSetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::AnnotationSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = AnnotationSet::default(); -/// -/// // 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 ! -/// let result = hub.annotation_sets().update(req, "annotationSetId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationSetUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: AnnotationSet, - _annotation_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationSetUpdateCall<'a, C, A> {} - -impl<'a, C, A> AnnotationSetUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AnnotationSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationSets.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("annotationSetId", self._annotation_set_id.to_string())); - for &field in ["alt", "annotationSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotationSets/{annotationSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationSetId}", "annotationSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: AnnotationSet) -> AnnotationSetUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the annotation set to be updated. - /// - /// Sets the *annotation set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_set_id(mut self, new_value: &str) -> AnnotationSetUpdateCall<'a, C, A> { - self._annotation_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationSetUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationSetUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationSetUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a new annotation set. Caller must have WRITE permission for the associated dataset. -/// -/// A builder for the *create* method supported by a *annotationSet* resource. -/// It is not used directly, but through a `AnnotationSetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::AnnotationSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = AnnotationSet::default(); -/// -/// // 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 ! -/// let result = hub.annotation_sets().create(req) -/// .doit(); -/// # } -/// ``` -pub struct AnnotationSetCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: AnnotationSet, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationSetCreateCall<'a, C, A> {} - -impl<'a, C, A> AnnotationSetCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AnnotationSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationSets.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotationSets".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: AnnotationSet) -> AnnotationSetCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationSetCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationSetCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationSetCreateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Searches for annotation sets that match the given criteria. Results are returned in a deterministic order. Caller must have READ permission for the queried datasets. -/// -/// A builder for the *search* method supported by a *annotationSet* resource. -/// It is not used directly, but through a `AnnotationSetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::SearchAnnotationSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = SearchAnnotationSetsRequest::default(); -/// -/// // 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 ! -/// let result = hub.annotation_sets().search(req) -/// .doit(); -/// # } -/// ``` -pub struct AnnotationSetSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchAnnotationSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationSetSearchCall<'a, C, A> {} - -impl<'a, C, A> AnnotationSetSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchAnnotationSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationSets.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotationSets/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: SearchAnnotationSetsRequest) -> AnnotationSetSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationSetSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationSetSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationSetSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates an annotation set. The update must respect all mutability restrictions and other invariants described on the annotation set resource. Caller must have WRITE permission for the associated dataset. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *annotationSet* resource. -/// It is not used directly, but through a `AnnotationSetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::AnnotationSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = AnnotationSet::default(); -/// -/// // 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 ! -/// let result = hub.annotation_sets().patch(req, "annotationSetId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationSetPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: AnnotationSet, - _annotation_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationSetPatchCall<'a, C, A> {} - -impl<'a, C, A> AnnotationSetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, AnnotationSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationSets.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("annotationSetId", self._annotation_set_id.to_string())); - for &field in ["alt", "annotationSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotationSets/{annotationSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationSetId}", "annotationSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: AnnotationSet) -> AnnotationSetPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the annotation set to be updated. - /// - /// Sets the *annotation set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_set_id(mut self, new_value: &str) -> AnnotationSetPatchCall<'a, C, A> { - self._annotation_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationSetPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationSetPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationSetPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes an annotation set. Caller must have WRITE permission for the associated annotation set. -/// -/// A builder for the *delete* method supported by a *annotationSet* resource. -/// It is not used directly, but through a `AnnotationSetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.annotation_sets().delete("annotationSetId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationSetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _annotation_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationSetDeleteCall<'a, C, A> {} - -impl<'a, C, A> AnnotationSetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotationSets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("annotationSetId", self._annotation_set_id.to_string())); - for &field in ["annotationSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotationSets/{annotationSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationSetId}", "annotationSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the annotation set to be deleted. - /// - /// Sets the *annotation set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_set_id(mut self, new_value: &str) -> AnnotationSetDeleteCall<'a, C, A> { - self._annotation_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationSetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationSetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationSetDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a list of variants matching the criteria. -/// -/// Implements GlobalAllianceApi.searchVariants. -/// -/// A builder for the *search* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::SearchVariantsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = SearchVariantsRequest::default(); -/// -/// // 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 ! -/// let result = hub.variants().search(req) -/// .doit(); -/// # } -/// ``` -pub struct VariantSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchVariantsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantSearchCall<'a, C, A> {} - -impl<'a, C, A> VariantSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchVariantsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variants/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: SearchVariantsRequest) -> VariantSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a variant. -/// -/// A builder for the *delete* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.variants().delete("variantId") -/// .doit(); -/// # } -/// ``` -pub struct VariantDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _variant_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantDeleteCall<'a, C, A> {} - -impl<'a, C, A> VariantDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("variantId", self._variant_id.to_string())); - for &field in ["variantId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variants/{variantId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantId}", "variantId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the variant to be deleted. - /// - /// Sets the *variant id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_id(mut self, new_value: &str) -> VariantDeleteCall<'a, C, A> { - self._variant_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a variant by ID. -/// -/// A builder for the *get* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.variants().get("variantId") -/// .doit(); -/// # } -/// ``` -pub struct VariantGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _variant_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantGetCall<'a, C, A> {} - -impl<'a, C, A> VariantGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Variant)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("variantId", self._variant_id.to_string())); - for &field in ["alt", "variantId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variants/{variantId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantId}", "variantId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the variant. - /// - /// Sets the *variant id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_id(mut self, new_value: &str) -> VariantGetCall<'a, C, A> { - self._variant_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a new variant. -/// -/// A builder for the *create* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::Variant; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = Variant::default(); -/// -/// // 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 ! -/// let result = hub.variants().create(req) -/// .doit(); -/// # } -/// ``` -pub struct VariantCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Variant, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantCreateCall<'a, C, A> {} - -impl<'a, C, A> VariantCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Variant)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variants".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Variant) -> VariantCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantCreateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a variant's names and info fields. All other modifications are silently ignored. Returns the modified variant without its calls. -/// -/// A builder for the *update* method supported by a *variant* resource. -/// It is not used directly, but through a `VariantMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::Variant; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = Variant::default(); -/// -/// // 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 ! -/// let result = hub.variants().update(req, "variantId") -/// .doit(); -/// # } -/// ``` -pub struct VariantUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Variant, - _variant_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantUpdateCall<'a, C, A> {} - -impl<'a, C, A> VariantUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Variant)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variants.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("variantId", self._variant_id.to_string())); - for &field in ["alt", "variantId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variants/{variantId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantId}", "variantId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Variant) -> VariantUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the variant to be updated. - /// - /// Sets the *variant id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_id(mut self, new_value: &str) -> VariantUpdateCall<'a, C, A> { - self._variant_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates an annotation. The update must respect all mutability restrictions and other invariants described on the annotation resource. Caller must have WRITE permission for the associated dataset. -/// -/// A builder for the *update* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::Annotation; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = Annotation::default(); -/// -/// // 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 ! -/// let result = hub.annotations().update(req, "annotationId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Annotation, - _annotation_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationUpdateCall<'a, C, A> {} - -impl<'a, C, A> AnnotationUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Annotation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("annotationId", self._annotation_id.to_string())); - for &field in ["alt", "annotationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotations/{annotationId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationId}", "annotationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Annotation) -> AnnotationUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the annotation set to be updated. - /// - /// Sets the *annotation id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_id(mut self, new_value: &str) -> AnnotationUpdateCall<'a, C, A> { - self._annotation_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets an annotation. Caller must have READ permission for the associated annotation set. -/// -/// A builder for the *get* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.annotations().get("annotationId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _annotation_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationGetCall<'a, C, A> {} - -impl<'a, C, A> AnnotationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Annotation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("annotationId", self._annotation_id.to_string())); - for &field in ["alt", "annotationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotations/{annotationId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationId}", "annotationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the annotation set to be retrieved. - /// - /// Sets the *annotation id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_id(mut self, new_value: &str) -> AnnotationGetCall<'a, C, A> { - self._annotation_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Searches for annotations that match the given criteria. Results are returned ordered by start position. Annotations that have matching start positions are ordered deterministically. Caller must have READ permission for the queried annotation sets. -/// -/// A builder for the *search* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::SearchAnnotationsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = SearchAnnotationsRequest::default(); -/// -/// // 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 ! -/// let result = hub.annotations().search(req) -/// .doit(); -/// # } -/// ``` -pub struct AnnotationSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchAnnotationsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationSearchCall<'a, C, A> {} - -impl<'a, C, A> AnnotationSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchAnnotationsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotations/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: SearchAnnotationsRequest) -> AnnotationSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes an annotation. Caller must have WRITE permission for the associated annotation set. -/// -/// A builder for the *delete* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.annotations().delete("annotationId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _annotation_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationDeleteCall<'a, C, A> {} - -impl<'a, C, A> AnnotationDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("annotationId", self._annotation_id.to_string())); - for &field in ["annotationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotations/{annotationId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationId}", "annotationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the annotation set to be deleted. - /// - /// Sets the *annotation id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_id(mut self, new_value: &str) -> AnnotationDeleteCall<'a, C, A> { - self._annotation_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates an annotation. The update must respect all mutability restrictions and other invariants described on the annotation resource. Caller must have WRITE permission for the associated dataset. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::Annotation; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = Annotation::default(); -/// -/// // 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 ! -/// let result = hub.annotations().patch(req, "annotationId") -/// .doit(); -/// # } -/// ``` -pub struct AnnotationPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Annotation, - _annotation_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationPatchCall<'a, C, A> {} - -impl<'a, C, A> AnnotationPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Annotation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("annotationId", self._annotation_id.to_string())); - for &field in ["alt", "annotationId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotations/{annotationId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{annotationId}", "annotationId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["annotationId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Annotation) -> AnnotationPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the annotation set to be updated. - /// - /// Sets the *annotation id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn annotation_id(mut self, new_value: &str) -> AnnotationPatchCall<'a, C, A> { - self._annotation_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a new annotation. Caller must have WRITE permission for the associated annotation set. -/// -/// A builder for the *create* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::Annotation; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = Annotation::default(); -/// -/// // 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 ! -/// let result = hub.annotations().create(req) -/// .doit(); -/// # } -/// ``` -pub struct AnnotationCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: Annotation, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationCreateCall<'a, C, A> {} - -impl<'a, C, A> AnnotationCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Annotation)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotations".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Annotation) -> AnnotationCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationCreateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates one or more new annotations atomically. All annotations must belong to the same annotation set. Caller must have WRITE permission for this annotation set. For optimal performance, batch positionally adjacent annotations together. -/// -/// -/// If the request has a systemic issue, such as an attempt to write to an inaccessible annotation set, the entire RPC will fail accordingly. For lesser data issues, when possible an error will be isolated to the corresponding batch entry in the response; the remaining well formed annotations will be created normally. -/// -/// A builder for the *batchCreate* method supported by a *annotation* resource. -/// It is not used directly, but through a `AnnotationMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::BatchCreateAnnotationsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = BatchCreateAnnotationsRequest::default(); -/// -/// // 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 ! -/// let result = hub.annotations().batch_create(req) -/// .doit(); -/// # } -/// ``` -pub struct AnnotationBatchCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: BatchCreateAnnotationsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for AnnotationBatchCreateCall<'a, C, A> {} - -impl<'a, C, A> AnnotationBatchCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, BatchAnnotationsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.annotations.batchCreate", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/annotations:batchCreate".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: BatchCreateAnnotationsRequest) -> AnnotationBatchCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> AnnotationBatchCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> AnnotationBatchCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> AnnotationBatchCreateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates and asynchronously runs an ad-hoc job. This is an experimental call and may be removed or changed at any time. -/// -/// A builder for the *jobs.create* method supported by a *experimental* resource. -/// It is not used directly, but through a `ExperimentalMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::ExperimentalCreateJobRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = ExperimentalCreateJobRequest::default(); -/// -/// // 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 ! -/// let result = hub.experimental().jobs_create(req) -/// .doit(); -/// # } -/// ``` -pub struct ExperimentalJobCreateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ExperimentalCreateJobRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ExperimentalJobCreateCall<'a, C, A> {} - -impl<'a, C, A> ExperimentalJobCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ExperimentalCreateJobResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.experimental.jobs.create", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/experimental/jobs/create".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DevstorageReadWrite.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ExperimentalCreateJobRequest) -> ExperimentalJobCreateCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ExperimentalJobCreateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ExperimentalJobCreateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DevstorageReadWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ExperimentalJobCreateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a variant set's metadata. All other modifications are silently ignored. -/// -/// A builder for the *update* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::VariantSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = VariantSet::default(); -/// -/// // 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 ! -/// let result = hub.variantsets().update(req, "variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: VariantSet, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetUpdateCall<'a, C, A> {} - -impl<'a, C, A> VariantsetUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VariantSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["alt", "variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variantsets/{variantSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: VariantSet) -> VariantsetUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the variant to be updated. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetUpdateCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantsetUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantsetUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantsetUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Exports variant set data to an external destination. -/// -/// A builder for the *export* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::ExportVariantSetRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = ExportVariantSetRequest::default(); -/// -/// // 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 ! -/// let result = hub.variantsets().export(req, "variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetExportCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ExportVariantSetRequest, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetExportCall<'a, C, A> {} - -impl<'a, C, A> VariantsetExportCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ExportVariantSetResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.export", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["alt", "variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variantsets/{variantSetId}/export".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Bigquery.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ExportVariantSetRequest) -> VariantsetExportCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The ID of the variant set that contains variant data which should be exported. The caller must have READ access to this variant set. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetExportCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantsetExportCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantsetExportCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Bigquery`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantsetExportCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a variant set's metadata. All other modifications are silently ignored. This method supports patch semantics. -/// -/// A builder for the *patch* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::VariantSet; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = VariantSet::default(); -/// -/// // 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 ! -/// let result = hub.variantsets().patch(req, "variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetPatchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: VariantSet, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetPatchCall<'a, C, A> {} - -impl<'a, C, A> VariantsetPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VariantSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.patch", - http_method: hyper::method::Method::Patch }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["alt", "variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variantsets/{variantSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: VariantSet) -> VariantsetPatchCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the variant to be updated. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetPatchCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantsetPatchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantsetPatchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantsetPatchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a list of all variant sets matching search criteria. -/// -/// Implements GlobalAllianceApi.searchVariantSets. -/// -/// A builder for the *search* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::SearchVariantSetsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = SearchVariantSetsRequest::default(); -/// -/// // 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 ! -/// let result = hub.variantsets().search(req) -/// .doit(); -/// # } -/// ``` -pub struct VariantsetSearchCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: SearchVariantSetsRequest, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetSearchCall<'a, C, A> {} - -impl<'a, C, A> VariantsetSearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, SearchVariantSetsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.search", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variantsets/search".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: SearchVariantSetsRequest) -> VariantsetSearchCall<'a, C, A> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantsetSearchCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantsetSearchCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantsetSearchCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Gets a variant set by ID. -/// -/// A builder for the *get* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.variantsets().get("variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetGetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetGetCall<'a, C, A> {} - -impl<'a, C, A> VariantsetGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VariantSet)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.get", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["alt", "variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variantsets/{variantSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// Required. The ID of the variant set. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetGetCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantsetGetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantsetGetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantsetGetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Merges the given variants with existing variants. Each variant will be merged with an existing variant that matches its reference sequence, start, end, reference bases, and alternative bases. If no such variant exists, a new one will be created. -/// -/// When variants are merged, the call information from the new variant is added to the existing variant, and other fields (such as key/value pairs) are discarded. -/// -/// A builder for the *mergeVariants* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::MergeVariantsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = MergeVariantsRequest::default(); -/// -/// // 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 ! -/// let result = hub.variantsets().merge_variants(req, "variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetMergeVariantCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: MergeVariantsRequest, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetMergeVariantCall<'a, C, A> {} - -impl<'a, C, A> VariantsetMergeVariantCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.mergeVariants", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variantsets/{variantSetId}/mergeVariants".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: MergeVariantsRequest) -> VariantsetMergeVariantCall<'a, C, A> { - self._request = new_value; - self - } - /// The destination variant set. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetMergeVariantCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantsetMergeVariantCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantsetMergeVariantCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantsetMergeVariantCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes the contents of a variant set. The variant set object is not deleted. -/// -/// A builder for the *delete* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let result = hub.variantsets().delete("variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetDeleteCall<'a, C, A> {} - -impl<'a, C, A> VariantsetDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variantsets/{variantSetId}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the variant set to be deleted. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetDeleteCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantsetDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantsetDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantsetDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates variant data by asynchronously importing the provided information. -/// -/// The variants for import will be merged with any existing data and each other according to the behavior of mergeVariants. In particular, this means for merged VCF variants that have conflicting INFO fields, some data will be arbitrarily discarded. As a special case, for single-sample VCF files, QUAL and FILTER fields will be moved to the call level; these are sometimes interpreted in a call-specific context. Imported VCF headers are appended to the metadata already in a variant set. -/// -/// A builder for the *importVariants* method supported by a *variantset* resource. -/// It is not used directly, but through a `VariantsetMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_genomics1_beta2 as genomics1_beta2; -/// use genomics1_beta2::ImportVariantsRequest; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use genomics1_beta2::Genomics; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Genomics::new(hyper::Client::new(), 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 ! -/// let mut req = ImportVariantsRequest::default(); -/// -/// // 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 ! -/// let result = hub.variantsets().import_variants(req, "variantSetId") -/// .doit(); -/// # } -/// ``` -pub struct VariantsetImportVariantCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Genomics, - _request: ImportVariantsRequest, - _variant_set_id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VariantsetImportVariantCall<'a, C, A> {} - -impl<'a, C, A> VariantsetImportVariantCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ImportVariantsResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "genomics.variantsets.importVariants", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("variantSetId", self._variant_set_id.to_string())); - for &field in ["alt", "variantSetId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/genomics/v1beta2/variantsets/{variantSetId}/importVariants".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::DevstorageReadWrite.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{variantSetId}", "variantSetId")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["variantSetId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ImportVariantsRequest) -> VariantsetImportVariantCall<'a, C, A> { - self._request = new_value; - self - } - /// Required. The variant set to which variant data should be imported. - /// - /// Sets the *variant set id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn variant_set_id(mut self, new_value: &str) -> VariantsetImportVariantCall<'a, C, A> { - self._variant_set_id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VariantsetImportVariantCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VariantsetImportVariantCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DevstorageReadWrite`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VariantsetImportVariantCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - diff --git a/gen/gmail1-cli/Cargo.toml b/gen/gmail1-cli/Cargo.toml index e229f23575..f93f200bb4 100644 --- a/gen/gmail1-cli/Cargo.toml +++ b/gen/gmail1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gmail1-cli" -version = "0.3.2+20150910" +version = "0.3.3+20151214" authors = ["Sebastian Thiel "] description = "A complete library to interact with gmail (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gmail1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/gmail1-cli/LICENSE.md b/gen/gmail1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/gmail1-cli/LICENSE.md +++ b/gen/gmail1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/gmail1-cli/README.md b/gen/gmail1-cli/README.md index c230e511bc..25f3b8f4d7 100644 --- a/gen/gmail1-cli/README.md +++ b/gen/gmail1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *gmail* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/gmail1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/gmail1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/gmail1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/gmail1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/gmail1-cli). # Usage -This documentation was generated from the *gmail* API at revision *20150910*. The CLI is at version *0.3.2*. +This documentation was generated from the *gmail* API at revision *20151214*. The CLI is at version *0.3.3*. ```bash gmail1 [options] @@ -65,18 +65,18 @@ gmail1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/gmail1-cli/mkdocs.yml b/gen/gmail1-cli/mkdocs.yml index fdb690e2b8..5429ff445c 100644 --- a/gen/gmail1-cli/mkdocs.yml +++ b/gen/gmail1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: gmail v0.3.2+20150910 +site_name: gmail v0.3.3+20151214 site_url: http://byron.github.io/google-apis-rs/google-gmail1-cli site_description: Write integrating applications with bcore @@ -44,5 +44,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/gmail1-cli/src/main.rs b/gen/gmail1-cli/src/main.rs index 8f76683ab8..fbceb3f99e 100644 --- a/gen/gmail1-cli/src/main.rs +++ b/gen/gmail1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Gmail>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _users_drafts_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _users_drafts_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "message.internal-date" => Some(("message.internalDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "message.history-id" => Some(("message.historyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -95,7 +95,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Draft = json::value::from_value(object).unwrap(); let mut call = self.hub.users().drafts_create(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -108,7 +108,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -116,7 +116,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -124,7 +124,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -148,10 +148,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_drafts_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_drafts_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().drafts_delete(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -164,7 +164,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -177,7 +177,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -192,10 +192,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_drafts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_drafts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().drafts_get(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "format" => { @@ -211,7 +211,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["format"].iter().map(|v|*v)); @@ -225,7 +225,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -248,10 +248,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_drafts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_drafts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().drafts_list(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -270,7 +270,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -284,7 +284,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -307,13 +307,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_drafts_send(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_drafts_send(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -327,8 +327,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "message.internal-date" => Some(("message.internalDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "message.history-id" => Some(("message.historyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -357,7 +357,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Draft = json::value::from_value(object).unwrap(); let mut call = self.hub.users().drafts_send(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -370,7 +370,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -378,7 +378,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -386,7 +386,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -410,13 +410,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_drafts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_drafts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -430,8 +430,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "message.internal-date" => Some(("message.internalDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "message.history-id" => Some(("message.historyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -460,7 +460,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Draft = json::value::from_value(object).unwrap(); let mut call = self.hub.users().drafts_update(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -473,7 +473,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -481,7 +481,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -489,7 +489,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -513,10 +513,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_get_profile(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_get_profile(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().get_profile(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -529,7 +529,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -542,7 +542,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -565,10 +565,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_history_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_history_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().history_list(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-history-id" => { @@ -593,7 +593,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "label-id", "start-history-id", "max-results"].iter().map(|v|*v)); @@ -607,7 +607,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -630,13 +630,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_labels_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_labels_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -650,8 +650,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "messages-total" => Some(("messagesTotal", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -674,7 +674,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Label = json::value::from_value(object).unwrap(); let mut call = self.hub.users().labels_create(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -687,7 +687,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -700,7 +700,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -723,10 +723,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_labels_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_labels_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().labels_delete(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -739,7 +739,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -752,7 +752,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -767,10 +767,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_labels_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_labels_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().labels_get(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -783,7 +783,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -796,7 +796,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -819,10 +819,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_labels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_labels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().labels_list(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -835,7 +835,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -848,7 +848,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -871,13 +871,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_labels_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_labels_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -891,8 +891,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "messages-total" => Some(("messagesTotal", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -915,7 +915,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Label = json::value::from_value(object).unwrap(); let mut call = self.hub.users().labels_patch(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -928,7 +928,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -941,7 +941,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -964,13 +964,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_labels_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_labels_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -984,8 +984,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "messages-total" => Some(("messagesTotal", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -1008,7 +1008,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Label = json::value::from_value(object).unwrap(); let mut call = self.hub.users().labels_update(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1021,7 +1021,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1034,7 +1034,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1057,10 +1057,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_messages_attachments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_messages_attachments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().messages_attachments_get(opt.value_of("user-id").unwrap_or(""), opt.value_of("message-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1073,7 +1073,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1086,7 +1086,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1109,10 +1109,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_messages_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_messages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().messages_delete(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1125,7 +1125,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1138,7 +1138,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1153,10 +1153,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_messages_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_messages_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().messages_get(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "metadata-headers" => { @@ -1175,7 +1175,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["metadata-headers", "format"].iter().map(|v|*v)); @@ -1189,7 +1189,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1212,13 +1212,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_messages_import(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_messages_import(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1232,8 +1232,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "internal-date" => Some(("internalDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "history-id" => Some(("historyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1261,7 +1261,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Message = json::value::from_value(object).unwrap(); let mut call = self.hub.users().messages_import(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "process-for-calendar" => { @@ -1286,7 +1286,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["process-for-calendar", "deleted", "internal-date-source", "never-mark-spam"].iter().map(|v|*v)); @@ -1295,7 +1295,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1303,7 +1303,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1327,13 +1327,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_messages_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_messages_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1347,8 +1347,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "internal-date" => Some(("internalDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "history-id" => Some(("historyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1376,7 +1376,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Message = json::value::from_value(object).unwrap(); let mut call = self.hub.users().messages_insert(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "internal-date-source" => { @@ -1395,7 +1395,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["deleted", "internal-date-source"].iter().map(|v|*v)); @@ -1404,7 +1404,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1412,7 +1412,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1436,10 +1436,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_messages_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_messages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().messages_list(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "q" => { @@ -1467,7 +1467,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["q", "page-token", "include-spam-trash", "max-results", "label-ids"].iter().map(|v|*v)); @@ -1481,7 +1481,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1504,13 +1504,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_messages_modify(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_messages_modify(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1524,8 +1524,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "remove-label-ids" => Some(("removeLabelIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "add-label-ids" => Some(("addLabelIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1541,7 +1541,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ModifyMessageRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.users().messages_modify(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1554,7 +1554,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1567,7 +1567,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1590,13 +1590,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_messages_send(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_messages_send(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1610,8 +1610,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "internal-date" => Some(("internalDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "history-id" => Some(("historyId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1639,7 +1639,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Message = json::value::from_value(object).unwrap(); let mut call = self.hub.users().messages_send(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1652,7 +1652,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1660,7 +1660,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1668,7 +1668,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1692,10 +1692,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_messages_trash(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_messages_trash(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().messages_trash(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1708,7 +1708,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1721,7 +1721,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1744,10 +1744,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_messages_untrash(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_messages_untrash(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().messages_untrash(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1760,7 +1760,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1773,7 +1773,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1796,10 +1796,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_stop(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_stop(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().stop(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1812,7 +1812,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1825,7 +1825,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1840,10 +1840,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_threads_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_threads_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().threads_delete(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1856,7 +1856,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1869,7 +1869,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1884,10 +1884,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_threads_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_threads_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().threads_get(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "metadata-headers" => { @@ -1906,7 +1906,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["metadata-headers", "format"].iter().map(|v|*v)); @@ -1920,7 +1920,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1943,10 +1943,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_threads_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_threads_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().threads_list(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "q" => { @@ -1974,7 +1974,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["q", "page-token", "include-spam-trash", "max-results", "label-ids"].iter().map(|v|*v)); @@ -1988,7 +1988,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2011,13 +2011,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_threads_modify(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_threads_modify(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2031,8 +2031,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "remove-label-ids" => Some(("removeLabelIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "add-label-ids" => Some(("addLabelIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2048,7 +2048,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ModifyThreadRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.users().threads_modify(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2061,7 +2061,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2074,7 +2074,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2097,10 +2097,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_threads_trash(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_threads_trash(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().threads_trash(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2113,7 +2113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2126,7 +2126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2149,10 +2149,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_threads_untrash(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_threads_untrash(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().threads_untrash(opt.value_of("user-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2165,7 +2165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2178,7 +2178,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2201,13 +2201,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_watch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_watch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2221,8 +2221,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "label-ids" => Some(("labelIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "topic-name" => Some(("topicName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2239,7 +2239,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::WatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.users().watch(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2252,7 +2252,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2265,7 +2265,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2414,14 +2414,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "gmail1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "gmail1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -2441,7 +2441,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -2481,7 +2481,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("users", "methods: 'drafts-create', 'drafts-delete', 'drafts-get', 'drafts-list', 'drafts-send', 'drafts-update', 'get-profile', 'history-list', 'labels-create', 'labels-delete', 'labels-get', 'labels-list', 'labels-patch', 'labels-update', 'messages-attachments-get', 'messages-delete', 'messages-get', 'messages-import', 'messages-insert', 'messages-list', 'messages-modify', 'messages-send', 'messages-trash', 'messages-untrash', 'stop', 'threads-delete', 'threads-get', 'threads-list', 'threads-modify', 'threads-trash', 'threads-untrash' and 'watch'", vec![ - ("drafts-create", + ("drafts-create", Some(r##"Creates a new draft with the DRAFT label."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_drafts-create", vec![ @@ -2515,7 +2515,7 @@ fn main() { Some(false), Some(false)), ]), - ("drafts-delete", + ("drafts-delete", Some(r##"Immediately and permanently deletes the specified draft. Does not simply trash it."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_drafts-delete", vec![ @@ -2537,7 +2537,7 @@ fn main() { Some(false), Some(true)), ]), - ("drafts-get", + ("drafts-get", Some(r##"Gets the specified draft."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_drafts-get", vec![ @@ -2565,7 +2565,7 @@ fn main() { Some(false), Some(false)), ]), - ("drafts-list", + ("drafts-list", Some(r##"Lists the drafts in the user's mailbox."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_drafts-list", vec![ @@ -2587,7 +2587,7 @@ fn main() { Some(false), Some(false)), ]), - ("drafts-send", + ("drafts-send", Some(r##"Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_drafts-send", vec![ @@ -2621,7 +2621,7 @@ fn main() { Some(false), Some(false)), ]), - ("drafts-update", + ("drafts-update", Some(r##"Replaces a draft's content."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_drafts-update", vec![ @@ -2661,7 +2661,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-profile", + ("get-profile", Some(r##"Gets the current user's Gmail profile."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_get-profile", vec![ @@ -2683,7 +2683,7 @@ fn main() { Some(false), Some(false)), ]), - ("history-list", + ("history-list", Some(r##"Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing historyId)."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_history-list", vec![ @@ -2705,7 +2705,7 @@ fn main() { Some(false), Some(false)), ]), - ("labels-create", + ("labels-create", Some(r##"Creates a new label."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_labels-create", vec![ @@ -2733,7 +2733,7 @@ fn main() { Some(false), Some(false)), ]), - ("labels-delete", + ("labels-delete", Some(r##"Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_labels-delete", vec![ @@ -2755,7 +2755,7 @@ fn main() { Some(false), Some(true)), ]), - ("labels-get", + ("labels-get", Some(r##"Gets the specified label."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_labels-get", vec![ @@ -2783,7 +2783,7 @@ fn main() { Some(false), Some(false)), ]), - ("labels-list", + ("labels-list", Some(r##"Lists all labels in the user's mailbox."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_labels-list", vec![ @@ -2805,7 +2805,7 @@ fn main() { Some(false), Some(false)), ]), - ("labels-patch", + ("labels-patch", Some(r##"Updates the specified label. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_labels-patch", vec![ @@ -2839,7 +2839,7 @@ fn main() { Some(false), Some(false)), ]), - ("labels-update", + ("labels-update", Some(r##"Updates the specified label."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_labels-update", vec![ @@ -2873,7 +2873,7 @@ fn main() { Some(false), Some(false)), ]), - ("messages-attachments-get", + ("messages-attachments-get", Some(r##"Gets the specified message attachment."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-attachments-get", vec![ @@ -2907,7 +2907,7 @@ fn main() { Some(false), Some(false)), ]), - ("messages-delete", + ("messages-delete", Some(r##"Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-delete", vec![ @@ -2929,7 +2929,7 @@ fn main() { Some(false), Some(true)), ]), - ("messages-get", + ("messages-get", Some(r##"Gets the specified message."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-get", vec![ @@ -2957,7 +2957,7 @@ fn main() { Some(false), Some(false)), ]), - ("messages-import", + ("messages-import", Some(r##"Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. Does not send a message."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-import", vec![ @@ -2991,7 +2991,7 @@ fn main() { Some(false), Some(false)), ]), - ("messages-insert", + ("messages-insert", Some(r##"Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-insert", vec![ @@ -3025,7 +3025,7 @@ fn main() { Some(false), Some(false)), ]), - ("messages-list", + ("messages-list", Some(r##"Lists the messages in the user's mailbox."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-list", vec![ @@ -3047,7 +3047,7 @@ fn main() { Some(false), Some(false)), ]), - ("messages-modify", + ("messages-modify", Some(r##"Modifies the labels on the specified message."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-modify", vec![ @@ -3081,7 +3081,7 @@ fn main() { Some(false), Some(false)), ]), - ("messages-send", + ("messages-send", Some(r##"Sends the specified message to the recipients in the To, Cc, and Bcc headers."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-send", vec![ @@ -3115,7 +3115,7 @@ fn main() { Some(false), Some(false)), ]), - ("messages-trash", + ("messages-trash", Some(r##"Moves the specified message to the trash."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-trash", vec![ @@ -3143,7 +3143,7 @@ fn main() { Some(false), Some(false)), ]), - ("messages-untrash", + ("messages-untrash", Some(r##"Removes the specified message from the trash."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_messages-untrash", vec![ @@ -3171,7 +3171,7 @@ fn main() { Some(false), Some(false)), ]), - ("stop", + ("stop", Some(r##"Stop receiving push notifications for the given user mailbox."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_stop", vec![ @@ -3187,7 +3187,7 @@ fn main() { Some(false), Some(true)), ]), - ("threads-delete", + ("threads-delete", Some(r##"Immediately and permanently deletes the specified thread. This operation cannot be undone. Prefer threads.trash instead."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_threads-delete", vec![ @@ -3209,7 +3209,7 @@ fn main() { Some(false), Some(true)), ]), - ("threads-get", + ("threads-get", Some(r##"Gets the specified thread."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_threads-get", vec![ @@ -3237,7 +3237,7 @@ fn main() { Some(false), Some(false)), ]), - ("threads-list", + ("threads-list", Some(r##"Lists the threads in the user's mailbox."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_threads-list", vec![ @@ -3259,7 +3259,7 @@ fn main() { Some(false), Some(false)), ]), - ("threads-modify", + ("threads-modify", Some(r##"Modifies the labels applied to the thread. This applies to all messages in the thread."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_threads-modify", vec![ @@ -3293,7 +3293,7 @@ fn main() { Some(false), Some(false)), ]), - ("threads-trash", + ("threads-trash", Some(r##"Moves the specified thread to the trash."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_threads-trash", vec![ @@ -3321,7 +3321,7 @@ fn main() { Some(false), Some(false)), ]), - ("threads-untrash", + ("threads-untrash", Some(r##"Removes the specified thread from the trash."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_threads-untrash", vec![ @@ -3349,7 +3349,7 @@ fn main() { Some(false), Some(false)), ]), - ("watch", + ("watch", Some(r##"Set up or update a push notification watch on the given user mailbox."##), "Details at http://byron.github.io/google-apis-rs/google_gmail1_cli/users_watch", vec![ @@ -3383,7 +3383,7 @@ fn main() { let mut app = App::new("gmail1") .author("Sebastian Thiel ") - .version("0.3.2+20150910") + .version("0.3.3+20151214") .about("The Gmail REST API.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_gmail1_cli") .arg(Arg::with_name("url") @@ -3407,7 +3407,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -3418,7 +3418,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/gmail1/Cargo.toml b/gen/gmail1/Cargo.toml index 31fe30b961..6d2fe0212d 100644 --- a/gen/gmail1/Cargo.toml +++ b/gen/gmail1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gmail1" -version = "0.1.10+20150910" +version = "0.1.11+20151214" authors = ["Sebastian Thiel "] description = "A complete library to interact with gmail (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/gmail1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/gmail1/LICENSE.md b/gen/gmail1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/gmail1/LICENSE.md +++ b/gen/gmail1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/gmail1/README.md b/gen/gmail1/README.md index 48da0bfa47..272722c6ba 100644 --- a/gen/gmail1/README.md +++ b/gen/gmail1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-gmail1` library allows access to all features of the *Google gmail* service. -This documentation was generated from *gmail* crate version *0.1.10+20150910*, where *20150910* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *gmail* crate version *0.1.11+20151214*, where *20151214* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *gmail* *v1* API can be found at the [official documentation site](https://developers.google.com/gmail/api/). diff --git a/gen/gmail1/src/cmn.rs b/gen/gmail1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/gmail1/src/cmn.rs +++ b/gen/gmail1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/gmail1/src/lib.rs b/gen/gmail1/src/lib.rs index abcdf5d2a5..139ec142a8 100644 --- a/gen/gmail1/src/lib.rs +++ b/gen/gmail1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *gmail* crate version *0.1.10+20150910*, where *20150910* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *gmail* crate version *0.1.11+20151214*, where *20151214* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *gmail* *v1* API can be found at the //! [official documentation site](https://developers.google.com/gmail/api/). diff --git a/gen/gmail1/src/lib.rs.in b/gen/gmail1/src/lib.rs.in index 9868a101f7..dc8c98efc7 100644 --- a/gen/gmail1/src/lib.rs.in +++ b/gen/gmail1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -161,7 +162,7 @@ impl<'a, C, A> Gmail Gmail { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -170,7 +171,7 @@ impl<'a, C, A> Gmail } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -565,7 +566,7 @@ pub struct WatchRequest { /// List of label_ids to restrict notifications about. By default, if unspecified, all changes are pushed out. If specified then dictates which labels are required for a push notification to be generated. #[serde(rename="labelIds")] pub label_ids: Option>, - /// A fully qualified Google Cloud Pub/Sub API topic name to publish the events to. This topic name **must** already exist in Cloud Pub/Sub and you **must** have already granted gmail "publish" permission on it. For example, "projects/my-project-identifier/topics/my-topic-name" (using the new Cloud Pub/Sub "v1beta2" topic naming format). + /// A fully qualified Google Cloud Pub/Sub API topic name to publish the events to. This topic name **must** already exist in Cloud Pub/Sub and you **must** have already granted gmail "publish" permission on it. For example, "projects/my-project-identifier/topics/my-topic-name" (using the Cloud Pub/Sub "v1" topic naming format). /// /// Note that the "my-project-identifier" portion must exactly match your Google developer project id (the one executing this watch request). #[serde(rename="topicName")] @@ -1452,7 +1453,7 @@ impl<'a, C, A> UserStopCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.stop", + dlg.begin(MethodInfo { id: "gmail.users.stop", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -1493,7 +1494,7 @@ impl<'a, C, A> UserStopCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1529,7 +1530,7 @@ impl<'a, C, A> UserStopCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1539,10 +1540,10 @@ impl<'a, C, A> UserStopCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1565,7 +1566,7 @@ impl<'a, C, A> UserStopCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserStopCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -1583,12 +1584,12 @@ impl<'a, C, A> UserStopCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1605,17 +1606,17 @@ impl<'a, C, A> UserStopCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserStopCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserStopCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1694,7 +1695,7 @@ impl<'a, C, A> UserMessageImportCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.messages.import", + dlg.begin(MethodInfo { id: "gmail.users.messages.import", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -1722,13 +1723,13 @@ impl<'a, C, A> UserMessageImportCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/gmail/v1/users/{userId}/messages/import".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/gmail/v1/users/{userId}/messages/import".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -1756,14 +1757,14 @@ impl<'a, C, A> UserMessageImportCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1840,7 +1841,7 @@ impl<'a, C, A> UserMessageImportCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1850,10 +1851,10 @@ impl<'a, C, A> UserMessageImportCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1956,7 +1957,7 @@ impl<'a, C, A> UserMessageImportCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Message) -> UserMessageImportCall<'a, C, A> { self._request = new_value; @@ -1966,7 +1967,7 @@ impl<'a, C, A> UserMessageImportCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserMessageImportCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2012,12 +2013,12 @@ impl<'a, C, A> UserMessageImportCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2034,17 +2035,17 @@ impl<'a, C, A> UserMessageImportCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserMessageImportCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMessageImportCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2114,7 +2115,7 @@ impl<'a, C, A> UserHistoryListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.history.list", + dlg.begin(MethodInfo { id: "gmail.users.history.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -2168,7 +2169,7 @@ impl<'a, C, A> UserHistoryListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2204,7 +2205,7 @@ impl<'a, C, A> UserHistoryListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2214,10 +2215,10 @@ impl<'a, C, A> UserHistoryListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2250,7 +2251,7 @@ impl<'a, C, A> UserHistoryListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserHistoryListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2296,12 +2297,12 @@ impl<'a, C, A> UserHistoryListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2318,17 +2319,17 @@ impl<'a, C, A> UserHistoryListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserHistoryListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserHistoryListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2399,7 +2400,7 @@ impl<'a, C, A> UserDraftCreateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.drafts.create", + dlg.begin(MethodInfo { id: "gmail.users.drafts.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -2415,13 +2416,13 @@ impl<'a, C, A> UserDraftCreateCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/gmail/v1/users/{userId}/drafts".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/gmail/v1/users/{userId}/drafts".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -2449,14 +2450,14 @@ impl<'a, C, A> UserDraftCreateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2533,7 +2534,7 @@ impl<'a, C, A> UserDraftCreateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2543,10 +2544,10 @@ impl<'a, C, A> UserDraftCreateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2649,7 +2650,7 @@ impl<'a, C, A> UserDraftCreateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Draft) -> UserDraftCreateCall<'a, C, A> { self._request = new_value; @@ -2659,7 +2660,7 @@ impl<'a, C, A> UserDraftCreateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserDraftCreateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2677,12 +2678,12 @@ impl<'a, C, A> UserDraftCreateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2699,17 +2700,17 @@ impl<'a, C, A> UserDraftCreateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserDraftCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDraftCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2778,7 +2779,7 @@ impl<'a, C, A> UserLabelCreateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.labels.create", + dlg.begin(MethodInfo { id: "gmail.users.labels.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -2820,14 +2821,14 @@ impl<'a, C, A> UserLabelCreateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2871,7 +2872,7 @@ impl<'a, C, A> UserLabelCreateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2881,10 +2882,10 @@ impl<'a, C, A> UserLabelCreateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2916,7 +2917,7 @@ impl<'a, C, A> UserLabelCreateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Label) -> UserLabelCreateCall<'a, C, A> { self._request = new_value; @@ -2926,7 +2927,7 @@ impl<'a, C, A> UserLabelCreateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserLabelCreateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2944,12 +2945,12 @@ impl<'a, C, A> UserLabelCreateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2966,17 +2967,17 @@ impl<'a, C, A> UserLabelCreateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserLabelCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserLabelCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3039,7 +3040,7 @@ impl<'a, C, A> UserLabelDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.labels.delete", + dlg.begin(MethodInfo { id: "gmail.users.labels.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -3081,7 +3082,7 @@ impl<'a, C, A> UserLabelDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3117,7 +3118,7 @@ impl<'a, C, A> UserLabelDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3127,10 +3128,10 @@ impl<'a, C, A> UserLabelDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3153,7 +3154,7 @@ impl<'a, C, A> UserLabelDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserLabelDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3163,7 +3164,7 @@ impl<'a, C, A> UserLabelDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserLabelDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -3181,12 +3182,12 @@ impl<'a, C, A> UserLabelDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3203,17 +3204,17 @@ impl<'a, C, A> UserLabelDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserLabelDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserLabelDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3276,7 +3277,7 @@ impl<'a, C, A> UserLabelGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.labels.get", + dlg.begin(MethodInfo { id: "gmail.users.labels.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -3319,7 +3320,7 @@ impl<'a, C, A> UserLabelGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3355,7 +3356,7 @@ impl<'a, C, A> UserLabelGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3365,10 +3366,10 @@ impl<'a, C, A> UserLabelGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3401,7 +3402,7 @@ impl<'a, C, A> UserLabelGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserLabelGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3411,7 +3412,7 @@ impl<'a, C, A> UserLabelGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserLabelGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -3429,12 +3430,12 @@ impl<'a, C, A> UserLabelGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3451,17 +3452,17 @@ impl<'a, C, A> UserLabelGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserLabelGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserLabelGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3524,7 +3525,7 @@ impl<'a, C, A> UserMessageTrashCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.messages.trash", + dlg.begin(MethodInfo { id: "gmail.users.messages.trash", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -3567,7 +3568,7 @@ impl<'a, C, A> UserMessageTrashCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3603,7 +3604,7 @@ impl<'a, C, A> UserMessageTrashCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3613,10 +3614,10 @@ impl<'a, C, A> UserMessageTrashCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3649,7 +3650,7 @@ impl<'a, C, A> UserMessageTrashCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserMessageTrashCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3659,7 +3660,7 @@ impl<'a, C, A> UserMessageTrashCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserMessageTrashCall<'a, C, A> { self._id = new_value.to_string(); @@ -3677,12 +3678,12 @@ impl<'a, C, A> UserMessageTrashCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3699,17 +3700,17 @@ impl<'a, C, A> UserMessageTrashCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserMessageTrashCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMessageTrashCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3780,7 +3781,7 @@ impl<'a, C, A> UserDraftSendCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.drafts.send", + dlg.begin(MethodInfo { id: "gmail.users.drafts.send", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -3796,13 +3797,13 @@ impl<'a, C, A> UserDraftSendCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/gmail/v1/users/{userId}/drafts/send".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/gmail/v1/users/{userId}/drafts/send".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -3830,14 +3831,14 @@ impl<'a, C, A> UserDraftSendCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3914,7 +3915,7 @@ impl<'a, C, A> UserDraftSendCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3924,10 +3925,10 @@ impl<'a, C, A> UserDraftSendCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4030,7 +4031,7 @@ impl<'a, C, A> UserDraftSendCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Draft) -> UserDraftSendCall<'a, C, A> { self._request = new_value; @@ -4040,7 +4041,7 @@ impl<'a, C, A> UserDraftSendCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserDraftSendCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4058,12 +4059,12 @@ impl<'a, C, A> UserDraftSendCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4080,17 +4081,17 @@ impl<'a, C, A> UserDraftSendCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserDraftSendCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDraftSendCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4153,7 +4154,7 @@ impl<'a, C, A> UserMessageUntrashCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.messages.untrash", + dlg.begin(MethodInfo { id: "gmail.users.messages.untrash", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -4196,7 +4197,7 @@ impl<'a, C, A> UserMessageUntrashCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4232,7 +4233,7 @@ impl<'a, C, A> UserMessageUntrashCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4242,10 +4243,10 @@ impl<'a, C, A> UserMessageUntrashCall<'a, C, A> where C: BorrowMut UserMessageUntrashCall<'a, C, A> where C: BorrowMut UserMessageUntrashCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4288,7 +4289,7 @@ impl<'a, C, A> UserMessageUntrashCall<'a, C, A> where C: BorrowMut UserMessageUntrashCall<'a, C, A> { self._id = new_value.to_string(); @@ -4306,12 +4307,12 @@ impl<'a, C, A> UserMessageUntrashCall<'a, C, A> where C: BorrowMut UserMessageUntrashCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserMessageUntrashCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMessageUntrashCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4400,7 +4401,7 @@ impl<'a, C, A> UserLabelListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.labels.list", + dlg.begin(MethodInfo { id: "gmail.users.labels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -4442,7 +4443,7 @@ impl<'a, C, A> UserLabelListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4478,7 +4479,7 @@ impl<'a, C, A> UserLabelListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4488,10 +4489,10 @@ impl<'a, C, A> UserLabelListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4524,7 +4525,7 @@ impl<'a, C, A> UserLabelListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserLabelListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4542,12 +4543,12 @@ impl<'a, C, A> UserLabelListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4564,17 +4565,17 @@ impl<'a, C, A> UserLabelListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserLabelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserLabelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4637,7 +4638,7 @@ impl<'a, C, A> UserMessageDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.messages.delete", + dlg.begin(MethodInfo { id: "gmail.users.messages.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -4679,7 +4680,7 @@ impl<'a, C, A> UserMessageDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4715,7 +4716,7 @@ impl<'a, C, A> UserMessageDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4725,10 +4726,10 @@ impl<'a, C, A> UserMessageDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4751,7 +4752,7 @@ impl<'a, C, A> UserMessageDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserMessageDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4761,7 +4762,7 @@ impl<'a, C, A> UserMessageDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserMessageDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -4779,12 +4780,12 @@ impl<'a, C, A> UserMessageDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4801,17 +4802,17 @@ impl<'a, C, A> UserMessageDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserMessageDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMessageDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4883,7 +4884,7 @@ impl<'a, C, A> UserDraftUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.drafts.update", + dlg.begin(MethodInfo { id: "gmail.users.drafts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -4900,13 +4901,13 @@ impl<'a, C, A> UserDraftUpdateCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/gmail/v1/users/{userId}/drafts/{id}".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/gmail/v1/users/{userId}/drafts/{id}".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -4934,14 +4935,14 @@ impl<'a, C, A> UserDraftUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5018,7 +5019,7 @@ impl<'a, C, A> UserDraftUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5028,10 +5029,10 @@ impl<'a, C, A> UserDraftUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5134,7 +5135,7 @@ impl<'a, C, A> UserDraftUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Draft) -> UserDraftUpdateCall<'a, C, A> { self._request = new_value; @@ -5144,7 +5145,7 @@ impl<'a, C, A> UserDraftUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserDraftUpdateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5154,7 +5155,7 @@ impl<'a, C, A> UserDraftUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserDraftUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -5172,12 +5173,12 @@ impl<'a, C, A> UserDraftUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5194,17 +5195,17 @@ impl<'a, C, A> UserDraftUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserDraftUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDraftUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5269,7 +5270,7 @@ impl<'a, C, A> UserDraftGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.drafts.get", + dlg.begin(MethodInfo { id: "gmail.users.drafts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -5315,7 +5316,7 @@ impl<'a, C, A> UserDraftGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5351,7 +5352,7 @@ impl<'a, C, A> UserDraftGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5361,10 +5362,10 @@ impl<'a, C, A> UserDraftGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5397,7 +5398,7 @@ impl<'a, C, A> UserDraftGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserDraftGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5407,7 +5408,7 @@ impl<'a, C, A> UserDraftGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserDraftGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -5432,12 +5433,12 @@ impl<'a, C, A> UserDraftGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5454,17 +5455,17 @@ impl<'a, C, A> UserDraftGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserDraftGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDraftGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5534,7 +5535,7 @@ impl<'a, C, A> UserLabelUpdateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.labels.update", + dlg.begin(MethodInfo { id: "gmail.users.labels.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -5577,14 +5578,14 @@ impl<'a, C, A> UserLabelUpdateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5628,7 +5629,7 @@ impl<'a, C, A> UserLabelUpdateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5638,10 +5639,10 @@ impl<'a, C, A> UserLabelUpdateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5673,7 +5674,7 @@ impl<'a, C, A> UserLabelUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Label) -> UserLabelUpdateCall<'a, C, A> { self._request = new_value; @@ -5683,7 +5684,7 @@ impl<'a, C, A> UserLabelUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserLabelUpdateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5693,7 +5694,7 @@ impl<'a, C, A> UserLabelUpdateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserLabelUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -5711,12 +5712,12 @@ impl<'a, C, A> UserLabelUpdateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5733,17 +5734,17 @@ impl<'a, C, A> UserLabelUpdateCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserLabelUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserLabelUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5806,7 +5807,7 @@ impl<'a, C, A> UserThreadUntrashCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.threads.untrash", + dlg.begin(MethodInfo { id: "gmail.users.threads.untrash", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -5849,7 +5850,7 @@ impl<'a, C, A> UserThreadUntrashCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5885,7 +5886,7 @@ impl<'a, C, A> UserThreadUntrashCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5895,10 +5896,10 @@ impl<'a, C, A> UserThreadUntrashCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5931,7 +5932,7 @@ impl<'a, C, A> UserThreadUntrashCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserThreadUntrashCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5941,7 +5942,7 @@ impl<'a, C, A> UserThreadUntrashCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserThreadUntrashCall<'a, C, A> { self._id = new_value.to_string(); @@ -5959,12 +5960,12 @@ impl<'a, C, A> UserThreadUntrashCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5981,17 +5982,17 @@ impl<'a, C, A> UserThreadUntrashCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserThreadUntrashCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserThreadUntrashCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6061,7 +6062,7 @@ impl<'a, C, A> UserLabelPatchCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.labels.patch", + dlg.begin(MethodInfo { id: "gmail.users.labels.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -6104,14 +6105,14 @@ impl<'a, C, A> UserLabelPatchCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6155,7 +6156,7 @@ impl<'a, C, A> UserLabelPatchCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6165,10 +6166,10 @@ impl<'a, C, A> UserLabelPatchCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6200,7 +6201,7 @@ impl<'a, C, A> UserLabelPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Label) -> UserLabelPatchCall<'a, C, A> { self._request = new_value; @@ -6210,7 +6211,7 @@ impl<'a, C, A> UserLabelPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserLabelPatchCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -6220,7 +6221,7 @@ impl<'a, C, A> UserLabelPatchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserLabelPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -6238,12 +6239,12 @@ impl<'a, C, A> UserLabelPatchCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6260,17 +6261,17 @@ impl<'a, C, A> UserLabelPatchCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserLabelPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserLabelPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6333,7 +6334,7 @@ impl<'a, C, A> UserDraftDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.drafts.delete", + dlg.begin(MethodInfo { id: "gmail.users.drafts.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -6375,7 +6376,7 @@ impl<'a, C, A> UserDraftDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6411,7 +6412,7 @@ impl<'a, C, A> UserDraftDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6421,10 +6422,10 @@ impl<'a, C, A> UserDraftDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6447,7 +6448,7 @@ impl<'a, C, A> UserDraftDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserDraftDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -6457,7 +6458,7 @@ impl<'a, C, A> UserDraftDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserDraftDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -6475,12 +6476,12 @@ impl<'a, C, A> UserDraftDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6497,17 +6498,17 @@ impl<'a, C, A> UserDraftDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserDraftDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDraftDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6579,7 +6580,7 @@ impl<'a, C, A> UserThreadListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.threads.list", + dlg.begin(MethodInfo { id: "gmail.users.threads.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -6640,7 +6641,7 @@ impl<'a, C, A> UserThreadListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6676,7 +6677,7 @@ impl<'a, C, A> UserThreadListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6686,10 +6687,10 @@ impl<'a, C, A> UserThreadListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6722,7 +6723,7 @@ impl<'a, C, A> UserThreadListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserThreadListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -6776,12 +6777,12 @@ impl<'a, C, A> UserThreadListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6798,17 +6799,17 @@ impl<'a, C, A> UserThreadListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserThreadListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserThreadListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6878,7 +6879,7 @@ impl<'a, C, A> UserThreadModifyCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.threads.modify", + dlg.begin(MethodInfo { id: "gmail.users.threads.modify", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -6921,14 +6922,14 @@ impl<'a, C, A> UserThreadModifyCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6972,7 +6973,7 @@ impl<'a, C, A> UserThreadModifyCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6982,10 +6983,10 @@ impl<'a, C, A> UserThreadModifyCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7017,7 +7018,7 @@ impl<'a, C, A> UserThreadModifyCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ModifyThreadRequest) -> UserThreadModifyCall<'a, C, A> { self._request = new_value; @@ -7027,7 +7028,7 @@ impl<'a, C, A> UserThreadModifyCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserThreadModifyCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -7037,7 +7038,7 @@ impl<'a, C, A> UserThreadModifyCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserThreadModifyCall<'a, C, A> { self._id = new_value.to_string(); @@ -7055,12 +7056,12 @@ impl<'a, C, A> UserThreadModifyCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7077,17 +7078,17 @@ impl<'a, C, A> UserThreadModifyCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserThreadModifyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserThreadModifyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7150,7 +7151,7 @@ impl<'a, C, A> UserThreadDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.threads.delete", + dlg.begin(MethodInfo { id: "gmail.users.threads.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -7192,7 +7193,7 @@ impl<'a, C, A> UserThreadDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7228,7 +7229,7 @@ impl<'a, C, A> UserThreadDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7238,10 +7239,10 @@ impl<'a, C, A> UserThreadDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7264,7 +7265,7 @@ impl<'a, C, A> UserThreadDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserThreadDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -7274,7 +7275,7 @@ impl<'a, C, A> UserThreadDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserThreadDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -7292,12 +7293,12 @@ impl<'a, C, A> UserThreadDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7314,17 +7315,17 @@ impl<'a, C, A> UserThreadDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserThreadDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserThreadDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7388,7 +7389,7 @@ impl<'a, C, A> UserMessageAttachmentGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.messages.attachments.get", + dlg.begin(MethodInfo { id: "gmail.users.messages.attachments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -7432,7 +7433,7 @@ impl<'a, C, A> UserMessageAttachmentGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7468,7 +7469,7 @@ impl<'a, C, A> UserMessageAttachmentGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7478,10 +7479,10 @@ impl<'a, C, A> UserMessageAttachmentGetCall<'a, C, A> where C: BorrowMut UserMessageAttachmentGetCall<'a, C, A> where C: BorrowMut UserMessageAttachmentGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -7524,7 +7525,7 @@ impl<'a, C, A> UserMessageAttachmentGetCall<'a, C, A> where C: BorrowMut UserMessageAttachmentGetCall<'a, C, A> { self._message_id = new_value.to_string(); @@ -7534,7 +7535,7 @@ impl<'a, C, A> UserMessageAttachmentGetCall<'a, C, A> where C: BorrowMut UserMessageAttachmentGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -7552,12 +7553,12 @@ impl<'a, C, A> UserMessageAttachmentGetCall<'a, C, A> where C: BorrowMut UserMessageAttachmentGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UserMessageAttachmentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMessageAttachmentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7654,7 +7655,7 @@ impl<'a, C, A> UserMessageModifyCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.messages.modify", + dlg.begin(MethodInfo { id: "gmail.users.messages.modify", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -7697,14 +7698,14 @@ impl<'a, C, A> UserMessageModifyCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7748,7 +7749,7 @@ impl<'a, C, A> UserMessageModifyCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7758,10 +7759,10 @@ impl<'a, C, A> UserMessageModifyCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7793,7 +7794,7 @@ impl<'a, C, A> UserMessageModifyCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ModifyMessageRequest) -> UserMessageModifyCall<'a, C, A> { self._request = new_value; @@ -7803,7 +7804,7 @@ impl<'a, C, A> UserMessageModifyCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserMessageModifyCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -7813,7 +7814,7 @@ impl<'a, C, A> UserMessageModifyCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserMessageModifyCall<'a, C, A> { self._id = new_value.to_string(); @@ -7831,12 +7832,12 @@ impl<'a, C, A> UserMessageModifyCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7853,17 +7854,17 @@ impl<'a, C, A> UserMessageModifyCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserMessageModifyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMessageModifyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7926,7 +7927,7 @@ impl<'a, C, A> UserThreadTrashCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.threads.trash", + dlg.begin(MethodInfo { id: "gmail.users.threads.trash", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -7969,7 +7970,7 @@ impl<'a, C, A> UserThreadTrashCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8005,7 +8006,7 @@ impl<'a, C, A> UserThreadTrashCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8015,10 +8016,10 @@ impl<'a, C, A> UserThreadTrashCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8051,7 +8052,7 @@ impl<'a, C, A> UserThreadTrashCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserThreadTrashCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -8061,7 +8062,7 @@ impl<'a, C, A> UserThreadTrashCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserThreadTrashCall<'a, C, A> { self._id = new_value.to_string(); @@ -8079,12 +8080,12 @@ impl<'a, C, A> UserThreadTrashCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8101,17 +8102,17 @@ impl<'a, C, A> UserThreadTrashCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserThreadTrashCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserThreadTrashCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8180,7 +8181,7 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.watch", + dlg.begin(MethodInfo { id: "gmail.users.watch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -8222,14 +8223,14 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8273,7 +8274,7 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8283,10 +8284,10 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8318,7 +8319,7 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: WatchRequest) -> UserWatchCall<'a, C, A> { self._request = new_value; @@ -8328,7 +8329,7 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserWatchCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -8346,12 +8347,12 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8368,17 +8369,17 @@ impl<'a, C, A> UserWatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserWatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserWatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8444,7 +8445,7 @@ impl<'a, C, A> UserDraftListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.drafts.list", + dlg.begin(MethodInfo { id: "gmail.users.drafts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -8492,7 +8493,7 @@ impl<'a, C, A> UserDraftListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8528,7 +8529,7 @@ impl<'a, C, A> UserDraftListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8538,10 +8539,10 @@ impl<'a, C, A> UserDraftListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8574,7 +8575,7 @@ impl<'a, C, A> UserDraftListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserDraftListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -8606,12 +8607,12 @@ impl<'a, C, A> UserDraftListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8628,17 +8629,17 @@ impl<'a, C, A> UserDraftListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserDraftListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDraftListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8709,7 +8710,7 @@ impl<'a, C, A> UserMessageSendCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.messages.send", + dlg.begin(MethodInfo { id: "gmail.users.messages.send", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -8725,13 +8726,13 @@ impl<'a, C, A> UserMessageSendCall<'a, C, A> where C: BorrowMut, params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/gmail/v1/users/{userId}/messages/send".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/gmail/v1/users/{userId}/messages/send".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -8759,14 +8760,14 @@ impl<'a, C, A> UserMessageSendCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8843,7 +8844,7 @@ impl<'a, C, A> UserMessageSendCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8853,10 +8854,10 @@ impl<'a, C, A> UserMessageSendCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8959,7 +8960,7 @@ impl<'a, C, A> UserMessageSendCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Message) -> UserMessageSendCall<'a, C, A> { self._request = new_value; @@ -8969,7 +8970,7 @@ impl<'a, C, A> UserMessageSendCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserMessageSendCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -8987,12 +8988,12 @@ impl<'a, C, A> UserMessageSendCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9009,17 +9010,17 @@ impl<'a, C, A> UserMessageSendCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserMessageSendCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMessageSendCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9086,7 +9087,7 @@ impl<'a, C, A> UserMessageGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.messages.get", + dlg.begin(MethodInfo { id: "gmail.users.messages.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -9139,7 +9140,7 @@ impl<'a, C, A> UserMessageGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9175,7 +9176,7 @@ impl<'a, C, A> UserMessageGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9185,10 +9186,10 @@ impl<'a, C, A> UserMessageGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9221,7 +9222,7 @@ impl<'a, C, A> UserMessageGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserMessageGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -9231,7 +9232,7 @@ impl<'a, C, A> UserMessageGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserMessageGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -9264,12 +9265,12 @@ impl<'a, C, A> UserMessageGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9286,17 +9287,17 @@ impl<'a, C, A> UserMessageGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserMessageGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMessageGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9368,7 +9369,7 @@ impl<'a, C, A> UserMessageListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.messages.list", + dlg.begin(MethodInfo { id: "gmail.users.messages.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -9429,7 +9430,7 @@ impl<'a, C, A> UserMessageListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9465,7 +9466,7 @@ impl<'a, C, A> UserMessageListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9475,10 +9476,10 @@ impl<'a, C, A> UserMessageListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9511,7 +9512,7 @@ impl<'a, C, A> UserMessageListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserMessageListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -9565,12 +9566,12 @@ impl<'a, C, A> UserMessageListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9587,17 +9588,17 @@ impl<'a, C, A> UserMessageListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserMessageListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMessageListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9659,7 +9660,7 @@ impl<'a, C, A> UserGetProfileCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.getProfile", + dlg.begin(MethodInfo { id: "gmail.users.getProfile", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -9701,7 +9702,7 @@ impl<'a, C, A> UserGetProfileCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9737,7 +9738,7 @@ impl<'a, C, A> UserGetProfileCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9747,10 +9748,10 @@ impl<'a, C, A> UserGetProfileCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9783,7 +9784,7 @@ impl<'a, C, A> UserGetProfileCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserGetProfileCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -9801,12 +9802,12 @@ impl<'a, C, A> UserGetProfileCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9823,17 +9824,17 @@ impl<'a, C, A> UserGetProfileCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserGetProfileCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserGetProfileCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9900,7 +9901,7 @@ impl<'a, C, A> UserThreadGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.threads.get", + dlg.begin(MethodInfo { id: "gmail.users.threads.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -9953,7 +9954,7 @@ impl<'a, C, A> UserThreadGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9989,7 +9990,7 @@ impl<'a, C, A> UserThreadGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9999,10 +10000,10 @@ impl<'a, C, A> UserThreadGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10035,7 +10036,7 @@ impl<'a, C, A> UserThreadGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserThreadGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -10045,7 +10046,7 @@ impl<'a, C, A> UserThreadGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> UserThreadGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -10078,12 +10079,12 @@ impl<'a, C, A> UserThreadGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10100,17 +10101,17 @@ impl<'a, C, A> UserThreadGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserThreadGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserThreadGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10185,7 +10186,7 @@ impl<'a, C, A> UserMessageInsertCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "gmail.users.messages.insert", + dlg.begin(MethodInfo { id: "gmail.users.messages.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -10207,13 +10208,13 @@ impl<'a, C, A> UserMessageInsertCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/gmail/v1/users/{userId}/messages".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/gmail/v1/users/{userId}/messages".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -10241,14 +10242,14 @@ impl<'a, C, A> UserMessageInsertCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10325,7 +10326,7 @@ impl<'a, C, A> UserMessageInsertCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10335,10 +10336,10 @@ impl<'a, C, A> UserMessageInsertCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10441,7 +10442,7 @@ impl<'a, C, A> UserMessageInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Message) -> UserMessageInsertCall<'a, C, A> { self._request = new_value; @@ -10451,7 +10452,7 @@ impl<'a, C, A> UserMessageInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> UserMessageInsertCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -10483,12 +10484,12 @@ impl<'a, C, A> UserMessageInsertCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10505,17 +10506,17 @@ impl<'a, C, A> UserMessageInsertCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Gmai`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserMessageInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserMessageInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/groupsmigration1-cli/Cargo.toml b/gen/groupsmigration1-cli/Cargo.toml index 6fb00997c2..ccee3a3214 100644 --- a/gen/groupsmigration1-cli/Cargo.toml +++ b/gen/groupsmigration1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-groupsmigration1-cli" -version = "0.3.2+20140416" +version = "0.3.3+20140416" authors = ["Sebastian Thiel "] description = "A complete library to interact with Groups Migration (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1-cli" @@ -24,7 +24,7 @@ serde_json = ">= 0.6.0" yup-oauth2 = "0.5" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/groupsmigration1-cli/LICENSE.md b/gen/groupsmigration1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/groupsmigration1-cli/LICENSE.md +++ b/gen/groupsmigration1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/groupsmigration1-cli/README.md b/gen/groupsmigration1-cli/README.md index bf82c873cf..7bebcdb1c2 100644 --- a/gen/groupsmigration1-cli/README.md +++ b/gen/groupsmigration1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Groups Migration* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/groupsmigration1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/groupsmigration1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/groupsmigration1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/groupsmigration1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1-cli). # Usage -This documentation was generated from the *Groups Migration* API at revision *20140416*. The CLI is at version *0.3.2*. +This documentation was generated from the *Groups Migration* API at revision *20140416*. The CLI is at version *0.3.3*. ```bash groupsmigration1 [options] @@ -34,18 +34,18 @@ groupsmigration1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/groupsmigration1-cli/mkdocs.yml b/gen/groupsmigration1-cli/mkdocs.yml index 9446a66b95..d2d2e032c5 100644 --- a/gen/groupsmigration1-cli/mkdocs.yml +++ b/gen/groupsmigration1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Groups Migration v0.3.2+20140416 +site_name: Groups Migration v0.3.3+20140416 site_url: http://byron.github.io/google-apis-rs/google-groupsmigration1-cli site_description: Write integrating applications with bcore @@ -13,5 +13,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/groupsmigration1-cli/src/main.rs b/gen/groupsmigration1-cli/src/main.rs index 5cc00274cc..f5eddc764d 100644 --- a/gen/groupsmigration1-cli/src/main.rs +++ b/gen/groupsmigration1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::GroupsMigration>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _archive_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _archive_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.archive().insert(opt.value_of("group-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -69,7 +69,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -77,7 +77,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -134,14 +134,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "groupsmigration1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "groupsmigration1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -161,7 +161,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -201,7 +201,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("archive", "methods: 'insert'", vec![ - ("insert", + ("insert", Some(r##"Inserts a new mail into the archive of the Google group."##), "Details at http://byron.github.io/google-apis-rs/google_groupsmigration1_cli/archive_insert", vec![ @@ -235,7 +235,7 @@ fn main() { let mut app = App::new("groupsmigration1") .author("Sebastian Thiel ") - .version("0.3.2+20140416") + .version("0.3.3+20140416") .about("Groups Migration Api.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_groupsmigration1_cli") .arg(Arg::with_name("url") @@ -259,7 +259,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -270,7 +270,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/groupsmigration1/Cargo.toml b/gen/groupsmigration1/Cargo.toml index b8d26c7b21..72e6c9df6e 100644 --- a/gen/groupsmigration1/Cargo.toml +++ b/gen/groupsmigration1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-groupsmigration1" -version = "0.1.10+20140416" +version = "0.1.11+20140416" authors = ["Sebastian Thiel "] description = "A complete library to interact with Groups Migration (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1" diff --git a/gen/groupsmigration1/LICENSE.md b/gen/groupsmigration1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/groupsmigration1/LICENSE.md +++ b/gen/groupsmigration1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/groupsmigration1/README.md b/gen/groupsmigration1/README.md index b41b1cf459..a18690373d 100644 --- a/gen/groupsmigration1/README.md +++ b/gen/groupsmigration1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-groupsmigration1` library allows access to all features of the *Google Groups Migration* service. -This documentation was generated from *Groups Migration* crate version *0.1.10+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Groups Migration* crate version *0.1.11+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Groups Migration* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/groups-migration/). diff --git a/gen/groupsmigration1/src/cmn.rs b/gen/groupsmigration1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/groupsmigration1/src/cmn.rs +++ b/gen/groupsmigration1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/groupsmigration1/src/lib.rs b/gen/groupsmigration1/src/lib.rs index 99114f0647..ab1a9a57f7 100644 --- a/gen/groupsmigration1/src/lib.rs +++ b/gen/groupsmigration1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Groups Migration* crate version *0.1.10+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Groups Migration* crate version *0.1.11+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Groups Migration* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/groups-migration/). diff --git a/gen/groupsmigration1/src/lib.rs.in b/gen/groupsmigration1/src/lib.rs.in index 629612c3c5..f39aabeba7 100644 --- a/gen/groupsmigration1/src/lib.rs.in +++ b/gen/groupsmigration1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -127,7 +128,7 @@ impl<'a, C, A> GroupsMigration GroupsMigration { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -136,7 +137,7 @@ impl<'a, C, A> GroupsMigration } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -296,7 +297,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "groupsmigration.archive.insert", + dlg.begin(MethodInfo { id: "groupsmigration.archive.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("groupId", self._group_id.to_string())); @@ -312,13 +313,13 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/groups/v1/groups/{groupId}/archive".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/groups/v1/groups/{groupId}/archive".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -346,7 +347,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -410,7 +411,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -420,10 +421,10 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -527,7 +528,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *group id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_id(mut self, new_value: &str) -> ArchiveInsertCall<'a, C, A> { self._group_id = new_value.to_string(); @@ -545,12 +546,12 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -567,17 +568,17 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppGroupMigration`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ArchiveInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ArchiveInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/groupssettings1-cli/Cargo.toml b/gen/groupssettings1-cli/Cargo.toml index cbb9563ee4..f4f48b063b 100644 --- a/gen/groupssettings1-cli/Cargo.toml +++ b/gen/groupssettings1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-groupssettings1-cli" -version = "0.3.2+20140428" +version = "0.3.3+20140428" authors = ["Sebastian Thiel "] description = "A complete library to interact with groupssettings (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupssettings1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/groupssettings1-cli/LICENSE.md b/gen/groupssettings1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/groupssettings1-cli/LICENSE.md +++ b/gen/groupssettings1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/groupssettings1-cli/README.md b/gen/groupssettings1-cli/README.md index ad9b9d3cea..6e9266b830 100644 --- a/gen/groupssettings1-cli/README.md +++ b/gen/groupssettings1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *groupssettings* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/groupssettings1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/groupssettings1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/groupssettings1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/groupssettings1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/groupssettings1-cli). # Usage -This documentation was generated from the *groupssettings* API at revision *20140428*. The CLI is at version *0.3.2*. +This documentation was generated from the *groupssettings* API at revision *20140428*. The CLI is at version *0.3.3*. ```bash groupssettings1 [options] @@ -36,18 +36,18 @@ groupssettings1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/groupssettings1-cli/mkdocs.yml b/gen/groupssettings1-cli/mkdocs.yml index 9f3c23a751..25af41fb77 100644 --- a/gen/groupssettings1-cli/mkdocs.yml +++ b/gen/groupssettings1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: groupssettings v0.3.2+20140428 +site_name: groupssettings v0.3.3+20140428 site_url: http://byron.github.io/google-apis-rs/google-groupssettings1-cli site_description: Write integrating applications with bcore @@ -15,5 +15,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/groupssettings1-cli/src/main.rs b/gen/groupssettings1-cli/src/main.rs index 1ba743ecda..ad93de142b 100644 --- a/gen/groupssettings1-cli/src/main.rs +++ b/gen/groupssettings1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Groupssettings>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _groups_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _groups_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().get(opt.value_of("group-unique-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,13 +97,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -117,8 +117,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "allow-external-members" => Some(("allowExternalMembers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-post-message" => Some(("whoCanPostMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -160,7 +160,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Groups = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().patch(request, opt.value_of("group-unique-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -173,7 +173,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -186,7 +186,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -209,13 +209,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -229,8 +229,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "allow-external-members" => Some(("allowExternalMembers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "who-can-post-message" => Some(("whoCanPostMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -272,7 +272,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Groups = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().update(request, opt.value_of("group-unique-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -285,7 +285,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -298,7 +298,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -360,14 +360,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "groupssettings1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "groupssettings1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -387,7 +387,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -426,7 +426,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("groups", "methods: 'get', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets one resource by id."##), "Details at http://byron.github.io/google-apis-rs/google_groupssettings1_cli/groups_get", vec![ @@ -448,7 +448,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an existing resource. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_groupssettings1_cli/groups_patch", vec![ @@ -476,7 +476,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing resource."##), "Details at http://byron.github.io/google-apis-rs/google_groupssettings1_cli/groups_update", vec![ @@ -510,7 +510,7 @@ fn main() { let mut app = App::new("groupssettings1") .author("Sebastian Thiel ") - .version("0.3.2+20140428") + .version("0.3.3+20140428") .about("Lets you manage permission levels and related settings of a group.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_groupssettings1_cli") .arg(Arg::with_name("url") @@ -534,7 +534,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -545,7 +545,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/groupssettings1/Cargo.toml b/gen/groupssettings1/Cargo.toml index db7b10b979..147d6671db 100644 --- a/gen/groupssettings1/Cargo.toml +++ b/gen/groupssettings1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-groupssettings1" -version = "0.1.10+20140428" +version = "0.1.11+20140428" authors = ["Sebastian Thiel "] description = "A complete library to interact with groupssettings (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupssettings1" diff --git a/gen/groupssettings1/LICENSE.md b/gen/groupssettings1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/groupssettings1/LICENSE.md +++ b/gen/groupssettings1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/groupssettings1/README.md b/gen/groupssettings1/README.md index 70d7029af5..b578fe6f90 100644 --- a/gen/groupssettings1/README.md +++ b/gen/groupssettings1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-groupssettings1` library allows access to all features of the *Google groupssettings* service. -This documentation was generated from *groupssettings* crate version *0.1.10+20140428*, where *20140428* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *groupssettings* crate version *0.1.11+20140428*, where *20140428* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *groupssettings* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/groups-settings/get_started). diff --git a/gen/groupssettings1/src/cmn.rs b/gen/groupssettings1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/groupssettings1/src/cmn.rs +++ b/gen/groupssettings1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/groupssettings1/src/lib.rs b/gen/groupssettings1/src/lib.rs index f5600f2637..69df587c7e 100644 --- a/gen/groupssettings1/src/lib.rs +++ b/gen/groupssettings1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *groupssettings* crate version *0.1.10+20140428*, where *20140428* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *groupssettings* crate version *0.1.11+20140428*, where *20140428* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *groupssettings* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/groups-settings/get_started). diff --git a/gen/groupssettings1/src/lib.rs.in b/gen/groupssettings1/src/lib.rs.in index 44b611b0e4..35c2c1be35 100644 --- a/gen/groupssettings1/src/lib.rs.in +++ b/gen/groupssettings1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -132,7 +133,7 @@ impl<'a, C, A> Groupssettings Groupssettings { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -141,7 +142,7 @@ impl<'a, C, A> Groupssettings } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -422,7 +423,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "groupsSettings.groups.update", + dlg.begin(MethodInfo { id: "groupsSettings.groups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("groupUniqueId", self._group_unique_id.to_string())); @@ -464,14 +465,14 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -515,7 +516,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -525,10 +526,10 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -560,7 +561,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Groups) -> GroupUpdateCall<'a, C, A> { self._request = new_value; @@ -570,7 +571,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *group unique id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_unique_id(mut self, new_value: &str) -> GroupUpdateCall<'a, C, A> { self._group_unique_id = new_value.to_string(); @@ -588,12 +589,12 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -610,17 +611,17 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppGroupSetting`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -689,7 +690,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "groupsSettings.groups.patch", + dlg.begin(MethodInfo { id: "groupsSettings.groups.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("groupUniqueId", self._group_unique_id.to_string())); @@ -731,14 +732,14 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -782,7 +783,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -792,10 +793,10 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -827,7 +828,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Groups) -> GroupPatchCall<'a, C, A> { self._request = new_value; @@ -837,7 +838,7 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *group unique id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_unique_id(mut self, new_value: &str) -> GroupPatchCall<'a, C, A> { self._group_unique_id = new_value.to_string(); @@ -855,12 +856,12 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -877,17 +878,17 @@ impl<'a, C, A> GroupPatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppGroupSetting`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -949,7 +950,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "groupsSettings.groups.get", + dlg.begin(MethodInfo { id: "groupsSettings.groups.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("groupUniqueId", self._group_unique_id.to_string())); @@ -991,7 +992,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1027,7 +1028,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1037,10 +1038,10 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1073,7 +1074,7 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *group unique id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_unique_id(mut self, new_value: &str) -> GroupGetCall<'a, C, A> { self._group_unique_id = new_value.to_string(); @@ -1091,12 +1092,12 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1113,17 +1114,17 @@ impl<'a, C, A> GroupGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppGroupSetting`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/iam1-cli/Cargo.toml b/gen/iam1-cli/Cargo.toml new file mode 100644 index 0000000000..24fb0d8785 --- /dev/null +++ b/gen/iam1-cli/Cargo.toml @@ -0,0 +1,35 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-iam1-cli" +version = "0.3.3+20160129" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with iam (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iam1-cli" +homepage = "https://cloud.google.com/iam/" +documentation = "http://byron.github.io/google-apis-rs/google_iam1_cli" +license = "MIT" +keywords = ["iam", "google", "cli"] + +[[bin]] +name = "iam1" + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +strsim = "0.4" +yup-hyper-mock = "1.0" +clap = "2.0" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + + +[dependencies.google-iam1] +path = "../iam1" diff --git a/gen/iam1-cli/LICENSE.md b/gen/iam1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/iam1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/iam1-cli/README.md b/gen/iam1-cli/README.md new file mode 100644 index 0000000000..3cf7a19e84 --- /dev/null +++ b/gen/iam1-cli/README.md @@ -0,0 +1,125 @@ + +The `iam1` command-line interface *(CLI)* allows to use most features of the *Google iam* service from the comfort of your terminal. + +By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's +capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. + +If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. + +Everything else about the *iam* API can be found at the +[official documentation site](https://cloud.google.com/iam/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/iam1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/iam1.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/iam1-cli). + +# Usage + +This documentation was generated from the *iam* API at revision *20160129*. The CLI is at version *0.3.3*. + +```bash +iam1 [options] + projects + service-accounts-create (-r )... [-p ]... [-o ] + service-accounts-delete [-p ]... [-o ] + service-accounts-get [-p ]... [-o ] + service-accounts-get-iam-policy [-p ]... [-o ] + service-accounts-keys-create (-r )... [-p ]... [-o ] + service-accounts-keys-delete [-p ]... [-o ] + service-accounts-keys-get [-p ]... [-o ] + service-accounts-keys-list [-p ]... [-o ] + service-accounts-list [-p ]... [-o ] + service-accounts-set-iam-policy (-r )... [-p ]... [-o ] + service-accounts-sign-blob (-r )... [-p ]... [-o ] + service-accounts-test-iam-permissions (-r )... [-p ]... [-o ] + service-accounts-update (-r )... [-p ]... [-o ] + iam1 --help + +Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. + --config-dir + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ~/.google-service-cli] + --debug + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --debug-auth + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + +``` + +# Configuration + +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `iam1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. + +More information about the various kinds of persistent data are given in the following paragraphs. + +# Authentication + +Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the +set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*. + +If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a +method that is read-only, it will ask only for a read-only scope. +You may use the `--scope` flag to specify a scope directly. +All applicable scopes are documented in the respective method's CLI documentation. + +The first time a scope is used, the user is asked for permission. Follow the instructions given +by the CLI to grant permissions, or to decline. + +If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration +directory, e.g. `~/.google-service-cli/iam1-token-.json`. No manual management of these tokens +is necessary. + +To revoke granted authentication, please refer to the [official documentation][revoke-access]. + +# Application Secrets + +In order to allow any application to use Google services, it will need to be registered using the +[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it +one by one. Most APIs can be used for free and have a daily quota. + +To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI +comes with a default application secret that is configured accordingly. This also means that heavy usage +all around the world may deplete the daily quota. + +You can workaround this limitation by putting your own secrets file at this location: +`~/.google-service-cli/iam1-secret.json`, assuming that the required *iam* API +was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at +*APIs & auth -> Credentials -> Download JSON* and used as is. + +Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new]. + + +# Debugging + +Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know +what exactly led to a particular issue. This is done by allowing all client-server communication to be +output to standard error *as-is*. + +The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag +will cause all communication related to authentication to standard error. +If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the +issue at hand. + +You may consider redirecting standard error into a file for ease of use, e.g. `iam1 --debug [options] 2>debug.txt`. + + +[scopes]: https://developers.google.com/+/api/oauth#scopes +[revoke-access]: http://webapps.stackexchange.com/a/30849 +[google-dev-console]: https://console.developers.google.com/ +[google-project-new]: https://developers.google.com/console/help/new/ \ No newline at end of file diff --git a/gen/iam1-cli/mkdocs.yml b/gen/iam1-cli/mkdocs.yml new file mode 100644 index 0000000000..55cc5b72a7 --- /dev/null +++ b/gen/iam1-cli/mkdocs.yml @@ -0,0 +1,29 @@ +site_name: iam v0.3.3+20160129 +site_url: http://byron.github.io/google-apis-rs/google-iam1-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/iam1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['projects_service-accounts-create.md', 'Projects', 'Service Accounts Create'] +- ['projects_service-accounts-delete.md', 'Projects', 'Service Accounts Delete'] +- ['projects_service-accounts-get.md', 'Projects', 'Service Accounts Get'] +- ['projects_service-accounts-get-iam-policy.md', 'Projects', 'Service Accounts Get Iam Policy'] +- ['projects_service-accounts-keys-create.md', 'Projects', 'Service Accounts Keys Create'] +- ['projects_service-accounts-keys-delete.md', 'Projects', 'Service Accounts Keys Delete'] +- ['projects_service-accounts-keys-get.md', 'Projects', 'Service Accounts Keys Get'] +- ['projects_service-accounts-keys-list.md', 'Projects', 'Service Accounts Keys List'] +- ['projects_service-accounts-list.md', 'Projects', 'Service Accounts List'] +- ['projects_service-accounts-set-iam-policy.md', 'Projects', 'Service Accounts Set Iam Policy'] +- ['projects_service-accounts-sign-blob.md', 'Projects', 'Service Accounts Sign Blob'] +- ['projects_service-accounts-test-iam-permissions.md', 'Projects', 'Service Accounts Test Iam Permissions'] +- ['projects_service-accounts-update.md', 'Projects', 'Service Accounts Update'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/iam1-cli/src/cmn.rs b/gen/iam1-cli/src/cmn.rs new file mode 100644 index 0000000000..ae86fdef65 --- /dev/null +++ b/gen/iam1-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::IoError(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::IoError(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::IoError(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + IOError((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::IOError((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + IOError((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::IOError((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::IOError( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::IoError(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::IoError(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/iam1-cli/src/main.rs b/gen/iam1-cli/src/main.rs new file mode 100644 index 0000000000..bae752fd87 --- /dev/null +++ b/gen/iam1-cli/src/main.rs @@ -0,0 +1,1507 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_iam1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Iam>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _projects_service_accounts_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "service-account.oauth2-client-id" => Some(("serviceAccount.oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.display-name" => Some(("serviceAccount.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.name" => Some(("serviceAccount.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.project-id" => Some(("serviceAccount.projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.etag" => Some(("serviceAccount.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.unique-id" => Some(("serviceAccount.uniqueId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "service-account.email" => Some(("serviceAccount.email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "account-id" => Some(("accountId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["account-id", "display-name", "email", "etag", "name", "oauth2-client-id", "project-id", "service-account", "unique-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreateServiceAccountRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().service_accounts_create(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().service_accounts_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().service_accounts_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().service_accounts_get_iam_policy(opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_keys_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "private-key-type" => Some(("privateKeyType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["private-key-type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::CreateServiceAccountKeyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().service_accounts_keys_create(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_keys_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().service_accounts_keys_delete(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_keys_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().service_accounts_keys_get(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_keys_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().service_accounts_keys_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "key-types" => { + call = call.add_key_types(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["key-types"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().service_accounts_list(opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["etag", "policy", "version"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().service_accounts_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_sign_blob(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "bytes-to-sign" => Some(("bytesToSign", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["bytes-to-sign"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::SignBlobRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().service_accounts_sign_blob(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["permissions"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().service_accounts_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_service_accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "oauth2-client-id" => Some(("oauth2ClientId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "unique-id" => Some(("uniqueId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["display-name", "email", "etag", "name", "oauth2-client-id", "project-id", "unique-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ServiceAccount = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().service_accounts_update(request, opt.value_of("name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("projects", Some(opt)) => { + match opt.subcommand() { + ("service-accounts-create", Some(opt)) => { + call_result = self._projects_service_accounts_create(opt, dry_run, &mut err); + }, + ("service-accounts-delete", Some(opt)) => { + call_result = self._projects_service_accounts_delete(opt, dry_run, &mut err); + }, + ("service-accounts-get", Some(opt)) => { + call_result = self._projects_service_accounts_get(opt, dry_run, &mut err); + }, + ("service-accounts-get-iam-policy", Some(opt)) => { + call_result = self._projects_service_accounts_get_iam_policy(opt, dry_run, &mut err); + }, + ("service-accounts-keys-create", Some(opt)) => { + call_result = self._projects_service_accounts_keys_create(opt, dry_run, &mut err); + }, + ("service-accounts-keys-delete", Some(opt)) => { + call_result = self._projects_service_accounts_keys_delete(opt, dry_run, &mut err); + }, + ("service-accounts-keys-get", Some(opt)) => { + call_result = self._projects_service_accounts_keys_get(opt, dry_run, &mut err); + }, + ("service-accounts-keys-list", Some(opt)) => { + call_result = self._projects_service_accounts_keys_list(opt, dry_run, &mut err); + }, + ("service-accounts-list", Some(opt)) => { + call_result = self._projects_service_accounts_list(opt, dry_run, &mut err); + }, + ("service-accounts-set-iam-policy", Some(opt)) => { + call_result = self._projects_service_accounts_set_iam_policy(opt, dry_run, &mut err); + }, + ("service-accounts-sign-blob", Some(opt)) => { + call_result = self._projects_service_accounts_sign_blob(opt, dry_run, &mut err); + }, + ("service-accounts-test-iam-permissions", Some(opt)) => { + call_result = self._projects_service_accounts_test_iam_permissions(opt, dry_run, &mut err); + }, + ("service-accounts-update", Some(opt)) => { + call_result = self._projects_service_accounts_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "iam1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "iam1", + db_dir: config_dir.clone(), + }, None); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::Iam::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "bearer-token", "callback", "fields", "key", "oauth-token", "pp", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("bearer-token", "bearer_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("projects", "methods: 'service-accounts-create', 'service-accounts-delete', 'service-accounts-get', 'service-accounts-get-iam-policy', 'service-accounts-keys-create', 'service-accounts-keys-delete', 'service-accounts-keys-get', 'service-accounts-keys-list', 'service-accounts-list', 'service-accounts-set-iam-policy', 'service-accounts-sign-blob', 'service-accounts-test-iam-permissions' and 'service-accounts-update'", vec![ + ("service-accounts-create", + Some(r##"Creates a service account and returns it."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-create", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The resource name of the project associated with the service accounts, such as "projects/123""##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-delete", + Some(r##"Deletes a service acount."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-get", + Some(r##"Gets a ServiceAccount"##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-get-iam-policy", + Some(r##"Returns the IAM access control policy for specified IAM resource."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-get-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-keys-create", + Some(r##"Creates a service account key and returns it."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-keys-create", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-keys-delete", + Some(r##"Deletes a service account key."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-keys-delete", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-keys-get", + Some(r##"Gets the ServiceAccountKey by key id."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-keys-get", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-keys-list", + Some(r##"Lists service account keys"##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-keys-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-list", + Some(r##"Lists service accounts for a project."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-list", + vec![ + (Some(r##"name"##), + None, + Some(r##"Required. The resource name of the project associated with the service accounts, such as "projects/123""##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-set-iam-policy", + Some(r##"Sets the IAM access control policy for the specified IAM resource."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-set-iam-policy", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-sign-blob", + Some(r##"Signs a blob using a service account."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-sign-blob", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-test-iam-permissions", + Some(r##"Tests the specified permissions against the IAM access control policy for the specified IAM resource."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-test-iam-permissions", + vec![ + (Some(r##"resource"##), + None, + Some(r##"REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("service-accounts-update", + Some(r##"Updates a service account. Currently, only the following fields are updatable: 'display_name' . The 'etag' is mandatory."##), + "Details at http://byron.github.io/google-apis-rs/google_iam1_cli/projects_service-accounts-update", + vec![ + (Some(r##"name"##), + None, + Some(r##"The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format "projects/{project}/serviceAccounts/{email}"."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("iam1") + .author("Sebastian Thiel ") + .version("0.3.3+20160129") + .about("Manages identity and access control for Google Cloud Platform resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_iam1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/iam1/Cargo.toml b/gen/iam1/Cargo.toml new file mode 100644 index 0000000000..fa9b1091e5 --- /dev/null +++ b/gen/iam1/Cargo.toml @@ -0,0 +1,29 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-iam1" +version = "0.1.11+20160129" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with iam (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/iam1" +homepage = "https://cloud.google.com/iam/" +documentation = "http://byron.github.io/google-apis-rs/google_iam1" +license = "MIT" +keywords = ["iam", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = "0.5" +url = ">= 0.5" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + diff --git a/gen/iam1/LICENSE.md b/gen/iam1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/iam1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/iam1/README.md b/gen/iam1/README.md new file mode 100644 index 0000000000..03677808b5 --- /dev/null +++ b/gen/iam1/README.md @@ -0,0 +1,181 @@ + +The `google-iam1` library allows access to all features of the *Google iam* service. + +This documentation was generated from *iam* crate version *0.1.11+20160129*, where *20160129* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. + +Everything else about the *iam* *v1* API can be found at the +[official documentation site](https://cloud.google.com/iam/). +# Features + +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_iam1/struct.Iam.html) ... + +* projects + * [*service accounts create*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountCreateCall.html), [*service accounts delete*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountDeleteCall.html), [*service accounts get*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountGetCall.html), [*service accounts get iam policy*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountGetIamPolicyCall.html), [*service accounts keys create*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountKeyCreateCall.html), [*service accounts keys delete*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountKeyDeleteCall.html), [*service accounts keys get*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountKeyGetCall.html), [*service accounts keys list*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountKeyListCall.html), [*service accounts list*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountListCall.html), [*service accounts set iam policy*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountSetIamPolicyCall.html), [*service accounts sign blob*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountSignBlobCall.html), [*service accounts test iam permissions*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountTestIamPermissionCall.html) and [*service accounts update*](http://byron.github.io/google-apis-rs/google_iam1/struct.ProjectServiceAccountUpdateCall.html) + + + + +# Structure of this Library + +The API is structured into the following primary items: + +* **[Hub](http://byron.github.io/google-apis-rs/google_iam1/struct.Iam.html)** + * a central object to maintain state and allow accessing all *Activities* + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_iam1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_iam1/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_iam1/trait.Resource.html)** + * primary types that you can apply *Activities* to + * a collection of properties and *Parts* + * **[Parts](http://byron.github.io/google-apis-rs/google_iam1/trait.Part.html)** + * a collection of properties + * never directly used in *Activities* +* **[Activities](http://byron.github.io/google-apis-rs/google_iam1/trait.CallBuilder.html)** + * operations to apply to *Resources* + +All *structures* are marked with applicable traits to further categorize them and ease browsing. + +Generally speaking, you can invoke *Activities* like this: + +```Rust,ignore +let r = hub.resource().activity(...).doit() +``` + +Or specifically ... + +```ignore +let r = hub.projects().service_accounts_update(...).doit() +let r = hub.projects().service_accounts_get(...).doit() +let r = hub.projects().service_accounts_create(...).doit() +``` + +The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +The `doit()` method performs the actual communication with the server and returns the respective result. + +# Usage + +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +google-iam1 = "*" +``` + +## A complete example + +```Rust +extern crate hyper; +extern crate yup_oauth2 as oauth2; +extern crate google_iam1 as iam1; +use iam1::ServiceAccount; +use iam1::{Result, Error}; +use std::default::Default; +use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +use iam1::Iam; + +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. +let secret: ApplicationSecret = Default::default(); +// Instantiate the authenticator. It will choose a suitable authentication flow for you, +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. +let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, + hyper::Client::new(), + ::default(), None); +let mut hub = Iam::new(hyper::Client::new(), 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 ! +let mut req = ServiceAccount::default(); + +// 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 ! +let result = hub.projects().service_accounts_update(req, "name") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} + +``` +## Handling Errors + +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_iam1/enum.Result.html) enumeration as return value of +the doit() methods, or handed as possibly intermediate results to either the +[Hub Delegate](http://byron.github.io/google-apis-rs/google_iam1/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_iam1/../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](http://byron.github.io/google-apis-rs/google_iam1/enum.Result.html), should be +read by you to obtain the media. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_iam1/trait.ResponseResult.html), 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")`. + +Methods supporting uploads can do so using up to 2 different protocols: +*simple* and *resumable*. The distinctiveness of each is represented by customized +`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. + +## Customization and Callbacks + +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_iam1/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_iam1/trait.CallBuilder.html) 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](http://byron.github.io/google-apis-rs/google_iam1/trait.Delegate.html) 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 [enocodable](http://byron.github.io/google-apis-rs/google_iam1/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_iam1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +are valid. +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_iam1/trait.Part.html) 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](http://byron.github.io/google-apis-rs/google_iam1/trait.CallBuilder.html), 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](http://byron.github.io/google-apis-rs/google_iam1/trait.RequestValue.html) are moved + +Arguments will always be copied or cloned into the builder, to make them independent of their original life times. + +[wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +[google-go-api]: https://github.com/google/google-api-go-client + +# License +The **iam1** 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-rs/LICENSE.md diff --git a/gen/iam1/src/build.rs b/gen/iam1/src/build.rs new file mode 100644 index 0000000000..63d480dedf --- /dev/null +++ b/gen/iam1/src/build.rs @@ -0,0 +1,16 @@ +extern crate syntex; +extern crate serde_codegen; + +use std::env; +use std::path::Path; + +pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-iam1", &src, &dst).unwrap(); +} diff --git a/gen/iam1/src/cmn.rs b/gen/iam1/src/cmn.rs new file mode 100644 index 0000000000..87b91a8986 --- /dev/null +++ b/gen/iam1/src/cmn.rs @@ -0,0 +1,771 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && 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() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +// The following macro invocation needs to be expanded, as `include!` +// doens't support external macros +// header!{ +// #[doc="The `X-Upload-Content-Type` header."] +// (XUploadContentType, "X-Upload-Content-Type") => [Mime] + +// xupload_content_type { +// test_header!( +// test1, +// vec![b"text/plain"], +// Some(HeaderField( +// vec![Mime(TopLevel::Text, SubLevel::Plain, Vec::new())] +// ))); + +// } +// } + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// 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 delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + // workaround https://github.com/rust-lang/rust/issues/22252 + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/cloudsearch1/src/lib.rs b/gen/iam1/src/lib.rs similarity index 63% rename from gen/cloudsearch1/src/lib.rs rename to gen/iam1/src/lib.rs index 39331f1f40..ad9c721b3e 100644 --- a/gen/cloudsearch1/src/lib.rs +++ b/gen/iam1/src/lib.rs @@ -2,12 +2,17 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *cloudsearch* crate version *0.1.6+20150416*, where *20150416* is the exact revision of the *cloudsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*. -//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudsearch1). +//! This documentation was generated from *iam* crate version *0.1.11+20160129*, where *20160129* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. +//! +//! Everything else about the *iam* *v1* API can be found at the +//! [official documentation site](https://cloud.google.com/iam/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/iam1). //! # Features //! -//! It seems there is nothing you can do here ... . +//! Handle the following *Resources* with ease from the central [hub](struct.Iam.html) ... //! +//! * projects +//! * [*service accounts create*](struct.ProjectServiceAccountCreateCall.html), [*service accounts delete*](struct.ProjectServiceAccountDeleteCall.html), [*service accounts get*](struct.ProjectServiceAccountGetCall.html), [*service accounts get iam policy*](struct.ProjectServiceAccountGetIamPolicyCall.html), [*service accounts keys create*](struct.ProjectServiceAccountKeyCreateCall.html), [*service accounts keys delete*](struct.ProjectServiceAccountKeyDeleteCall.html), [*service accounts keys get*](struct.ProjectServiceAccountKeyGetCall.html), [*service accounts keys list*](struct.ProjectServiceAccountKeyListCall.html), [*service accounts list*](struct.ProjectServiceAccountListCall.html), [*service accounts set iam policy*](struct.ProjectServiceAccountSetIamPolicyCall.html), [*service accounts sign blob*](struct.ProjectServiceAccountSignBlobCall.html), [*service accounts test iam permissions*](struct.ProjectServiceAccountTestIamPermissionCall.html) and [*service accounts update*](struct.ProjectServiceAccountUpdateCall.html) //! //! //! @@ -18,7 +23,7 @@ //! //! The API is structured into the following primary items: //! -//! * **[Hub](struct.Cloudsearch.html)** +//! * **[Hub](struct.Iam.html)** //! * a central object to maintain state and allow accessing all *Activities* //! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn //! allow access to individual [*Call Builders*](trait.CallBuilder.html) @@ -39,6 +44,13 @@ //! let r = hub.resource().activity(...).doit() //! ``` //! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().service_accounts_update(...).doit() +//! let r = hub.projects().service_accounts_get(...).doit() +//! let r = hub.projects().service_accounts_create(...).doit() +//! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` //! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be @@ -53,7 +65,7 @@ //! //! ```toml //! [dependencies] -//! google-cloudsearch1 = "*" +//! google-iam1 = "*" //! ``` //! //! ## A complete example @@ -61,12 +73,13 @@ //! ```test_harness,no_run //! extern crate hyper; //! extern crate yup_oauth2 as oauth2; -//! extern crate google_cloudsearch1 as cloudsearch1; -//! +//! extern crate google_iam1 as iam1; +//! use iam1::ServiceAccount; +//! use iam1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; //! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -//! use cloudsearch1::Cloudsearch; +//! use iam1::Iam; //! //! // Get an ApplicationSecret instance by some means. It contains the `client_id` and //! // `client_secret`, among other things. @@ -79,10 +92,36 @@ //! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, //! hyper::Client::new(), //! ::default(), None); -//! let mut hub = Cloudsearch::new(hyper::Client::new(), auth); +//! let mut hub = Iam::new(hyper::Client::new(), 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 ! +//! let mut req = ServiceAccount::default(); +//! +//! // 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 ! +//! let result = hub.projects().service_accounts_update(req, "name") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } //! # } //! ``` -//! //! ## Handling Errors //! //! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of @@ -127,7 +166,7 @@ //! //! * [PODs][wiki-pod] are handed by copy //! * strings are passed as `&str` -//! * [request values](trait.RequestValue.html) are borrowed +//! * [request values](trait.RequestValue.html) are moved //! //! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. //! @@ -136,120 +175,11 @@ //! [google-go-api]: https://github.com/google/google-api-go-client //! //! -#![feature(std_misc)] + // Unused attributes happen thanks to defined, but unused structures // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . #![allow(unused_imports, unused_mut, dead_code)] -// Required for serde annotations -#![feature(custom_derive, custom_attribute, plugin, slice_patterns)] -#![plugin(serde_macros)] - -#[macro_use] -extern crate hyper; -extern crate serde; -extern crate yup_oauth2 as oauth2; -extern crate mime; -extern crate url; - -mod cmn; - -use std::collections::HashMap; -use std::cell::RefCell; -use std::borrow::BorrowMut; -use std::default::Default; -use std::collections::BTreeMap; -use serde::json; -use std::io; -use std::fs; -use std::thread::sleep_ms; - -pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse}; - - -// ############## -// UTILITIES ### -// ############ - - - - -// ######## -// HUB ### -// ###### - -/// Central instance to access all Cloudsearch related resource activities -/// -/// # Examples -/// -/// Instantiate a new hub -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_cloudsearch1 as cloudsearch1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use cloudsearch1::Cloudsearch; -/// -/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and -/// // `client_secret`, among other things. -/// let secret: ApplicationSecret = Default::default(); -/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, -/// // unless you replace `None` with the desired Flow. -/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about -/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and -/// // retrieve them from storage. -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Cloudsearch::new(hyper::Client::new(), auth); -/// # } -/// ``` -/// -pub struct Cloudsearch { - client: RefCell, - auth: RefCell, - _user_agent: String, -} - -impl<'a, C, A> Hub for Cloudsearch {} - -impl<'a, C, A> Cloudsearch - where C: BorrowMut, A: oauth2::GetToken { - - pub fn new(client: C, authenticator: A) -> Cloudsearch { - Cloudsearch { - client: RefCell::new(client), - auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.6".to_string(), - } - } - - - /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.6`. - /// - /// Returns the previously set user-agent. - pub fn user_agent(&mut self, agent_name: String) -> String { - let prev = self._user_agent.clone(); - self._user_agent = agent_name; - prev - } -} - - - -// ################### -// MethodBuilders ### -// ################# - - - -// ################### -// CallBuilders ### -// ################# +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/iam1/src/lib.rs.in b/gen/iam1/src/lib.rs.in new file mode 100644 index 0000000000..f28f2fa905 --- /dev/null +++ b/gen/iam1/src/lib.rs.in @@ -0,0 +1,4274 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +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; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View and manage your data across Google Cloud Platform services + CloudPlatform, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::CloudPlatform + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Iam related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_iam1 as iam1; +/// use iam1::ServiceAccount; +/// use iam1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use iam1::Iam; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let mut req = ServiceAccount::default(); +/// +/// // 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 ! +/// let result = hub.projects().service_accounts_update(req, "name") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Iam { + client: RefCell, + auth: RefCell, + _user_agent: String, +} + +impl<'a, C, A> Hub for Iam {} + +impl<'a, C, A> Iam + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Iam { + Iam { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/0.1.11".to_string(), + } + } + + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/0.1.11`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Request message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts test iam permissions projects](struct.ProjectServiceAccountTestIamPermissionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsRequest { + /// The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview. + pub permissions: Option>, +} + +impl RequestValue for TestIamPermissionsRequest {} + + +/// Request message for `SetIamPolicy` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts set iam policy projects](struct.ProjectServiceAccountSetIamPolicyCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SetIamPolicyRequest { + /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them. + pub policy: Option, +} + +impl RequestValue for SetIamPolicyRequest {} + + +/// The service account keys list response. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts keys list projects](struct.ProjectServiceAccountKeyListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListServiceAccountKeysResponse { + /// The public keys for the service account. + pub keys: Option>, +} + +impl ResponseResult for ListServiceAccountKeysResponse {} + + +/// A service account in the Identity and Access Management API. To create a service account, you specify the project_id and account_id for the account. The account_id is unique within the project, and used to generate the service account email address and a stable unique id. All other methods can identify accounts using the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts update projects](struct.ProjectServiceAccountUpdateCall.html) (request|response) +/// * [service accounts get projects](struct.ProjectServiceAccountGetCall.html) (response) +/// * [service accounts create projects](struct.ProjectServiceAccountCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ServiceAccount { + /// @OutputOnly. The OAuth2 client id for the service account. This is used in conjunction with the OAuth2 clientconfig API to make three legged OAuth2 (3LO) flows to access the data of Google users. + #[serde(rename="oauth2ClientId")] + pub oauth2_client_id: Option, + /// Used to perform a consistent read-modify-write. + pub etag: Option, + /// Optional. A user-specified description of the service account. Must be fewer than 100 UTF-8 bytes. + #[serde(rename="displayName")] + pub display_name: Option, + /// The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format "projects/{project}/serviceAccounts/{email}". + pub name: Option, + /// @OutputOnly unique and stable id of the service account. + #[serde(rename="uniqueId")] + pub unique_id: Option, + /// @OutputOnly The id of the project that owns the service account. + #[serde(rename="projectId")] + pub project_id: Option, + /// @OutputOnly Email address of the service account. + pub email: Option, +} + +impl RequestValue for ServiceAccount {} +impl ResponseResult for ServiceAccount {} + + +/// A rule to be applied in a Policy. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Rule { + /// The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is not in this set of entries. The format for in and not_in entries is the same as for members in a Binding (see google/iam/v1/policy.proto). + #[serde(rename="notIn")] + pub not_in: Option>, + /// Human-readable description of the rule. + pub description: Option, + /// The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in this set of entries. + #[serde(rename="in")] + pub in_: Option>, + /// Required + pub action: Option, + /// Additional restrictions that must be met + pub conditions: Option>, + /// The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action. + #[serde(rename="logConfig")] + pub log_config: Option>, + /// A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs. + pub permissions: Option>, +} + +impl Part for Rule {} + + +/// The service account sign blob request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts sign blob projects](struct.ProjectServiceAccountSignBlobCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SignBlobRequest { + /// The bytes to sign + #[serde(rename="bytesToSign")] + pub bytes_to_sign: Option, +} + +impl RequestValue for SignBlobRequest {} + + +/// The service account list response. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts list projects](struct.ProjectServiceAccountListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListServiceAccountsResponse { + /// To retrieve the next page of results, set [ListServiceAccountsRequest.page_token] to this value. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The list of matching service accounts. + pub accounts: Option>, +} + +impl ResponseResult for ListServiceAccountsResponse {} + + +/// Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other-app@appspot.gserviceaccount.com"] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts set iam policy projects](struct.ProjectServiceAccountSetIamPolicyCall.html) (response) +/// * [service accounts get iam policy projects](struct.ProjectServiceAccountGetIamPolicyCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// no description provided + pub rules: Option>, + /// Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error. + pub bindings: Option>, + /// Version of the `Policy`. The default version is 0. + pub version: Option, + /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly. + pub etag: Option, +} + +impl ResponseResult for Policy {} + + +/// 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); } The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts delete projects](struct.ProjectServiceAccountDeleteCall.html) (response) +/// * [service accounts keys delete projects](struct.ProjectServiceAccountKeyDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty; + +impl ResponseResult for Empty {} + + +/// Write a Cloud Audit log +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CloudAuditOptions; + +impl Part for CloudAuditOptions {} + + +/// Options for counters +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CounterOptions { + /// The field value to attribute. + pub field: Option, + /// The metric to update. + pub metric: Option, +} + +impl Part for CounterOptions {} + + +/// Response message for `TestIamPermissions` method. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts test iam permissions projects](struct.ProjectServiceAccountTestIamPermissionCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct TestIamPermissionsResponse { + /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed. + pub permissions: Option>, +} + +impl ResponseResult for TestIamPermissionsResponse {} + + +/// Associates `members` with a `role`. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Binding { + /// Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required + pub role: Option, + /// Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. + pub members: Option>, +} + +impl Part for Binding {} + + +/// Write a Data Access (Gin) log +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DataAccessOptions; + +impl Part for DataAccessOptions {} + + +/// Represents a service account key. A service account can have 0 or more key pairs. The private keys for these are not stored by Google. ServiceAccountKeys are immutable. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts keys get projects](struct.ProjectServiceAccountKeyGetCall.html) (response) +/// * [service accounts keys create projects](struct.ProjectServiceAccountKeyCreateCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ServiceAccountKey { + /// The type of the private key. + #[serde(rename="privateKeyType")] + pub private_key_type: Option, + /// The key data. + #[serde(rename="privateKeyData")] + pub private_key_data: Option, + /// The key can be used before this timestamp. + #[serde(rename="validBeforeTime")] + pub valid_before_time: Option, + /// The resource name of the service account key in the format "projects/{project}/serviceAccounts/{email}/keys/{key}". + pub name: Option, + /// The key can be used after this timestamp. + #[serde(rename="validAfterTime")] + pub valid_after_time: Option, +} + +impl ResponseResult for ServiceAccountKey {} + + +/// The service account sign blob response. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts sign blob projects](struct.ProjectServiceAccountSignBlobCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SignBlobResponse { + /// The id of the key used to sign the blob. + #[serde(rename="keyId")] + pub key_id: Option, + /// The signed blob. + pub signature: Option, +} + +impl ResponseResult for SignBlobResponse {} + + +/// The service account key create request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts keys create projects](struct.ProjectServiceAccountKeyCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateServiceAccountKeyRequest { + /// The type of the key requested. GOOGLE_CREDENTIALS is the default key type. + #[serde(rename="privateKeyType")] + pub private_key_type: Option, +} + +impl RequestValue for CreateServiceAccountKeyRequest {} + + +/// The service account create request. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [service accounts create projects](struct.ProjectServiceAccountCreateCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct CreateServiceAccountRequest { + /// The ServiceAccount resource to create. Currently, only the following values are user assignable: display_name . + #[serde(rename="serviceAccount")] + pub service_account: Option, + /// Required. The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 1-63 characters long, and match the regular expression [a-z]([-a-z0-9]*[a-z0-9]) to comply with RFC1035. + #[serde(rename="accountId")] + pub account_id: Option, +} + +impl RequestValue for CreateServiceAccountRequest {} + + +/// Specifies what kind of log the caller must write Increment a streamz counter with the specified metric and field names. Metric names should start with a '/', generally be lowercase-only, and end in "_count". Field names should not contain an initial slash. The actual exported metric names will have "/iam/policy" prepended. Field names correspond to IAM request parameters and field values are their respective values. At present only "iam_principal", corresponding to IAMContext.principal, is supported. Examples: counter { metric: "/debug_access_count" field: "iam_principal" } ==> increment counter /iam/policy/backend_debug_access_count {iam_principal=[value of IAMContext.principal]} At this time we do not support: * multiple field names (though this may be supported in the future) * decrementing the counter * incrementing it by anything other than 1 +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogConfig { + /// Counter options. + pub counter: Option, + /// Data access options. + #[serde(rename="dataAccess")] + pub data_access: Option, + /// Cloud audit options. + #[serde(rename="cloudAudit")] + pub cloud_audit: Option, +} + +impl Part for LogConfig {} + + +/// A condition to be met. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Condition { + /// Trusted attributes supplied by the IAM system. + pub iam: Option, + /// Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. + pub sys: Option, + /// The objects of the condition. This is mutually exclusive with 'value'. + pub values: Option>, + /// Trusted attributes discharged by the service. + pub svc: Option, + /// The object of the condition. Exactly one of these must be set. + pub value: Option, + /// An operator to apply the subject with. + pub op: Option, +} + +impl Part for Condition {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `Iam` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_iam1 as iam1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use iam1::Iam; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Iam::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `service_accounts_create(...)`, `service_accounts_delete(...)`, `service_accounts_get(...)`, `service_accounts_get_iam_policy(...)`, `service_accounts_keys_create(...)`, `service_accounts_keys_delete(...)`, `service_accounts_keys_get(...)`, `service_accounts_keys_list(...)`, `service_accounts_list(...)`, `service_accounts_set_iam_policy(...)`, `service_accounts_sign_blob(...)`, `service_accounts_test_iam_permissions(...)` and `service_accounts_update(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists service account keys + /// + /// # Arguments + /// + /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + pub fn service_accounts_keys_list(&self, name: &str) -> ProjectServiceAccountKeyListCall<'a, C, A> { + ProjectServiceAccountKeyListCall { + hub: self.hub, + _name: name.to_string(), + _key_types: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Sets the IAM access control policy for the specified IAM resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + pub fn service_accounts_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectServiceAccountSetIamPolicyCall<'a, C, A> { + ProjectServiceAccountSetIamPolicyCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a service account key. + /// + /// # Arguments + /// + /// * `name` - The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account. + pub fn service_accounts_keys_delete(&self, name: &str) -> ProjectServiceAccountKeyDeleteCall<'a, C, A> { + ProjectServiceAccountKeyDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a service account key and returns it. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + pub fn service_accounts_keys_create(&self, request: CreateServiceAccountKeyRequest, name: &str) -> ProjectServiceAccountKeyCreateCall<'a, C, A> { + ProjectServiceAccountKeyCreateCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Signs a blob using a service account. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + pub fn service_accounts_sign_blob(&self, request: SignBlobRequest, name: &str) -> ProjectServiceAccountSignBlobCall<'a, C, A> { + ProjectServiceAccountSignBlobCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a service account. Currently, only the following fields are updatable: 'display_name' . The 'etag' is mandatory. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format "projects/{project}/serviceAccounts/{email}". + pub fn service_accounts_update(&self, request: ServiceAccount, name: &str) -> ProjectServiceAccountUpdateCall<'a, C, A> { + ProjectServiceAccountUpdateCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists service accounts for a project. + /// + /// # Arguments + /// + /// * `name` - Required. The resource name of the project associated with the service accounts, such as "projects/123" + pub fn service_accounts_list(&self, name: &str) -> ProjectServiceAccountListCall<'a, C, A> { + ProjectServiceAccountListCall { + hub: self.hub, + _name: name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a service acount. + /// + /// # Arguments + /// + /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + pub fn service_accounts_delete(&self, name: &str) -> ProjectServiceAccountDeleteCall<'a, C, A> { + ProjectServiceAccountDeleteCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets the ServiceAccountKey by key id. + /// + /// # Arguments + /// + /// * `name` - The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account. + pub fn service_accounts_keys_get(&self, name: &str) -> ProjectServiceAccountKeyGetCall<'a, C, A> { + ProjectServiceAccountKeyGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns the IAM access control policy for specified IAM resource. + /// + /// # Arguments + /// + /// * `resource` - REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. + pub fn service_accounts_get_iam_policy(&self, resource: &str) -> ProjectServiceAccountGetIamPolicyCall<'a, C, A> { + ProjectServiceAccountGetIamPolicyCall { + hub: self.hub, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Tests the specified permissions against the IAM access control policy for the specified IAM resource. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + pub fn service_accounts_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectServiceAccountTestIamPermissionCall<'a, C, A> { + ProjectServiceAccountTestIamPermissionCall { + hub: self.hub, + _request: request, + _resource: resource.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a service account and returns it. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `name` - Required. The resource name of the project associated with the service accounts, such as "projects/123" + pub fn service_accounts_create(&self, request: CreateServiceAccountRequest, name: &str) -> ProjectServiceAccountCreateCall<'a, C, A> { + ProjectServiceAccountCreateCall { + hub: self.hub, + _request: request, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a ServiceAccount + /// + /// # Arguments + /// + /// * `name` - The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + pub fn service_accounts_get(&self, name: &str) -> ProjectServiceAccountGetCall<'a, C, A> { + ProjectServiceAccountGetCall { + hub: self.hub, + _name: name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Lists service account keys +/// +/// A builder for the *serviceAccounts.keys.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().service_accounts_keys_list("name") +/// .add_key_types("sed") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountKeyListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _name: String, + _key_types: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountKeyListCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountKeyListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListServiceAccountKeysResponse)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.keys.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + if self._key_types.len() > 0 { + let mut s = String::new(); + for f in self._key_types.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("keyTypes", s)); + } + for &field in ["alt", "name", "keyTypes"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+name}/keys".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// + /// Sets the *name* path property to the given value. + /// + /// 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) -> ProjectServiceAccountKeyListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The type of keys the user wants to list. If empty, all key types are included in the response. Duplicate key types are not allowed. + /// + /// Append the given value to the *key types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_key_types(mut self, new_value: &str) -> ProjectServiceAccountKeyListCall<'a, C, A> { + self._key_types.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountKeyListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountKeyListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountKeyListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Sets the IAM access control policy for the specified IAM resource. +/// +/// A builder for the *serviceAccounts.setIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// use iam1::SetIamPolicyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let mut req = SetIamPolicyRequest::default(); +/// +/// // 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 ! +/// let result = hub.projects().service_accounts_set_iam_policy(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountSetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: SetIamPolicyRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountSetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountSetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.setIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+resource}:setIamPolicy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: SetIamPolicyRequest) -> ProjectServiceAccountSetIamPolicyCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectServiceAccountSetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountSetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountSetIamPolicyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a service account key. +/// +/// A builder for the *serviceAccounts.keys.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().service_accounts_keys_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountKeyDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountKeyDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountKeyDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.keys.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// + /// Sets the *name* path property to the given value. + /// + /// 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) -> ProjectServiceAccountKeyDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountKeyDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountKeyDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountKeyDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a service account key and returns it. +/// +/// A builder for the *serviceAccounts.keys.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// use iam1::CreateServiceAccountKeyRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let mut req = CreateServiceAccountKeyRequest::default(); +/// +/// // 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 ! +/// let result = hub.projects().service_accounts_keys_create(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountKeyCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: CreateServiceAccountKeyRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountKeyCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountKeyCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ServiceAccountKey)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.keys.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+name}/keys".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreateServiceAccountKeyRequest) -> ProjectServiceAccountKeyCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// + /// Sets the *name* path property to the given value. + /// + /// 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) -> ProjectServiceAccountKeyCreateCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountKeyCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountKeyCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountKeyCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Signs a blob using a service account. +/// +/// A builder for the *serviceAccounts.signBlob* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// use iam1::SignBlobRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let mut req = SignBlobRequest::default(); +/// +/// // 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 ! +/// let result = hub.projects().service_accounts_sign_blob(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountSignBlobCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: SignBlobRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountSignBlobCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountSignBlobCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SignBlobResponse)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.signBlob", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+name}:signBlob".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: SignBlobRequest) -> ProjectServiceAccountSignBlobCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// + /// Sets the *name* path property to the given value. + /// + /// 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) -> ProjectServiceAccountSignBlobCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountSignBlobCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountSignBlobCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountSignBlobCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a service account. Currently, only the following fields are updatable: 'display_name' . The 'etag' is mandatory. +/// +/// A builder for the *serviceAccounts.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// use iam1::ServiceAccount; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let mut req = ServiceAccount::default(); +/// +/// // 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 ! +/// let result = hub.projects().service_accounts_update(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: ServiceAccount, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ServiceAccount)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: ServiceAccount) -> ProjectServiceAccountUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format "projects/{project}/serviceAccounts/{email}". + /// + /// Sets the *name* path property to the given value. + /// + /// 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) -> ProjectServiceAccountUpdateCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists service accounts for a project. +/// +/// A builder for the *serviceAccounts.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().service_accounts_list("name") +/// .page_token("amet.") +/// .page_size(-81) +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _name: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountListCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListServiceAccountsResponse)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "name", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+name}/serviceAccounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of the project associated with the service accounts, such as "projects/123" + /// + /// Sets the *name* path property to the given value. + /// + /// 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) -> ProjectServiceAccountListCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// Optional pagination token returned in an earlier [ListServiceAccountsResponse.next_page_token]. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectServiceAccountListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the [ListServiceAccountsResponse.next_page_token] in a subsequent request. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectServiceAccountListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a service acount. +/// +/// A builder for the *serviceAccounts.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().service_accounts_delete("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// + /// Sets the *name* path property to the given value. + /// + /// 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) -> ProjectServiceAccountDeleteCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets the ServiceAccountKey by key id. +/// +/// A builder for the *serviceAccounts.keys.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().service_accounts_keys_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountKeyGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountKeyGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountKeyGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ServiceAccountKey)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.keys.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the service account key in the format "projects/{project}/serviceAccounts/{account}/keys/{key}". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// + /// Sets the *name* path property to the given value. + /// + /// 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) -> ProjectServiceAccountKeyGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountKeyGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountKeyGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountKeyGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns the IAM access control policy for specified IAM resource. +/// +/// A builder for the *serviceAccounts.getIamPolicy* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().service_accounts_get_iam_policy("resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountGetIamPolicyCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountGetIamPolicyCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountGetIamPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Policy)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.getIamPolicy", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+resource}:getIamPolicy".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectServiceAccountGetIamPolicyCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountGetIamPolicyCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountGetIamPolicyCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Tests the specified permissions against the IAM access control policy for the specified IAM resource. +/// +/// A builder for the *serviceAccounts.testIamPermissions* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// use iam1::TestIamPermissionsRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let mut req = TestIamPermissionsRequest::default(); +/// +/// // 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 ! +/// let result = hub.projects().service_accounts_test_iam_permissions(req, "resource") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountTestIamPermissionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: TestIamPermissionsRequest, + _resource: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountTestIamPermissionCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountTestIamPermissionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, TestIamPermissionsResponse)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.testIamPermissions", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("resource", self._resource.to_string())); + for &field in ["alt", "resource"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+resource}:testIamPermissions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+resource}", "resource")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["resource"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: TestIamPermissionsRequest) -> ProjectServiceAccountTestIamPermissionCall<'a, C, A> { + self._request = new_value; + self + } + /// REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. + /// + /// Sets the *resource* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn resource(mut self, new_value: &str) -> ProjectServiceAccountTestIamPermissionCall<'a, C, A> { + self._resource = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountTestIamPermissionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountTestIamPermissionCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a service account and returns it. +/// +/// A builder for the *serviceAccounts.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// use iam1::CreateServiceAccountRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let mut req = CreateServiceAccountRequest::default(); +/// +/// // 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 ! +/// let result = hub.projects().service_accounts_create(req, "name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _request: CreateServiceAccountRequest, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ServiceAccount)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+name}/serviceAccounts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CreateServiceAccountRequest) -> ProjectServiceAccountCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// Required. The resource name of the project associated with the service accounts, such as "projects/123" + /// + /// Sets the *name* path property to the given value. + /// + /// 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) -> ProjectServiceAccountCreateCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a ServiceAccount +/// +/// A builder for the *serviceAccounts.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_iam1 as iam1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use iam1::Iam; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Iam::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().service_accounts_get("name") +/// .doit(); +/// # } +/// ``` +pub struct ProjectServiceAccountGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Iam, + _name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectServiceAccountGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectServiceAccountGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ServiceAccount)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "iam.projects.serviceAccounts.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("name", self._name.to_string())); + for &field in ["alt", "name"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://iam.googleapis.com/v1/{+name}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+name}", "name")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["name"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the service account in the format "projects/{project}/serviceAccounts/{account}". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account. + /// + /// Sets the *name* path property to the given value. + /// + /// 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) -> ProjectServiceAccountGetCall<'a, C, A> { + self._name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectServiceAccountGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectServiceAccountGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectServiceAccountGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/identitytoolkit3-cli/Cargo.toml b/gen/identitytoolkit3-cli/Cargo.toml index 2db13c7ba7..74f11916c0 100644 --- a/gen/identitytoolkit3-cli/Cargo.toml +++ b/gen/identitytoolkit3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-identitytoolkit3-cli" -version = "0.3.2+20151008" +version = "0.3.3+20160125" authors = ["Sebastian Thiel "] description = "A complete library to interact with Identity Toolkit (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/identitytoolkit3-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/identitytoolkit3-cli/LICENSE.md b/gen/identitytoolkit3-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/identitytoolkit3-cli/LICENSE.md +++ b/gen/identitytoolkit3-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/identitytoolkit3-cli/README.md b/gen/identitytoolkit3-cli/README.md index 06d3280e23..47f1af2026 100644 --- a/gen/identitytoolkit3-cli/README.md +++ b/gen/identitytoolkit3-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Identity Toolkit* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/identitytoolkit3.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/identitytoolkit3.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/identitytoolkit3.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/identitytoolkit3.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/identitytoolkit3-cli). # Usage -This documentation was generated from the *Identity Toolkit* API at revision *20151008*. The CLI is at version *0.3.2*. +This documentation was generated from the *Identity Toolkit* API at revision *20160125*. The CLI is at version *0.3.3*. ```bash identitytoolkit3 [options] @@ -34,25 +34,28 @@ identitytoolkit3 [options] download-account (-r )... [-p ]... [-o ] get-account-info (-r )... [-p ]... [-o ] get-oob-confirmation-code (-r )... [-p ]... [-o ] + get-project-config [-p ]... [-o ] get-public-keys [-p ]... [-o ] get-recaptcha-param [-p ]... [-o ] reset-password (-r )... [-p ]... [-o ] set-account-info (-r )... [-p ]... [-o ] + sign-out-user (-r )... [-p ]... [-o ] upload-account (-r )... [-p ]... [-o ] verify-assertion (-r )... [-p ]... [-o ] + verify-custom-token (-r )... [-p ]... [-o ] verify-password (-r )... [-p ]... [-o ] identitytoolkit3 --help Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/identitytoolkit3-cli/mkdocs.yml b/gen/identitytoolkit3-cli/mkdocs.yml index e88581942e..88e488996f 100644 --- a/gen/identitytoolkit3-cli/mkdocs.yml +++ b/gen/identitytoolkit3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Identity Toolkit v0.3.2+20151008 +site_name: Identity Toolkit v0.3.3+20160125 site_url: http://byron.github.io/google-apis-rs/google-identitytoolkit3-cli site_description: Write integrating applications with bcore @@ -14,15 +14,18 @@ pages: - ['relyingparty_download-account.md', 'Relyingparty', 'Download Account'] - ['relyingparty_get-account-info.md', 'Relyingparty', 'Get Account Info'] - ['relyingparty_get-oob-confirmation-code.md', 'Relyingparty', 'Get Oob Confirmation Code'] +- ['relyingparty_get-project-config.md', 'Relyingparty', 'Get Project Config'] - ['relyingparty_get-public-keys.md', 'Relyingparty', 'Get Public Keys'] - ['relyingparty_get-recaptcha-param.md', 'Relyingparty', 'Get Recaptcha Param'] - ['relyingparty_reset-password.md', 'Relyingparty', 'Reset Password'] - ['relyingparty_set-account-info.md', 'Relyingparty', 'Set Account Info'] +- ['relyingparty_sign-out-user.md', 'Relyingparty', 'Sign Out User'] - ['relyingparty_upload-account.md', 'Relyingparty', 'Upload Account'] - ['relyingparty_verify-assertion.md', 'Relyingparty', 'Verify Assertion'] +- ['relyingparty_verify-custom-token.md', 'Relyingparty', 'Verify Custom Token'] - ['relyingparty_verify-password.md', 'Relyingparty', 'Verify Password'] theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/identitytoolkit3-cli/src/main.rs b/gen/identitytoolkit3-cli/src/main.rs index e17789fc2f..66a2600b0d 100644 --- a/gen/identitytoolkit3-cli/src/main.rs +++ b/gen/identitytoolkit3-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::IdentityToolkit>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _relyingparty_create_auth_uri(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _relyingparty_create_auth_uri(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "openid-realm" => Some(("openidRealm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "oauth-scope" => Some(("oauthScope", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -90,7 +90,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::IdentitytoolkitRelyingpartyCreateAuthUriRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.relyingparty().create_auth_uri(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -103,7 +103,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -136,13 +136,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_delete_account(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_delete_account(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -156,12 +156,13 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "delegated-project-number" => Some(("delegatedProjectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "local-id" => Some(("localId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["local-id"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["delegated-project-number", "local-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -172,7 +173,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::IdentitytoolkitRelyingpartyDeleteAccountRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.relyingparty().delete_account(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -185,7 +186,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -218,13 +219,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_download_account(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_download_account(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -238,13 +239,14 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "next-page-token" => Some(("nextPageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delegated-project-number" => Some(("delegatedProjectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "max-results" => Some(("maxResults", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["max-results", "next-page-token"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["delegated-project-number", "max-results", "next-page-token"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -255,7 +257,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::IdentitytoolkitRelyingpartyDownloadAccountRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.relyingparty().download_account(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -268,7 +270,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -301,13 +303,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_get_account_info(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_get_account_info(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -321,8 +323,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "id-token" => Some(("idToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -339,7 +341,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::IdentitytoolkitRelyingpartyGetAccountInfoRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.relyingparty().get_account_info(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -352,7 +354,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -385,13 +387,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_get_oob_confirmation_code(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_get_oob_confirmation_code(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -405,8 +407,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "request-type" => Some(("requestType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -428,7 +430,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Relyingparty = json::value::from_value(object).unwrap(); let mut call = self.hub.relyingparty().get_oob_confirmation_code(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -441,7 +443,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -474,10 +476,59 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_get_public_keys(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_get_project_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.relyingparty().get_project_config(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _relyingparty_get_public_keys(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.relyingparty().get_public_keys(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -490,7 +541,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -523,10 +574,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_get_recaptcha_param(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_get_recaptcha_param(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.relyingparty().get_recaptcha_param(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -539,7 +590,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -572,13 +623,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_reset_password(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_reset_password(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -592,8 +643,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "new-password" => Some(("newPassword", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "old-password" => Some(("oldPassword", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -611,7 +662,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::IdentitytoolkitRelyingpartyResetPasswordRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.relyingparty().reset_password(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -624,7 +675,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -657,13 +708,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_set_account_info(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_set_account_info(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -677,24 +728,26 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { + "delegated-project-number" => Some(("delegatedProjectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "local-id" => Some(("localId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "valid-since" => Some(("validSince", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "upgrade-to-federated-login" => Some(("upgradeToFederatedLogin", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "captcha-response" => Some(("captchaResponse", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instance-id" => Some(("instanceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "email-verified" => Some(("emailVerified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "provider" => Some(("provider", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "disable-user" => Some(("disableUser", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "captcha-challenge" => Some(("captchaChallenge", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "captcha-response" => Some(("captchaResponse", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id-token" => Some(("idToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "oob-code" => Some(("oobCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "password" => Some(("password", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["captcha-challenge", "captcha-response", "disable-user", "display-name", "email", "email-verified", "id-token", "local-id", "oob-code", "password", "provider", "upgrade-to-federated-login", "valid-since"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["captcha-challenge", "captcha-response", "delegated-project-number", "disable-user", "display-name", "email", "email-verified", "id-token", "instance-id", "local-id", "oob-code", "password", "provider", "upgrade-to-federated-login", "valid-since"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -705,7 +758,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::IdentitytoolkitRelyingpartySetAccountInfoRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.relyingparty().set_account_info(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -718,7 +771,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -751,13 +804,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_upload_account(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_sign_out_user(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -771,16 +824,100 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "instance-id" => Some(("instanceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "local-id" => Some(("localId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["instance-id", "local-id"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::IdentitytoolkitRelyingpartySignOutUserRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.relyingparty().sign_out_user(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _relyingparty_upload_account(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "salt-separator" => Some(("saltSeparator", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "hash-algorithm" => Some(("hashAlgorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "memory-cost" => Some(("memoryCost", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "delegated-project-number" => Some(("delegatedProjectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "signer-key" => Some(("signerKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "memory-cost" => Some(("memoryCost", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "salt-separator" => Some(("saltSeparator", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "rounds" => Some(("rounds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["hash-algorithm", "memory-cost", "rounds", "salt-separator", "signer-key"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["delegated-project-number", "hash-algorithm", "memory-cost", "rounds", "salt-separator", "signer-key"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -791,7 +928,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::IdentitytoolkitRelyingpartyUploadAccountRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.relyingparty().upload_account(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -804,7 +941,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -837,13 +974,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_verify_assertion(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_verify_assertion(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -857,15 +994,18 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "request-uri" => Some(("requestUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "post-body" => Some(("postBody", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "return-refresh-token" => Some(("returnRefreshToken", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "delegated-project-number" => Some(("delegatedProjectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instance-id" => Some(("instanceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "request-uri" => Some(("requestUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "pending-id-token" => Some(("pendingIdToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "session-id" => Some(("sessionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "return-refresh-token" => Some(("returnRefreshToken", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["pending-id-token", "post-body", "request-uri", "return-refresh-token"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["delegated-project-number", "instance-id", "pending-id-token", "post-body", "request-uri", "return-refresh-token", "session-id"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -876,7 +1016,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::IdentitytoolkitRelyingpartyVerifyAssertionRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.relyingparty().verify_assertion(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -889,7 +1029,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -922,13 +1062,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _relyingparty_verify_password(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _relyingparty_verify_custom_token(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -942,16 +1082,13 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "captcha-response" => Some(("captchaResponse", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "captcha-challenge" => Some(("captchaChallenge", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "password" => Some(("password", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "pending-id-token" => Some(("pendingIdToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "instance-id" => Some(("instanceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "token" => Some(("token", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["captcha-challenge", "captcha-response", "email", "password", "pending-id-token"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["instance-id", "token"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -960,9 +1097,9 @@ impl<'n, 'a> Engine<'n, 'a> { FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); } } - let mut request: api::IdentitytoolkitRelyingpartyVerifyPasswordRequest = json::value::from_value(object).unwrap(); - let mut call = self.hub.relyingparty().verify_password(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut request: api::IdentitytoolkitRelyingpartyVerifyCustomTokenRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.relyingparty().verify_custom_token(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -975,7 +1112,95 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _relyingparty_verify_password(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "instance-id" => Some(("instanceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "delegated-project-number" => Some(("delegatedProjectNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "captcha-response" => Some(("captchaResponse", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "pending-id-token" => Some(("pendingIdToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "captcha-challenge" => Some(("captchaChallenge", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "password" => Some(("password", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "email" => Some(("email", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["captcha-challenge", "captcha-response", "delegated-project-number", "email", "instance-id", "password", "pending-id-token"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::IdentitytoolkitRelyingpartyVerifyPasswordRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.relyingparty().verify_password(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1030,6 +1255,9 @@ impl<'n, 'a> Engine<'n, 'a> { ("get-oob-confirmation-code", Some(opt)) => { call_result = self._relyingparty_get_oob_confirmation_code(opt, dry_run, &mut err); }, + ("get-project-config", Some(opt)) => { + call_result = self._relyingparty_get_project_config(opt, dry_run, &mut err); + }, ("get-public-keys", Some(opt)) => { call_result = self._relyingparty_get_public_keys(opt, dry_run, &mut err); }, @@ -1042,12 +1270,18 @@ impl<'n, 'a> Engine<'n, 'a> { ("set-account-info", Some(opt)) => { call_result = self._relyingparty_set_account_info(opt, dry_run, &mut err); }, + ("sign-out-user", Some(opt)) => { + call_result = self._relyingparty_sign_out_user(opt, dry_run, &mut err); + }, ("upload-account", Some(opt)) => { call_result = self._relyingparty_upload_account(opt, dry_run, &mut err); }, ("verify-assertion", Some(opt)) => { call_result = self._relyingparty_verify_assertion(opt, dry_run, &mut err); }, + ("verify-custom-token", Some(opt)) => { + call_result = self._relyingparty_verify_custom_token(opt, dry_run, &mut err); + }, ("verify-password", Some(opt)) => { call_result = self._relyingparty_verify_password(opt, dry_run, &mut err); }, @@ -1074,14 +1308,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "identitytoolkit3-secret.json", + match cmn::application_secret_from_directory(&config_dir, "identitytoolkit3-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1101,7 +1335,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1139,8 +1373,8 @@ impl<'n, 'a> Engine<'n, 'a> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("relyingparty", "methods: 'create-auth-uri', 'delete-account', 'download-account', 'get-account-info', 'get-oob-confirmation-code', 'get-public-keys', 'get-recaptcha-param', 'reset-password', 'set-account-info', 'upload-account', 'verify-assertion' and 'verify-password'", vec![ - ("create-auth-uri", + ("relyingparty", "methods: 'create-auth-uri', 'delete-account', 'download-account', 'get-account-info', 'get-oob-confirmation-code', 'get-project-config', 'get-public-keys', 'get-recaptcha-param', 'reset-password', 'set-account-info', 'sign-out-user', 'upload-account', 'verify-assertion', 'verify-custom-token' and 'verify-password'", vec![ + ("create-auth-uri", Some(r##"Creates the URI used by the IdP to authenticate the user."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_create-auth-uri", vec![ @@ -1162,7 +1396,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete-account", + ("delete-account", Some(r##"Delete user account."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_delete-account", vec![ @@ -1184,7 +1418,7 @@ fn main() { Some(false), Some(false)), ]), - ("download-account", + ("download-account", Some(r##"Batch download user accounts."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_download-account", vec![ @@ -1206,7 +1440,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-account-info", + ("get-account-info", Some(r##"Returns the account info."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_get-account-info", vec![ @@ -1228,7 +1462,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-oob-confirmation-code", + ("get-oob-confirmation-code", Some(r##"Get a code for user action confirmation."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_get-oob-confirmation-code", vec![ @@ -1250,7 +1484,23 @@ fn main() { Some(false), Some(false)), ]), - ("get-public-keys", + ("get-project-config", + Some(r##"Get project configuration."##), + "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_get-project-config", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("get-public-keys", Some(r##"Get token signing public key."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_get-public-keys", vec![ @@ -1266,7 +1516,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-recaptcha-param", + ("get-recaptcha-param", Some(r##"Get recaptcha secure param."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_get-recaptcha-param", vec![ @@ -1282,7 +1532,7 @@ fn main() { Some(false), Some(false)), ]), - ("reset-password", + ("reset-password", Some(r##"Reset password for a user."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_reset-password", vec![ @@ -1304,7 +1554,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-account-info", + ("set-account-info", Some(r##"Set account info for a user."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_set-account-info", vec![ @@ -1326,7 +1576,29 @@ fn main() { Some(false), Some(false)), ]), - ("upload-account", + ("sign-out-user", + Some(r##"Sign out user."##), + "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_sign-out-user", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("upload-account", Some(r##"Batch upload existing user accounts."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_upload-account", vec![ @@ -1348,7 +1620,7 @@ fn main() { Some(false), Some(false)), ]), - ("verify-assertion", + ("verify-assertion", Some(r##"Verifies the assertion returned by the IdP."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_verify-assertion", vec![ @@ -1370,7 +1642,29 @@ fn main() { Some(false), Some(false)), ]), - ("verify-password", + ("verify-custom-token", + Some(r##"Verifies the developer asserted ID token."##), + "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_verify-custom-token", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("verify-password", Some(r##"Verifies the user entered password."##), "Details at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli/relyingparty_verify-password", vec![ @@ -1398,7 +1692,7 @@ fn main() { let mut app = App::new("identitytoolkit3") .author("Sebastian Thiel ") - .version("0.3.2+20151008") + .version("0.3.3+20160125") .about("Help the third party sites to implement federated login.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_identitytoolkit3_cli") .arg(Arg::with_name("folder") @@ -1417,7 +1711,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1428,7 +1722,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/identitytoolkit3/Cargo.toml b/gen/identitytoolkit3/Cargo.toml index 895f43108a..bfbff69828 100644 --- a/gen/identitytoolkit3/Cargo.toml +++ b/gen/identitytoolkit3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-identitytoolkit3" -version = "0.1.10+20151008" +version = "0.1.11+20160125" authors = ["Sebastian Thiel "] description = "A complete library to interact with Identity Toolkit (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/identitytoolkit3" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/identitytoolkit3/LICENSE.md b/gen/identitytoolkit3/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/identitytoolkit3/LICENSE.md +++ b/gen/identitytoolkit3/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/identitytoolkit3/README.md b/gen/identitytoolkit3/README.md index e6ee8f236c..e510414aef 100644 --- a/gen/identitytoolkit3/README.md +++ b/gen/identitytoolkit3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-identitytoolkit3` library allows access to all features of the *Google Identity Toolkit* service. -This documentation was generated from *Identity Toolkit* crate version *0.1.10+20151008*, where *20151008* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Identity Toolkit* crate version *0.1.11+20160125*, where *20160125* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Identity Toolkit* *v3* API can be found at the [official documentation site](https://developers.google.com/identity-toolkit/v3/). @@ -14,7 +14,7 @@ Everything else about the *Identity Toolkit* *v3* API can be found at the Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.IdentityToolkit.html) ... * [relyingparty](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.Relyingparty.html) - * [*create auth uri*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyCreateAuthUriCall.html), [*delete account*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyDeleteAccountCall.html), [*download account*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyDownloadAccountCall.html), [*get account info*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyGetAccountInfoCall.html), [*get oob confirmation code*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyGetOobConfirmationCodeCall.html), [*get public keys*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyGetPublicKeyCall.html), [*get recaptcha param*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyGetRecaptchaParamCall.html), [*reset password*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyResetPasswordCall.html), [*set account info*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartySetAccountInfoCall.html), [*upload account*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyUploadAccountCall.html), [*verify assertion*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyVerifyAssertionCall.html) and [*verify password*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyVerifyPasswordCall.html) + * [*create auth uri*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyCreateAuthUriCall.html), [*delete account*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyDeleteAccountCall.html), [*download account*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyDownloadAccountCall.html), [*get account info*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyGetAccountInfoCall.html), [*get oob confirmation code*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyGetOobConfirmationCodeCall.html), [*get project config*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyGetProjectConfigCall.html), [*get public keys*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyGetPublicKeyCall.html), [*get recaptcha param*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyGetRecaptchaParamCall.html), [*reset password*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyResetPasswordCall.html), [*set account info*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartySetAccountInfoCall.html), [*sign out user*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartySignOutUserCall.html), [*upload account*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyUploadAccountCall.html), [*verify assertion*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyVerifyAssertionCall.html), [*verify custom token*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyVerifyCustomTokenCall.html) and [*verify password*](http://byron.github.io/google-apis-rs/google_identitytoolkit3/struct.RelyingpartyVerifyPasswordCall.html) diff --git a/gen/identitytoolkit3/src/cmn.rs b/gen/identitytoolkit3/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/identitytoolkit3/src/cmn.rs +++ b/gen/identitytoolkit3/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/identitytoolkit3/src/lib.rs b/gen/identitytoolkit3/src/lib.rs index 604a59580c..59f902e27b 100644 --- a/gen/identitytoolkit3/src/lib.rs +++ b/gen/identitytoolkit3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Identity Toolkit* crate version *0.1.10+20151008*, where *20151008* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Identity Toolkit* crate version *0.1.11+20160125*, where *20160125* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Identity Toolkit* *v3* API can be found at the //! [official documentation site](https://developers.google.com/identity-toolkit/v3/). @@ -12,7 +12,7 @@ //! Handle the following *Resources* with ease from the central [hub](struct.IdentityToolkit.html) ... //! //! * [relyingparty](struct.Relyingparty.html) -//! * [*create auth uri*](struct.RelyingpartyCreateAuthUriCall.html), [*delete account*](struct.RelyingpartyDeleteAccountCall.html), [*download account*](struct.RelyingpartyDownloadAccountCall.html), [*get account info*](struct.RelyingpartyGetAccountInfoCall.html), [*get oob confirmation code*](struct.RelyingpartyGetOobConfirmationCodeCall.html), [*get public keys*](struct.RelyingpartyGetPublicKeyCall.html), [*get recaptcha param*](struct.RelyingpartyGetRecaptchaParamCall.html), [*reset password*](struct.RelyingpartyResetPasswordCall.html), [*set account info*](struct.RelyingpartySetAccountInfoCall.html), [*upload account*](struct.RelyingpartyUploadAccountCall.html), [*verify assertion*](struct.RelyingpartyVerifyAssertionCall.html) and [*verify password*](struct.RelyingpartyVerifyPasswordCall.html) +//! * [*create auth uri*](struct.RelyingpartyCreateAuthUriCall.html), [*delete account*](struct.RelyingpartyDeleteAccountCall.html), [*download account*](struct.RelyingpartyDownloadAccountCall.html), [*get account info*](struct.RelyingpartyGetAccountInfoCall.html), [*get oob confirmation code*](struct.RelyingpartyGetOobConfirmationCodeCall.html), [*get project config*](struct.RelyingpartyGetProjectConfigCall.html), [*get public keys*](struct.RelyingpartyGetPublicKeyCall.html), [*get recaptcha param*](struct.RelyingpartyGetRecaptchaParamCall.html), [*reset password*](struct.RelyingpartyResetPasswordCall.html), [*set account info*](struct.RelyingpartySetAccountInfoCall.html), [*sign out user*](struct.RelyingpartySignOutUserCall.html), [*upload account*](struct.RelyingpartyUploadAccountCall.html), [*verify assertion*](struct.RelyingpartyVerifyAssertionCall.html), [*verify custom token*](struct.RelyingpartyVerifyCustomTokenCall.html) and [*verify password*](struct.RelyingpartyVerifyPasswordCall.html) //! //! //! diff --git a/gen/identitytoolkit3/src/lib.rs.in b/gen/identitytoolkit3/src/lib.rs.in index 038681db6a..0ca92c6a81 100644 --- a/gen/identitytoolkit3/src/lib.rs.in +++ b/gen/identitytoolkit3/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -110,7 +111,7 @@ impl<'a, C, A> IdentityToolkit IdentityToolkit { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -119,7 +120,7 @@ impl<'a, C, A> IdentityToolkit } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -133,6 +134,26 @@ impl<'a, C, A> IdentityToolkit // ############ // SCHEMAS ### // ########## +/// Respone of uploading accounts in batch. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [upload account relyingparty](struct.RelyingpartyUploadAccountCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct UploadAccountResponse { + /// The fixed string "identitytoolkit#UploadAccountResponse". + pub kind: Option, + /// The error encountered while processing the account info. + pub error: Option>, +} + +impl ResponseResult for UploadAccountResponse {} + + /// Request of getting a code for user confirmation (reset password, change email etc.) /// /// # Activities @@ -186,72 +207,46 @@ pub struct CreateAuthUriResponse { /// True if captcha is required. #[serde(rename="captchaRequired")] pub captcha_required: Option, - /// The URI used by the IDP to authenticate the user. - #[serde(rename="authUri")] - pub auth_uri: Option, /// Whether the user is registered if the identifier is an email. pub registered: Option, - /// The provider ID of the auth URI. - #[serde(rename="providerId")] - pub provider_id: Option, + /// all providers the user has once used to do federated login + #[serde(rename="allProviders")] + pub all_providers: Option>, /// True if the authUri is for user's existing provider. #[serde(rename="forExistingProvider")] pub for_existing_provider: Option, + /// Session ID which should be passed in the following verifyAssertion request. + #[serde(rename="sessionId")] + pub session_id: Option, + /// The provider ID of the auth URI. + #[serde(rename="providerId")] + pub provider_id: Option, + /// The URI used by the IDP to authenticate the user. + #[serde(rename="authUri")] + pub auth_uri: Option, } impl ResponseResult for CreateAuthUriResponse {} -/// Request to set the account information. +/// Response of resetting the password. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [set account info relyingparty](struct.RelyingpartySetAccountInfoCall.html) (request) +/// * [reset password relyingparty](struct.RelyingpartyResetPasswordCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct IdentitytoolkitRelyingpartySetAccountInfoRequest { - /// The name of the user. - #[serde(rename="displayName")] - pub display_name: Option, - /// The local ID of the user. - #[serde(rename="localId")] - pub local_id: Option, - /// Timestamp in seconds for valid login token. - #[serde(rename="validSince")] - pub valid_since: Option, - /// Mark the user to upgrade to federated login. - #[serde(rename="upgradeToFederatedLogin")] - pub upgrade_to_federated_login: Option, - /// Response to the captcha. - #[serde(rename="captchaResponse")] - pub captcha_response: Option, - /// Mark the email as verified or not. - #[serde(rename="emailVerified")] - pub email_verified: Option, - /// Whether to disable the user. - #[serde(rename="disableUser")] - pub disable_user: Option, - /// The captcha challenge. - #[serde(rename="captchaChallenge")] - pub captcha_challenge: Option, - /// The GITKit token of the authenticated user. - #[serde(rename="idToken")] - pub id_token: Option, - /// The associated IDPs of the user. - pub provider: Option>, - /// The out-of-band code of the change email request. - #[serde(rename="oobCode")] - pub oob_code: Option, - /// The new password of the user. - pub password: Option, - /// The email of the user. +pub struct ResetPasswordResponse { + /// The fixed string "identitytoolkit#ResetPasswordResponse". + pub kind: Option, + /// The user's email. pub email: Option, } -impl RequestValue for IdentitytoolkitRelyingpartySetAccountInfoRequest {} +impl ResponseResult for ResetPasswordResponse {} /// Request to delete account. @@ -265,6 +260,9 @@ impl RequestValue for IdentitytoolkitRelyingpartySetAccountInfoRequest {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct IdentitytoolkitRelyingpartyDeleteAccountRequest { + /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration. + #[serde(rename="delegatedProjectNumber")] + pub delegated_project_number: Option, /// The local ID of the user. #[serde(rename="localId")] pub local_id: Option, @@ -273,6 +271,34 @@ pub struct IdentitytoolkitRelyingpartyDeleteAccountRequest { impl RequestValue for IdentitytoolkitRelyingpartyDeleteAccountRequest {} +/// Response of getting the project configuration. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [get project config relyingparty](struct.RelyingpartyGetProjectConfigCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IdentitytoolkitRelyingpartyGetProjectConfigResponse { + /// Project ID of the relying party. + #[serde(rename="projectId")] + pub project_id: Option, + /// Browser API key, needed when making http request to Apiary. + #[serde(rename="apiKey")] + pub api_key: Option, + /// Whether to allow password user sign in or sign up. + #[serde(rename="allowPasswordUser")] + pub allow_password_user: Option, + /// OAuth2 provider configuration. + #[serde(rename="idpConfig")] + pub idp_config: Option>, +} + +impl ResponseResult for IdentitytoolkitRelyingpartyGetProjectConfigResponse {} + + /// Response of getting a code for user confirmation (reset password, change email etc.). /// /// # Activities @@ -289,6 +315,8 @@ pub struct GetOobConfirmationCodeResponse { /// The code to be send to the user. #[serde(rename="oobCode")] pub oob_code: Option, + /// The email address that the email is sent to. + pub email: Option, } impl ResponseResult for GetOobConfirmationCodeResponse {} @@ -341,6 +369,28 @@ pub struct DownloadAccountResponse { impl ResponseResult for DownloadAccountResponse {} +/// Request to sign out user. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sign out user relyingparty](struct.RelyingpartySignOutUserCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IdentitytoolkitRelyingpartySignOutUserRequest { + /// Instance id token of the app. + #[serde(rename="instanceId")] + pub instance_id: Option, + /// The local ID of the user. + #[serde(rename="localId")] + pub local_id: Option, +} + +impl RequestValue for IdentitytoolkitRelyingpartySignOutUserRequest {} + + /// Response of getting recaptcha param. /// /// # Activities @@ -365,31 +415,25 @@ pub struct GetRecaptchaParamResponse { impl ResponseResult for GetRecaptchaParamResponse {} -/// Request to reset the password. +/// Response from verifying a custom token /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [reset password relyingparty](struct.RelyingpartyResetPasswordCall.html) (request) +/// * [verify custom token relyingparty](struct.RelyingpartyVerifyCustomTokenCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct IdentitytoolkitRelyingpartyResetPasswordRequest { - /// The new password inputted by the user. - #[serde(rename="newPassword")] - pub new_password: Option, - /// The old password inputted by the user. - #[serde(rename="oldPassword")] - pub old_password: Option, - /// The confirmation code. - #[serde(rename="oobCode")] - pub oob_code: Option, - /// The email address of the user. - pub email: Option, +pub struct VerifyCustomTokenResponse { + /// The GITKit token for authenticated user. + #[serde(rename="idToken")] + pub id_token: Option, + /// The fixed string "identitytoolkit#VerifyCustomTokenResponse". + pub kind: Option, } -impl RequestValue for IdentitytoolkitRelyingpartyResetPasswordRequest {} +impl ResponseResult for VerifyCustomTokenResponse {} /// Response of verifying the IDP assertion. @@ -496,6 +540,27 @@ pub struct VerifyAssertionResponse { impl ResponseResult for VerifyAssertionResponse {} +/// Template for a single idp configuration. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IdpConfig { + /// Percent of users who will be prompted/redirected federated login for this IDP. + #[serde(rename="experimentPercent")] + pub experiment_percent: Option, + /// Whether this IDP is enabled. + pub enabled: Option, + /// OAuth2 client ID. + #[serde(rename="clientId")] + pub client_id: Option, + /// OAuth2 provider. + pub provider: Option, +} + +impl Part for IdpConfig {} + + /// The error encountered while processing the account info. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -512,24 +577,31 @@ impl NestedType for UploadAccountResponseError {} impl Part for UploadAccountResponseError {} -/// Respone of uploading accounts in batch. +/// Request to reset the password. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [upload account relyingparty](struct.RelyingpartyUploadAccountCall.html) (response) +/// * [reset password relyingparty](struct.RelyingpartyResetPasswordCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UploadAccountResponse { - /// The fixed string "identitytoolkit#UploadAccountResponse". - pub kind: Option, - /// The error encountered while processing the account info. - pub error: Option>, +pub struct IdentitytoolkitRelyingpartyResetPasswordRequest { + /// The new password inputted by the user. + #[serde(rename="newPassword")] + pub new_password: Option, + /// The old password inputted by the user. + #[serde(rename="oldPassword")] + pub old_password: Option, + /// The confirmation code. + #[serde(rename="oobCode")] + pub oob_code: Option, + /// The email address of the user. + pub email: Option, } -impl ResponseResult for UploadAccountResponse {} +impl RequestValue for IdentitytoolkitRelyingpartyResetPasswordRequest {} /// Request to upload user account in batch. @@ -546,6 +618,9 @@ pub struct IdentitytoolkitRelyingpartyUploadAccountRequest { /// The password hash algorithm. #[serde(rename="hashAlgorithm")] pub hash_algorithm: Option, + /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration. + #[serde(rename="delegatedProjectNumber")] + pub delegated_project_number: Option, /// Memory cost for hash calculation. Used by scrypt similar algorithms. #[serde(rename="memoryCost")] pub memory_cost: Option, @@ -607,24 +682,62 @@ pub struct VerifyPasswordResponse { impl ResponseResult for VerifyPasswordResponse {} -/// Response of resetting the password. +/// Request to set the account information. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [reset password relyingparty](struct.RelyingpartyResetPasswordCall.html) (response) +/// * [set account info relyingparty](struct.RelyingpartySetAccountInfoCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ResetPasswordResponse { - /// The fixed string "identitytoolkit#ResetPasswordResponse". - pub kind: Option, - /// The user's email. +pub struct IdentitytoolkitRelyingpartySetAccountInfoRequest { + /// The captcha challenge. + #[serde(rename="captchaChallenge")] + pub captcha_challenge: Option, + /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration. + #[serde(rename="delegatedProjectNumber")] + pub delegated_project_number: Option, + /// The name of the user. + #[serde(rename="displayName")] + pub display_name: Option, + /// The local ID of the user. + #[serde(rename="localId")] + pub local_id: Option, + /// Timestamp in seconds for valid login token. + #[serde(rename="validSince")] + pub valid_since: Option, + /// Mark the user to upgrade to federated login. + #[serde(rename="upgradeToFederatedLogin")] + pub upgrade_to_federated_login: Option, + /// Instance id token of the app. + #[serde(rename="instanceId")] + pub instance_id: Option, + /// Mark the email as verified or not. + #[serde(rename="emailVerified")] + pub email_verified: Option, + /// Whether to disable the user. + #[serde(rename="disableUser")] + pub disable_user: Option, + /// Response to the captcha. + #[serde(rename="captchaResponse")] + pub captcha_response: Option, + /// The GITKit token of the authenticated user. + #[serde(rename="idToken")] + pub id_token: Option, + /// The associated IDPs of the user. + pub provider: Option>, + /// The out-of-band code of the change email request. + #[serde(rename="oobCode")] + pub oob_code: Option, + /// The new password of the user. + pub password: Option, + /// The email of the user. pub email: Option, } -impl ResponseResult for ResetPasswordResponse {} +impl RequestValue for IdentitytoolkitRelyingpartySetAccountInfoRequest {} /// Respone of deleting account. @@ -645,6 +758,25 @@ pub struct DeleteAccountResponse { impl ResponseResult for DeleteAccountResponse {} +/// Response of signing out user. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sign out user relyingparty](struct.RelyingpartySignOutUserCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IdentitytoolkitRelyingpartySignOutUserResponse { + /// The local ID of the user. + #[serde(rename="localId")] + pub local_id: Option, +} + +impl ResponseResult for IdentitytoolkitRelyingpartySignOutUserResponse {} + + /// Request to get the IDP authentication URL. /// /// # Activities @@ -703,9 +835,15 @@ pub struct IdentitytoolkitRelyingpartyVerifyPasswordRequest { /// Response to the captcha. #[serde(rename="captchaResponse")] pub captcha_response: Option, + /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration. + #[serde(rename="delegatedProjectNumber")] + pub delegated_project_number: Option, /// The captcha challenge. #[serde(rename="captchaChallenge")] pub captcha_challenge: Option, + /// Instance id token of the app. + #[serde(rename="instanceId")] + pub instance_id: Option, /// The password inputed by the user. pub password: Option, /// The email of the user. @@ -757,47 +895,25 @@ pub struct IdentitytoolkitRelyingpartyGetPublicKeysResponse(Option, - /// The local ID of the user. - #[serde(rename="localId")] - pub local_id: Option, - /// Timestamp in seconds for valid login token. - #[serde(rename="validSince")] - pub valid_since: Option, - /// The URL of the user profile photo. - #[serde(rename="photoUrl")] - pub photo_url: Option, - /// Whether the email has been verified. - #[serde(rename="emailVerified")] - pub email_verified: Option, - /// The user's hashed password. - #[serde(rename="passwordHash")] - pub password_hash: Option, - /// Whether the user is disabled. - pub disabled: Option, - /// Version of the user's password. - pub version: Option, - /// The IDP of the user. - #[serde(rename="providerUserInfo")] - pub provider_user_info: Option>, - /// The timestamp when the password was last updated. - #[serde(rename="passwordUpdatedAt")] - pub password_updated_at: Option, - /// The user's password salt. - pub salt: Option, - /// The email of the user. - pub email: Option, +pub struct IdentitytoolkitRelyingpartyVerifyCustomTokenRequest { + /// Instance id token of the app. + #[serde(rename="instanceId")] + pub instance_id: Option, + /// The custom token to verify + pub token: Option, } -impl Part for UserInfo {} +impl RequestValue for IdentitytoolkitRelyingpartyVerifyCustomTokenRequest {} /// Request to download user account in batch. @@ -814,6 +930,9 @@ pub struct IdentitytoolkitRelyingpartyDownloadAccountRequest { /// The token for the next page. This should be taken from the previous response. #[serde(rename="nextPageToken")] pub next_page_token: Option, + /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration. + #[serde(rename="delegatedProjectNumber")] + pub delegated_project_number: Option, /// The max number of results to return in the response. #[serde(rename="maxResults")] pub max_results: Option, @@ -863,6 +982,43 @@ pub struct GetAccountInfoResponse { impl ResponseResult for GetAccountInfoResponse {} +/// Request to verify the IDP assertion. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [verify assertion relyingparty](struct.RelyingpartyVerifyAssertionCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct IdentitytoolkitRelyingpartyVerifyAssertionRequest { + /// The post body if the request is a HTTP POST. + #[serde(rename="postBody")] + pub post_body: Option, + /// GCP project number of the requesting delegated app. Currently only intended for Firebase V1 migration. + #[serde(rename="delegatedProjectNumber")] + pub delegated_project_number: Option, + /// Instance id token of the app. + #[serde(rename="instanceId")] + pub instance_id: Option, + /// The URI to which the IDP redirects the user back. It may contain federated login result params added by the IDP. + #[serde(rename="requestUri")] + pub request_uri: Option, + /// Whether to return refresh tokens. + #[serde(rename="returnRefreshToken")] + pub return_refresh_token: Option, + /// Session ID, which should match the one in previous createAuthUri request. + #[serde(rename="sessionId")] + pub session_id: Option, + /// The GITKit token for the non-trusted IDP pending to be confirmed by the user. + #[serde(rename="pendingIdToken")] + pub pending_id_token: Option, +} + +impl RequestValue for IdentitytoolkitRelyingpartyVerifyAssertionRequest {} + + /// Respone of setting the account information. /// /// # Activities @@ -895,32 +1051,47 @@ pub struct SetAccountInfoResponse { impl ResponseResult for SetAccountInfoResponse {} -/// Request to verify the IDP assertion. +/// Template for an individual account info. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [verify assertion relyingparty](struct.RelyingpartyVerifyAssertionCall.html) (request) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct IdentitytoolkitRelyingpartyVerifyAssertionRequest { - /// The URI to which the IDP redirects the user back. It may contain federated login result params added by the IDP. - #[serde(rename="requestUri")] - pub request_uri: Option, - /// The post body if the request is a HTTP POST. - #[serde(rename="postBody")] - pub post_body: Option, - /// Whether to return refresh tokens. - #[serde(rename="returnRefreshToken")] - pub return_refresh_token: Option, - /// The GITKit token for the non-trusted IDP pending to be confirmed by the user. - #[serde(rename="pendingIdToken")] - pub pending_id_token: Option, +pub struct UserInfo { + /// The name of the user. + #[serde(rename="displayName")] + pub display_name: Option, + /// The local ID of the user. + #[serde(rename="localId")] + pub local_id: Option, + /// Timestamp in seconds for valid login token. + #[serde(rename="validSince")] + pub valid_since: Option, + /// The URL of the user profile photo. + #[serde(rename="photoUrl")] + pub photo_url: Option, + /// Whether the email has been verified. + #[serde(rename="emailVerified")] + pub email_verified: Option, + /// The user's hashed password. + #[serde(rename="passwordHash")] + pub password_hash: Option, + /// Whether the user is disabled. + pub disabled: Option, + /// Version of the user's password. + pub version: Option, + /// The IDP of the user. + #[serde(rename="providerUserInfo")] + pub provider_user_info: Option>, + /// The timestamp when the password was last updated. + #[serde(rename="passwordUpdatedAt")] + pub password_updated_at: Option, + /// The user's password salt. + pub salt: Option, + /// The email of the user. + pub email: Option, } -impl RequestValue for IdentitytoolkitRelyingpartyVerifyAssertionRequest {} +impl Part for UserInfo {} @@ -951,7 +1122,7 @@ impl RequestValue for IdentitytoolkitRelyingpartyVerifyAssertionRequest {} /// ::default(), None); /// let mut hub = IdentityToolkit::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `create_auth_uri(...)`, `delete_account(...)`, `download_account(...)`, `get_account_info(...)`, `get_oob_confirmation_code(...)`, `get_public_keys(...)`, `get_recaptcha_param(...)`, `reset_password(...)`, `set_account_info(...)`, `upload_account(...)`, `verify_assertion(...)` and `verify_password(...)` +/// // like `create_auth_uri(...)`, `delete_account(...)`, `download_account(...)`, `get_account_info(...)`, `get_oob_confirmation_code(...)`, `get_project_config(...)`, `get_public_keys(...)`, `get_recaptcha_param(...)`, `reset_password(...)`, `set_account_info(...)`, `sign_out_user(...)`, `upload_account(...)`, `verify_assertion(...)`, `verify_custom_token(...)` and `verify_password(...)` /// // to build up your call. /// let rb = hub.relyingparty(); /// # } @@ -1009,6 +1180,22 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Sign out user. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn sign_out_user(&self, request: IdentitytoolkitRelyingpartySignOutUserRequest) -> RelyingpartySignOutUserCall<'a, C, A> { + RelyingpartySignOutUserCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Verifies the assertion returned by the IdP. @@ -1057,6 +1244,22 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { } } + /// Create a builder to help you perform the following task: + /// + /// Verifies the developer asserted ID token. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn verify_custom_token(&self, request: IdentitytoolkitRelyingpartyVerifyCustomTokenRequest) -> RelyingpartyVerifyCustomTokenCall<'a, C, A> { + RelyingpartyVerifyCustomTokenCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _additional_params: Default::default(), + } + } + /// Create a builder to help you perform the following task: /// /// Reset password for a user. @@ -1147,6 +1350,17 @@ impl<'a, C, A> RelyingpartyMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Get project configuration. + pub fn get_project_config(&self) -> RelyingpartyGetProjectConfigCall<'a, C, A> { + RelyingpartyGetProjectConfigCall { + hub: self.hub, + _delegate: Default::default(), + _additional_params: Default::default(), + } + } } @@ -1216,7 +1430,7 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.getOobConfirmationCode", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.getOobConfirmationCode", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1245,14 +1459,14 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1281,7 +1495,7 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1291,10 +1505,10 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1326,7 +1540,7 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Relyingparty) -> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> { self._request = new_value; @@ -1344,12 +1558,12 @@ impl<'a, C, A> RelyingpartyGetOobConfirmationCodeCall<'a, C, A> where C: BorrowM } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1420,7 +1634,7 @@ impl<'a, C, A> RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.getPublicKeys", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.getPublicKeys", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1449,7 +1663,7 @@ impl<'a, C, A> RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1470,7 +1684,7 @@ impl<'a, C, A> RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1480,10 +1694,10 @@ impl<'a, C, A> RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut RelyingpartyGetPublicKeyCall<'a, C, A> where C: BorrowMut RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.createAuthUri", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.createAuthUri", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1636,14 +1850,14 @@ impl<'a, C, A> RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1672,7 +1886,7 @@ impl<'a, C, A> RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1682,10 +1896,10 @@ impl<'a, C, A> RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut RelyingpartyCreateAuthUriCall<'a, C, A> { self._request = new_value; @@ -1735,12 +1949,12 @@ impl<'a, C, A> RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut RelyingpartyCreateAuthUriCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = IdentityToolkit::new(hyper::Client::new(), 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 ! +/// let mut req = IdentitytoolkitRelyingpartySignOutUserRequest::default(); +/// +/// // 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 ! +/// let result = hub.relyingparty().sign_out_user(req) +/// .doit(); +/// # } +/// ``` +pub struct RelyingpartySignOutUserCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a IdentityToolkit, + _request: IdentitytoolkitRelyingpartySignOutUserRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, +} + +impl<'a, C, A> CallBuilder for RelyingpartySignOutUserCall<'a, C, A> {} + +impl<'a, C, A> RelyingpartySignOutUserCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, IdentitytoolkitRelyingpartySignOutUserResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.signOutUser", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/signOutUser".to_string(); + + let mut key = self.hub.auth.borrow_mut().api_key(); + if key.is_none() { + key = dlg.api_key(); + } + match key { + Some(value) => params.push(("key", value)), + None => { + dlg.finished(false); + return Err(Error::MissingAPIKey) + } + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: IdentitytoolkitRelyingpartySignOutUserRequest) -> RelyingpartySignOutUserCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RelyingpartySignOutUserCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RelyingpartySignOutUserCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + +} + + /// Verifies the assertion returned by the IdP. /// /// A builder for the *verifyAssertion* method supported by a *relyingparty* resource. @@ -1818,7 +2243,7 @@ impl<'a, C, A> RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.verifyAssertion", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.verifyAssertion", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1847,14 +2272,14 @@ impl<'a, C, A> RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1883,7 +2308,7 @@ impl<'a, C, A> RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1893,10 +2318,10 @@ impl<'a, C, A> RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyAssertionCall<'a, C, A> { self._request = new_value; @@ -1946,12 +2371,12 @@ impl<'a, C, A> RelyingpartyVerifyAssertionCall<'a, C, A> where C: BorrowMut RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.uploadAccount", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.uploadAccount", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2058,14 +2483,14 @@ impl<'a, C, A> RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2094,7 +2519,7 @@ impl<'a, C, A> RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2104,10 +2529,10 @@ impl<'a, C, A> RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut RelyingpartyUploadAccountCall<'a, C, A> { self._request = new_value; @@ -2157,12 +2582,12 @@ impl<'a, C, A> RelyingpartyUploadAccountCall<'a, C, A> where C: BorrowMut RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.getAccountInfo", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.getAccountInfo", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2269,14 +2694,14 @@ impl<'a, C, A> RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2305,7 +2730,7 @@ impl<'a, C, A> RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2315,10 +2740,10 @@ impl<'a, C, A> RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut RelyingpartyGetAccountInfoCall<'a, C, A> { self._request = new_value; @@ -2368,12 +2793,12 @@ impl<'a, C, A> RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut RelyingpartyGetAccountInfoCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = IdentityToolkit::new(hyper::Client::new(), 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 ! +/// let mut req = IdentitytoolkitRelyingpartyVerifyCustomTokenRequest::default(); +/// +/// // 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 ! +/// let result = hub.relyingparty().verify_custom_token(req) +/// .doit(); +/// # } +/// ``` +pub struct RelyingpartyVerifyCustomTokenCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a IdentityToolkit, + _request: IdentitytoolkitRelyingpartyVerifyCustomTokenRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, +} + +impl<'a, C, A> CallBuilder for RelyingpartyVerifyCustomTokenCall<'a, C, A> {} + +impl<'a, C, A> RelyingpartyVerifyCustomTokenCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VerifyCustomTokenResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.verifyCustomToken", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyCustomToken".to_string(); + + let mut key = self.hub.auth.borrow_mut().api_key(); + if key.is_none() { + key = dlg.api_key(); + } + match key { + Some(value) => params.push(("key", value)), + None => { + dlg.finished(false); + return Err(Error::MissingAPIKey) + } + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: IdentitytoolkitRelyingpartyVerifyCustomTokenRequest) -> RelyingpartyVerifyCustomTokenCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RelyingpartyVerifyCustomTokenCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RelyingpartyVerifyCustomTokenCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + +} + + /// Reset password for a user. /// /// A builder for the *resetPassword* method supported by a *relyingparty* resource. @@ -2451,7 +3087,7 @@ impl<'a, C, A> RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.resetPassword", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.resetPassword", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2480,14 +3116,14 @@ impl<'a, C, A> RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2516,7 +3152,7 @@ impl<'a, C, A> RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2526,10 +3162,10 @@ impl<'a, C, A> RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut RelyingpartyResetPasswordCall<'a, C, A> { self._request = new_value; @@ -2579,12 +3215,12 @@ impl<'a, C, A> RelyingpartyResetPasswordCall<'a, C, A> where C: BorrowMut RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.downloadAccount", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.downloadAccount", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2691,14 +3327,14 @@ impl<'a, C, A> RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2727,7 +3363,7 @@ impl<'a, C, A> RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2737,10 +3373,10 @@ impl<'a, C, A> RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut RelyingpartyDownloadAccountCall<'a, C, A> { self._request = new_value; @@ -2790,12 +3426,12 @@ impl<'a, C, A> RelyingpartyDownloadAccountCall<'a, C, A> where C: BorrowMut RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.setAccountInfo", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.setAccountInfo", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2902,14 +3538,14 @@ impl<'a, C, A> RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2938,7 +3574,7 @@ impl<'a, C, A> RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2948,10 +3584,10 @@ impl<'a, C, A> RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut RelyingpartySetAccountInfoCall<'a, C, A> { self._request = new_value; @@ -3001,12 +3637,12 @@ impl<'a, C, A> RelyingpartySetAccountInfoCall<'a, C, A> where C: BorrowMut RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.deleteAccount", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.deleteAccount", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3113,14 +3749,14 @@ impl<'a, C, A> RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3149,7 +3785,7 @@ impl<'a, C, A> RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3159,10 +3795,10 @@ impl<'a, C, A> RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut RelyingpartyDeleteAccountCall<'a, C, A> { self._request = new_value; @@ -3212,12 +3848,12 @@ impl<'a, C, A> RelyingpartyDeleteAccountCall<'a, C, A> where C: BorrowMut RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.getRecaptchaParam", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.getRecaptchaParam", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3317,7 +3953,7 @@ impl<'a, C, A> RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3338,7 +3974,7 @@ impl<'a, C, A> RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3348,10 +3984,10 @@ impl<'a, C, A> RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut RelyingpartyGetRecaptchaParamCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.verifyPassword", + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.verifyPassword", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3504,14 +4140,14 @@ impl<'a, C, A> RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3540,7 +4176,7 @@ impl<'a, C, A> RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3550,10 +4186,10 @@ impl<'a, C, A> RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyPasswordCall<'a, C, A> { self._request = new_value; @@ -3603,12 +4239,12 @@ impl<'a, C, A> RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut RelyingpartyVerifyPasswordCall<'a, C, A> where C: BorrowMut::default(), None); +/// # let mut hub = IdentityToolkit::new(hyper::Client::new(), 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 ! +/// let result = hub.relyingparty().get_project_config() +/// .doit(); +/// # } +/// ``` +pub struct RelyingpartyGetProjectConfigCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a IdentityToolkit, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, +} + +impl<'a, C, A> CallBuilder for RelyingpartyGetProjectConfigCall<'a, C, A> {} + +impl<'a, C, A> RelyingpartyGetProjectConfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, IdentitytoolkitRelyingpartyGetProjectConfigResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "identitytoolkit.relyingparty.getProjectConfig", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/identitytoolkit/v3/relyingparty/getProjectConfig".to_string(); + + let mut key = self.hub.auth.borrow_mut().api_key(); + if key.is_none() { + key = dlg.api_key(); + } + match key { + Some(value) => params.push(("key", value)), + None => { + dlg.finished(false); + return Err(Error::MissingAPIKey) + } + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> RelyingpartyGetProjectConfigCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> RelyingpartyGetProjectConfigCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + +} + + diff --git a/gen/kgsearch1-cli/Cargo.toml b/gen/kgsearch1-cli/Cargo.toml new file mode 100644 index 0000000000..b8577e4039 --- /dev/null +++ b/gen/kgsearch1-cli/Cargo.toml @@ -0,0 +1,35 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-kgsearch1-cli" +version = "0.3.3+20151215" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with kgsearch (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/kgsearch1-cli" +homepage = "https://developers.google.com/knowledge-graph/" +documentation = "http://byron.github.io/google-apis-rs/google_kgsearch1_cli" +license = "MIT" +keywords = ["kgsearch", "google", "cli"] + +[[bin]] +name = "kgsearch1" + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +strsim = "0.4" +yup-hyper-mock = "1.0" +clap = "2.0" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + + +[dependencies.google-kgsearch1] +path = "../kgsearch1" diff --git a/gen/kgsearch1-cli/LICENSE.md b/gen/kgsearch1-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/kgsearch1-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudsearch1-cli/README.md b/gen/kgsearch1-cli/README.md similarity index 71% rename from gen/cloudsearch1-cli/README.md rename to gen/kgsearch1-cli/README.md index 1296a46c89..896f8a5468 100644 --- a/gen/cloudsearch1-cli/README.md +++ b/gen/kgsearch1-cli/README.md @@ -3,40 +3,52 @@ DO NOT EDIT ! This file was generated automatically from 'src/mako/cli/README.md.mako' DO NOT EDIT ! --> -The `cloudsearch1` command-line interface *(CLI)* allows to use most features of the *Google cloudsearch* service from the comfort of your terminal. +The `kgsearch1` command-line interface *(CLI)* allows to use most features of the *Google kgsearch* service from the comfort of your terminal. By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. +Everything else about the *kgsearch* API can be found at the +[official documentation site](https://developers.google.com/knowledge-graph/). + +# Downloads + +You can download the pre-compiled 64bit binaries for the following platforms: + +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/kgsearch1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/kgsearch1.tar.gz) + +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/kgsearch1-cli). + # Usage -This documentation was generated from the *cloudsearch* API at revision *20150416*. The CLI is at version *0.1.0*. +This documentation was generated from the *kgsearch* API at revision *20151215*. The CLI is at version *0.3.3*. ```bash - cloudsearch1 --help - -All documentation details can be found at -http://byron.github.io/google-apis-rs/google_cloudsearch1_cli/index.html +kgsearch1 [options] + entities + search [-p ]... [-o ] + kgsearch1 --help Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` # Configuration -The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `cloudsearch1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `kgsearch1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. More information about the various kinds of persistent data are given in the following paragraphs. @@ -54,7 +66,7 @@ The first time a scope is used, the user is asked for permission. Follow the ins by the CLI to grant permissions, or to decline. If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration -directory, e.g. `~/.google-service-cli/cloudsearch1-token-.json`. No manual management of these tokens +directory, e.g. `~/.google-service-cli/kgsearch1-token-.json`. No manual management of these tokens is necessary. To revoke granted authentication, please refer to the [official documentation][revoke-access]. @@ -70,7 +82,7 @@ comes with a default application secret that is configured accordingly. This als all around the world may deplete the daily quota. You can workaround this limitation by putting your own secrets file at this location: -`~/.google-service-cli/cloudsearch1-secret.json`, assuming that the required *cloudsearch* API +`~/.google-service-cli/kgsearch1-secret.json`, assuming that the required *kgsearch* API was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at *APIs & auth -> Credentials -> Download JSON* and used as is. @@ -88,7 +100,7 @@ will cause all communication related to authentication to standard error. If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the issue at hand. -You may consider redirecting standard error into a file for ease of use, e.g. `cloudsearch1 --debug [options] 2>debug.txt`. +You may consider redirecting standard error into a file for ease of use, e.g. `kgsearch1 --debug [options] 2>debug.txt`. [scopes]: https://developers.google.com/+/api/oauth#scopes diff --git a/gen/kgsearch1-cli/mkdocs.yml b/gen/kgsearch1-cli/mkdocs.yml new file mode 100644 index 0000000000..a28ae00be5 --- /dev/null +++ b/gen/kgsearch1-cli/mkdocs.yml @@ -0,0 +1,17 @@ +site_name: kgsearch v0.3.3+20151215 +site_url: http://byron.github.io/google-apis-rs/google-kgsearch1-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/kgsearch1-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['entities_search.md', 'Entities', 'Search'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/kgsearch1-cli/src/cmn.rs b/gen/kgsearch1-cli/src/cmn.rs new file mode 100644 index 0000000000..ae86fdef65 --- /dev/null +++ b/gen/kgsearch1-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::IoError(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::IoError(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::IoError(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + IOError((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::IOError((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + IOError((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::IOError((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::IOError( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::IoError(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::IoError(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/kgsearch1-cli/src/main.rs b/gen/kgsearch1-cli/src/main.rs new file mode 100644 index 0000000000..0b77a31543 --- /dev/null +++ b/gen/kgsearch1-cli/src/main.rs @@ -0,0 +1,332 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/cli/main.rs.mako' +// DO NOT EDIT ! +#![allow(unused_variables, unused_imports, dead_code, unused_mut)] + +#[macro_use] +extern crate clap; +extern crate yup_oauth2 as oauth2; +extern crate yup_hyper_mock as mock; +extern crate serde; +extern crate serde_json; +extern crate hyper; +extern crate mime; +extern crate strsim; +extern crate google_kgsearch1 as api; + +use std::env; +use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; + +mod cmn; + +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, + calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; + +use std::default::Default; +use std::str::FromStr; + +use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; +use serde_json as json; +use clap::ArgMatches; + +enum DoitError { + IoError(String, io::Error), + ApiError(api::Error), +} + +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::Kgsearch>, + gp: Vec<&'static str>, + gpm: Vec<(&'static str, &'static str)>, +} + + +impl<'n> Engine<'n> { + fn _entities_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.entities().search(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "types" => { + call = call.add_types(value.unwrap_or("")); + }, + "query" => { + call = call.query(value.unwrap_or("")); + }, + "prefix" => { + call = call.prefix(arg_from_str(value.unwrap_or("false"), err, "prefix", "boolean")); + }, + "limit" => { + call = call.limit(arg_from_str(value.unwrap_or("-0"), err, "limit", "integer")); + }, + "languages" => { + call = call.add_languages(value.unwrap_or("")); + }, + "indent" => { + call = call.indent(arg_from_str(value.unwrap_or("false"), err, "indent", "boolean")); + }, + "ids" => { + call = call.add_ids(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["indent", "ids", "languages", "prefix", "limit", "query", "types"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _doit(&self, dry_run: bool) -> Result, Option> { + let mut err = InvalidOptionsError::new(); + let mut call_result: Result<(), DoitError> = Ok(()); + let mut err_opt: Option = None; + match self.opt.subcommand() { + ("entities", Some(opt)) => { + match opt.subcommand() { + ("search", Some(opt)) => { + call_result = self._entities_search(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("entities".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); + } + } + + if dry_run { + if err.issues.len() > 0 { + err_opt = Some(err); + } + Err(err_opt) + } else { + Ok(call_result) + } + } + + // Please note that this call will fail if any part of the opt can't be handled + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { + let (config_dir, secret) = { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { + Err(e) => return Err(InvalidOptionsError::single(e, 3)), + Ok(p) => p, + }; + + match cmn::application_secret_from_directory(&config_dir, "kgsearch1-secret.json", + "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { + Ok(secret) => (config_dir, secret), + Err(e) => return Err(InvalidOptionsError::single(e, 4)) + } + }; + + let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, + if opt.is_present("debug-auth") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }, + JsonTokenStorage { + program_name: "kgsearch1", + db_dir: config_dir.clone(), + }, None); + + let client = + if opt.is_present("debug") { + hyper::Client::with_connector(mock::TeeConnector { + connector: hyper::net::HttpsConnector::::default() + }) + } else { + hyper::Client::new() + }; + let engine = Engine { + opt: opt, + hub: api::Kgsearch::new(client, auth), + gp: vec!["$-xgafv", "access-token", "alt", "bearer-token", "callback", "fields", "key", "oauth-token", "pp", "pretty-print", "quota-user", "upload-type", "upload-protocol"], + gpm: vec![ + ("$-xgafv", "$.xgafv"), + ("access-token", "access_token"), + ("bearer-token", "bearer_token"), + ("oauth-token", "oauth_token"), + ("pretty-print", "prettyPrint"), + ("quota-user", "quotaUser"), + ("upload-type", "uploadType"), + ("upload-protocol", "upload_protocol"), + ] + }; + + match engine._doit(true) { + Err(Some(err)) => Err(err), + Err(None) => Ok(engine), + Ok(_) => unreachable!(), + } + } + + fn doit(&self) -> Result<(), DoitError> { + match self._doit(false) { + Ok(res) => res, + Err(_) => unreachable!(), + } + } +} + +fn main() { + let mut exit_status = 0i32; + let arg_data = [ + ("entities", "methods: 'search'", vec![ + ("search", + Some(r##"Searches Knowledge Graph for entities that match the constraints. A list of matched entities will be returned in response, which will be in JSON-LD format and compatible with http://schema.org"##), + "Details at http://byron.github.io/google-apis-rs/google_kgsearch1_cli/entities_search", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ]; + + let mut app = App::new("kgsearch1") + .author("Sebastian Thiel ") + .version("0.3.3+20151215") + .about("Knowledge Graph Search API allows developers to search the Google Knowledge Graph for entities.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_kgsearch1_cli") + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") + .multiple(false) + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .multiple(false) + .takes_value(false)); + + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); + + for &(sub_command_name, ref desc, url_info, ref args) in subcommands { + let mut scmd = SubCommand::with_name(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + scmd = scmd.after_help(url_info); + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { + let arg_name_str = + match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }; + let mut arg = Arg::with_name(arg_name_str) + .empty_values(false); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + + let matches = app.get_matches(); + + let debug = matches.is_present("debug"); + match Engine::new(matches) { + Err(err) => { + exit_status = err.exit_code; + writeln!(io::stderr(), "{}", err).ok(); + }, + Ok(engine) => { + if let Err(doit_err) = engine.doit() { + exit_status = 1; + match doit_err { + DoitError::IoError(path, err) => { + writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok(); + }, + DoitError::ApiError(err) => { + if debug { + writeln!(io::stderr(), "{:#?}", err).ok(); + } else { + writeln!(io::stderr(), "{}", err).ok(); + } + } + } + } + } + } + + std::process::exit(exit_status); +} \ No newline at end of file diff --git a/gen/kgsearch1/Cargo.toml b/gen/kgsearch1/Cargo.toml new file mode 100644 index 0000000000..11ce4d86e2 --- /dev/null +++ b/gen/kgsearch1/Cargo.toml @@ -0,0 +1,29 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-kgsearch1" +version = "0.1.11+20151215" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with kgsearch (protocol v1)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/kgsearch1" +homepage = "https://developers.google.com/knowledge-graph/" +documentation = "http://byron.github.io/google-apis-rs/google_kgsearch1" +license = "MIT" +keywords = ["kgsearch", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +url = ">= 0.5" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + diff --git a/gen/kgsearch1/LICENSE.md b/gen/kgsearch1/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/kgsearch1/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/cloudsearch1/README.md b/gen/kgsearch1/README.md similarity index 54% rename from gen/cloudsearch1/README.md rename to gen/kgsearch1/README.md index 07bef0b9e4..413ff8d101 100644 --- a/gen/cloudsearch1/README.md +++ b/gen/kgsearch1/README.md @@ -3,13 +3,18 @@ DO NOT EDIT ! This file was generated automatically from 'src/mako/api/README.md.mako' DO NOT EDIT ! --> -The `google-cloudsearch1` library allows access to all features of the *Google cloudsearch* service. +The `google-kgsearch1` library allows access to all features of the *Google kgsearch* service. -This documentation was generated from *cloudsearch* crate version *0.1.6+20150416*, where *20150416* is the exact revision of the *cloudsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*. +This documentation was generated from *kgsearch* crate version *0.1.11+20151215*, where *20151215* is the exact revision of the *kgsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. + +Everything else about the *kgsearch* *v1* API can be found at the +[official documentation site](https://developers.google.com/knowledge-graph/). # Features -It seems there is nothing you can do here ... . +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_kgsearch1/struct.Kgsearch.html) ... +* entities + * [*search*](http://byron.github.io/google-apis-rs/google_kgsearch1/struct.EntitySearchCall.html) @@ -18,17 +23,17 @@ It seems there is nothing you can do here ... . The API is structured into the following primary items: -* **[Hub](http://byron.github.io/google-apis-rs/google_cloudsearch1/struct.Cloudsearch.html)** +* **[Hub](http://byron.github.io/google-apis-rs/google_kgsearch1/struct.Kgsearch.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.CallBuilder.html) -* **[Resources](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.Resource.html)** + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.Part.html)** + * **[Parts](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.CallBuilder.html)** +* **[Activities](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -39,6 +44,11 @@ Generally speaking, you can invoke *Activities* like this: let r = hub.resource().activity(...).doit() ``` +Or specifically ... + +```ignore +let r = hub.entities().search(...).doit() +``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be @@ -53,7 +63,7 @@ To use this library, you would put the following lines into your `Cargo.toml` fi ```toml [dependencies] -google-cloudsearch1 = "*" +google-kgsearch1 = "*" ``` ## A complete example @@ -61,11 +71,11 @@ google-cloudsearch1 = "*" ```Rust extern crate hyper; extern crate yup_oauth2 as oauth2; -extern crate google_cloudsearch1 as cloudsearch1; - +extern crate google_kgsearch1 as kgsearch1; +use kgsearch1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -use cloudsearch1::Cloudsearch; +use kgsearch1::Kgsearch; // Get an ApplicationSecret instance by some means. It contains the `client_id` and // `client_secret`, among other things. @@ -78,23 +88,51 @@ let secret: ApplicationSecret = Default::default(); let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::new(), ::default(), None); -let mut hub = Cloudsearch::new(hyper::Client::new(), auth); +let mut hub = Kgsearch::new(hyper::Client::new(), 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 ! +let result = hub.entities().search() + .add_types("eirmod") + .query("sit") + .prefix(false) + .limit(-42) + .add_languages("et") + .indent(true) + .add_ids("kasd") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} ``` - ## Handling Errors -All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_cloudsearch1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_kgsearch1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_cloudsearch1/../yup-oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_kgsearch1/../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](http://byron.github.io/google-apis-rs/google_cloudsearch1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google_kgsearch1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.ResponseResult.html), 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")`. @@ -104,29 +142,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](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.Delegate.html) to the -[Method Builder](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.CallBuilder.html) 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](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.Delegate.html) 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 [enocodable](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.RequestValue.html) and -[decodable](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.Part.html) 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](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.CallBuilder.html), 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](http://byron.github.io/google-apis-rs/google_cloudsearch1/trait.RequestValue.html) are borrowed +* [request values](http://byron.github.io/google-apis-rs/google_kgsearch1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. @@ -135,7 +173,7 @@ Arguments will always be copied or cloned into the builder, to make them indepen [google-go-api]: https://github.com/google/google-api-go-client # License -The **cloudsearch1** library was generated by Sebastian Thiel, and is placed +The **kgsearch1** 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]. diff --git a/gen/kgsearch1/src/build.rs b/gen/kgsearch1/src/build.rs new file mode 100644 index 0000000000..cfd14121ce --- /dev/null +++ b/gen/kgsearch1/src/build.rs @@ -0,0 +1,16 @@ +extern crate syntex; +extern crate serde_codegen; + +use std::env; +use std::path::Path; + +pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-kgsearch1", &src, &dst).unwrap(); +} diff --git a/gen/kgsearch1/src/cmn.rs b/gen/kgsearch1/src/cmn.rs new file mode 100644 index 0000000000..87b91a8986 --- /dev/null +++ b/gen/kgsearch1/src/cmn.rs @@ -0,0 +1,771 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && 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() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +// The following macro invocation needs to be expanded, as `include!` +// doens't support external macros +// header!{ +// #[doc="The `X-Upload-Content-Type` header."] +// (XUploadContentType, "X-Upload-Content-Type") => [Mime] + +// xupload_content_type { +// test_header!( +// test1, +// vec![b"text/plain"], +// Some(HeaderField( +// vec![Mime(TopLevel::Text, SubLevel::Plain, Vec::new())] +// ))); + +// } +// } + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// 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 delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + // workaround https://github.com/rust-lang/rust/issues/22252 + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/kgsearch1/src/lib.rs b/gen/kgsearch1/src/lib.rs new file mode 100644 index 0000000000..dccf63f9da --- /dev/null +++ b/gen/kgsearch1/src/lib.rs @@ -0,0 +1,184 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// DO NOT EDIT ! + +//! This documentation was generated from *kgsearch* crate version *0.1.11+20151215*, where *20151215* is the exact revision of the *kgsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. +//! +//! Everything else about the *kgsearch* *v1* API can be found at the +//! [official documentation site](https://developers.google.com/knowledge-graph/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/kgsearch1). +//! # Features +//! +//! Handle the following *Resources* with ease from the central [hub](struct.Kgsearch.html) ... +//! +//! * entities +//! * [*search*](struct.EntitySearchCall.html) +//! +//! +//! +//! +//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html). +//! +//! # Structure of this Library +//! +//! The API is structured into the following primary items: +//! +//! * **[Hub](struct.Kgsearch.html)** +//! * a central object to maintain state and allow accessing all *Activities* +//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn +//! allow access to individual [*Call Builders*](trait.CallBuilder.html) +//! * **[Resources](trait.Resource.html)** +//! * primary types that you can apply *Activities* to +//! * a collection of properties and *Parts* +//! * **[Parts](trait.Part.html)** +//! * a collection of properties +//! * never directly used in *Activities* +//! * **[Activities](trait.CallBuilder.html)** +//! * operations to apply to *Resources* +//! +//! All *structures* are marked with applicable traits to further categorize them and ease browsing. +//! +//! Generally speaking, you can invoke *Activities* like this: +//! +//! ```Rust,ignore +//! let r = hub.resource().activity(...).doit() +//! ``` +//! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.entities().search(...).doit() +//! ``` +//! +//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` +//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be +//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. +//! The `doit()` method performs the actual communication with the server and returns the respective result. +//! +//! # Usage +//! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! google-kgsearch1 = "*" +//! ``` +//! +//! ## A complete example +//! +//! ```test_harness,no_run +//! extern crate hyper; +//! extern crate yup_oauth2 as oauth2; +//! extern crate google_kgsearch1 as kgsearch1; +//! use kgsearch1::{Result, Error}; +//! # #[test] fn egal() { +//! use std::default::Default; +//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +//! use kgsearch1::Kgsearch; +//! +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. +//! let secret: ApplicationSecret = Default::default(); +//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. +//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +//! hyper::Client::new(), +//! ::default(), None); +//! let mut hub = Kgsearch::new(hyper::Client::new(), 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 ! +//! let result = hub.entities().search() +//! .add_types("justo") +//! .query("justo") +//! .prefix(true) +//! .limit(-17) +//! .add_languages("diam") +//! .indent(false) +//! .add_ids("Lorem") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } +//! # } +//! ``` +//! ## Handling Errors +//! +//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of +//! the doit() methods, or handed as possibly intermediate results to either the +//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../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](enum.Result.html), should be +//! read by you to obtain the media. +//! If such a method also supports a [Response Result](trait.ResponseResult.html), 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")`. +//! +//! Methods supporting uploads can do so using up to 2 different protocols: +//! *simple* and *resumable*. The distinctiveness of each is represented by customized +//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. +//! +//! ## Customization and Callbacks +//! +//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the +//! [Method Builder](trait.CallBuilder.html) 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](trait.Delegate.html) 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 [enocodable](trait.RequestValue.html) and +//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +//! are valid. +//! Most optionals are are considered [Parts](trait.Part.html) 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](trait.CallBuilder.html), 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](trait.RequestValue.html) are moved +//! +//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. +//! +//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure +//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern +//! [google-go-api]: https://github.com/google/google-api-go-client +//! +//! + +// Unused attributes happen thanks to defined, but unused structures +// We don't warn about this, as depending on the API, some data structures or facilities are never used. +// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any +// unused imports in fully featured APIs. Same with unused_mut ... . +#![allow(unused_imports, unused_mut, dead_code)] + +include!(concat!(env!("OUT_DIR"), "/lib.rs")); \ No newline at end of file diff --git a/gen/kgsearch1/src/lib.rs.in b/gen/kgsearch1/src/lib.rs.in new file mode 100644 index 0000000000..e169b4e169 --- /dev/null +++ b/gen/kgsearch1/src/lib.rs.in @@ -0,0 +1,516 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +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; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all Kgsearch related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_kgsearch1 as kgsearch1; +/// use kgsearch1::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use kgsearch1::Kgsearch; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Kgsearch::new(hyper::Client::new(), 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 ! +/// let result = hub.entities().search() +/// .add_types("accusam") +/// .query("takimata") +/// .prefix(false) +/// .limit(-1) +/// .add_languages("erat") +/// .indent(true) +/// .add_ids("sea") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct Kgsearch { + client: RefCell, + auth: RefCell, + _user_agent: String, +} + +impl<'a, C, A> Hub for Kgsearch {} + +impl<'a, C, A> Kgsearch + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> Kgsearch { + Kgsearch { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/0.1.11".to_string(), + } + } + + pub fn entities(&'a self) -> EntityMethods<'a, C, A> { + EntityMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/0.1.11`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// Response message includes the context and a list of matching results which contain the detail of associated entities. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [search entities](struct.EntitySearchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SearchResponse { + /// The schema type of top-level JSON-LD object, e.g. ItemList. + #[serde(rename="type")] + pub type_: Option, + /// The item list of search results. + #[serde(rename="itemListElement")] + pub item_list_element: Option>, + /// The local context applicable for the response. See more details at http://www.w3.org/TR/json-ld/#context-definitions. + pub context: Option, +} + +impl ResponseResult for SearchResponse {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *entity* resources. +/// It is not used directly, but through the `Kgsearch` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_kgsearch1 as kgsearch1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use kgsearch1::Kgsearch; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Kgsearch::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `search(...)` +/// // to build up your call. +/// let rb = hub.entities(); +/// # } +/// ``` +pub struct EntityMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Kgsearch, +} + +impl<'a, C, A> MethodsBuilder for EntityMethods<'a, C, A> {} + +impl<'a, C, A> EntityMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Searches Knowledge Graph for entities that match the constraints. A list of matched entities will be returned in response, which will be in JSON-LD format and compatible with http://schema.org + pub fn search(&self) -> EntitySearchCall<'a, C, A> { + EntitySearchCall { + hub: self.hub, + _types: Default::default(), + _query: Default::default(), + _prefix: Default::default(), + _limit: Default::default(), + _languages: Default::default(), + _indent: Default::default(), + _ids: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Searches Knowledge Graph for entities that match the constraints. A list of matched entities will be returned in response, which will be in JSON-LD format and compatible with http://schema.org +/// +/// A builder for the *search* method supported by a *entity* resource. +/// It is not used directly, but through a `EntityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_kgsearch1 as kgsearch1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use kgsearch1::Kgsearch; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Kgsearch::new(hyper::Client::new(), 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 ! +/// let result = hub.entities().search() +/// .add_types("nonumy") +/// .query("dolores") +/// .prefix(false) +/// .limit(-95) +/// .add_languages("aliquyam") +/// .indent(false) +/// .add_ids("no") +/// .doit(); +/// # } +/// ``` +pub struct EntitySearchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Kgsearch, + _types: Vec, + _query: Option, + _prefix: Option, + _limit: Option, + _languages: Vec, + _indent: Option, + _ids: Vec, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, +} + +impl<'a, C, A> CallBuilder for EntitySearchCall<'a, C, A> {} + +impl<'a, C, A> EntitySearchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SearchResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "kgsearch.entities.search", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + if self._types.len() > 0 { + let mut s = String::new(); + for f in self._types.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("types", s)); + } + if let Some(value) = self._query { + params.push(("query", value.to_string())); + } + if let Some(value) = self._prefix { + params.push(("prefix", value.to_string())); + } + if let Some(value) = self._limit { + params.push(("limit", value.to_string())); + } + if self._languages.len() > 0 { + let mut s = String::new(); + for f in self._languages.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("languages", s)); + } + if let Some(value) = self._indent { + params.push(("indent", value.to_string())); + } + if self._ids.len() > 0 { + let mut s = String::new(); + for f in self._ids.iter() { + s.push_str(&("/".to_string() + &f.to_string())); + } + params.push(("ids", s)); + } + for &field in ["alt", "types", "query", "prefix", "limit", "languages", "indent", "ids"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://kgsearch.googleapis.com/v1/entities:search".to_string(); + + let mut key = self.hub.auth.borrow_mut().api_key(); + if key.is_none() { + key = dlg.api_key(); + } + match key { + Some(value) => params.push(("key", value)), + None => { + dlg.finished(false); + return Err(Error::MissingAPIKey) + } + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Restricts returned entities with these types, e.g. Person (as defined in http://schema.org/Person). + /// + /// Append the given value to the *types* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_types(mut self, new_value: &str) -> EntitySearchCall<'a, C, A> { + self._types.push(new_value.to_string()); + self + } + /// The literal query string for search. + /// + /// Sets the *query* query property to the given value. + pub fn query(mut self, new_value: &str) -> EntitySearchCall<'a, C, A> { + self._query = Some(new_value.to_string()); + self + } + /// Enables prefix match against names and aliases of entities + /// + /// Sets the *prefix* query property to the given value. + pub fn prefix(mut self, new_value: bool) -> EntitySearchCall<'a, C, A> { + self._prefix = Some(new_value); + self + } + /// Limits the number of entities to be returned. + /// + /// Sets the *limit* query property to the given value. + pub fn limit(mut self, new_value: i32) -> EntitySearchCall<'a, C, A> { + self._limit = Some(new_value); + self + } + /// The list of language codes (defined in ISO 693) to run the query with, e.g. 'en'. + /// + /// Append the given value to the *languages* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_languages(mut self, new_value: &str) -> EntitySearchCall<'a, C, A> { + self._languages.push(new_value.to_string()); + self + } + /// Enables indenting of json results. + /// + /// Sets the *indent* query property to the given value. + pub fn indent(mut self, new_value: bool) -> EntitySearchCall<'a, C, A> { + self._indent = Some(new_value); + self + } + /// The list of entity id to be used for search instead of query string. + /// + /// Append the given value to the *ids* query property. + /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. + pub fn add_ids(mut self, new_value: &str) -> EntitySearchCall<'a, C, A> { + self._ids.push(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EntitySearchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EntitySearchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + +} + + diff --git a/gen/licensing1-cli/Cargo.toml b/gen/licensing1-cli/Cargo.toml index 2577f68066..a622ff735c 100644 --- a/gen/licensing1-cli/Cargo.toml +++ b/gen/licensing1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-licensing1-cli" -version = "0.3.2+20150525" +version = "0.3.3+20150901" authors = ["Sebastian Thiel "] description = "A complete library to interact with licensing (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/licensing1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/licensing1-cli/LICENSE.md b/gen/licensing1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/licensing1-cli/LICENSE.md +++ b/gen/licensing1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/licensing1-cli/README.md b/gen/licensing1-cli/README.md index 6a1028980c..83f877c16b 100644 --- a/gen/licensing1-cli/README.md +++ b/gen/licensing1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *licensing* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/licensing1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/licensing1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/licensing1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/licensing1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/licensing1-cli). # Usage -This documentation was generated from the *licensing* API at revision *20150525*. The CLI is at version *0.3.2*. +This documentation was generated from the *licensing* API at revision *20150901*. The CLI is at version *0.3.3*. ```bash licensing1 [options] @@ -40,18 +40,18 @@ licensing1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/licensing1-cli/mkdocs.yml b/gen/licensing1-cli/mkdocs.yml index 39ccd2fc51..5bd0aa7788 100644 --- a/gen/licensing1-cli/mkdocs.yml +++ b/gen/licensing1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: licensing v0.3.2+20150525 +site_name: licensing v0.3.3+20150901 site_url: http://byron.github.io/google-apis-rs/google-licensing1-cli site_description: Write integrating applications with bcore @@ -19,5 +19,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/licensing1-cli/src/main.rs b/gen/licensing1-cli/src/main.rs index e2bbb065d6..71a91b52c8 100644 --- a/gen/licensing1-cli/src/main.rs +++ b/gen/licensing1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Licensing>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _license_assignments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _license_assignments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.license_assignments().delete(opt.value_of("product-id").unwrap_or(""), opt.value_of("sku-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -89,10 +89,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _license_assignments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _license_assignments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.license_assignments().get(opt.value_of("product-id").unwrap_or(""), opt.value_of("sku-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -105,7 +105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -141,13 +141,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _license_assignments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _license_assignments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -161,8 +161,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "user-id" => Some(("userId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -177,7 +177,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LicenseAssignmentInsert = json::value::from_value(object).unwrap(); let mut call = self.hub.license_assignments().insert(request, opt.value_of("product-id").unwrap_or(""), opt.value_of("sku-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -190,7 +190,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -203,7 +203,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -226,10 +226,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _license_assignments_list_for_product(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _license_assignments_list_for_product(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.license_assignments().list_for_product(opt.value_of("product-id").unwrap_or(""), opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -248,7 +248,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -262,7 +262,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -285,10 +285,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _license_assignments_list_for_product_and_sku(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _license_assignments_list_for_product_and_sku(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.license_assignments().list_for_product_and_sku(opt.value_of("product-id").unwrap_or(""), opt.value_of("sku-id").unwrap_or(""), opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -307,7 +307,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -321,7 +321,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -344,13 +344,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _license_assignments_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _license_assignments_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -364,8 +364,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "sku-id" => Some(("skuId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -385,7 +385,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LicenseAssignment = json::value::from_value(object).unwrap(); let mut call = self.hub.license_assignments().patch(request, opt.value_of("product-id").unwrap_or(""), opt.value_of("sku-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -398,7 +398,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -411,7 +411,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -434,13 +434,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _license_assignments_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _license_assignments_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -454,8 +454,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "sku-id" => Some(("skuId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -475,7 +475,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LicenseAssignment = json::value::from_value(object).unwrap(); let mut call = self.hub.license_assignments().update(request, opt.value_of("product-id").unwrap_or(""), opt.value_of("sku-id").unwrap_or(""), opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -488,7 +488,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -501,7 +501,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -575,14 +575,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "licensing1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "licensing1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -602,7 +602,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -641,7 +641,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("license-assignments", "methods: 'delete', 'get', 'insert', 'list-for-product', 'list-for-product-and-sku', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Revoke License."##), "Details at http://byron.github.io/google-apis-rs/google_licensing1_cli/license-assignments_delete", vec![ @@ -669,7 +669,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Get license assignment of a particular product and sku for a user"##), "Details at http://byron.github.io/google-apis-rs/google_licensing1_cli/license-assignments_get", vec![ @@ -703,7 +703,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Assign License."##), "Details at http://byron.github.io/google-apis-rs/google_licensing1_cli/license-assignments_insert", vec![ @@ -737,7 +737,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-for-product", + ("list-for-product", Some(r##"List license assignments for given product of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_licensing1_cli/license-assignments_list-for-product", vec![ @@ -765,7 +765,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-for-product-and-sku", + ("list-for-product-and-sku", Some(r##"List license assignments for given product and sku of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_licensing1_cli/license-assignments_list-for-product-and-sku", vec![ @@ -799,7 +799,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Assign License. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_licensing1_cli/license-assignments_patch", vec![ @@ -839,7 +839,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Assign License."##), "Details at http://byron.github.io/google-apis-rs/google_licensing1_cli/license-assignments_update", vec![ @@ -885,7 +885,7 @@ fn main() { let mut app = App::new("licensing1") .author("Sebastian Thiel ") - .version("0.3.2+20150525") + .version("0.3.3+20150901") .about("Licensing API to view and manage license for your domain.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_licensing1_cli") .arg(Arg::with_name("url") @@ -909,7 +909,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -920,7 +920,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/licensing1/Cargo.toml b/gen/licensing1/Cargo.toml index b5eb036087..e5c47dfb22 100644 --- a/gen/licensing1/Cargo.toml +++ b/gen/licensing1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-licensing1" -version = "0.1.10+20150525" +version = "0.1.11+20150901" authors = ["Sebastian Thiel "] description = "A complete library to interact with licensing (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/licensing1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/licensing1/LICENSE.md b/gen/licensing1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/licensing1/LICENSE.md +++ b/gen/licensing1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/licensing1/README.md b/gen/licensing1/README.md index 4a929fbbc5..dc4d9b1599 100644 --- a/gen/licensing1/README.md +++ b/gen/licensing1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-licensing1` library allows access to all features of the *Google licensing* service. -This documentation was generated from *licensing* crate version *0.1.10+20150525*, where *20150525* is the exact revision of the *licensing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *licensing* crate version *0.1.11+20150901*, where *20150901* is the exact revision of the *licensing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *licensing* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/licensing/). diff --git a/gen/licensing1/src/cmn.rs b/gen/licensing1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/licensing1/src/cmn.rs +++ b/gen/licensing1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/licensing1/src/lib.rs b/gen/licensing1/src/lib.rs index 33d6d5d0d7..e04d38e96a 100644 --- a/gen/licensing1/src/lib.rs +++ b/gen/licensing1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *licensing* crate version *0.1.10+20150525*, where *20150525* is the exact revision of the *licensing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *licensing* crate version *0.1.11+20150901*, where *20150901* is the exact revision of the *licensing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *licensing* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/licensing/). diff --git a/gen/licensing1/src/lib.rs.in b/gen/licensing1/src/lib.rs.in index 52e2c3063f..f2b2cbb8cc 100644 --- a/gen/licensing1/src/lib.rs.in +++ b/gen/licensing1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -128,7 +129,7 @@ impl<'a, C, A> Licensing Licensing { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -137,7 +138,7 @@ impl<'a, C, A> Licensing } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -497,7 +498,7 @@ impl<'a, C, A> LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "licensing.licenseAssignments.delete", + dlg.begin(MethodInfo { id: "licensing.licenseAssignments.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("productId", self._product_id.to_string())); @@ -540,7 +541,7 @@ impl<'a, C, A> LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -576,7 +577,7 @@ impl<'a, C, A> LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -586,10 +587,10 @@ impl<'a, C, A> LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut LicenseAssignmentDeleteCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -622,7 +623,7 @@ impl<'a, C, A> LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut LicenseAssignmentDeleteCall<'a, C, A> { self._sku_id = new_value.to_string(); @@ -632,7 +633,7 @@ impl<'a, C, A> LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut LicenseAssignmentDeleteCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -650,12 +651,12 @@ impl<'a, C, A> LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut LicenseAssignmentDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LicenseAssignmentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LicenseAssignmentDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -749,7 +750,7 @@ impl<'a, C, A> LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "licensing.licenseAssignments.listForProduct", + dlg.begin(MethodInfo { id: "licensing.licenseAssignments.listForProduct", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("productId", self._product_id.to_string())); @@ -798,7 +799,7 @@ impl<'a, C, A> LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -834,7 +835,7 @@ impl<'a, C, A> LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -844,10 +845,10 @@ impl<'a, C, A> LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -880,7 +881,7 @@ impl<'a, C, A> LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< /// /// Sets the *product id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn product_id(mut self, new_value: &str) -> LicenseAssignmentListForProductCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -890,7 +891,7 @@ impl<'a, C, A> LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< /// /// Sets the *customer id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn customer_id(mut self, new_value: &str) -> LicenseAssignmentListForProductCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -922,12 +923,12 @@ impl<'a, C, A> LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -944,17 +945,17 @@ impl<'a, C, A> LicenseAssignmentListForProductCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppLicensing`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LicenseAssignmentListForProductCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LicenseAssignmentListForProductCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1018,7 +1019,7 @@ impl<'a, C, A> LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "licensing.licenseAssignments.get", + dlg.begin(MethodInfo { id: "licensing.licenseAssignments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("productId", self._product_id.to_string())); @@ -1062,7 +1063,7 @@ impl<'a, C, A> LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1098,7 +1099,7 @@ impl<'a, C, A> LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1108,10 +1109,10 @@ impl<'a, C, A> LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut LicenseAssignmentGetCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -1154,7 +1155,7 @@ impl<'a, C, A> LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut LicenseAssignmentGetCall<'a, C, A> { self._sku_id = new_value.to_string(); @@ -1164,7 +1165,7 @@ impl<'a, C, A> LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut LicenseAssignmentGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -1182,12 +1183,12 @@ impl<'a, C, A> LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut LicenseAssignmentGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LicenseAssignmentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LicenseAssignmentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1282,7 +1283,7 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "licensing.licenseAssignments.listForProductAndSku", + dlg.begin(MethodInfo { id: "licensing.licenseAssignments.listForProductAndSku", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("productId", self._product_id.to_string())); @@ -1332,7 +1333,7 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1368,7 +1369,7 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1378,10 +1379,10 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1414,7 +1415,7 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr /// /// Sets the *product id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn product_id(mut self, new_value: &str) -> LicenseAssignmentListForProductAndSkuCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -1424,7 +1425,7 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr /// /// Sets the *sku id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sku_id(mut self, new_value: &str) -> LicenseAssignmentListForProductAndSkuCall<'a, C, A> { self._sku_id = new_value.to_string(); @@ -1434,7 +1435,7 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr /// /// Sets the *customer id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn customer_id(mut self, new_value: &str) -> LicenseAssignmentListForProductAndSkuCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -1466,12 +1467,12 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1488,17 +1489,17 @@ impl<'a, C, A> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where C: Borr } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppLicensing`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LicenseAssignmentListForProductAndSkuCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LicenseAssignmentListForProductAndSkuCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1569,7 +1570,7 @@ impl<'a, C, A> LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "licensing.licenseAssignments.update", + dlg.begin(MethodInfo { id: "licensing.licenseAssignments.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("productId", self._product_id.to_string())); @@ -1613,14 +1614,14 @@ impl<'a, C, A> LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1664,7 +1665,7 @@ impl<'a, C, A> LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1674,10 +1675,10 @@ impl<'a, C, A> LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut LicenseAssignmentUpdateCall<'a, C, A> { self._request = new_value; @@ -1719,7 +1720,7 @@ impl<'a, C, A> LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut LicenseAssignmentUpdateCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -1729,7 +1730,7 @@ impl<'a, C, A> LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut LicenseAssignmentUpdateCall<'a, C, A> { self._sku_id = new_value.to_string(); @@ -1739,7 +1740,7 @@ impl<'a, C, A> LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut LicenseAssignmentUpdateCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -1757,12 +1758,12 @@ impl<'a, C, A> LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut LicenseAssignmentUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LicenseAssignmentUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LicenseAssignmentUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1860,7 +1861,7 @@ impl<'a, C, A> LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "licensing.licenseAssignments.patch", + dlg.begin(MethodInfo { id: "licensing.licenseAssignments.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("productId", self._product_id.to_string())); @@ -1904,14 +1905,14 @@ impl<'a, C, A> LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1955,7 +1956,7 @@ impl<'a, C, A> LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1965,10 +1966,10 @@ impl<'a, C, A> LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut LicenseAssignmentPatchCall<'a, C, A> { self._request = new_value; @@ -2010,7 +2011,7 @@ impl<'a, C, A> LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut LicenseAssignmentPatchCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -2020,7 +2021,7 @@ impl<'a, C, A> LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut LicenseAssignmentPatchCall<'a, C, A> { self._sku_id = new_value.to_string(); @@ -2030,7 +2031,7 @@ impl<'a, C, A> LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut LicenseAssignmentPatchCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2048,12 +2049,12 @@ impl<'a, C, A> LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut LicenseAssignmentPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LicenseAssignmentPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LicenseAssignmentPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2150,7 +2151,7 @@ impl<'a, C, A> LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "licensing.licenseAssignments.insert", + dlg.begin(MethodInfo { id: "licensing.licenseAssignments.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("productId", self._product_id.to_string())); @@ -2193,14 +2194,14 @@ impl<'a, C, A> LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2244,7 +2245,7 @@ impl<'a, C, A> LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2254,10 +2255,10 @@ impl<'a, C, A> LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut LicenseAssignmentInsertCall<'a, C, A> { self._request = new_value; @@ -2299,7 +2300,7 @@ impl<'a, C, A> LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut LicenseAssignmentInsertCall<'a, C, A> { self._product_id = new_value.to_string(); @@ -2309,7 +2310,7 @@ impl<'a, C, A> LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut LicenseAssignmentInsertCall<'a, C, A> { self._sku_id = new_value.to_string(); @@ -2327,12 +2328,12 @@ impl<'a, C, A> LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut LicenseAssignmentInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LicenseAssignmentInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LicenseAssignmentInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/logging1_beta3-cli/Cargo.toml b/gen/logging1_beta3-cli/Cargo.toml index dcec2f6124..eef5b55459 100644 --- a/gen/logging1_beta3-cli/Cargo.toml +++ b/gen/logging1_beta3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-logging1_beta3-cli" -version = "0.3.2+20151007" +version = "0.3.3+20151007" authors = ["Sebastian Thiel "] description = "A complete library to interact with logging (protocol v1beta3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging1_beta3-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/logging1_beta3-cli/LICENSE.md b/gen/logging1_beta3-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/logging1_beta3-cli/LICENSE.md +++ b/gen/logging1_beta3-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/logging1_beta3-cli/README.md b/gen/logging1_beta3-cli/README.md index acadf4330e..6d7aec3815 100644 --- a/gen/logging1_beta3-cli/README.md +++ b/gen/logging1_beta3-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *logging* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/logging1-beta3.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/logging1-beta3.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/logging1-beta3.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/logging1-beta3.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/logging1_beta3-cli). # Usage -This documentation was generated from the *logging* API at revision *20151007*. The CLI is at version *0.3.2*. +This documentation was generated from the *logging* API at revision *20151007*. The CLI is at version *0.3.3*. ```bash logging1-beta3 [options] @@ -58,18 +58,18 @@ logging1-beta3 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/logging1_beta3-cli/mkdocs.yml b/gen/logging1_beta3-cli/mkdocs.yml index fb316aa9ea..4eab7527bd 100644 --- a/gen/logging1_beta3-cli/mkdocs.yml +++ b/gen/logging1_beta3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: logging v0.3.2+20151007 +site_name: logging v0.3.3+20151007 site_url: http://byron.github.io/google-apis-rs/google-logging1_beta3-cli site_description: Write integrating applications with bcore @@ -37,5 +37,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/logging1_beta3-cli/src/main.rs b/gen/logging1_beta3-cli/src/main.rs index f1e00a4fe7..9b1c2f77ed 100644 --- a/gen/logging1_beta3-cli/src/main.rs +++ b/gen/logging1_beta3-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Logging>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _projects_log_services_indexes_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _projects_log_services_indexes_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().log_services_indexes_list(opt.value_of("projects-id").unwrap_or(""), opt.value_of("log-services-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -73,7 +73,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "depth", "index-prefix", "page-size"].iter().map(|v|*v)); @@ -87,7 +87,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -110,10 +110,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_log_services_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_log_services_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().log_services_list(opt.value_of("projects-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -132,7 +132,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -146,7 +146,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -169,13 +169,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_log_services_sinks_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_log_services_sinks_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -189,8 +189,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -207,7 +207,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LogSink = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().log_services_sinks_create(request, opt.value_of("projects-id").unwrap_or(""), opt.value_of("log-services-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -220,7 +220,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -233,7 +233,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -256,10 +256,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_log_services_sinks_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_log_services_sinks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().log_services_sinks_delete(opt.value_of("projects-id").unwrap_or(""), opt.value_of("log-services-id").unwrap_or(""), opt.value_of("sinks-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -272,7 +272,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -285,7 +285,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -308,10 +308,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_log_services_sinks_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_log_services_sinks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().log_services_sinks_get(opt.value_of("projects-id").unwrap_or(""), opt.value_of("log-services-id").unwrap_or(""), opt.value_of("sinks-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -324,7 +324,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -337,7 +337,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -360,10 +360,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_log_services_sinks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_log_services_sinks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().log_services_sinks_list(opt.value_of("projects-id").unwrap_or(""), opt.value_of("log-services-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -376,7 +376,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -389,7 +389,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -412,13 +412,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_log_services_sinks_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_log_services_sinks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -432,8 +432,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -450,7 +450,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LogSink = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().log_services_sinks_update(request, opt.value_of("projects-id").unwrap_or(""), opt.value_of("log-services-id").unwrap_or(""), opt.value_of("sinks-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -463,7 +463,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -476,7 +476,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -499,10 +499,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_logs_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().logs_delete(opt.value_of("projects-id").unwrap_or(""), opt.value_of("logs-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -515,7 +515,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -528,7 +528,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -551,13 +551,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_logs_entries_write(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_logs_entries_write(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -571,8 +571,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "common-labels" => Some(("commonLabels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), _ => { @@ -587,7 +587,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::WriteLogEntriesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().logs_entries_write(request, opt.value_of("projects-id").unwrap_or(""), opt.value_of("logs-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -600,7 +600,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -613,7 +613,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -636,10 +636,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_logs_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_logs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().logs_list(opt.value_of("projects-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "service-name" => { @@ -664,7 +664,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "service-name", "service-index-prefix", "page-size"].iter().map(|v|*v)); @@ -678,7 +678,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -701,13 +701,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_logs_sinks_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_logs_sinks_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -721,8 +721,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -739,7 +739,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LogSink = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().logs_sinks_create(request, opt.value_of("projects-id").unwrap_or(""), opt.value_of("logs-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -752,7 +752,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -765,7 +765,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -788,10 +788,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_logs_sinks_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_logs_sinks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().logs_sinks_delete(opt.value_of("projects-id").unwrap_or(""), opt.value_of("logs-id").unwrap_or(""), opt.value_of("sinks-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -804,7 +804,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -817,7 +817,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -840,10 +840,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_logs_sinks_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_logs_sinks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().logs_sinks_get(opt.value_of("projects-id").unwrap_or(""), opt.value_of("logs-id").unwrap_or(""), opt.value_of("sinks-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -856,7 +856,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -869,7 +869,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -892,10 +892,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_logs_sinks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_logs_sinks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().logs_sinks_list(opt.value_of("projects-id").unwrap_or(""), opt.value_of("logs-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -908,7 +908,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -921,7 +921,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -944,13 +944,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_logs_sinks_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_logs_sinks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -964,8 +964,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -982,7 +982,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LogSink = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().logs_sinks_update(request, opt.value_of("projects-id").unwrap_or(""), opt.value_of("logs-id").unwrap_or(""), opt.value_of("sinks-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -995,7 +995,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1008,7 +1008,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1031,13 +1031,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_metrics_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_metrics_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1051,8 +1051,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1069,7 +1069,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LogMetric = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().metrics_create(request, opt.value_of("projects-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1082,7 +1082,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1095,7 +1095,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1118,10 +1118,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_metrics_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_metrics_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().metrics_delete(opt.value_of("projects-id").unwrap_or(""), opt.value_of("metrics-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1134,7 +1134,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1147,7 +1147,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1170,10 +1170,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_metrics_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_metrics_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().metrics_get(opt.value_of("projects-id").unwrap_or(""), opt.value_of("metrics-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1186,7 +1186,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1199,7 +1199,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1222,10 +1222,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_metrics_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_metrics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().metrics_list(opt.value_of("projects-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1244,7 +1244,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -1258,7 +1258,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1281,13 +1281,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_metrics_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_metrics_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1301,8 +1301,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1319,7 +1319,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LogMetric = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().metrics_update(request, opt.value_of("projects-id").unwrap_or(""), opt.value_of("metrics-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1332,7 +1332,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1345,7 +1345,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1368,13 +1368,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_sinks_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_sinks_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1388,8 +1388,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1406,7 +1406,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LogSink = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().sinks_create(request, opt.value_of("projects-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1419,7 +1419,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1432,7 +1432,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1455,10 +1455,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_sinks_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_sinks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().sinks_delete(opt.value_of("projects-id").unwrap_or(""), opt.value_of("sinks-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1471,7 +1471,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1484,7 +1484,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1507,10 +1507,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_sinks_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_sinks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().sinks_get(opt.value_of("projects-id").unwrap_or(""), opt.value_of("sinks-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1523,7 +1523,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1536,7 +1536,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1559,10 +1559,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_sinks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_sinks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().sinks_list(opt.value_of("projects-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1575,7 +1575,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1588,7 +1588,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1611,13 +1611,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_sinks_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_sinks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1631,8 +1631,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1649,7 +1649,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LogSink = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().sinks_update(request, opt.value_of("projects-id").unwrap_or(""), opt.value_of("sinks-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1662,7 +1662,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1675,7 +1675,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1803,14 +1803,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "logging1-beta3-secret.json", + match cmn::application_secret_from_directory(&config_dir, "logging1-beta3-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1830,7 +1830,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1873,7 +1873,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("projects", "methods: 'log-services-indexes-list', 'log-services-list', 'log-services-sinks-create', 'log-services-sinks-delete', 'log-services-sinks-get', 'log-services-sinks-list', 'log-services-sinks-update', 'logs-delete', 'logs-entries-write', 'logs-list', 'logs-sinks-create', 'logs-sinks-delete', 'logs-sinks-get', 'logs-sinks-list', 'logs-sinks-update', 'metrics-create', 'metrics-delete', 'metrics-get', 'metrics-list', 'metrics-update', 'sinks-create', 'sinks-delete', 'sinks-get', 'sinks-list' and 'sinks-update'", vec![ - ("log-services-indexes-list", + ("log-services-indexes-list", Some(r##"Lists the current index values for a log service."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_log-services-indexes-list", vec![ @@ -1901,7 +1901,7 @@ fn main() { Some(false), Some(false)), ]), - ("log-services-list", + ("log-services-list", Some(r##"Lists the log services that have log entries in this project."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_log-services-list", vec![ @@ -1923,7 +1923,7 @@ fn main() { Some(false), Some(false)), ]), - ("log-services-sinks-create", + ("log-services-sinks-create", Some(r##"Creates a log service sink. All log entries from a specified log service are written to the destination."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_log-services-sinks-create", vec![ @@ -1957,7 +1957,7 @@ fn main() { Some(false), Some(false)), ]), - ("log-services-sinks-delete", + ("log-services-sinks-delete", Some(r##"Deletes a log service sink. After deletion, no new log entries are written to the destination."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_log-services-sinks-delete", vec![ @@ -1991,7 +1991,7 @@ fn main() { Some(false), Some(false)), ]), - ("log-services-sinks-get", + ("log-services-sinks-get", Some(r##"Gets a log service sink."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_log-services-sinks-get", vec![ @@ -2025,7 +2025,7 @@ fn main() { Some(false), Some(false)), ]), - ("log-services-sinks-list", + ("log-services-sinks-list", Some(r##"Lists log service sinks associated with a log service."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_log-services-sinks-list", vec![ @@ -2053,7 +2053,7 @@ fn main() { Some(false), Some(false)), ]), - ("log-services-sinks-update", + ("log-services-sinks-update", Some(r##"Updates a log service sink. If the sink does not exist, it is created."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_log-services-sinks-update", vec![ @@ -2093,7 +2093,7 @@ fn main() { Some(false), Some(false)), ]), - ("logs-delete", + ("logs-delete", Some(r##"Deletes a log and all its log entries. The log will reappear if it receives new entries."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_logs-delete", vec![ @@ -2121,7 +2121,7 @@ fn main() { Some(false), Some(false)), ]), - ("logs-entries-write", + ("logs-entries-write", Some(r##"Writes log entries to Cloud Logging. Each entry consists of a `LogEntry` object. You must fill in all the fields of the object, including one of the payload fields. You may supply a map, `commonLabels`, that holds default (key, value) data for the `entries[].metadata.labels` map in each entry, saving you the trouble of creating identical copies for each entry."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_logs-entries-write", vec![ @@ -2155,7 +2155,7 @@ fn main() { Some(false), Some(false)), ]), - ("logs-list", + ("logs-list", Some(r##"Lists the logs in the project. Only logs that have entries are listed."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_logs-list", vec![ @@ -2177,7 +2177,7 @@ fn main() { Some(false), Some(false)), ]), - ("logs-sinks-create", + ("logs-sinks-create", Some(r##"Creates a log sink. All log entries for a specified log are written to the destination."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_logs-sinks-create", vec![ @@ -2211,7 +2211,7 @@ fn main() { Some(false), Some(false)), ]), - ("logs-sinks-delete", + ("logs-sinks-delete", Some(r##"Deletes a log sink. After deletion, no new log entries are written to the destination."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_logs-sinks-delete", vec![ @@ -2245,7 +2245,7 @@ fn main() { Some(false), Some(false)), ]), - ("logs-sinks-get", + ("logs-sinks-get", Some(r##"Gets a log sink."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_logs-sinks-get", vec![ @@ -2279,7 +2279,7 @@ fn main() { Some(false), Some(false)), ]), - ("logs-sinks-list", + ("logs-sinks-list", Some(r##"Lists log sinks associated with a log."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_logs-sinks-list", vec![ @@ -2307,7 +2307,7 @@ fn main() { Some(false), Some(false)), ]), - ("logs-sinks-update", + ("logs-sinks-update", Some(r##"Updates a log sink. If the sink does not exist, it is created."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_logs-sinks-update", vec![ @@ -2347,7 +2347,7 @@ fn main() { Some(false), Some(false)), ]), - ("metrics-create", + ("metrics-create", Some(r##"Create the specified log metric resource."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_metrics-create", vec![ @@ -2375,7 +2375,7 @@ fn main() { Some(false), Some(false)), ]), - ("metrics-delete", + ("metrics-delete", Some(r##"Deletes the specified log metric."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_metrics-delete", vec![ @@ -2403,7 +2403,7 @@ fn main() { Some(false), Some(false)), ]), - ("metrics-get", + ("metrics-get", Some(r##"Get the specified log metric resource."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_metrics-get", vec![ @@ -2431,7 +2431,7 @@ fn main() { Some(false), Some(false)), ]), - ("metrics-list", + ("metrics-list", Some(r##"List log metrics associated with the specified project."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_metrics-list", vec![ @@ -2453,7 +2453,7 @@ fn main() { Some(false), Some(false)), ]), - ("metrics-update", + ("metrics-update", Some(r##"Create or update the specified log metric resource."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_metrics-update", vec![ @@ -2487,7 +2487,7 @@ fn main() { Some(false), Some(false)), ]), - ("sinks-create", + ("sinks-create", Some(r##"Creates a project sink. A logs filter determines which log entries are written to the destination."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_sinks-create", vec![ @@ -2515,7 +2515,7 @@ fn main() { Some(false), Some(false)), ]), - ("sinks-delete", + ("sinks-delete", Some(r##"Deletes a project sink. After deletion, no new log entries are written to the destination."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_sinks-delete", vec![ @@ -2543,7 +2543,7 @@ fn main() { Some(false), Some(false)), ]), - ("sinks-get", + ("sinks-get", Some(r##"Gets a project sink."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_sinks-get", vec![ @@ -2571,7 +2571,7 @@ fn main() { Some(false), Some(false)), ]), - ("sinks-list", + ("sinks-list", Some(r##"Lists project sinks associated with a project."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_sinks-list", vec![ @@ -2593,7 +2593,7 @@ fn main() { Some(false), Some(false)), ]), - ("sinks-update", + ("sinks-update", Some(r##"Updates a project sink. If the sink does not exist, it is created. The destination, filter, or both may be updated."##), "Details at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli/projects_sinks-update", vec![ @@ -2633,7 +2633,7 @@ fn main() { let mut app = App::new("logging1-beta3") .author("Sebastian Thiel ") - .version("0.3.2+20151007") + .version("0.3.3+20151007") .about("Google Cloud Logging API lets you create logs, ingest log entries, and manage log sinks.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_logging1_beta3_cli") .arg(Arg::with_name("url") @@ -2657,7 +2657,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -2668,7 +2668,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/logging1_beta3/Cargo.toml b/gen/logging1_beta3/Cargo.toml index 4fb8bcdc51..f2ca9dcbd0 100644 --- a/gen/logging1_beta3/Cargo.toml +++ b/gen/logging1_beta3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-logging1_beta3" -version = "0.1.10+20151007" +version = "0.1.11+20151007" authors = ["Sebastian Thiel "] description = "A complete library to interact with logging (protocol v1beta3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging1_beta3" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/logging1_beta3/LICENSE.md b/gen/logging1_beta3/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/logging1_beta3/LICENSE.md +++ b/gen/logging1_beta3/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/logging1_beta3/README.md b/gen/logging1_beta3/README.md index a2ba3dca6f..e82d327a4d 100644 --- a/gen/logging1_beta3/README.md +++ b/gen/logging1_beta3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-logging1_beta3` library allows access to all features of the *Google logging* service. -This documentation was generated from *logging* crate version *0.1.10+20151007*, where *20151007* is the exact revision of the *logging:v1beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *logging* crate version *0.1.11+20151007*, where *20151007* is the exact revision of the *logging:v1beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *logging* *v1_beta3* API can be found at the [official documentation site](https://cloud.google.com/logging/docs/). diff --git a/gen/logging1_beta3/src/cmn.rs b/gen/logging1_beta3/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/logging1_beta3/src/cmn.rs +++ b/gen/logging1_beta3/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/logging1_beta3/src/lib.rs b/gen/logging1_beta3/src/lib.rs index 4e2352fbdc..51b4038b7c 100644 --- a/gen/logging1_beta3/src/lib.rs +++ b/gen/logging1_beta3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *logging* crate version *0.1.10+20151007*, where *20151007* is the exact revision of the *logging:v1beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *logging* crate version *0.1.11+20151007*, where *20151007* is the exact revision of the *logging:v1beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *logging* *v1_beta3* API can be found at the //! [official documentation site](https://cloud.google.com/logging/docs/). diff --git a/gen/logging1_beta3/src/lib.rs.in b/gen/logging1_beta3/src/lib.rs.in index b38452bb7f..661ad2aca3 100644 --- a/gen/logging1_beta3/src/lib.rs.in +++ b/gen/logging1_beta3/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -148,7 +149,7 @@ impl<'a, C, A> Logging Logging { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -157,7 +158,7 @@ impl<'a, C, A> Logging } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1205,7 +1206,7 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logs.delete", + dlg.begin(MethodInfo { id: "logging.projects.logs.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -1248,7 +1249,7 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1284,7 +1285,7 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1294,10 +1295,10 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1330,7 +1331,7 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *projects id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectLogDeleteCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -1340,7 +1341,7 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *logs id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn logs_id(mut self, new_value: &str) -> ProjectLogDeleteCall<'a, C, A> { self._logs_id = new_value.to_string(); @@ -1358,12 +1359,12 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1386,17 +1387,17 @@ impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectLogDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1466,7 +1467,7 @@ impl<'a, C, A> ProjectLogSinkCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logs.sinks.create", + dlg.begin(MethodInfo { id: "logging.projects.logs.sinks.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -1509,14 +1510,14 @@ impl<'a, C, A> ProjectLogSinkCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1560,7 +1561,7 @@ impl<'a, C, A> ProjectLogSinkCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1570,10 +1571,10 @@ impl<'a, C, A> ProjectLogSinkCreateCall<'a, C, A> where C: BorrowMut ProjectLogSinkCreateCall<'a, C, A> where C: BorrowMut ProjectLogSinkCreateCall<'a, C, A> { self._request = new_value; @@ -1615,7 +1616,7 @@ impl<'a, C, A> ProjectLogSinkCreateCall<'a, C, A> where C: BorrowMut ProjectLogSinkCreateCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -1625,7 +1626,7 @@ impl<'a, C, A> ProjectLogSinkCreateCall<'a, C, A> where C: BorrowMut ProjectLogSinkCreateCall<'a, C, A> { self._logs_id = new_value.to_string(); @@ -1643,12 +1644,12 @@ impl<'a, C, A> ProjectLogSinkCreateCall<'a, C, A> where C: BorrowMut ProjectLogSinkCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogSinkCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogSinkCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1744,7 +1745,7 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.get", + dlg.begin(MethodInfo { id: "logging.projects.metrics.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -1787,7 +1788,7 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1823,7 +1824,7 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1833,10 +1834,10 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1869,7 +1870,7 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *projects id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectMetricGetCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -1879,7 +1880,7 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *metrics id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn metrics_id(mut self, new_value: &str) -> ProjectMetricGetCall<'a, C, A> { self._metrics_id = new_value.to_string(); @@ -1897,12 +1898,12 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1925,17 +1926,17 @@ impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectMetricGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectMetricGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2005,7 +2006,7 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logs.list", + dlg.begin(MethodInfo { id: "logging.projects.logs.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -2059,7 +2060,7 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2095,7 +2096,7 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2105,10 +2106,10 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2141,7 +2142,7 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *projects id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectLogListCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -2187,12 +2188,12 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2215,17 +2216,17 @@ impl<'a, C, A> ProjectLogListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectLogListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2294,7 +2295,7 @@ impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.create", + dlg.begin(MethodInfo { id: "logging.projects.metrics.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -2336,14 +2337,14 @@ impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2387,7 +2388,7 @@ impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2397,10 +2398,10 @@ impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut ProjectMetricCreateCall<'a, C, A> where C: BorrowMut ProjectMetricCreateCall<'a, C, A> { self._request = new_value; @@ -2442,7 +2443,7 @@ impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut ProjectMetricCreateCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -2460,12 +2461,12 @@ impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut ProjectMetricCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectMetricCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectMetricCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2561,7 +2562,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.sinks.get", + dlg.begin(MethodInfo { id: "logging.projects.sinks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -2604,7 +2605,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2640,7 +2641,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2650,10 +2651,10 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2686,7 +2687,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *projects id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectSinkGetCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -2696,7 +2697,7 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *sinks id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sinks_id(mut self, new_value: &str) -> ProjectSinkGetCall<'a, C, A> { self._sinks_id = new_value.to_string(); @@ -2714,12 +2715,12 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2742,17 +2743,17 @@ impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSinkGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSinkGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2816,7 +2817,7 @@ impl<'a, C, A> ProjectLogSinkGetCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logs.sinks.get", + dlg.begin(MethodInfo { id: "logging.projects.logs.sinks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -2860,7 +2861,7 @@ impl<'a, C, A> ProjectLogSinkGetCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2896,7 +2897,7 @@ impl<'a, C, A> ProjectLogSinkGetCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2906,10 +2907,10 @@ impl<'a, C, A> ProjectLogSinkGetCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2942,7 +2943,7 @@ impl<'a, C, A> ProjectLogSinkGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *projects id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectLogSinkGetCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -2952,7 +2953,7 @@ impl<'a, C, A> ProjectLogSinkGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *logs id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn logs_id(mut self, new_value: &str) -> ProjectLogSinkGetCall<'a, C, A> { self._logs_id = new_value.to_string(); @@ -2962,7 +2963,7 @@ impl<'a, C, A> ProjectLogSinkGetCall<'a, C, A> where C: BorrowMut /// /// Sets the *sinks id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sinks_id(mut self, new_value: &str) -> ProjectLogSinkGetCall<'a, C, A> { self._sinks_id = new_value.to_string(); @@ -2980,12 +2981,12 @@ impl<'a, C, A> ProjectLogSinkGetCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3008,17 +3009,17 @@ impl<'a, C, A> ProjectLogSinkGetCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectLogSinkGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogSinkGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3089,7 +3090,7 @@ impl<'a, C, A> ProjectLogServiceSinkUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logServices.sinks.update", + dlg.begin(MethodInfo { id: "logging.projects.logServices.sinks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -3133,14 +3134,14 @@ impl<'a, C, A> ProjectLogServiceSinkUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3184,7 +3185,7 @@ impl<'a, C, A> ProjectLogServiceSinkUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3194,10 +3195,10 @@ impl<'a, C, A> ProjectLogServiceSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkUpdateCall<'a, C, A> { self._request = new_value; @@ -3239,7 +3240,7 @@ impl<'a, C, A> ProjectLogServiceSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkUpdateCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -3249,7 +3250,7 @@ impl<'a, C, A> ProjectLogServiceSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkUpdateCall<'a, C, A> { self._log_services_id = new_value.to_string(); @@ -3259,7 +3260,7 @@ impl<'a, C, A> ProjectLogServiceSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkUpdateCall<'a, C, A> { self._sinks_id = new_value.to_string(); @@ -3277,12 +3278,12 @@ impl<'a, C, A> ProjectLogServiceSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogServiceSinkUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogServiceSinkUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3385,7 +3386,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.sinks.update", + dlg.begin(MethodInfo { id: "logging.projects.sinks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -3428,14 +3429,14 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3479,7 +3480,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3489,10 +3490,10 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3524,7 +3525,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LogSink) -> ProjectSinkUpdateCall<'a, C, A> { self._request = new_value; @@ -3534,7 +3535,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *projects id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectSinkUpdateCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -3544,7 +3545,7 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *sinks id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sinks_id(mut self, new_value: &str) -> ProjectSinkUpdateCall<'a, C, A> { self._sinks_id = new_value.to_string(); @@ -3562,12 +3563,12 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3590,17 +3591,17 @@ impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSinkUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSinkUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3671,7 +3672,7 @@ impl<'a, C, A> ProjectLogServiceIndexeListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logServices.indexes.list", + dlg.begin(MethodInfo { id: "logging.projects.logServices.indexes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -3726,7 +3727,7 @@ impl<'a, C, A> ProjectLogServiceIndexeListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3762,7 +3763,7 @@ impl<'a, C, A> ProjectLogServiceIndexeListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3772,10 +3773,10 @@ impl<'a, C, A> ProjectLogServiceIndexeListCall<'a, C, A> where C: BorrowMut ProjectLogServiceIndexeListCall<'a, C, A> where C: BorrowMut ProjectLogServiceIndexeListCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -3818,7 +3819,7 @@ impl<'a, C, A> ProjectLogServiceIndexeListCall<'a, C, A> where C: BorrowMut ProjectLogServiceIndexeListCall<'a, C, A> { self._log_services_id = new_value.to_string(); @@ -3864,12 +3865,12 @@ impl<'a, C, A> ProjectLogServiceIndexeListCall<'a, C, A> where C: BorrowMut ProjectLogServiceIndexeListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogServiceIndexeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogServiceIndexeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3964,7 +3965,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.sinks.list", + dlg.begin(MethodInfo { id: "logging.projects.sinks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -4006,7 +4007,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4042,7 +4043,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4052,10 +4053,10 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4088,7 +4089,7 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *projects id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectSinkListCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -4106,12 +4107,12 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4134,17 +4135,17 @@ impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSinkListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSinkListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4210,7 +4211,7 @@ impl<'a, C, A> ProjectLogServiceListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logServices.list", + dlg.begin(MethodInfo { id: "logging.projects.logServices.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -4258,7 +4259,7 @@ impl<'a, C, A> ProjectLogServiceListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4294,7 +4295,7 @@ impl<'a, C, A> ProjectLogServiceListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4304,10 +4305,10 @@ impl<'a, C, A> ProjectLogServiceListCall<'a, C, A> where C: BorrowMut ProjectLogServiceListCall<'a, C, A> where C: BorrowMut ProjectLogServiceListCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -4372,12 +4373,12 @@ impl<'a, C, A> ProjectLogServiceListCall<'a, C, A> where C: BorrowMut ProjectLogServiceListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogServiceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogServiceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4480,7 +4481,7 @@ impl<'a, C, A> ProjectLogEntryWriteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logs.entries.write", + dlg.begin(MethodInfo { id: "logging.projects.logs.entries.write", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -4523,14 +4524,14 @@ impl<'a, C, A> ProjectLogEntryWriteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4574,7 +4575,7 @@ impl<'a, C, A> ProjectLogEntryWriteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4584,10 +4585,10 @@ impl<'a, C, A> ProjectLogEntryWriteCall<'a, C, A> where C: BorrowMut ProjectLogEntryWriteCall<'a, C, A> where C: BorrowMut ProjectLogEntryWriteCall<'a, C, A> { self._request = new_value; @@ -4629,7 +4630,7 @@ impl<'a, C, A> ProjectLogEntryWriteCall<'a, C, A> where C: BorrowMut ProjectLogEntryWriteCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -4639,7 +4640,7 @@ impl<'a, C, A> ProjectLogEntryWriteCall<'a, C, A> where C: BorrowMut ProjectLogEntryWriteCall<'a, C, A> { self._logs_id = new_value.to_string(); @@ -4657,12 +4658,12 @@ impl<'a, C, A> ProjectLogEntryWriteCall<'a, C, A> where C: BorrowMut ProjectLogEntryWriteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogEntryWriteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogEntryWriteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4759,7 +4760,7 @@ impl<'a, C, A> ProjectLogServiceSinkDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logServices.sinks.delete", + dlg.begin(MethodInfo { id: "logging.projects.logServices.sinks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -4803,7 +4804,7 @@ impl<'a, C, A> ProjectLogServiceSinkDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4839,7 +4840,7 @@ impl<'a, C, A> ProjectLogServiceSinkDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4849,10 +4850,10 @@ impl<'a, C, A> ProjectLogServiceSinkDeleteCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkDeleteCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkDeleteCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -4895,7 +4896,7 @@ impl<'a, C, A> ProjectLogServiceSinkDeleteCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkDeleteCall<'a, C, A> { self._log_services_id = new_value.to_string(); @@ -4905,7 +4906,7 @@ impl<'a, C, A> ProjectLogServiceSinkDeleteCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkDeleteCall<'a, C, A> { self._sinks_id = new_value.to_string(); @@ -4923,12 +4924,12 @@ impl<'a, C, A> ProjectLogServiceSinkDeleteCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogServiceSinkDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogServiceSinkDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5024,7 +5025,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.sinks.delete", + dlg.begin(MethodInfo { id: "logging.projects.sinks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -5067,7 +5068,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5103,7 +5104,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5113,10 +5114,10 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5149,7 +5150,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *projects id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectSinkDeleteCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -5159,7 +5160,7 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *sinks id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sinks_id(mut self, new_value: &str) -> ProjectSinkDeleteCall<'a, C, A> { self._sinks_id = new_value.to_string(); @@ -5177,12 +5178,12 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -5205,17 +5206,17 @@ impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSinkDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSinkDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5285,7 +5286,7 @@ impl<'a, C, A> ProjectLogServiceSinkCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logServices.sinks.create", + dlg.begin(MethodInfo { id: "logging.projects.logServices.sinks.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -5328,14 +5329,14 @@ impl<'a, C, A> ProjectLogServiceSinkCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5379,7 +5380,7 @@ impl<'a, C, A> ProjectLogServiceSinkCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5389,10 +5390,10 @@ impl<'a, C, A> ProjectLogServiceSinkCreateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkCreateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkCreateCall<'a, C, A> { self._request = new_value; @@ -5434,7 +5435,7 @@ impl<'a, C, A> ProjectLogServiceSinkCreateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkCreateCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -5444,7 +5445,7 @@ impl<'a, C, A> ProjectLogServiceSinkCreateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkCreateCall<'a, C, A> { self._log_services_id = new_value.to_string(); @@ -5462,12 +5463,12 @@ impl<'a, C, A> ProjectLogServiceSinkCreateCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogServiceSinkCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogServiceSinkCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5564,7 +5565,7 @@ impl<'a, C, A> ProjectLogSinkDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logs.sinks.delete", + dlg.begin(MethodInfo { id: "logging.projects.logs.sinks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -5608,7 +5609,7 @@ impl<'a, C, A> ProjectLogSinkDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5644,7 +5645,7 @@ impl<'a, C, A> ProjectLogSinkDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5654,10 +5655,10 @@ impl<'a, C, A> ProjectLogSinkDeleteCall<'a, C, A> where C: BorrowMut ProjectLogSinkDeleteCall<'a, C, A> where C: BorrowMut ProjectLogSinkDeleteCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -5700,7 +5701,7 @@ impl<'a, C, A> ProjectLogSinkDeleteCall<'a, C, A> where C: BorrowMut ProjectLogSinkDeleteCall<'a, C, A> { self._logs_id = new_value.to_string(); @@ -5710,7 +5711,7 @@ impl<'a, C, A> ProjectLogSinkDeleteCall<'a, C, A> where C: BorrowMut ProjectLogSinkDeleteCall<'a, C, A> { self._sinks_id = new_value.to_string(); @@ -5728,12 +5729,12 @@ impl<'a, C, A> ProjectLogSinkDeleteCall<'a, C, A> where C: BorrowMut ProjectLogSinkDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogSinkDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogSinkDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5835,7 +5836,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.sinks.create", + dlg.begin(MethodInfo { id: "logging.projects.sinks.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -5877,14 +5878,14 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5928,7 +5929,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5938,10 +5939,10 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5973,7 +5974,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LogSink) -> ProjectSinkCreateCall<'a, C, A> { self._request = new_value; @@ -5983,7 +5984,7 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut /// /// Sets the *projects id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectSinkCreateCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -6001,12 +6002,12 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -6029,17 +6030,17 @@ impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSinkCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSinkCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6103,7 +6104,7 @@ impl<'a, C, A> ProjectLogServiceSinkGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logServices.sinks.get", + dlg.begin(MethodInfo { id: "logging.projects.logServices.sinks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -6147,7 +6148,7 @@ impl<'a, C, A> ProjectLogServiceSinkGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6183,7 +6184,7 @@ impl<'a, C, A> ProjectLogServiceSinkGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6193,10 +6194,10 @@ impl<'a, C, A> ProjectLogServiceSinkGetCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkGetCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkGetCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -6239,7 +6240,7 @@ impl<'a, C, A> ProjectLogServiceSinkGetCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkGetCall<'a, C, A> { self._log_services_id = new_value.to_string(); @@ -6249,7 +6250,7 @@ impl<'a, C, A> ProjectLogServiceSinkGetCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkGetCall<'a, C, A> { self._sinks_id = new_value.to_string(); @@ -6267,12 +6268,12 @@ impl<'a, C, A> ProjectLogServiceSinkGetCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogServiceSinkGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogServiceSinkGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6368,7 +6369,7 @@ impl<'a, C, A> ProjectLogSinkListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logs.sinks.list", + dlg.begin(MethodInfo { id: "logging.projects.logs.sinks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -6411,7 +6412,7 @@ impl<'a, C, A> ProjectLogSinkListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6447,7 +6448,7 @@ impl<'a, C, A> ProjectLogSinkListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6457,10 +6458,10 @@ impl<'a, C, A> ProjectLogSinkListCall<'a, C, A> where C: BorrowMut ProjectLogSinkListCall<'a, C, A> where C: BorrowMut ProjectLogSinkListCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -6503,7 +6504,7 @@ impl<'a, C, A> ProjectLogSinkListCall<'a, C, A> where C: BorrowMut ProjectLogSinkListCall<'a, C, A> { self._logs_id = new_value.to_string(); @@ -6521,12 +6522,12 @@ impl<'a, C, A> ProjectLogSinkListCall<'a, C, A> where C: BorrowMut ProjectLogSinkListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogSinkListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogSinkListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6629,7 +6630,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.update", + dlg.begin(MethodInfo { id: "logging.projects.metrics.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -6672,14 +6673,14 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6723,7 +6724,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6733,10 +6734,10 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> { self._request = new_value; @@ -6778,7 +6779,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -6788,7 +6789,7 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> { self._metrics_id = new_value.to_string(); @@ -6806,12 +6807,12 @@ impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectMetricUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectMetricUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6915,7 +6916,7 @@ impl<'a, C, A> ProjectLogSinkUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logs.sinks.update", + dlg.begin(MethodInfo { id: "logging.projects.logs.sinks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -6959,14 +6960,14 @@ impl<'a, C, A> ProjectLogSinkUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7010,7 +7011,7 @@ impl<'a, C, A> ProjectLogSinkUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7020,10 +7021,10 @@ impl<'a, C, A> ProjectLogSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogSinkUpdateCall<'a, C, A> { self._request = new_value; @@ -7065,7 +7066,7 @@ impl<'a, C, A> ProjectLogSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogSinkUpdateCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -7075,7 +7076,7 @@ impl<'a, C, A> ProjectLogSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogSinkUpdateCall<'a, C, A> { self._logs_id = new_value.to_string(); @@ -7085,7 +7086,7 @@ impl<'a, C, A> ProjectLogSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogSinkUpdateCall<'a, C, A> { self._sinks_id = new_value.to_string(); @@ -7103,12 +7104,12 @@ impl<'a, C, A> ProjectLogSinkUpdateCall<'a, C, A> where C: BorrowMut ProjectLogSinkUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogSinkUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogSinkUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7204,7 +7205,7 @@ impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.delete", + dlg.begin(MethodInfo { id: "logging.projects.metrics.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -7247,7 +7248,7 @@ impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7283,7 +7284,7 @@ impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7293,10 +7294,10 @@ impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDeleteCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -7339,7 +7340,7 @@ impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDeleteCall<'a, C, A> { self._metrics_id = new_value.to_string(); @@ -7357,12 +7358,12 @@ impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectMetricDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectMetricDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7458,7 +7459,7 @@ impl<'a, C, A> ProjectLogServiceSinkListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.logServices.sinks.list", + dlg.begin(MethodInfo { id: "logging.projects.logServices.sinks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -7501,7 +7502,7 @@ impl<'a, C, A> ProjectLogServiceSinkListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7537,7 +7538,7 @@ impl<'a, C, A> ProjectLogServiceSinkListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7547,10 +7548,10 @@ impl<'a, C, A> ProjectLogServiceSinkListCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkListCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkListCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -7593,7 +7594,7 @@ impl<'a, C, A> ProjectLogServiceSinkListCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkListCall<'a, C, A> { self._log_services_id = new_value.to_string(); @@ -7611,12 +7612,12 @@ impl<'a, C, A> ProjectLogServiceSinkListCall<'a, C, A> where C: BorrowMut ProjectLogServiceSinkListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectLogServiceSinkListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectLogServiceSinkListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7715,7 +7716,7 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "logging.projects.metrics.list", + dlg.begin(MethodInfo { id: "logging.projects.metrics.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectsId", self._projects_id.to_string())); @@ -7763,7 +7764,7 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7799,7 +7800,7 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7809,10 +7810,10 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7845,7 +7846,7 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut /// /// Sets the *projects id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn projects_id(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { self._projects_id = new_value.to_string(); @@ -7877,12 +7878,12 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -7905,17 +7906,17 @@ impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectMetricListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectMetricListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/logging2_beta1-cli/Cargo.toml b/gen/logging2_beta1-cli/Cargo.toml index 101eb949e6..60418d9218 100644 --- a/gen/logging2_beta1-cli/Cargo.toml +++ b/gen/logging2_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-logging2_beta1-cli" -version = "0.3.2+20151007" +version = "0.3.3+20160104" authors = ["Sebastian Thiel "] description = "A complete library to interact with logging (protocol v2beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/logging2_beta1-cli/LICENSE.md b/gen/logging2_beta1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/logging2_beta1-cli/LICENSE.md +++ b/gen/logging2_beta1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/logging2_beta1-cli/README.md b/gen/logging2_beta1-cli/README.md index 349cc69433..bcd028566b 100644 --- a/gen/logging2_beta1-cli/README.md +++ b/gen/logging2_beta1-cli/README.md @@ -17,29 +17,50 @@ Everything else about the *logging* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/logging2-beta1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/logging2-beta1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/logging2-beta1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/logging2-beta1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1-cli). # Usage -This documentation was generated from the *logging* API at revision *20151007*. The CLI is at version *0.3.2*. +This documentation was generated from the *logging* API at revision *20160104*. The CLI is at version *0.3.3*. ```bash logging2-beta1 [options] + entries + list (-r )... [-p ]... [-o ] + write (-r )... [-p ]... [-o ] + monitored-resource-descriptors + list [-p ]... [-o ] + projects + logs-delete [-p ]... [-o ] + metrics-create (-r )... [-p ]... [-o ] + metrics-delete [-p ]... [-o ] + metrics-get [-p ]... [-o ] + metrics-list [-p ]... [-o ] + metrics-update (-r )... [-p ]... [-o ] + sinks-create (-r )... [-p ]... [-o ] + sinks-delete [-p ]... [-o ] + sinks-get [-p ]... [-o ] + sinks-list [-p ]... [-o ] + sinks-update (-r )... [-p ]... [-o ] logging2-beta1 --help Configuration: + [--scope ]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/logging2_beta1-cli/mkdocs.yml b/gen/logging2_beta1-cli/mkdocs.yml index 2d5ccd7f6c..3e6b572c82 100644 --- a/gen/logging2_beta1-cli/mkdocs.yml +++ b/gen/logging2_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: logging v0.3.2+20151007 +site_name: logging v0.3.3+20160104 site_url: http://byron.github.io/google-apis-rs/google-logging2_beta1-cli site_description: Write integrating applications with bcore @@ -9,8 +9,22 @@ site_dir: build_html pages: - ['index.md', 'Home'] +- ['entries_list.md', 'Entries', 'List'] +- ['entries_write.md', 'Entries', 'Write'] +- ['monitored-resource-descriptors_list.md', 'Monitored Resource Descriptors', 'List'] +- ['projects_logs-delete.md', 'Projects', 'Logs Delete'] +- ['projects_metrics-create.md', 'Projects', 'Metrics Create'] +- ['projects_metrics-delete.md', 'Projects', 'Metrics Delete'] +- ['projects_metrics-get.md', 'Projects', 'Metrics Get'] +- ['projects_metrics-list.md', 'Projects', 'Metrics List'] +- ['projects_metrics-update.md', 'Projects', 'Metrics Update'] +- ['projects_sinks-create.md', 'Projects', 'Sinks Create'] +- ['projects_sinks-delete.md', 'Projects', 'Sinks Delete'] +- ['projects_sinks-get.md', 'Projects', 'Sinks Get'] +- ['projects_sinks-list.md', 'Projects', 'Sinks List'] +- ['projects_sinks-update.md', 'Projects', 'Sinks Update'] theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/logging2_beta1-cli/src/main.rs b/gen/logging2_beta1-cli/src/main.rs index 9c3d85703b..22a0c2bd82 100644 --- a/gen/logging2_beta1-cli/src/main.rs +++ b/gen/logging2_beta1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,20 +36,1050 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Logging>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { +impl<'n> Engine<'n> { + fn _entries_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "project-ids" => Some(("projectIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "page-size" => Some(("pageSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "order-by" => Some(("orderBy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "page-token" => Some(("pageToken", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["filter", "order-by", "page-size", "page-token", "project-ids"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::ListLogEntriesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.entries().list(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _entries_write(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "resource.labels" => Some(("resource.labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "resource.type" => Some(("resource.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "labels" => Some(("labels", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), + "log-name" => Some(("logName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["labels", "log-name", "resource", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::WriteLogEntriesRequest = json::value::from_value(object).unwrap(); + let mut call = self.hub.entries().write(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _monitored_resource_descriptors_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.monitored_resource_descriptors().list(); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_logs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().logs_delete(opt.value_of("log-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_metrics_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "filter", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogMetric = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().metrics_create(request, opt.value_of("project-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_metrics_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().metrics_delete(opt.value_of("metric-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_metrics_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().metrics_get(opt.value_of("metric-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_metrics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().metrics_list(opt.value_of("project-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_metrics_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "filter", "name"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogMetric = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().metrics_update(request, opt.value_of("metric-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_sinks_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "filter", "name", "output-version-format"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogSink = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().sinks_create(request, opt.value_of("project-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_sinks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().sinks_delete(opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_sinks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().sinks_get(opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_sinks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.projects().sinks_list(opt.value_of("project-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "page-size" => { + call = call.page_size(arg_from_str(value.unwrap_or("-0"), err, "page-size", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "page-size"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _projects_sinks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "filter" => Some(("filter", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination" => Some(("destination", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "output-version-format" => Some(("outputVersionFormat", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["destination", "filter", "name", "output-version-format"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LogSink = json::value::from_value(object).unwrap(); + let mut call = self.hub.projects().sinks_update(request, opt.value_of("sink-name").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + fn _doit(&self, dry_run: bool) -> Result, Option> { let mut err = InvalidOptionsError::new(); let mut call_result: Result<(), DoitError> = Ok(()); let mut err_opt: Option = None; match self.opt.subcommand() { + ("entries", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._entries_list(opt, dry_run, &mut err); + }, + ("write", Some(opt)) => { + call_result = self._entries_write(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("entries".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("monitored-resource-descriptors", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._monitored_resource_descriptors_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("monitored-resource-descriptors".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("projects", Some(opt)) => { + match opt.subcommand() { + ("logs-delete", Some(opt)) => { + call_result = self._projects_logs_delete(opt, dry_run, &mut err); + }, + ("metrics-create", Some(opt)) => { + call_result = self._projects_metrics_create(opt, dry_run, &mut err); + }, + ("metrics-delete", Some(opt)) => { + call_result = self._projects_metrics_delete(opt, dry_run, &mut err); + }, + ("metrics-get", Some(opt)) => { + call_result = self._projects_metrics_get(opt, dry_run, &mut err); + }, + ("metrics-list", Some(opt)) => { + call_result = self._projects_metrics_list(opt, dry_run, &mut err); + }, + ("metrics-update", Some(opt)) => { + call_result = self._projects_metrics_update(opt, dry_run, &mut err); + }, + ("sinks-create", Some(opt)) => { + call_result = self._projects_sinks_create(opt, dry_run, &mut err); + }, + ("sinks-delete", Some(opt)) => { + call_result = self._projects_sinks_delete(opt, dry_run, &mut err); + }, + ("sinks-get", Some(opt)) => { + call_result = self._projects_sinks_get(opt, dry_run, &mut err); + }, + ("sinks-list", Some(opt)) => { + call_result = self._projects_sinks_list(opt, dry_run, &mut err); + }, + ("sinks-update", Some(opt)) => { + call_result = self._projects_sinks_update(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("projects".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, _ => { err.issues.push(CLIError::MissingCommandError); writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); @@ -67,14 +1097,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "logging2-beta1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "logging2-beta1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -94,7 +1124,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -136,13 +1166,353 @@ impl<'n, 'a> Engine<'n, 'a> { fn main() { let mut exit_status = 0i32; let arg_data = [ + ("entries", "methods: 'list' and 'write'", vec![ + ("list", + Some(r##"Lists log entries. Use this method to retrieve log entries from Cloud Logging. For ways to export log entries, see [Exporting Logs](/logging/docs/export)."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/entries_list", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("write", + Some(r##"Writes log entries to Cloud Logging. All log entries in Cloud Logging are written by this method."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/entries_write", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("monitored-resource-descriptors", "methods: 'list'", vec![ + ("list", + Some(r##"Lists monitored resource descriptors that are used by Cloud Logging."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/monitored-resource-descriptors_list", + vec![ + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("projects", "methods: 'logs-delete', 'metrics-create', 'metrics-delete', 'metrics-get', 'metrics-list', 'metrics-update', 'sinks-create', 'sinks-delete', 'sinks-get', 'sinks-list' and 'sinks-update'", vec![ + ("logs-delete", + Some(r##"Deletes a log and all its log entries. The log will reappear if it receives new entries."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_logs-delete", + vec![ + (Some(r##"log-name"##), + None, + Some(r##"Required. The resource name of the log to delete. Example: `"projects/my-project/logs/syslog"`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("metrics-create", + Some(r##"Creates a logs-based metric."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_metrics-create", + vec![ + (Some(r##"project-name"##), + None, + Some(r##"The resource name of the project in which to create the metric. Example: `"projects/my-project-id"`. The new metric must be provided in the request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("metrics-delete", + Some(r##"Deletes a logs-based metric."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_metrics-delete", + vec![ + (Some(r##"metric-name"##), + None, + Some(r##"The resource name of the metric to delete. Example: `"projects/my-project-id/metrics/my-metric-id"`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("metrics-get", + Some(r##"Gets a logs-based metric."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_metrics-get", + vec![ + (Some(r##"metric-name"##), + None, + Some(r##"The resource name of the desired metric. Example: `"projects/my-project-id/metrics/my-metric-id"`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("metrics-list", + Some(r##"Lists logs-based metrics."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_metrics-list", + vec![ + (Some(r##"project-name"##), + None, + Some(r##"Required. The resource name of the project containing the metrics. Example: `"projects/my-project-id"`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("metrics-update", + Some(r##"Creates or updates a logs-based metric."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_metrics-update", + vec![ + (Some(r##"metric-name"##), + None, + Some(r##"The resource name of the metric to update. Example: `"projects/my-project-id/metrics/my-metric-id"`. The updated metric must be provided in the request and have the same identifier that is specified in `metricName`. If the metric does not exist, it is created."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-create", + Some(r##"Creates a sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_sinks-create", + vec![ + (Some(r##"project-name"##), + None, + Some(r##"The resource name of the project in which to create the sink. Example: `"projects/my-project-id"`. The new sink must be provided in the request."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-delete", + Some(r##"Deletes a sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_sinks-delete", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"The resource name of the sink to delete. Example: `"projects/my-project-id/sinks/my-sink-id"`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-get", + Some(r##"Gets a sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_sinks-get", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"The resource name of the sink to return. Example: `"projects/my-project-id/sinks/my-sink-id"`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-list", + Some(r##"Lists sinks."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_sinks-list", + vec![ + (Some(r##"project-name"##), + None, + Some(r##"Required. The resource name of the project containing the sinks. Example: `"projects/my-logging-project"`, `"projects/01234567890"`."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("sinks-update", + Some(r##"Creates or updates a sink."##), + "Details at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli/projects_sinks-update", + vec![ + (Some(r##"sink-name"##), + None, + Some(r##"The resource name of the sink to update. Example: `"projects/my-project-id/sinks/my-sink-id"`. The updated sink must be provided in the request and have the same name that is specified in `sinkName`. If the sink does not exist, it is created."##), + Some(true), + Some(false)), + + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ]; let mut app = App::new("logging2-beta1") .author("Sebastian Thiel ") - .version("0.3.2+20151007") - .about("Google Cloud Logging API lets you create logs, ingest log entries, and manage log sinks.") + .version("0.3.3+20160104") + .about("The Google Cloud Logging API lets you write log entries and manage your logs, log sinks and logs-based metrics.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_logging2_beta1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .multiple(true) + .takes_value(true)) .arg(Arg::with_name("folder") .long("config-dir") .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli") @@ -159,7 +1529,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -170,7 +1540,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/logging2_beta1/Cargo.toml b/gen/logging2_beta1/Cargo.toml index ea2af7676a..49f0088061 100644 --- a/gen/logging2_beta1/Cargo.toml +++ b/gen/logging2_beta1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-logging2_beta1" -version = "0.1.10+20151007" +version = "0.1.11+20160104" authors = ["Sebastian Thiel "] description = "A complete library to interact with logging (protocol v2beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/logging2_beta1/LICENSE.md b/gen/logging2_beta1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/logging2_beta1/LICENSE.md +++ b/gen/logging2_beta1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/logging2_beta1/README.md b/gen/logging2_beta1/README.md index fbb82dabb5..4382e36de7 100644 --- a/gen/logging2_beta1/README.md +++ b/gen/logging2_beta1/README.md @@ -5,14 +5,20 @@ DO NOT EDIT ! --> The `google-logging2_beta1` library allows access to all features of the *Google logging* service. -This documentation was generated from *logging* crate version *0.1.10+20151007*, where *20151007* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *logging* crate version *0.1.11+20160104*, where *20160104* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *logging* *v2_beta1* API can be found at the [official documentation site](https://cloud.google.com/logging/docs/). # Features -It seems there is nothing you can do here ... . +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.Logging.html) ... +* entries + * [*list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.EntryListCall.html) and [*write*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.EntryWriteCall.html) +* [monitored resource descriptors](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.MonitoredResourceDescriptor.html) + * [*list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.MonitoredResourceDescriptorListCall.html) +* projects + * [*logs delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectLogDeleteCall.html), [*metrics create*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricCreateCall.html), [*metrics delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricDeleteCall.html), [*metrics get*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricGetCall.html), [*metrics list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricListCall.html), [*metrics update*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectMetricUpdateCall.html), [*sinks create*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkCreateCall.html), [*sinks delete*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkDeleteCall.html), [*sinks get*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkGetCall.html), [*sinks list*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkListCall.html) and [*sinks update*](http://byron.github.io/google-apis-rs/google_logging2_beta1/struct.ProjectSinkUpdateCall.html) @@ -42,6 +48,13 @@ Generally speaking, you can invoke *Activities* like this: let r = hub.resource().activity(...).doit() ``` +Or specifically ... + +```ignore +let r = hub.projects().sinks_get(...).doit() +let r = hub.projects().sinks_update(...).doit() +let r = hub.projects().sinks_create(...).doit() +``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be @@ -65,7 +78,8 @@ google-logging2_beta1 = "*" extern crate hyper; extern crate yup_oauth2 as oauth2; extern crate google_logging2_beta1 as logging2_beta1; - +use logging2_beta1::LogSink; +use logging2_beta1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; use logging2_beta1::Logging; @@ -82,9 +96,35 @@ let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::new(), ::default(), None); let mut hub = Logging::new(hyper::Client::new(), 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 ! +let mut req = LogSink::default(); + +// 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 ! +let result = hub.projects().sinks_update(req, "sinkName") + .doit(); + +match result { + Err(e) => match e { + // The Error enum provides details about what exactly happened. + // You can also just use its `Debug`, `Display` or `Error` traits + Error::HttpError(_) + |Error::MissingAPIKey + |Error::MissingToken(_) + |Error::Cancelled + |Error::UploadSizeLimitExceeded(_, _) + |Error::Failure(_) + |Error::BadRequest(_) + |Error::FieldClash(_) + |Error::JsonDecodeError(_, _) => println!("{}", e), + }, + Ok(res) => println!("Success: {:?}", res), +} ``` - ## Handling Errors All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_logging2_beta1/enum.Result.html) enumeration as return value of diff --git a/gen/logging2_beta1/src/cmn.rs b/gen/logging2_beta1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/logging2_beta1/src/cmn.rs +++ b/gen/logging2_beta1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/logging2_beta1/src/lib.rs b/gen/logging2_beta1/src/lib.rs index d96fa0c3f0..7ebd221911 100644 --- a/gen/logging2_beta1/src/lib.rs +++ b/gen/logging2_beta1/src/lib.rs @@ -2,15 +2,21 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *logging* crate version *0.1.10+20151007*, where *20151007* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *logging* crate version *0.1.11+20160104*, where *20160104* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *logging* *v2_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/logging/docs/). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/logging2_beta1). //! # Features //! -//! It seems there is nothing you can do here ... . +//! Handle the following *Resources* with ease from the central [hub](struct.Logging.html) ... //! +//! * entries +//! * [*list*](struct.EntryListCall.html) and [*write*](struct.EntryWriteCall.html) +//! * [monitored resource descriptors](struct.MonitoredResourceDescriptor.html) +//! * [*list*](struct.MonitoredResourceDescriptorListCall.html) +//! * projects +//! * [*logs delete*](struct.ProjectLogDeleteCall.html), [*metrics create*](struct.ProjectMetricCreateCall.html), [*metrics delete*](struct.ProjectMetricDeleteCall.html), [*metrics get*](struct.ProjectMetricGetCall.html), [*metrics list*](struct.ProjectMetricListCall.html), [*metrics update*](struct.ProjectMetricUpdateCall.html), [*sinks create*](struct.ProjectSinkCreateCall.html), [*sinks delete*](struct.ProjectSinkDeleteCall.html), [*sinks get*](struct.ProjectSinkGetCall.html), [*sinks list*](struct.ProjectSinkListCall.html) and [*sinks update*](struct.ProjectSinkUpdateCall.html) //! //! //! @@ -42,6 +48,13 @@ //! let r = hub.resource().activity(...).doit() //! ``` //! +//! Or specifically ... +//! +//! ```ignore +//! let r = hub.projects().sinks_get(...).doit() +//! let r = hub.projects().sinks_update(...).doit() +//! let r = hub.projects().sinks_create(...).doit() +//! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` //! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be @@ -65,7 +78,8 @@ //! extern crate hyper; //! extern crate yup_oauth2 as oauth2; //! extern crate google_logging2_beta1 as logging2_beta1; -//! +//! use logging2_beta1::LogSink; +//! use logging2_beta1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; //! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -83,9 +97,35 @@ //! hyper::Client::new(), //! ::default(), None); //! let mut hub = Logging::new(hyper::Client::new(), 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 ! +//! let mut req = LogSink::default(); +//! +//! // 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 ! +//! let result = hub.projects().sinks_update(req, "sinkName") +//! .doit(); +//! +//! match result { +//! Err(e) => match e { +//! // The Error enum provides details about what exactly happened. +//! // You can also just use its `Debug`, `Display` or `Error` traits +//! Error::HttpError(_) +//! |Error::MissingAPIKey +//! |Error::MissingToken(_) +//! |Error::Cancelled +//! |Error::UploadSizeLimitExceeded(_, _) +//! |Error::Failure(_) +//! |Error::BadRequest(_) +//! |Error::FieldClash(_) +//! |Error::JsonDecodeError(_, _) => println!("{}", e), +//! }, +//! Ok(res) => println!("Success: {:?}", res), +//! } //! # } //! ``` -//! //! ## Handling Errors //! //! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of diff --git a/gen/logging2_beta1/src/lib.rs.in b/gen/logging2_beta1/src/lib.rs.in index 4a27ae6cea..a263734722 100644 --- a/gen/logging2_beta1/src/lib.rs.in +++ b/gen/logging2_beta1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -30,6 +31,44 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, // UTILITIES ### // ############ +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// Administrate log data for your projects + Admin, + + /// View log data for your projects + Read, + + /// Submit log data for your projects + Write, + + /// View and manage your data across Google Cloud Platform services + CloudPlatform, + + /// View your data across Google Cloud Platform services + CloudPlatformReadOnly, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::Admin => "https://www.googleapis.com/auth/logging.admin", + Scope::Read => "https://www.googleapis.com/auth/logging.read", + Scope::Write => "https://www.googleapis.com/auth/logging.write", + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::Read + } +} @@ -47,7 +86,8 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// extern crate hyper; /// extern crate yup_oauth2 as oauth2; /// extern crate google_logging2_beta1 as logging2_beta1; -/// +/// use logging2_beta1::LogSink; +/// use logging2_beta1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; /// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -65,9 +105,35 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// hyper::Client::new(), /// ::default(), None); /// let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let mut req = LogSink::default(); +/// +/// // 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 ! +/// let result = hub.projects().sinks_update(req, "sinkName") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } /// # } /// ``` -/// pub struct Logging { client: RefCell, auth: RefCell, @@ -83,13 +149,22 @@ impl<'a, C, A> Logging Logging { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } + pub fn entries(&'a self) -> EntryMethods<'a, C, A> { + EntryMethods { hub: &self } + } + pub fn monitored_resource_descriptors(&'a self) -> MonitoredResourceDescriptorMethods<'a, C, A> { + MonitoredResourceDescriptorMethods { hub: &self } + } + pub fn projects(&'a self) -> ProjectMethods<'a, C, A> { + ProjectMethods { hub: &self } + } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -103,14 +178,4357 @@ impl<'a, C, A> Logging // ############ // SCHEMAS ### // ########## +/// Result returned from `ListLogEntries`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list entries](struct.EntryListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLogEntriesResponse { + /// If there are more results than were returned, then `nextPageToken` is given a value in the response. To get the next batch of results, call this method again using the value of `nextPageToken` as `pageToken`. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of log entries. + pub entries: Option>, +} + +impl ResponseResult for ListLogEntriesResponse {} + + +/// Result returned from ListLogMetrics. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [metrics list projects](struct.ProjectMetricListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLogMetricsResponse { + /// A list of logs-based metrics. + pub metrics: Option>, + /// If there are more results than were returned, then `nextPageToken` is given a value in the response. To get the next batch of results, call this method again using the value of `nextPageToken` as `pageToken`. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} + +impl ResponseResult for ListLogMetricsResponse {} + + +/// A specific monitored resource or a group of monitored resources. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MonitoredResource { + /// Values for some or all of the labels listed in the associated monitored resource descriptor. For example, specify a specific Cloud SQL database by supplying values for both the `"database_id"` and `"zone"` labels. Specify the set of all Cloud SQL databases in a particular location by supplying a value for only the `"zone"` label. + pub labels: Option>, + /// The type of monitored resource. This field must match the value of the `type` field in a MonitoredResourceDescriptor object. For example, `"cloudsql_database"` represents Cloud SQL databases. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for MonitoredResource {} + + +/// Additional information about a potentially long-running operation with which a log entry is associated. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogEntryOperation { + /// Optional. Set this to True if this is the last log entry in the operation. + pub last: Option, + /// Required. An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation. + pub id: Option, + /// Required. An arbitrary producer identifier. The combination of `id` and `producer` must be globally unique. Examples for `producer`: `"MyDivision.MyBigCompany.com"`, "github.com/MyProject/MyApplication"`. + pub producer: Option, + /// Optional. Set this to True if this is the first log entry in the operation. + pub first: Option, +} + +impl Part for LogEntryOperation {} + + +/// A common proto for logging HTTP requests. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct HttpRequest { + /// The response code indicating the status of response. Examples: 200, 404. + pub status: Option, + /// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. + #[serde(rename="requestMethod")] + pub request_method: Option, + /// The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: `"http://example.com/some/info?color=red"`. + #[serde(rename="requestUrl")] + pub request_url: Option, + /// Whether or not an entity was served from cache (with or without validation). + #[serde(rename="cacheHit")] + pub cache_hit: Option, + /// The referer URL of the request, as defined in [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + pub referer: Option, + /// The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. + #[serde(rename="remoteIp")] + pub remote_ip: Option, + /// The user agent sent by the client. Example: `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. + #[serde(rename="userAgent")] + pub user_agent: Option, + /// Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if `cache_hit` is True. + #[serde(rename="validatedWithOriginServer")] + pub validated_with_origin_server: Option, + /// The size of the HTTP request message in bytes, including the request headers and the request body. + #[serde(rename="requestSize")] + pub request_size: Option, + /// The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body. + #[serde(rename="responseSize")] + pub response_size: Option, +} + +impl Part for HttpRequest {} + + +/// Describes a sink used to export log entries outside Cloud Logging. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sinks get projects](struct.ProjectSinkGetCall.html) (response) +/// * [sinks update projects](struct.ProjectSinkUpdateCall.html) (request|response) +/// * [sinks create projects](struct.ProjectSinkCreateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogSink { + /// An [advanced logs filter](/logging/docs/view/advanced_filters) that defines the log entries to be exported. The filter must be consistent with the log entry format designed by the `outputVersionFormat` parameter, regardless of the format of the log entry that was originally written to Cloud Logging. Example: `"logName:syslog AND severity>=ERROR"`. + pub filter: Option, + /// The export destination. See [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs). Examples: `"storage.googleapis.com/a-bucket"`, `"bigquery.googleapis.com/projects/a-project-id/datasets/a-dataset"`. + pub destination: Option, + /// Required. The client-assigned sink identifier. Example: `"my-severe-errors-to-pubsub"`. Sink identifiers are limited to 1000 characters and can include only the following characters: `A-Z`, `a-z`, `0-9`, and the special characters `_-.`. + pub name: Option, + /// The log entry version used when exporting log entries from this sink. This version does not have to correspond to the version of the log entry when it was written to Cloud Logging. + #[serde(rename="outputVersionFormat")] + pub output_version_format: Option, +} + +impl RequestValue for LogSink {} +impl ResponseResult for LogSink {} + + +/// 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); } The JSON representation for `Empty` is empty JSON object `{}`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [logs delete projects](struct.ProjectLogDeleteCall.html) (response) +/// * [metrics delete projects](struct.ProjectMetricDeleteCall.html) (response) +/// * [sinks delete projects](struct.ProjectSinkDeleteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Empty; + +impl ResponseResult for Empty {} + + +/// The parameters to `ListLogEntries`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list entries](struct.EntryListCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListLogEntriesRequest { + /// Optional. An [advanced logs filter](/logging/docs/view/advanced_filters). The filter is compared against all log entries in the projects specified by `projectIds`. Only entries that match the filter are retrieved. An empty filter matches all log entries. + pub filter: Option, + /// Required. One or more project IDs or project numbers from which to retrieve log entries. Examples of a project ID: `"my-project-1A"`, `"1234567890"`. + #[serde(rename="projectIds")] + pub project_ids: Option>, + /// Optional. How the results should be sorted. Presently, the only permitted values are `"timestamp"` (default) and `"timestamp desc"`. The first option returns entries in order of increasing values of `LogEntry.timestamp` (oldest first), and the second option returns entries in order of decreasing timestamps (newest first). Entries with equal timestamps are returned in order of `LogEntry.insertId`. + #[serde(rename="orderBy")] + pub order_by: Option, + /// Optional. The maximum number of results to return from this request. Fewer results might be returned. You must check for the `nextPageToken` result to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value in the `pageToken` parameter to the next request. + #[serde(rename="pageSize")] + pub page_size: Option, + /// Optional. If the `pageToken` request parameter is supplied, then the next page of results in the set are retrieved. The `pageToken` parameter must be set with the value of the `nextPageToken` result parameter from the previous request. The values of `projectIds`, `filter`, and `orderBy` must be the same as in the previous request. + #[serde(rename="pageToken")] + pub page_token: Option, +} + +impl RequestValue for ListLogEntriesRequest {} + + +/// Result returned from ListMonitoredResourceDescriptors. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list monitored resource descriptors](struct.MonitoredResourceDescriptorListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListMonitoredResourceDescriptorsResponse { + /// If there are more results than were returned, then `nextPageToken` is returned in the response. To get the next batch of results, call this method again using the value of `nextPageToken` as `pageToken`. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of resource descriptors. + #[serde(rename="resourceDescriptors")] + pub resource_descriptors: Option>, +} + +impl ResponseResult for ListMonitoredResourceDescriptorsResponse {} + + +/// Result returned from `ListSinks`. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [sinks list projects](struct.ProjectSinkListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ListSinksResponse { + /// If there are more results than were returned, then `nextPageToken` is given a value in the response. To get the next batch of results, call this method again using the value of `nextPageToken` as `pageToken`. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// A list of sinks. + pub sinks: Option>, +} + +impl ResponseResult for ListSinksResponse {} + + +/// Result returned from WriteLogEntries. empty +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [write entries](struct.EntryWriteCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WriteLogEntriesResponse; + +impl ResponseResult for WriteLogEntriesResponse {} + + +/// The parameters to WriteLogEntries. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [write entries](struct.EntryWriteCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct WriteLogEntriesRequest { + /// Optional. A default log resource name for those log entries in `entries` that do not specify their own `logName`. Example: `"projects/my-project/logs/syslog"`. See LogEntry. + #[serde(rename="logName")] + pub log_name: Option, + /// Optional. User-defined `key:value` items that are added to the `labels` field of each log entry in `entries`, except when a log entry specifies its own `key:value` item with the same key. Example: `{ "size": "large", "color":"red" }` + pub labels: Option>, + /// Optional. A default monitored resource for those log entries in `entries` that do not specify their own `resource`. + pub resource: Option, + /// Required. The log entries to write. The log entries must have values for all required fields. + pub entries: Option>, +} + +impl RequestValue for WriteLogEntriesRequest {} + + +/// A description of a label. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LabelDescriptor { + /// The type of data that can be assigned to the label. + #[serde(rename="valueType")] + pub value_type: Option, + /// A human-readable description for the label. + pub description: Option, + /// The label key. + pub key: Option, +} + +impl Part for LabelDescriptor {} + + +/// An individual entry in a log. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogEntry { + /// Optional. Information about the HTTP request associated with this log entry, if applicable. + #[serde(rename="httpRequest")] + pub http_request: Option, + /// Required. The monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error. + pub resource: Option, + /// Optional. The severity of the log entry. The default value is `LogSeverity.DEFAULT`. + pub severity: Option, + /// The log entry payload, represented as a Unicode string (UTF-8). + #[serde(rename="textPayload")] + pub text_payload: Option, + /// Optional. The time the event described by the log entry occurred. If omitted, Cloud Logging will use the time the log entry is written. + pub timestamp: Option, + /// Optional. A set of user-defined (key, value) data that provides additional information about the log entry. + pub labels: Option>, + /// The log entry payload, represented as a protocol buffer. You can only use `protoPayload` values that belong to a set of approved types. + #[serde(rename="protoPayload")] + pub proto_payload: Option>, + /// The log entry payload, represented as a structure that is expressed as a JSON object. + #[serde(rename="jsonPayload")] + pub json_payload: Option>, + /// Required. The resource name of the log to which this log entry belongs. The format of the name is `projects//logs/, + /// Optional. A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same log with the same ID as duplicates which can be removed. If omitted, Cloud Logging will generate a unique ID for this log entry. + #[serde(rename="insertId")] + pub insert_id: Option, + /// Optional. Information about an operation associated with the log entry, if applicable. + pub operation: Option, +} + +impl Part for LogEntry {} + + +/// Describes a logs-based metric. The value of the metric is the number of log entries that match a logs filter. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [metrics create projects](struct.ProjectMetricCreateCall.html) (request|response) +/// * [metrics get projects](struct.ProjectMetricGetCall.html) (response) +/// * [metrics update projects](struct.ProjectMetricUpdateCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LogMetric { + /// An [advanced logs filter](/logging/docs/view/advanced_filters). Example: `"logName:syslog AND severity>=ERROR"`. + pub filter: Option, + /// Required. The client-assigned metric identifier. Example: `"severe_errors"`. Metric identifiers are limited to 1000 characters and can include only the following characters: `A-Z`, `a-z`, `0-9`, and the special characters `_-.,+!*',()%/\`. The forward-slash character (`/`) denotes a hierarchy of name pieces, and it cannot be the first character of the name. + pub name: Option, + /// A description of this metric, which is used in documentation. + pub description: Option, +} + +impl RequestValue for LogMetric {} +impl ResponseResult for LogMetric {} + + +/// A description of a type of monitored resource. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list monitored resource descriptors](struct.MonitoredResourceDescriptorListCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MonitoredResourceDescriptor { + /// The monitored resource type. For example, the type `"cloudsql_database"` represents databases in Google Cloud SQL. + #[serde(rename="type")] + pub type_: Option, + /// A set of labels that can be used to describe instances of this monitored resource type. For example, Cloud SQL databases can be labeled with their `"database_id"` and their `"zone"`. + pub labels: Option>, + /// A concise name for the monitored resource type, which is displayed in user interfaces. For example, `"Cloud SQL Database"`. + #[serde(rename="displayName")] + pub display_name: Option, + /// A detailed description of the monitored resource type, which is used in documentation. + pub description: Option, +} + +impl Resource for MonitoredResourceDescriptor {} + + // ################### // MethodBuilders ### // ################# +/// A builder providing access to all methods supported on *monitoredResourceDescriptor* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2_beta1 as logging2_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2_beta1::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.monitored_resource_descriptors(); +/// # } +/// ``` +pub struct MonitoredResourceDescriptorMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for MonitoredResourceDescriptorMethods<'a, C, A> {} + +impl<'a, C, A> MonitoredResourceDescriptorMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists monitored resource descriptors that are used by Cloud Logging. + pub fn list(&self) -> MonitoredResourceDescriptorListCall<'a, C, A> { + MonitoredResourceDescriptorListCall { + hub: self.hub, + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2_beta1 as logging2_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2_beta1::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `logs_delete(...)`, `metrics_create(...)`, `metrics_delete(...)`, `metrics_get(...)`, `metrics_list(...)`, `metrics_update(...)`, `sinks_create(...)`, `sinks_delete(...)`, `sinks_get(...)`, `sinks_list(...)` and `sinks_update(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} + +impl<'a, C, A> ProjectMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists sinks. + /// + /// # Arguments + /// + /// * `projectName` - Required. The resource name of the project containing the sinks. Example: `"projects/my-logging-project"`, `"projects/01234567890"`. + pub fn sinks_list(&self, project_name: &str) -> ProjectSinkListCall<'a, C, A> { + ProjectSinkListCall { + hub: self.hub, + _project_name: project_name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a log and all its log entries. The log will reappear if it receives new entries. + /// + /// # Arguments + /// + /// * `logName` - Required. The resource name of the log to delete. Example: `"projects/my-project/logs/syslog"`. + pub fn logs_delete(&self, log_name: &str) -> ProjectLogDeleteCall<'a, C, A> { + ProjectLogDeleteCall { + hub: self.hub, + _log_name: log_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a sink. + /// + /// # Arguments + /// + /// * `sinkName` - The resource name of the sink to return. Example: `"projects/my-project-id/sinks/my-sink-id"`. + pub fn sinks_get(&self, sink_name: &str) -> ProjectSinkGetCall<'a, C, A> { + ProjectSinkGetCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets a logs-based metric. + /// + /// # Arguments + /// + /// * `metricName` - The resource name of the desired metric. Example: `"projects/my-project-id/metrics/my-metric-id"`. + pub fn metrics_get(&self, metric_name: &str) -> ProjectMetricGetCall<'a, C, A> { + ProjectMetricGetCall { + hub: self.hub, + _metric_name: metric_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates or updates a sink. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `sinkName` - The resource name of the sink to update. Example: `"projects/my-project-id/sinks/my-sink-id"`. The updated sink must be provided in the request and have the same name that is specified in `sinkName`. If the sink does not exist, it is created. + pub fn sinks_update(&self, request: LogSink, sink_name: &str) -> ProjectSinkUpdateCall<'a, C, A> { + ProjectSinkUpdateCall { + hub: self.hub, + _request: request, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a logs-based metric. + /// + /// # Arguments + /// + /// * `metricName` - The resource name of the metric to delete. Example: `"projects/my-project-id/metrics/my-metric-id"`. + pub fn metrics_delete(&self, metric_name: &str) -> ProjectMetricDeleteCall<'a, C, A> { + ProjectMetricDeleteCall { + hub: self.hub, + _metric_name: metric_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a sink. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `projectName` - The resource name of the project in which to create the sink. Example: `"projects/my-project-id"`. The new sink must be provided in the request. + pub fn sinks_create(&self, request: LogSink, project_name: &str) -> ProjectSinkCreateCall<'a, C, A> { + ProjectSinkCreateCall { + hub: self.hub, + _request: request, + _project_name: project_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a logs-based metric. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `projectName` - The resource name of the project in which to create the metric. Example: `"projects/my-project-id"`. The new metric must be provided in the request. + pub fn metrics_create(&self, request: LogMetric, project_name: &str) -> ProjectMetricCreateCall<'a, C, A> { + ProjectMetricCreateCall { + hub: self.hub, + _request: request, + _project_name: project_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a sink. + /// + /// # Arguments + /// + /// * `sinkName` - The resource name of the sink to delete. Example: `"projects/my-project-id/sinks/my-sink-id"`. + pub fn sinks_delete(&self, sink_name: &str) -> ProjectSinkDeleteCall<'a, C, A> { + ProjectSinkDeleteCall { + hub: self.hub, + _sink_name: sink_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists logs-based metrics. + /// + /// # Arguments + /// + /// * `projectName` - Required. The resource name of the project containing the metrics. Example: `"projects/my-project-id"`. + pub fn metrics_list(&self, project_name: &str) -> ProjectMetricListCall<'a, C, A> { + ProjectMetricListCall { + hub: self.hub, + _project_name: project_name.to_string(), + _page_token: Default::default(), + _page_size: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates or updates a logs-based metric. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `metricName` - The resource name of the metric to update. Example: `"projects/my-project-id/metrics/my-metric-id"`. The updated metric must be provided in the request and have the same identifier that is specified in `metricName`. If the metric does not exist, it is created. + pub fn metrics_update(&self, request: LogMetric, metric_name: &str) -> ProjectMetricUpdateCall<'a, C, A> { + ProjectMetricUpdateCall { + hub: self.hub, + _request: request, + _metric_name: metric_name.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *entry* resources. +/// It is not used directly, but through the `Logging` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_logging2_beta1 as logging2_beta1; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use logging2_beta1::Logging; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = Logging::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` and `write(...)` +/// // to build up your call. +/// let rb = hub.entries(); +/// # } +/// ``` +pub struct EntryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, +} + +impl<'a, C, A> MethodsBuilder for EntryMethods<'a, C, A> {} + +impl<'a, C, A> EntryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists log entries. Use this method to retrieve log entries from Cloud Logging. For ways to export log entries, see [Exporting Logs](/logging/docs/export). + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn list(&self, request: ListLogEntriesRequest) -> EntryListCall<'a, C, A> { + EntryListCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Writes log entries to Cloud Logging. All log entries in Cloud Logging are written by this method. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn write(&self, request: WriteLogEntriesRequest) -> EntryWriteCall<'a, C, A> { + EntryWriteCall { + hub: self.hub, + _request: request, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + // ################### // CallBuilders ### // ################# +/// Lists monitored resource descriptors that are used by Cloud Logging. +/// +/// A builder for the *list* method supported by a *monitoredResourceDescriptor* resource. +/// It is not used directly, but through a `MonitoredResourceDescriptorMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let result = hub.monitored_resource_descriptors().list() +/// .page_token("Stet") +/// .page_size(-42) +/// .doit(); +/// # } +/// ``` +pub struct MonitoredResourceDescriptorListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for MonitoredResourceDescriptorListCall<'a, C, A> {} + +impl<'a, C, A> MonitoredResourceDescriptorListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListMonitoredResourceDescriptorsResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.monitoredResourceDescriptors.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/monitoredResourceDescriptors".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Optional. If the `pageToken` request parameter is supplied, then the next page of results in the set are retrieved. The `pageToken` parameter must be set with the value of the `nextPageToken` result parameter from the previous request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> MonitoredResourceDescriptorListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Fewer results might be returned. You must check for the `nextPageToken` result to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value in the `pageToken` parameter to the next request. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> MonitoredResourceDescriptorListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> MonitoredResourceDescriptorListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> MonitoredResourceDescriptorListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> MonitoredResourceDescriptorListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists sinks. +/// +/// A builder for the *sinks.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().sinks_list("projectName") +/// .page_token("dolores") +/// .page_size(-63) +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _project_name: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkListCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListSinksResponse)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("projectName", self._project_name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "projectName", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+projectName}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+projectName}", "projectName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["projectName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of the project containing the sinks. Example: `"projects/my-logging-project"`, `"projects/01234567890"`. + /// + /// Sets the *project name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_name(mut self, new_value: &str) -> ProjectSinkListCall<'a, C, A> { + self._project_name = new_value.to_string(); + self + } + /// Optional. If the `pageToken` request parameter is supplied, then the next page of results in the set are retrieved. The `pageToken` parameter must be set with the value of the `nextPageToken` result parameter from the previous request. The value of `projectName` must be the same as in the previous request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectSinkListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Fewer results might be returned. You must check for the `nextPageToken` result to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value in the `pageToken` parameter to the next request. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectSinkListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectSinkListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectSinkListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a log and all its log entries. The log will reappear if it receives new entries. +/// +/// A builder for the *logs.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().logs_delete("logName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectLogDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _log_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectLogDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectLogDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.logs.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("logName", self._log_name.to_string())); + for &field in ["alt", "logName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+logName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+logName}", "logName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["logName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of the log to delete. Example: `"projects/my-project/logs/syslog"`. + /// + /// Sets the *log name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn log_name(mut self, new_value: &str) -> ProjectLogDeleteCall<'a, C, A> { + self._log_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectLogDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectLogDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectLogDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a sink. +/// +/// A builder for the *sinks.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().sinks_get("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the sink to return. Example: `"projects/my-project-id/sinks/my-sink-id"`. + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> ProjectSinkGetCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectSinkGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectSinkGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets a logs-based metric. +/// +/// A builder for the *metrics.get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().metrics_get("metricName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _metric_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricGetCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("metricName", self._metric_name.to_string())); + for &field in ["alt", "metricName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+metricName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["metricName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the desired metric. Example: `"projects/my-project-id/metrics/my-metric-id"`. + /// + /// Sets the *metric name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn metric_name(mut self, new_value: &str) -> ProjectMetricGetCall<'a, C, A> { + self._metric_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectMetricGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectMetricGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates or updates a sink. +/// +/// A builder for the *sinks.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let mut req = LogSink::default(); +/// +/// // 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 ! +/// let result = hub.projects().sinks_update(req, "sinkName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: LogSink) -> ProjectSinkUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the sink to update. Example: `"projects/my-project-id/sinks/my-sink-id"`. The updated sink must be provided in the request and have the same name that is specified in `sinkName`. If the sink does not exist, it is created. + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> ProjectSinkUpdateCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectSinkUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectSinkUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a logs-based metric. +/// +/// A builder for the *metrics.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().metrics_delete("metricName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _metric_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("metricName", self._metric_name.to_string())); + for &field in ["alt", "metricName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+metricName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["metricName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the metric to delete. Example: `"projects/my-project-id/metrics/my-metric-id"`. + /// + /// Sets the *metric name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn metric_name(mut self, new_value: &str) -> ProjectMetricDeleteCall<'a, C, A> { + self._metric_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectMetricDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectMetricDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a sink. +/// +/// A builder for the *sinks.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::LogSink; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let mut req = LogSink::default(); +/// +/// // 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 ! +/// let result = hub.projects().sinks_create(req, "projectName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogSink, + _project_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogSink)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("projectName", self._project_name.to_string())); + for &field in ["alt", "projectName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+projectName}/sinks".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+projectName}", "projectName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["projectName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: LogSink) -> ProjectSinkCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the project in which to create the sink. Example: `"projects/my-project-id"`. The new sink must be provided in the request. + /// + /// Sets the *project name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_name(mut self, new_value: &str) -> ProjectSinkCreateCall<'a, C, A> { + self._project_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectSinkCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectSinkCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a logs-based metric. +/// +/// A builder for the *metrics.create* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::LogMetric; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let mut req = LogMetric::default(); +/// +/// // 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 ! +/// let result = hub.projects().metrics_create(req, "projectName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricCreateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogMetric, + _project_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricCreateCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.create", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("projectName", self._project_name.to_string())); + for &field in ["alt", "projectName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+projectName}/metrics".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+projectName}", "projectName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["projectName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: LogMetric) -> ProjectMetricCreateCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the project in which to create the metric. Example: `"projects/my-project-id"`. The new metric must be provided in the request. + /// + /// Sets the *project name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_name(mut self, new_value: &str) -> ProjectMetricCreateCall<'a, C, A> { + self._project_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectMetricCreateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricCreateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectMetricCreateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a sink. +/// +/// A builder for the *sinks.delete* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().sinks_delete("sinkName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectSinkDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _sink_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectSinkDeleteCall<'a, C, A> {} + +impl<'a, C, A> ProjectSinkDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.sinks.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("sinkName", self._sink_name.to_string())); + for &field in ["alt", "sinkName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+sinkName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+sinkName}", "sinkName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["sinkName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The resource name of the sink to delete. Example: `"projects/my-project-id/sinks/my-sink-id"`. + /// + /// Sets the *sink name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn sink_name(mut self, new_value: &str) -> ProjectSinkDeleteCall<'a, C, A> { + self._sink_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectSinkDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectSinkDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectSinkDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists logs-based metrics. +/// +/// A builder for the *metrics.list* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let result = hub.projects().metrics_list("projectName") +/// .page_token("gubergren") +/// .page_size(-95) +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _project_name: String, + _page_token: Option, + _page_size: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricListCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogMetricsResponse)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("projectName", self._project_name.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._page_size { + params.push(("pageSize", value.to_string())); + } + for &field in ["alt", "projectName", "pageToken", "pageSize"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+projectName}/metrics".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+projectName}", "projectName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["projectName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Required. The resource name of the project containing the metrics. Example: `"projects/my-project-id"`. + /// + /// Sets the *project name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project_name(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { + self._project_name = new_value.to_string(); + self + } + /// Optional. If the `pageToken` request parameter is supplied, then the next page of results in the set are retrieved. The `pageToken` parameter must be set with the value of the `nextPageToken` result parameter from the previous request. The value of `projectName` must be the same as in the previous request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ProjectMetricListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. The maximum number of results to return from this request. Fewer results might be returned. You must check for the `nextPageToken` result to determine if additional results are available, which you can retrieve by passing the `nextPageToken` value in the `pageToken` parameter to the next request. + /// + /// Sets the *page size* query property to the given value. + pub fn page_size(mut self, new_value: i32) -> ProjectMetricListCall<'a, C, A> { + self._page_size = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectMetricListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectMetricListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates or updates a logs-based metric. +/// +/// A builder for the *metrics.update* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::LogMetric; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let mut req = LogMetric::default(); +/// +/// // 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 ! +/// let result = hub.projects().metrics_update(req, "metricName") +/// .doit(); +/// # } +/// ``` +pub struct ProjectMetricUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: LogMetric, + _metric_name: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ProjectMetricUpdateCall<'a, C, A> {} + +impl<'a, C, A> ProjectMetricUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LogMetric)> { + use url::percent_encoding::{percent_encode, FORM_URLENCODED_ENCODE_SET}; + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.projects.metrics.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("metricName", self._metric_name.to_string())); + for &field in ["alt", "metricName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/{+metricName}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{+metricName}", "metricName")].iter() { + let mut replace_with = String::new(); + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = value.to_string(); + break; + } + } + if find_this.as_bytes()[1] == '+' as u8 { + replace_with = percent_encode(replace_with.as_bytes(), FORM_URLENCODED_ENCODE_SET); + } + url = url.replace(find_this, &replace_with); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["metricName"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: LogMetric) -> ProjectMetricUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The resource name of the metric to update. Example: `"projects/my-project-id/metrics/my-metric-id"`. The updated metric must be provided in the request and have the same identifier that is specified in `metricName`. If the metric does not exist, it is created. + /// + /// Sets the *metric name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn metric_name(mut self, new_value: &str) -> ProjectMetricUpdateCall<'a, C, A> { + self._metric_name = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ProjectMetricUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> ProjectMetricUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ProjectMetricUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists log entries. Use this method to retrieve log entries from Cloud Logging. For ways to export log entries, see [Exporting Logs](/logging/docs/export). +/// +/// A builder for the *list* method supported by a *entry* resource. +/// It is not used directly, but through a `EntryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::ListLogEntriesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let mut req = ListLogEntriesRequest::default(); +/// +/// // 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 ! +/// let result = hub.entries().list(req) +/// .doit(); +/// # } +/// ``` +pub struct EntryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: ListLogEntriesRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EntryListCall<'a, C, A> {} + +impl<'a, C, A> EntryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ListLogEntriesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.entries.list", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/entries:list".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: ListLogEntriesRequest) -> EntryListCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EntryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EntryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EntryListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Writes log entries to Cloud Logging. All log entries in Cloud Logging are written by this method. +/// +/// A builder for the *write* method supported by a *entry* resource. +/// It is not used directly, but through a `EntryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_logging2_beta1 as logging2_beta1; +/// use logging2_beta1::WriteLogEntriesRequest; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use logging2_beta1::Logging; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = Logging::new(hyper::Client::new(), 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 ! +/// let mut req = WriteLogEntriesRequest::default(); +/// +/// // 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 ! +/// let result = hub.entries().write(req) +/// .doit(); +/// # } +/// ``` +pub struct EntryWriteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a Logging, + _request: WriteLogEntriesRequest, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EntryWriteCall<'a, C, A> {} + +impl<'a, C, A> EntryWriteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, WriteLogEntriesResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "logging.entries.write", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + for &field in ["alt"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://logging.googleapis.com/v2beta1/entries:write".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: WriteLogEntriesRequest) -> EntryWriteCall<'a, C, A> { + self._request = new_value; + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EntryWriteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *bearer_token* (query-string) - OAuth bearer token. + /// * *pp* (query-boolean) - Pretty-print response. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + /// * *access_token* (query-string) - OAuth access token. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *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. + /// * *callback* (query-string) - JSONP + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *alt* (query-string) - Data format for response. + /// * *$.xgafv* (query-string) - V1 error format. + pub fn param(mut self, name: T, value: T) -> EntryWriteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EntryWriteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/manager1_beta2-cli/Cargo.toml b/gen/manager1_beta2-cli/Cargo.toml index 57b74a9f7e..ee3bf2f9b8 100644 --- a/gen/manager1_beta2-cli/Cargo.toml +++ b/gen/manager1_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-manager1_beta2-cli" -version = "0.3.2+20140915" +version = "0.3.3+20140915" authors = ["Sebastian Thiel "] description = "A complete library to interact with manager (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/manager1_beta2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/manager1_beta2-cli/LICENSE.md b/gen/manager1_beta2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/manager1_beta2-cli/LICENSE.md +++ b/gen/manager1_beta2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/manager1_beta2-cli/README.md b/gen/manager1_beta2-cli/README.md index f5f0340796..ee50ea8cfe 100644 --- a/gen/manager1_beta2-cli/README.md +++ b/gen/manager1_beta2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *manager* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/manager1-beta2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/manager1-beta2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/manager1-beta2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/manager1-beta2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/manager1_beta2-cli). # Usage -This documentation was generated from the *manager* API at revision *20140915*. The CLI is at version *0.3.2*. +This documentation was generated from the *manager* API at revision *20140915*. The CLI is at version *0.3.3*. ```bash manager1-beta2 [options] @@ -42,18 +42,18 @@ manager1-beta2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/manager1_beta2-cli/mkdocs.yml b/gen/manager1_beta2-cli/mkdocs.yml index c682da503b..decbc86079 100644 --- a/gen/manager1_beta2-cli/mkdocs.yml +++ b/gen/manager1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: manager v0.3.2+20140915 +site_name: manager v0.3.3+20140915 site_url: http://byron.github.io/google-apis-rs/google-manager1_beta2-cli site_description: Write integrating applications with bcore @@ -20,5 +20,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/manager1_beta2-cli/src/main.rs b/gen/manager1_beta2-cli/src/main.rs index b9db33f363..b82eca974f 100644 --- a/gen/manager1_beta2-cli/src/main.rs +++ b/gen/manager1_beta2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Manager>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _deployments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _deployments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.deployments().delete(opt.value_of("project-id").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("deployment-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -89,10 +89,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.deployments().get(opt.value_of("project-id").unwrap_or(""), opt.value_of("region").unwrap_or(""), opt.value_of("deployment-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -105,7 +105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -141,13 +141,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -161,8 +161,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "state.status" => Some(("state.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state.details" => Some(("state.details", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -182,7 +182,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Deployment = json::value::from_value(object).unwrap(); let mut call = self.hub.deployments().insert(request, opt.value_of("project-id").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -195,7 +195,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -208,7 +208,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -231,10 +231,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _deployments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _deployments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.deployments().list(opt.value_of("project-id").unwrap_or(""), opt.value_of("region").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -253,7 +253,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -267,7 +267,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -290,10 +290,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _templates_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _templates_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.templates().delete(opt.value_of("project-id").unwrap_or(""), opt.value_of("template-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -306,7 +306,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -319,7 +319,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -334,10 +334,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _templates_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _templates_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.templates().get(opt.value_of("project-id").unwrap_or(""), opt.value_of("template-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -350,7 +350,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -363,7 +363,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -386,13 +386,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _templates_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _templates_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -406,8 +406,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -423,7 +423,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Template = json::value::from_value(object).unwrap(); let mut call = self.hub.templates().insert(request, opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -436,7 +436,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -449,7 +449,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -472,10 +472,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _templates_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _templates_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.templates().list(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -494,7 +494,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -508,7 +508,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -593,14 +593,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "manager1-beta2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "manager1-beta2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -620,7 +620,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -659,7 +659,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("deployments", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_manager1_beta2_cli/deployments_delete", vec![ @@ -687,7 +687,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_manager1_beta2_cli/deployments_get", vec![ @@ -721,7 +721,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_manager1_beta2_cli/deployments_insert", vec![ @@ -755,7 +755,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_manager1_beta2_cli/deployments_list", vec![ @@ -786,7 +786,7 @@ fn main() { ]), ("templates", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_manager1_beta2_cli/templates_delete", vec![ @@ -808,7 +808,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_manager1_beta2_cli/templates_get", vec![ @@ -836,7 +836,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_manager1_beta2_cli/templates_insert", vec![ @@ -864,7 +864,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##""##), "Details at http://byron.github.io/google-apis-rs/google_manager1_beta2_cli/templates_list", vec![ @@ -892,7 +892,7 @@ fn main() { let mut app = App::new("manager1-beta2") .author("Sebastian Thiel ") - .version("0.3.2+20140915") + .version("0.3.3+20140915") .about("The Deployment Manager API allows users to declaratively configure, deploy and run complex solutions on the Google Cloud Platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_manager1_beta2_cli") .arg(Arg::with_name("url") @@ -916,7 +916,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -927,7 +927,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/manager1_beta2/Cargo.toml b/gen/manager1_beta2/Cargo.toml index 8f1196902f..0883f9958a 100644 --- a/gen/manager1_beta2/Cargo.toml +++ b/gen/manager1_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-manager1_beta2" -version = "0.1.10+20140915" +version = "0.1.11+20140915" authors = ["Sebastian Thiel "] description = "A complete library to interact with manager (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/manager1_beta2" diff --git a/gen/manager1_beta2/LICENSE.md b/gen/manager1_beta2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/manager1_beta2/LICENSE.md +++ b/gen/manager1_beta2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/manager1_beta2/README.md b/gen/manager1_beta2/README.md index c013ff00a1..93b9d17c3c 100644 --- a/gen/manager1_beta2/README.md +++ b/gen/manager1_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-manager1_beta2` library allows access to all features of the *Google manager* service. -This documentation was generated from *manager* crate version *0.1.10+20140915*, where *20140915* is the exact revision of the *manager:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *manager* crate version *0.1.11+20140915*, where *20140915* is the exact revision of the *manager:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *manager* *v1_beta2* API can be found at the [official documentation site](https://developers.google.com/deployment-manager/). diff --git a/gen/manager1_beta2/src/cmn.rs b/gen/manager1_beta2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/manager1_beta2/src/cmn.rs +++ b/gen/manager1_beta2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/manager1_beta2/src/lib.rs b/gen/manager1_beta2/src/lib.rs index 4a411dcea0..3c72f8ba80 100644 --- a/gen/manager1_beta2/src/lib.rs +++ b/gen/manager1_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *manager* crate version *0.1.10+20140915*, where *20140915* is the exact revision of the *manager:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *manager* crate version *0.1.11+20140915*, where *20140915* is the exact revision of the *manager:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *manager* *v1_beta2* API can be found at the //! [official documentation site](https://developers.google.com/deployment-manager/). diff --git a/gen/manager1_beta2/src/lib.rs.in b/gen/manager1_beta2/src/lib.rs.in index f316568f94..b0a22f3621 100644 --- a/gen/manager1_beta2/src/lib.rs.in +++ b/gen/manager1_beta2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -152,7 +153,7 @@ impl<'a, C, A> Manager Manager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -164,7 +165,7 @@ impl<'a, C, A> Manager } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1237,7 +1238,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "manager.templates.list", + dlg.begin(MethodInfo { id: "manager.templates.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1285,7 +1286,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1321,7 +1322,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1331,10 +1332,10 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1366,7 +1367,7 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TemplateListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1398,12 +1399,12 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1420,17 +1421,17 @@ impl<'a, C, A> TemplateListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TemplateListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TemplateListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1493,7 +1494,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "manager.templates.delete", + dlg.begin(MethodInfo { id: "manager.templates.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1535,7 +1536,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1571,7 +1572,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1581,10 +1582,10 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1606,7 +1607,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TemplateDeleteCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1615,7 +1616,7 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *template name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn template_name(mut self, new_value: &str) -> TemplateDeleteCall<'a, C, A> { self._template_name = new_value.to_string(); @@ -1633,12 +1634,12 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1655,17 +1656,17 @@ impl<'a, C, A> TemplateDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TemplateDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TemplateDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1734,7 +1735,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "manager.templates.insert", + dlg.begin(MethodInfo { id: "manager.templates.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -1776,14 +1777,14 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1827,7 +1828,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1837,10 +1838,10 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1872,7 +1873,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Template) -> TemplateInsertCall<'a, C, A> { self._request = new_value; @@ -1881,7 +1882,7 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TemplateInsertCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -1899,12 +1900,12 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1921,17 +1922,17 @@ impl<'a, C, A> TemplateInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TemplateInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TemplateInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1994,7 +1995,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "manager.templates.get", + dlg.begin(MethodInfo { id: "manager.templates.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2037,7 +2038,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2073,7 +2074,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2083,10 +2084,10 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2118,7 +2119,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> TemplateGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2127,7 +2128,7 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *template name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn template_name(mut self, new_value: &str) -> TemplateGetCall<'a, C, A> { self._template_name = new_value.to_string(); @@ -2145,12 +2146,12 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2167,17 +2168,17 @@ impl<'a, C, A> TemplateGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TemplateGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TemplateGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2247,7 +2248,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "manager.deployments.insert", + dlg.begin(MethodInfo { id: "manager.deployments.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2290,14 +2291,14 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2341,7 +2342,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2351,10 +2352,10 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2386,7 +2387,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Deployment) -> DeploymentInsertCall<'a, C, A> { self._request = new_value; @@ -2395,7 +2396,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> DeploymentInsertCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2404,7 +2405,7 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> DeploymentInsertCall<'a, C, A> { self._region = new_value.to_string(); @@ -2422,12 +2423,12 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2444,17 +2445,17 @@ impl<'a, C, A> DeploymentInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppengineAdmin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2518,7 +2519,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "manager.deployments.get", + dlg.begin(MethodInfo { id: "manager.deployments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2562,7 +2563,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2598,7 +2599,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2608,10 +2609,10 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2643,7 +2644,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> DeploymentGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2652,7 +2653,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> DeploymentGetCall<'a, C, A> { self._region = new_value.to_string(); @@ -2661,7 +2662,7 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *deployment name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment_name(mut self, new_value: &str) -> DeploymentGetCall<'a, C, A> { self._deployment_name = new_value.to_string(); @@ -2679,12 +2680,12 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2701,17 +2702,17 @@ impl<'a, C, A> DeploymentGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2778,7 +2779,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "manager.deployments.list", + dlg.begin(MethodInfo { id: "manager.deployments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2827,7 +2828,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2863,7 +2864,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2873,10 +2874,10 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2908,7 +2909,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2917,7 +2918,7 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> DeploymentListCall<'a, C, A> { self._region = new_value.to_string(); @@ -2949,12 +2950,12 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2971,17 +2972,17 @@ impl<'a, C, A> DeploymentListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::NdevCloudmanReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3045,7 +3046,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "manager.deployments.delete", + dlg.begin(MethodInfo { id: "manager.deployments.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -3088,7 +3089,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3124,7 +3125,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3134,10 +3135,10 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3159,7 +3160,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -3168,7 +3169,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *region* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn region(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C, A> { self._region = new_value.to_string(); @@ -3177,7 +3178,7 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *deployment name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn deployment_name(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C, A> { self._deployment_name = new_value.to_string(); @@ -3195,12 +3196,12 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3217,17 +3218,17 @@ impl<'a, C, A> DeploymentDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DeploymentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DeploymentDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/mapsengine1-cli/Cargo.toml b/gen/mapsengine1-cli/Cargo.toml index 28ce08cdf7..5b34094c0a 100644 --- a/gen/mapsengine1-cli/Cargo.toml +++ b/gen/mapsengine1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-mapsengine1-cli" -version = "0.3.2+20150629" +version = "0.3.3+20151202" authors = ["Sebastian Thiel "] description = "A complete library to interact with Maps Engine (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/mapsengine1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/mapsengine1-cli/LICENSE.md b/gen/mapsengine1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/mapsengine1-cli/LICENSE.md +++ b/gen/mapsengine1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/mapsengine1-cli/README.md b/gen/mapsengine1-cli/README.md index eaf3086dd7..df6a881ee2 100644 --- a/gen/mapsengine1-cli/README.md +++ b/gen/mapsengine1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Maps Engine* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/mapsengine1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/mapsengine1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/mapsengine1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/mapsengine1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/mapsengine1-cli). # Usage -This documentation was generated from the *Maps Engine* API at revision *20150629*. The CLI is at version *0.3.2*. +This documentation was generated from the *Maps Engine* API at revision *20151202*. The CLI is at version *0.3.3*. ```bash mapsengine1 [options] @@ -116,18 +116,18 @@ mapsengine1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/mapsengine1-cli/mkdocs.yml b/gen/mapsengine1-cli/mkdocs.yml index d10d563413..9ddaccf986 100644 --- a/gen/mapsengine1-cli/mkdocs.yml +++ b/gen/mapsengine1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Maps Engine v0.3.2+20150629 +site_name: Maps Engine v0.3.3+20151202 site_url: http://byron.github.io/google-apis-rs/google-mapsengine1-cli site_description: Write integrating applications with bcore @@ -89,5 +89,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/mapsengine1-cli/src/main.rs b/gen/mapsengine1-cli/src/main.rs index fe63eeeb37..4b52bf2c52 100644 --- a/gen/mapsengine1-cli/src/main.rs +++ b/gen/mapsengine1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::MapsEngine>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _assets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _assets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.assets().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _assets_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _assets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.assets().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "type" => { @@ -152,7 +152,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["modified-after", "search", "tags", "project-id", "created-after", "max-results", "page-token", "created-before", "role", "bbox", "modified-before", "creator-email", "type"].iter().map(|v|*v)); @@ -166,7 +166,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -189,10 +189,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _assets_parents_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _assets_parents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.assets().parents_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -211,7 +211,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -225,7 +225,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -248,10 +248,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _assets_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _assets_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.assets().permissions_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -264,7 +264,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -277,7 +277,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -300,10 +300,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_cancel_processing(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_cancel_processing(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().cancel_processing(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -316,7 +316,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -329,7 +329,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -352,13 +352,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -372,8 +372,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "style.feature-info.content" => Some(("style.featureInfo.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "style.type" => Some(("style.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -406,7 +406,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Layer = json::value::from_value(object).unwrap(); let mut call = self.hub.layers().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "process" => { @@ -422,7 +422,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["process"].iter().map(|v|*v)); @@ -436,7 +436,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -459,10 +459,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -475,7 +475,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -488,7 +488,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -503,10 +503,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "version" => { @@ -522,7 +522,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["version"].iter().map(|v|*v)); @@ -536,7 +536,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -559,10 +559,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_get_published(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_get_published(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().get_published(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -575,7 +575,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -588,7 +588,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -611,10 +611,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tags" => { @@ -666,7 +666,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["modified-after", "search", "processing-status", "project-id", "tags", "created-after", "max-results", "page-token", "created-before", "role", "bbox", "modified-before", "creator-email"].iter().map(|v|*v)); @@ -680,7 +680,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -703,10 +703,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_list_published(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_list_published(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().list_published(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "project-id" => { @@ -728,7 +728,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["project-id", "max-results", "page-token"].iter().map(|v|*v)); @@ -742,7 +742,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -765,10 +765,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_parents_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_parents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().parents_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -787,7 +787,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -801,7 +801,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -824,13 +824,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -844,8 +844,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "style.feature-info.content" => Some(("style.featureInfo.content", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "style.type" => Some(("style.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -878,7 +878,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Layer = json::value::from_value(object).unwrap(); let mut call = self.hub.layers().patch(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -891,7 +891,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -904,7 +904,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -919,13 +919,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_permissions_batch_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_permissions_batch_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -939,8 +939,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ids" => Some(("ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -955,7 +955,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PermissionsBatchDeleteRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.layers().permissions_batch_delete(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -968,7 +968,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -981,7 +981,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1004,13 +1004,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_permissions_batch_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_permissions_batch_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1024,8 +1024,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -1039,7 +1039,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PermissionsBatchUpdateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.layers().permissions_batch_update(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1052,7 +1052,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1065,7 +1065,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1088,10 +1088,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().permissions_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1104,7 +1104,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1117,7 +1117,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1140,10 +1140,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_process(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_process(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().process(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1156,7 +1156,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1169,7 +1169,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1192,10 +1192,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_publish(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_publish(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().publish(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "force" => { @@ -1211,7 +1211,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["force"].iter().map(|v|*v)); @@ -1225,7 +1225,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1248,10 +1248,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _layers_unpublish(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _layers_unpublish(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.layers().unpublish(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1264,7 +1264,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1277,7 +1277,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1300,13 +1300,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1320,8 +1320,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "processing-status" => Some(("processingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1351,7 +1351,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Map = json::value::from_value(object).unwrap(); let mut call = self.hub.maps().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1364,7 +1364,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1377,7 +1377,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1400,10 +1400,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.maps().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1416,7 +1416,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1429,7 +1429,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1444,10 +1444,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.maps().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "version" => { @@ -1463,7 +1463,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["version"].iter().map(|v|*v)); @@ -1477,7 +1477,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1500,10 +1500,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_get_published(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_get_published(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.maps().get_published(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1516,7 +1516,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1529,7 +1529,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1552,10 +1552,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.maps().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tags" => { @@ -1607,7 +1607,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["modified-after", "search", "processing-status", "project-id", "tags", "created-after", "max-results", "page-token", "created-before", "role", "bbox", "modified-before", "creator-email"].iter().map(|v|*v)); @@ -1621,7 +1621,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1644,10 +1644,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_list_published(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_list_published(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.maps().list_published(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "project-id" => { @@ -1669,7 +1669,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["project-id", "max-results", "page-token"].iter().map(|v|*v)); @@ -1683,7 +1683,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1706,13 +1706,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1726,8 +1726,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "processing-status" => Some(("processingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1757,7 +1757,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Map = json::value::from_value(object).unwrap(); let mut call = self.hub.maps().patch(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1770,7 +1770,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1783,7 +1783,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1798,13 +1798,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_permissions_batch_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_permissions_batch_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1818,8 +1818,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ids" => Some(("ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -1834,7 +1834,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PermissionsBatchDeleteRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.maps().permissions_batch_delete(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1847,7 +1847,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1860,7 +1860,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1883,13 +1883,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_permissions_batch_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_permissions_batch_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1903,8 +1903,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -1918,7 +1918,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PermissionsBatchUpdateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.maps().permissions_batch_update(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1931,7 +1931,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1944,7 +1944,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1967,10 +1967,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.maps().permissions_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1983,7 +1983,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1996,7 +1996,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2019,10 +2019,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_publish(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_publish(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.maps().publish(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "force" => { @@ -2038,7 +2038,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["force"].iter().map(|v|*v)); @@ -2052,7 +2052,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2075,10 +2075,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _maps_unpublish(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _maps_unpublish(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.maps().unpublish(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2091,7 +2091,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2104,7 +2104,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2127,13 +2127,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_icons_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_icons_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2147,8 +2147,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2165,7 +2165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Icon = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().icons_create(request, opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2178,7 +2178,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2186,7 +2186,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -2194,7 +2194,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2218,11 +2218,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_icons_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_icons_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.projects().icons_get(opt.value_of("project-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2238,7 +2238,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2251,7 +2251,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2279,10 +2279,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_icons_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_icons_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().icons_list(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2301,7 +2301,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -2315,7 +2315,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2338,10 +2338,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2354,7 +2354,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2367,7 +2367,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2390,10 +2390,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_cancel_processing(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_cancel_processing(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.raster_collections().cancel_processing(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2406,7 +2406,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2419,7 +2419,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2442,13 +2442,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2462,8 +2462,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "attribution" => Some(("attribution", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2493,7 +2493,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RasterCollection = json::value::from_value(object).unwrap(); let mut call = self.hub.raster_collections().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2506,7 +2506,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2519,7 +2519,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2542,10 +2542,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.raster_collections().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2558,7 +2558,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2571,7 +2571,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2586,10 +2586,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.raster_collections().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2602,7 +2602,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2615,7 +2615,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2638,10 +2638,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.raster_collections().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tags" => { @@ -2693,7 +2693,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["modified-after", "search", "processing-status", "project-id", "tags", "created-after", "max-results", "page-token", "created-before", "role", "bbox", "modified-before", "creator-email"].iter().map(|v|*v)); @@ -2707,7 +2707,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2730,10 +2730,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_parents_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_parents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.raster_collections().parents_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2752,7 +2752,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -2766,7 +2766,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2789,13 +2789,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2809,8 +2809,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "attribution" => Some(("attribution", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2840,7 +2840,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RasterCollection = json::value::from_value(object).unwrap(); let mut call = self.hub.raster_collections().patch(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2853,7 +2853,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2866,7 +2866,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2881,13 +2881,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_permissions_batch_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_permissions_batch_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2901,8 +2901,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ids" => Some(("ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -2917,7 +2917,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PermissionsBatchDeleteRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.raster_collections().permissions_batch_delete(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2930,7 +2930,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2943,7 +2943,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2966,13 +2966,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_permissions_batch_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_permissions_batch_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2986,8 +2986,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -3001,7 +3001,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PermissionsBatchUpdateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.raster_collections().permissions_batch_update(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3014,7 +3014,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3027,7 +3027,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3050,10 +3050,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.raster_collections().permissions_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3066,7 +3066,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3079,7 +3079,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3102,10 +3102,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_process(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_process(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.raster_collections().process(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3118,7 +3118,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3131,7 +3131,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3154,13 +3154,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_rasters_batch_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_rasters_batch_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3174,8 +3174,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ids" => Some(("ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -3190,7 +3190,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RasterCollectionsRasterBatchDeleteRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.raster_collections().rasters_batch_delete(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3203,7 +3203,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3216,7 +3216,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3239,13 +3239,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_rasters_batch_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_rasters_batch_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3259,8 +3259,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ids" => Some(("ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -3275,7 +3275,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RasterCollectionsRastersBatchInsertRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.raster_collections().rasters_batch_insert(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3288,7 +3288,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3301,7 +3301,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3324,10 +3324,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _raster_collections_rasters_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _raster_collections_rasters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.raster_collections().rasters_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tags" => { @@ -3373,7 +3373,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["modified-after", "search", "tags", "created-after", "max-results", "page-token", "created-before", "role", "bbox", "modified-before", "creator-email"].iter().map(|v|*v)); @@ -3387,7 +3387,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3410,10 +3410,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rasters().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3426,7 +3426,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3439,7 +3439,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3454,10 +3454,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_files_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_files_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rasters().files_insert(opt.value_of("id").unwrap_or(""), opt.value_of("filename").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3470,7 +3470,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3478,7 +3478,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -3486,7 +3486,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3502,10 +3502,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rasters().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3518,7 +3518,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3531,7 +3531,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3554,10 +3554,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rasters().list(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tags" => { @@ -3606,7 +3606,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["modified-after", "search", "processing-status", "tags", "created-after", "max-results", "page-token", "created-before", "role", "bbox", "modified-before", "creator-email"].iter().map(|v|*v)); @@ -3620,7 +3620,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3643,10 +3643,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_parents_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_parents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rasters().parents_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3665,7 +3665,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -3679,7 +3679,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3702,13 +3702,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3722,8 +3722,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "acquisition-time.start" => Some(("acquisitionTime.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "acquisition-time.end" => Some(("acquisitionTime.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3756,7 +3756,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Raster = json::value::from_value(object).unwrap(); let mut call = self.hub.rasters().patch(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3769,7 +3769,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3782,7 +3782,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3797,13 +3797,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_permissions_batch_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_permissions_batch_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3817,8 +3817,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ids" => Some(("ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -3833,7 +3833,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PermissionsBatchDeleteRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.rasters().permissions_batch_delete(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3846,7 +3846,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3859,7 +3859,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3882,13 +3882,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_permissions_batch_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_permissions_batch_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3902,8 +3902,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -3917,7 +3917,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PermissionsBatchUpdateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.rasters().permissions_batch_update(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3930,7 +3930,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3943,7 +3943,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3966,10 +3966,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rasters().permissions_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3982,7 +3982,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3995,7 +3995,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4018,10 +4018,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_process(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_process(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rasters().process(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4034,7 +4034,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4047,7 +4047,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4070,13 +4070,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rasters_upload(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rasters_upload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4090,8 +4090,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "acquisition-time.start" => Some(("acquisitionTime.start", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "acquisition-time.end" => Some(("acquisitionTime.end", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4124,7 +4124,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Raster = json::value::from_value(object).unwrap(); let mut call = self.hub.rasters().upload(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4137,7 +4137,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4150,7 +4150,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4173,13 +4173,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4193,8 +4193,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "schema.primary-geometry" => Some(("schema.primaryGeometry", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "schema.primary-key" => Some(("schema.primaryKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4225,7 +4225,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Table = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4238,7 +4238,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4251,7 +4251,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4274,10 +4274,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4290,7 +4290,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4303,7 +4303,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4318,13 +4318,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_features_batch_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_features_batch_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4338,8 +4338,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "gx-ids" => Some(("gx_ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "primary-keys" => Some(("primaryKeys", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -4355,7 +4355,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FeaturesBatchDeleteRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().features_batch_delete(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4368,7 +4368,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4381,7 +4381,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4396,13 +4396,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_features_batch_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_features_batch_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4416,8 +4416,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "normalize-geometries" => Some(("normalizeGeometries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { @@ -4432,7 +4432,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FeaturesBatchInsertRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().features_batch_insert(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4445,7 +4445,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4458,7 +4458,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4473,13 +4473,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_features_batch_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_features_batch_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4493,8 +4493,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "normalize-geometries" => Some(("normalizeGeometries", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), _ => { @@ -4509,7 +4509,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::FeaturesBatchPatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().features_batch_patch(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4522,7 +4522,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4535,7 +4535,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4550,10 +4550,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_features_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_features_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().features_get(opt.value_of("table-id").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "version" => { @@ -4572,7 +4572,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["version", "select"].iter().map(|v|*v)); @@ -4586,7 +4586,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4609,10 +4609,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_features_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_features_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().features_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "where" => { @@ -4652,7 +4652,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "intersects", "max-results", "page-token", "version", "limit", "include", "where", "select"].iter().map(|v|*v)); @@ -4666,7 +4666,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4689,10 +4689,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_files_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_files_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().files_insert(opt.value_of("id").unwrap_or(""), opt.value_of("filename").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4705,7 +4705,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4713,7 +4713,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -4721,7 +4721,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4737,10 +4737,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "version" => { @@ -4756,7 +4756,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["version"].iter().map(|v|*v)); @@ -4770,7 +4770,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4793,10 +4793,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tags" => { @@ -4848,7 +4848,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["modified-after", "search", "processing-status", "project-id", "tags", "created-after", "max-results", "page-token", "created-before", "role", "bbox", "modified-before", "creator-email"].iter().map(|v|*v)); @@ -4862,7 +4862,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4885,10 +4885,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_parents_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_parents_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().parents_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -4907,7 +4907,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -4921,7 +4921,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4944,13 +4944,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4964,8 +4964,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "schema.primary-geometry" => Some(("schema.primaryGeometry", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "schema.primary-key" => Some(("schema.primaryKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4996,7 +4996,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Table = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().patch(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5009,7 +5009,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5022,7 +5022,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -5037,13 +5037,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_permissions_batch_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_permissions_batch_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5057,8 +5057,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ids" => Some(("ids", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -5073,7 +5073,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PermissionsBatchDeleteRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().permissions_batch_delete(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5086,7 +5086,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5099,7 +5099,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5122,13 +5122,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_permissions_batch_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_permissions_batch_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5142,8 +5142,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -5157,7 +5157,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PermissionsBatchUpdateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().permissions_batch_update(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5170,7 +5170,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5183,7 +5183,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5206,10 +5206,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().permissions_list(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5222,7 +5222,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5235,7 +5235,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5258,10 +5258,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_process(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_process(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tables().process(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5274,7 +5274,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5287,7 +5287,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5310,13 +5310,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tables_upload(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tables_upload(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5330,8 +5330,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "schema.primary-geometry" => Some(("schema.primaryGeometry", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "schema.primary-key" => Some(("schema.primaryKey", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5362,7 +5362,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Table = json::value::from_value(object).unwrap(); let mut call = self.hub.tables().upload(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5375,7 +5375,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5388,7 +5388,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5720,14 +5720,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "mapsengine1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "mapsengine1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -5747,7 +5747,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -5787,7 +5787,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("assets", "methods: 'get', 'list', 'parents-list' and 'permissions-list'", vec![ - ("get", + ("get", Some(r##"Return metadata for a particular asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/assets_get", vec![ @@ -5809,7 +5809,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Return all assets readable by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/assets_list", vec![ @@ -5825,7 +5825,7 @@ fn main() { Some(false), Some(false)), ]), - ("parents-list", + ("parents-list", Some(r##"Return all parent ids of the specified asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/assets_parents-list", vec![ @@ -5847,7 +5847,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-list", + ("permissions-list", Some(r##"Return all of the permissions for the specified asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/assets_permissions-list", vec![ @@ -5872,7 +5872,7 @@ fn main() { ]), ("layers", "methods: 'cancel-processing', 'create', 'delete', 'get', 'get-published', 'list', 'list-published', 'parents-list', 'patch', 'permissions-batch-delete', 'permissions-batch-update', 'permissions-list', 'process', 'publish' and 'unpublish'", vec![ - ("cancel-processing", + ("cancel-processing", Some(r##"Cancel processing on a layer asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_cancel-processing", vec![ @@ -5894,7 +5894,7 @@ fn main() { Some(false), Some(false)), ]), - ("create", + ("create", Some(r##"Create a layer asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_create", vec![ @@ -5916,7 +5916,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete a layer."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_delete", vec![ @@ -5932,7 +5932,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Return metadata for a particular layer."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_get", vec![ @@ -5954,7 +5954,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-published", + ("get-published", Some(r##"Return the published metadata for a particular layer."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_get-published", vec![ @@ -5976,7 +5976,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Return all layers readable by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_list", vec![ @@ -5992,7 +5992,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-published", + ("list-published", Some(r##"Return all published layers readable by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_list-published", vec![ @@ -6008,7 +6008,7 @@ fn main() { Some(false), Some(false)), ]), - ("parents-list", + ("parents-list", Some(r##"Return all parent ids of the specified layer."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_parents-list", vec![ @@ -6030,7 +6030,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Mutate a layer asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_patch", vec![ @@ -6052,7 +6052,7 @@ fn main() { Some(false), Some(true)), ]), - ("permissions-batch-delete", + ("permissions-batch-delete", Some(r##"Remove permission entries from an already existing asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_permissions-batch-delete", vec![ @@ -6080,7 +6080,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-batch-update", + ("permissions-batch-update", Some(r##"Add or update permission entries to an already existing asset. An asset can hold up to 20 different permission entries. Each batchInsert request is atomic."##), @@ -6110,7 +6110,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-list", + ("permissions-list", Some(r##"Return all of the permissions for the specified asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_permissions-list", vec![ @@ -6132,7 +6132,7 @@ fn main() { Some(false), Some(false)), ]), - ("process", + ("process", Some(r##"Process a layer asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_process", vec![ @@ -6154,7 +6154,7 @@ fn main() { Some(false), Some(false)), ]), - ("publish", + ("publish", Some(r##"Publish a layer asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_publish", vec![ @@ -6176,7 +6176,7 @@ fn main() { Some(false), Some(false)), ]), - ("unpublish", + ("unpublish", Some(r##"Unpublish a layer asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/layers_unpublish", vec![ @@ -6201,7 +6201,7 @@ fn main() { ]), ("maps", "methods: 'create', 'delete', 'get', 'get-published', 'list', 'list-published', 'patch', 'permissions-batch-delete', 'permissions-batch-update', 'permissions-list', 'publish' and 'unpublish'", vec![ - ("create", + ("create", Some(r##"Create a map asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_create", vec![ @@ -6223,7 +6223,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete a map."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_delete", vec![ @@ -6239,7 +6239,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Return metadata for a particular map."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_get", vec![ @@ -6261,7 +6261,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-published", + ("get-published", Some(r##"Return the published metadata for a particular map."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_get-published", vec![ @@ -6283,7 +6283,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Return all maps readable by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_list", vec![ @@ -6299,7 +6299,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-published", + ("list-published", Some(r##"Return all published maps readable by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_list-published", vec![ @@ -6315,7 +6315,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Mutate a map asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_patch", vec![ @@ -6337,7 +6337,7 @@ fn main() { Some(false), Some(true)), ]), - ("permissions-batch-delete", + ("permissions-batch-delete", Some(r##"Remove permission entries from an already existing asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_permissions-batch-delete", vec![ @@ -6365,7 +6365,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-batch-update", + ("permissions-batch-update", Some(r##"Add or update permission entries to an already existing asset. An asset can hold up to 20 different permission entries. Each batchInsert request is atomic."##), @@ -6395,7 +6395,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-list", + ("permissions-list", Some(r##"Return all of the permissions for the specified asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_permissions-list", vec![ @@ -6417,7 +6417,7 @@ fn main() { Some(false), Some(false)), ]), - ("publish", + ("publish", Some(r##"Publish a map asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_publish", vec![ @@ -6439,7 +6439,7 @@ fn main() { Some(false), Some(false)), ]), - ("unpublish", + ("unpublish", Some(r##"Unpublish a map asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/maps_unpublish", vec![ @@ -6464,7 +6464,7 @@ fn main() { ]), ("projects", "methods: 'icons-create', 'icons-get', 'icons-list' and 'list'", vec![ - ("icons-create", + ("icons-create", Some(r##"Create an icon."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/projects_icons-create", vec![ @@ -6498,7 +6498,7 @@ fn main() { Some(false), Some(false)), ]), - ("icons-get", + ("icons-get", Some(r##"Return an icon or its associated metadata"##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/projects_icons-get", vec![ @@ -6526,7 +6526,7 @@ fn main() { Some(false), Some(false)), ]), - ("icons-list", + ("icons-list", Some(r##"Return all icons in the current project"##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/projects_icons-list", vec![ @@ -6548,7 +6548,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Return all projects readable by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/projects_list", vec![ @@ -6567,7 +6567,7 @@ fn main() { ]), ("raster-collections", "methods: 'cancel-processing', 'create', 'delete', 'get', 'list', 'parents-list', 'patch', 'permissions-batch-delete', 'permissions-batch-update', 'permissions-list', 'process', 'rasters-batch-delete', 'rasters-batch-insert' and 'rasters-list'", vec![ - ("cancel-processing", + ("cancel-processing", Some(r##"Cancel processing on a raster collection asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_cancel-processing", vec![ @@ -6589,7 +6589,7 @@ fn main() { Some(false), Some(false)), ]), - ("create", + ("create", Some(r##"Create a raster collection asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_create", vec![ @@ -6611,7 +6611,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete a raster collection."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_delete", vec![ @@ -6627,7 +6627,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Return metadata for a particular raster collection."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_get", vec![ @@ -6649,7 +6649,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Return all raster collections readable by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_list", vec![ @@ -6665,7 +6665,7 @@ fn main() { Some(false), Some(false)), ]), - ("parents-list", + ("parents-list", Some(r##"Return all parent ids of the specified raster collection."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_parents-list", vec![ @@ -6687,7 +6687,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Mutate a raster collection asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_patch", vec![ @@ -6709,7 +6709,7 @@ fn main() { Some(false), Some(true)), ]), - ("permissions-batch-delete", + ("permissions-batch-delete", Some(r##"Remove permission entries from an already existing asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_permissions-batch-delete", vec![ @@ -6737,7 +6737,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-batch-update", + ("permissions-batch-update", Some(r##"Add or update permission entries to an already existing asset. An asset can hold up to 20 different permission entries. Each batchInsert request is atomic."##), @@ -6767,7 +6767,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-list", + ("permissions-list", Some(r##"Return all of the permissions for the specified asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_permissions-list", vec![ @@ -6789,7 +6789,7 @@ fn main() { Some(false), Some(false)), ]), - ("process", + ("process", Some(r##"Process a raster collection asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_process", vec![ @@ -6811,7 +6811,7 @@ fn main() { Some(false), Some(false)), ]), - ("rasters-batch-delete", + ("rasters-batch-delete", Some(r##"Remove rasters from an existing raster collection. Up to 50 rasters can be included in a single batchDelete request. Each batchDelete request is atomic."##), @@ -6841,7 +6841,7 @@ fn main() { Some(false), Some(false)), ]), - ("rasters-batch-insert", + ("rasters-batch-insert", Some(r##"Add rasters to an existing raster collection. Rasters must be successfully processed in order to be added to a raster collection. Up to 50 rasters can be included in a single batchInsert request. Each batchInsert request is atomic."##), @@ -6871,7 +6871,7 @@ fn main() { Some(false), Some(false)), ]), - ("rasters-list", + ("rasters-list", Some(r##"Return all rasters within a raster collection."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/raster-collections_rasters-list", vec![ @@ -6896,7 +6896,7 @@ fn main() { ]), ("rasters", "methods: 'delete', 'files-insert', 'get', 'list', 'parents-list', 'patch', 'permissions-batch-delete', 'permissions-batch-update', 'permissions-list', 'process' and 'upload'", vec![ - ("delete", + ("delete", Some(r##"Delete a raster."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/rasters_delete", vec![ @@ -6912,7 +6912,7 @@ fn main() { Some(false), Some(true)), ]), - ("files-insert", + ("files-insert", Some(r##"Upload a file to a raster asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/rasters_files-insert", vec![ @@ -6940,7 +6940,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Return metadata for a single raster."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/rasters_get", vec![ @@ -6962,7 +6962,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Return all rasters readable by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/rasters_list", vec![ @@ -6984,7 +6984,7 @@ fn main() { Some(false), Some(false)), ]), - ("parents-list", + ("parents-list", Some(r##"Return all parent ids of the specified rasters."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/rasters_parents-list", vec![ @@ -7006,7 +7006,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Mutate a raster asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/rasters_patch", vec![ @@ -7028,7 +7028,7 @@ fn main() { Some(false), Some(true)), ]), - ("permissions-batch-delete", + ("permissions-batch-delete", Some(r##"Remove permission entries from an already existing asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/rasters_permissions-batch-delete", vec![ @@ -7056,7 +7056,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-batch-update", + ("permissions-batch-update", Some(r##"Add or update permission entries to an already existing asset. An asset can hold up to 20 different permission entries. Each batchInsert request is atomic."##), @@ -7086,7 +7086,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-list", + ("permissions-list", Some(r##"Return all of the permissions for the specified asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/rasters_permissions-list", vec![ @@ -7108,7 +7108,7 @@ fn main() { Some(false), Some(false)), ]), - ("process", + ("process", Some(r##"Process a raster asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/rasters_process", vec![ @@ -7130,7 +7130,7 @@ fn main() { Some(false), Some(false)), ]), - ("upload", + ("upload", Some(r##"Create a skeleton raster asset for upload."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/rasters_upload", vec![ @@ -7155,7 +7155,7 @@ fn main() { ]), ("tables", "methods: 'create', 'delete', 'features-batch-delete', 'features-batch-insert', 'features-batch-patch', 'features-get', 'features-list', 'files-insert', 'get', 'list', 'parents-list', 'patch', 'permissions-batch-delete', 'permissions-batch-update', 'permissions-list', 'process' and 'upload'", vec![ - ("create", + ("create", Some(r##"Create a table asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_create", vec![ @@ -7177,7 +7177,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete a table."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_delete", vec![ @@ -7193,7 +7193,7 @@ fn main() { Some(false), Some(true)), ]), - ("features-batch-delete", + ("features-batch-delete", Some(r##"Delete all features matching the given IDs."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_features-batch-delete", vec![ @@ -7215,7 +7215,7 @@ fn main() { Some(false), Some(true)), ]), - ("features-batch-insert", + ("features-batch-insert", Some(r##"Append features to an existing table. A single batchInsert request can create: @@ -7245,7 +7245,7 @@ fn main() { Some(false), Some(true)), ]), - ("features-batch-patch", + ("features-batch-patch", Some(r##"Update the supplied features. A single batchPatch request can update: @@ -7281,7 +7281,7 @@ fn main() { Some(false), Some(true)), ]), - ("features-get", + ("features-get", Some(r##"Return a single feature, given its ID."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_features-get", vec![ @@ -7309,7 +7309,7 @@ fn main() { Some(false), Some(false)), ]), - ("features-list", + ("features-list", Some(r##"Return all features readable by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_features-list", vec![ @@ -7331,7 +7331,7 @@ fn main() { Some(false), Some(false)), ]), - ("files-insert", + ("files-insert", Some(r##"Upload a file to a placeholder table asset. See Table Upload in the Developer's Guide for more information. Supported file types are listed in the Supported data formats and limits article of the Google Maps Engine help center."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_files-insert", @@ -7360,7 +7360,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Return metadata for a particular table, including the schema."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_get", vec![ @@ -7382,7 +7382,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Return all tables readable by the current user."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_list", vec![ @@ -7398,7 +7398,7 @@ fn main() { Some(false), Some(false)), ]), - ("parents-list", + ("parents-list", Some(r##"Return all parent ids of the specified table."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_parents-list", vec![ @@ -7420,7 +7420,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Mutate a table asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_patch", vec![ @@ -7442,7 +7442,7 @@ fn main() { Some(false), Some(true)), ]), - ("permissions-batch-delete", + ("permissions-batch-delete", Some(r##"Remove permission entries from an already existing asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_permissions-batch-delete", vec![ @@ -7470,7 +7470,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-batch-update", + ("permissions-batch-update", Some(r##"Add or update permission entries to an already existing asset. An asset can hold up to 20 different permission entries. Each batchInsert request is atomic."##), @@ -7500,7 +7500,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-list", + ("permissions-list", Some(r##"Return all of the permissions for the specified asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_permissions-list", vec![ @@ -7522,7 +7522,7 @@ fn main() { Some(false), Some(false)), ]), - ("process", + ("process", Some(r##"Process a table asset."##), "Details at http://byron.github.io/google-apis-rs/google_mapsengine1_cli/tables_process", vec![ @@ -7544,7 +7544,7 @@ fn main() { Some(false), Some(false)), ]), - ("upload", + ("upload", Some(r##"Create a placeholder table asset to which table files can be uploaded. Once the placeholder has been created, files are uploaded to the https://www.googleapis.com/upload/mapsengine/v1/tables/table_id/files endpoint. See Table Upload in the Developer's Guide or Table.files: insert in the reference documentation for more information."##), @@ -7574,7 +7574,7 @@ fn main() { let mut app = App::new("mapsengine1") .author("Sebastian Thiel ") - .version("0.3.2+20150629") + .version("0.3.3+20151202") .about("The Google Maps Engine API allows developers to store and query geospatial vector and raster data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_mapsengine1_cli") .arg(Arg::with_name("url") @@ -7598,7 +7598,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -7609,7 +7609,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/mapsengine1/Cargo.toml b/gen/mapsengine1/Cargo.toml index f394b77e40..ff605c0280 100644 --- a/gen/mapsengine1/Cargo.toml +++ b/gen/mapsengine1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-mapsengine1" -version = "0.1.10+20150629" +version = "0.1.11+20151202" authors = ["Sebastian Thiel "] description = "A complete library to interact with Maps Engine (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/mapsengine1" diff --git a/gen/mapsengine1/LICENSE.md b/gen/mapsengine1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/mapsengine1/LICENSE.md +++ b/gen/mapsengine1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/mapsengine1/README.md b/gen/mapsengine1/README.md index 4f97dc871c..72cac47911 100644 --- a/gen/mapsengine1/README.md +++ b/gen/mapsengine1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-mapsengine1` library allows access to all features of the *Google Maps Engine* service. -This documentation was generated from *Maps Engine* crate version *0.1.10+20150629*, where *20150629* is the exact revision of the *mapsengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Maps Engine* crate version *0.1.11+20151202*, where *20151202* is the exact revision of the *mapsengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Maps Engine* *v1* API can be found at the [official documentation site](https://developers.google.com/maps-engine/). diff --git a/gen/mapsengine1/src/cmn.rs b/gen/mapsengine1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/mapsengine1/src/cmn.rs +++ b/gen/mapsengine1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/mapsengine1/src/lib.rs b/gen/mapsengine1/src/lib.rs index 3d70791de3..1311d8b83e 100644 --- a/gen/mapsengine1/src/lib.rs +++ b/gen/mapsengine1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Maps Engine* crate version *0.1.10+20150629*, where *20150629* is the exact revision of the *mapsengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Maps Engine* crate version *0.1.11+20151202*, where *20151202* is the exact revision of the *mapsengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Maps Engine* *v1* API can be found at the //! [official documentation site](https://developers.google.com/maps-engine/). diff --git a/gen/mapsengine1/src/lib.rs.in b/gen/mapsengine1/src/lib.rs.in index fc625536d5..fc2a0059bd 100644 --- a/gen/mapsengine1/src/lib.rs.in +++ b/gen/mapsengine1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -143,7 +144,7 @@ impl<'a, C, A> MapsEngine MapsEngine { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -170,7 +171,7 @@ impl<'a, C, A> MapsEngine } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -3924,7 +3925,7 @@ impl<'a, C, A> LayerUnpublishCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.unpublish", + dlg.begin(MethodInfo { id: "mapsengine.layers.unpublish", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -3966,7 +3967,7 @@ impl<'a, C, A> LayerUnpublishCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4002,7 +4003,7 @@ impl<'a, C, A> LayerUnpublishCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4012,10 +4013,10 @@ impl<'a, C, A> LayerUnpublishCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4048,7 +4049,7 @@ impl<'a, C, A> LayerUnpublishCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LayerUnpublishCall<'a, C, A> { self._id = new_value.to_string(); @@ -4066,12 +4067,12 @@ impl<'a, C, A> LayerUnpublishCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4088,17 +4089,17 @@ impl<'a, C, A> LayerUnpublishCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerUnpublishCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerUnpublishCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4162,7 +4163,7 @@ impl<'a, C, A> LayerPublishCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.publish", + dlg.begin(MethodInfo { id: "mapsengine.layers.publish", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -4207,7 +4208,7 @@ impl<'a, C, A> LayerPublishCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4243,7 +4244,7 @@ impl<'a, C, A> LayerPublishCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4253,10 +4254,10 @@ impl<'a, C, A> LayerPublishCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4289,7 +4290,7 @@ impl<'a, C, A> LayerPublishCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LayerPublishCall<'a, C, A> { self._id = new_value.to_string(); @@ -4314,12 +4315,12 @@ impl<'a, C, A> LayerPublishCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4336,17 +4337,17 @@ impl<'a, C, A> LayerPublishCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerPublishCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerPublishCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4413,7 +4414,7 @@ impl<'a, C, A> LayerListPublishedCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.listPublished", + dlg.begin(MethodInfo { id: "mapsengine.layers.listPublished", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._project_id { @@ -4442,7 +4443,7 @@ impl<'a, C, A> LayerListPublishedCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4478,7 +4479,7 @@ impl<'a, C, A> LayerListPublishedCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4488,10 +4489,10 @@ impl<'a, C, A> LayerListPublishedCall<'a, C, A> where C: BorrowMut LayerListPublishedCall<'a, C, A> where C: BorrowMut LayerListPublishedCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LayerListPublishedCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerListPublishedCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4655,7 +4656,7 @@ impl<'a, C, A> LayerCreateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.create", + dlg.begin(MethodInfo { id: "mapsengine.layers.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._process { @@ -4678,14 +4679,14 @@ impl<'a, C, A> LayerCreateCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4729,7 +4730,7 @@ impl<'a, C, A> LayerCreateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4739,10 +4740,10 @@ impl<'a, C, A> LayerCreateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4774,7 +4775,7 @@ impl<'a, C, A> LayerCreateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Layer) -> LayerCreateCall<'a, C, A> { self._request = new_value; @@ -4799,12 +4800,12 @@ impl<'a, C, A> LayerCreateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4821,17 +4822,17 @@ impl<'a, C, A> LayerCreateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4893,7 +4894,7 @@ impl<'a, C, A> LayerGetPublishedCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.getPublished", + dlg.begin(MethodInfo { id: "mapsengine.layers.getPublished", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -4935,7 +4936,7 @@ impl<'a, C, A> LayerGetPublishedCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4971,7 +4972,7 @@ impl<'a, C, A> LayerGetPublishedCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4981,10 +4982,10 @@ impl<'a, C, A> LayerGetPublishedCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5017,7 +5018,7 @@ impl<'a, C, A> LayerGetPublishedCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LayerGetPublishedCall<'a, C, A> { self._id = new_value.to_string(); @@ -5035,12 +5036,12 @@ impl<'a, C, A> LayerGetPublishedCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5057,17 +5058,17 @@ impl<'a, C, A> LayerGetPublishedCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerGetPublishedCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerGetPublishedCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5129,7 +5130,7 @@ impl<'a, C, A> LayerDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.delete", + dlg.begin(MethodInfo { id: "mapsengine.layers.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -5170,7 +5171,7 @@ impl<'a, C, A> LayerDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5206,7 +5207,7 @@ impl<'a, C, A> LayerDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5216,10 +5217,10 @@ impl<'a, C, A> LayerDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5242,7 +5243,7 @@ impl<'a, C, A> LayerDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LayerDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -5260,12 +5261,12 @@ impl<'a, C, A> LayerDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5282,17 +5283,17 @@ impl<'a, C, A> LayerDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5356,7 +5357,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.get", + dlg.begin(MethodInfo { id: "mapsengine.layers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -5401,7 +5402,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5437,7 +5438,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5447,10 +5448,10 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5483,7 +5484,7 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LayerGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -5508,12 +5509,12 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5530,17 +5531,17 @@ impl<'a, C, A> LayerGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5609,7 +5610,7 @@ impl<'a, C, A> LayerPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.permissions.batchDelete", + dlg.begin(MethodInfo { id: "mapsengine.layers.permissions.batchDelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -5651,14 +5652,14 @@ impl<'a, C, A> LayerPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5702,7 +5703,7 @@ impl<'a, C, A> LayerPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5712,10 +5713,10 @@ impl<'a, C, A> LayerPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut LayerPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut LayerPermissionBatchDeleteCall<'a, C, A> { self._request = new_value; @@ -5757,7 +5758,7 @@ impl<'a, C, A> LayerPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut LayerPermissionBatchDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -5775,12 +5776,12 @@ impl<'a, C, A> LayerPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut LayerPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LayerPermissionBatchDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerPermissionBatchDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5878,7 +5879,7 @@ impl<'a, C, A> LayerPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.permissions.batchUpdate", + dlg.begin(MethodInfo { id: "mapsengine.layers.permissions.batchUpdate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -5920,14 +5921,14 @@ impl<'a, C, A> LayerPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5971,7 +5972,7 @@ impl<'a, C, A> LayerPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5981,10 +5982,10 @@ impl<'a, C, A> LayerPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut LayerPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut LayerPermissionBatchUpdateCall<'a, C, A> { self._request = new_value; @@ -6026,7 +6027,7 @@ impl<'a, C, A> LayerPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut LayerPermissionBatchUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -6044,12 +6045,12 @@ impl<'a, C, A> LayerPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut LayerPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LayerPermissionBatchUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerPermissionBatchUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6163,7 +6164,7 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.list", + dlg.begin(MethodInfo { id: "mapsengine.layers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); if let Some(value) = self._tags { @@ -6222,7 +6223,7 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6258,7 +6259,7 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6268,10 +6269,10 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6402,12 +6403,12 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6424,17 +6425,17 @@ impl<'a, C, A> LayerListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6500,7 +6501,7 @@ impl<'a, C, A> LayerParentListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.parents.list", + dlg.begin(MethodInfo { id: "mapsengine.layers.parents.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -6548,7 +6549,7 @@ impl<'a, C, A> LayerParentListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6584,7 +6585,7 @@ impl<'a, C, A> LayerParentListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6594,10 +6595,10 @@ impl<'a, C, A> LayerParentListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6630,7 +6631,7 @@ impl<'a, C, A> LayerParentListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LayerParentListCall<'a, C, A> { self._id = new_value.to_string(); @@ -6662,12 +6663,12 @@ impl<'a, C, A> LayerParentListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6684,17 +6685,17 @@ impl<'a, C, A> LayerParentListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerParentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerParentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6756,7 +6757,7 @@ impl<'a, C, A> LayerCancelProcessingCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.cancelProcessing", + dlg.begin(MethodInfo { id: "mapsengine.layers.cancelProcessing", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -6798,7 +6799,7 @@ impl<'a, C, A> LayerCancelProcessingCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6834,7 +6835,7 @@ impl<'a, C, A> LayerCancelProcessingCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6844,10 +6845,10 @@ impl<'a, C, A> LayerCancelProcessingCall<'a, C, A> where C: BorrowMut LayerCancelProcessingCall<'a, C, A> where C: BorrowMut LayerCancelProcessingCall<'a, C, A> { self._id = new_value.to_string(); @@ -6898,12 +6899,12 @@ impl<'a, C, A> LayerCancelProcessingCall<'a, C, A> where C: BorrowMut LayerCancelProcessingCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LayerCancelProcessingCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerCancelProcessingCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6999,7 +7000,7 @@ impl<'a, C, A> LayerPatchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.patch", + dlg.begin(MethodInfo { id: "mapsengine.layers.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -7040,14 +7041,14 @@ impl<'a, C, A> LayerPatchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7091,7 +7092,7 @@ impl<'a, C, A> LayerPatchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7101,10 +7102,10 @@ impl<'a, C, A> LayerPatchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7126,7 +7127,7 @@ impl<'a, C, A> LayerPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Layer) -> LayerPatchCall<'a, C, A> { self._request = new_value; @@ -7136,7 +7137,7 @@ impl<'a, C, A> LayerPatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LayerPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -7154,12 +7155,12 @@ impl<'a, C, A> LayerPatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7176,17 +7177,17 @@ impl<'a, C, A> LayerPatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7248,7 +7249,7 @@ impl<'a, C, A> LayerPermissionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.permissions.list", + dlg.begin(MethodInfo { id: "mapsengine.layers.permissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -7290,7 +7291,7 @@ impl<'a, C, A> LayerPermissionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7326,7 +7327,7 @@ impl<'a, C, A> LayerPermissionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7336,10 +7337,10 @@ impl<'a, C, A> LayerPermissionListCall<'a, C, A> where C: BorrowMut LayerPermissionListCall<'a, C, A> where C: BorrowMut LayerPermissionListCall<'a, C, A> { self._id = new_value.to_string(); @@ -7390,12 +7391,12 @@ impl<'a, C, A> LayerPermissionListCall<'a, C, A> where C: BorrowMut LayerPermissionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> LayerPermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerPermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7484,7 +7485,7 @@ impl<'a, C, A> LayerProcesCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.layers.process", + dlg.begin(MethodInfo { id: "mapsengine.layers.process", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -7526,7 +7527,7 @@ impl<'a, C, A> LayerProcesCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7562,7 +7563,7 @@ impl<'a, C, A> LayerProcesCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7572,10 +7573,10 @@ impl<'a, C, A> LayerProcesCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7608,7 +7609,7 @@ impl<'a, C, A> LayerProcesCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LayerProcesCall<'a, C, A> { self._id = new_value.to_string(); @@ -7626,12 +7627,12 @@ impl<'a, C, A> LayerProcesCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7648,17 +7649,17 @@ impl<'a, C, A> LayerProcesCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LayerProcesCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LayerProcesCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7729,7 +7730,7 @@ impl<'a, C, A> RasterPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.permissions.batchUpdate", + dlg.begin(MethodInfo { id: "mapsengine.rasters.permissions.batchUpdate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -7771,14 +7772,14 @@ impl<'a, C, A> RasterPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7822,7 +7823,7 @@ impl<'a, C, A> RasterPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7832,10 +7833,10 @@ impl<'a, C, A> RasterPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut RasterPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut RasterPermissionBatchUpdateCall<'a, C, A> { self._request = new_value; @@ -7877,7 +7878,7 @@ impl<'a, C, A> RasterPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut RasterPermissionBatchUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -7895,12 +7896,12 @@ impl<'a, C, A> RasterPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut RasterPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterPermissionBatchUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterPermissionBatchUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7996,7 +7997,7 @@ impl<'a, C, A> RasterPatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.patch", + dlg.begin(MethodInfo { id: "mapsengine.rasters.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -8037,14 +8038,14 @@ impl<'a, C, A> RasterPatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8088,7 +8089,7 @@ impl<'a, C, A> RasterPatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8098,10 +8099,10 @@ impl<'a, C, A> RasterPatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8123,7 +8124,7 @@ impl<'a, C, A> RasterPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Raster) -> RasterPatchCall<'a, C, A> { self._request = new_value; @@ -8133,7 +8134,7 @@ impl<'a, C, A> RasterPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -8151,12 +8152,12 @@ impl<'a, C, A> RasterPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8173,17 +8174,17 @@ impl<'a, C, A> RasterPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8245,7 +8246,7 @@ impl<'a, C, A> RasterPermissionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.permissions.list", + dlg.begin(MethodInfo { id: "mapsengine.rasters.permissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -8287,7 +8288,7 @@ impl<'a, C, A> RasterPermissionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8323,7 +8324,7 @@ impl<'a, C, A> RasterPermissionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8333,10 +8334,10 @@ impl<'a, C, A> RasterPermissionListCall<'a, C, A> where C: BorrowMut RasterPermissionListCall<'a, C, A> where C: BorrowMut RasterPermissionListCall<'a, C, A> { self._id = new_value.to_string(); @@ -8387,12 +8388,12 @@ impl<'a, C, A> RasterPermissionListCall<'a, C, A> where C: BorrowMut RasterPermissionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterPermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterPermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8481,7 +8482,7 @@ impl<'a, C, A> RasterDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.delete", + dlg.begin(MethodInfo { id: "mapsengine.rasters.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -8522,7 +8523,7 @@ impl<'a, C, A> RasterDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8558,7 +8559,7 @@ impl<'a, C, A> RasterDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8568,10 +8569,10 @@ impl<'a, C, A> RasterDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8594,7 +8595,7 @@ impl<'a, C, A> RasterDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -8612,12 +8613,12 @@ impl<'a, C, A> RasterDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8634,17 +8635,17 @@ impl<'a, C, A> RasterDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8713,7 +8714,7 @@ impl<'a, C, A> RasterPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.permissions.batchDelete", + dlg.begin(MethodInfo { id: "mapsengine.rasters.permissions.batchDelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -8755,14 +8756,14 @@ impl<'a, C, A> RasterPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8806,7 +8807,7 @@ impl<'a, C, A> RasterPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8816,10 +8817,10 @@ impl<'a, C, A> RasterPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut RasterPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut RasterPermissionBatchDeleteCall<'a, C, A> { self._request = new_value; @@ -8861,7 +8862,7 @@ impl<'a, C, A> RasterPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut RasterPermissionBatchDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -8879,12 +8880,12 @@ impl<'a, C, A> RasterPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut RasterPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterPermissionBatchDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterPermissionBatchDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8976,7 +8977,7 @@ impl<'a, C, A> RasterFileInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.files.insert", + dlg.begin(MethodInfo { id: "mapsengine.rasters.files.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -8992,13 +8993,13 @@ impl<'a, C, A> RasterFileInsertCall<'a, C, A> where C: BorrowMut, } - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/mapsengine/v1/rasters/{id}/files".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/mapsengine/v1/rasters/{id}/files".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -9026,7 +9027,7 @@ impl<'a, C, A> RasterFileInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9090,7 +9091,7 @@ impl<'a, C, A> RasterFileInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9100,10 +9101,10 @@ impl<'a, C, A> RasterFileInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9197,7 +9198,7 @@ impl<'a, C, A> RasterFileInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterFileInsertCall<'a, C, A> { self._id = new_value.to_string(); @@ -9207,7 +9208,7 @@ impl<'a, C, A> RasterFileInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *filename* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn filename(mut self, new_value: &str) -> RasterFileInsertCall<'a, C, A> { self._filename = new_value.to_string(); @@ -9225,12 +9226,12 @@ impl<'a, C, A> RasterFileInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9247,17 +9248,17 @@ impl<'a, C, A> RasterFileInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterFileInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterFileInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9319,7 +9320,7 @@ impl<'a, C, A> RasterProcesCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.process", + dlg.begin(MethodInfo { id: "mapsengine.rasters.process", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -9361,7 +9362,7 @@ impl<'a, C, A> RasterProcesCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9397,7 +9398,7 @@ impl<'a, C, A> RasterProcesCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9407,10 +9408,10 @@ impl<'a, C, A> RasterProcesCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9443,7 +9444,7 @@ impl<'a, C, A> RasterProcesCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterProcesCall<'a, C, A> { self._id = new_value.to_string(); @@ -9461,12 +9462,12 @@ impl<'a, C, A> RasterProcesCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9483,17 +9484,17 @@ impl<'a, C, A> RasterProcesCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterProcesCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterProcesCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9555,7 +9556,7 @@ impl<'a, C, A> RasterGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.get", + dlg.begin(MethodInfo { id: "mapsengine.rasters.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -9597,7 +9598,7 @@ impl<'a, C, A> RasterGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9633,7 +9634,7 @@ impl<'a, C, A> RasterGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9643,10 +9644,10 @@ impl<'a, C, A> RasterGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9679,7 +9680,7 @@ impl<'a, C, A> RasterGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -9697,12 +9698,12 @@ impl<'a, C, A> RasterGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9719,17 +9720,17 @@ impl<'a, C, A> RasterGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9815,7 +9816,7 @@ impl<'a, C, A> RasterListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.list", + dlg.begin(MethodInfo { id: "mapsengine.rasters.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -9872,7 +9873,7 @@ impl<'a, C, A> RasterListCall<'a, C, A> where C: BorrowMut, A: oa self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9908,7 +9909,7 @@ impl<'a, C, A> RasterListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9918,10 +9919,10 @@ impl<'a, C, A> RasterListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9954,7 +9955,7 @@ impl<'a, C, A> RasterListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> RasterListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -10055,12 +10056,12 @@ impl<'a, C, A> RasterListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10077,17 +10078,17 @@ impl<'a, C, A> RasterListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10155,7 +10156,7 @@ impl<'a, C, A> RasterUploadCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.upload", + dlg.begin(MethodInfo { id: "mapsengine.rasters.upload", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -10175,14 +10176,14 @@ impl<'a, C, A> RasterUploadCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10226,7 +10227,7 @@ impl<'a, C, A> RasterUploadCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10236,10 +10237,10 @@ impl<'a, C, A> RasterUploadCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10271,7 +10272,7 @@ impl<'a, C, A> RasterUploadCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Raster) -> RasterUploadCall<'a, C, A> { self._request = new_value; @@ -10289,12 +10290,12 @@ impl<'a, C, A> RasterUploadCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10311,17 +10312,17 @@ impl<'a, C, A> RasterUploadCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterUploadCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterUploadCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10387,7 +10388,7 @@ impl<'a, C, A> RasterParentListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasters.parents.list", + dlg.begin(MethodInfo { id: "mapsengine.rasters.parents.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -10435,7 +10436,7 @@ impl<'a, C, A> RasterParentListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10471,7 +10472,7 @@ impl<'a, C, A> RasterParentListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10481,10 +10482,10 @@ impl<'a, C, A> RasterParentListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10517,7 +10518,7 @@ impl<'a, C, A> RasterParentListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterParentListCall<'a, C, A> { self._id = new_value.to_string(); @@ -10549,12 +10550,12 @@ impl<'a, C, A> RasterParentListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10571,17 +10572,17 @@ impl<'a, C, A> RasterParentListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterParentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterParentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10643,7 +10644,7 @@ impl<'a, C, A> AssetPermissionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.assets.permissions.list", + dlg.begin(MethodInfo { id: "mapsengine.assets.permissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -10685,7 +10686,7 @@ impl<'a, C, A> AssetPermissionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10721,7 +10722,7 @@ impl<'a, C, A> AssetPermissionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10731,10 +10732,10 @@ impl<'a, C, A> AssetPermissionListCall<'a, C, A> where C: BorrowMut AssetPermissionListCall<'a, C, A> where C: BorrowMut AssetPermissionListCall<'a, C, A> { self._id = new_value.to_string(); @@ -10785,12 +10786,12 @@ impl<'a, C, A> AssetPermissionListCall<'a, C, A> where C: BorrowMut AssetPermissionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AssetPermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AssetPermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10904,7 +10905,7 @@ impl<'a, C, A> AssetListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.assets.list", + dlg.begin(MethodInfo { id: "mapsengine.assets.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); if let Some(value) = self._type_ { @@ -10963,7 +10964,7 @@ impl<'a, C, A> AssetListCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10999,7 +11000,7 @@ impl<'a, C, A> AssetListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11009,10 +11010,10 @@ impl<'a, C, A> AssetListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11144,12 +11145,12 @@ impl<'a, C, A> AssetListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11166,17 +11167,17 @@ impl<'a, C, A> AssetListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AssetListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AssetListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11238,7 +11239,7 @@ impl<'a, C, A> AssetGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.assets.get", + dlg.begin(MethodInfo { id: "mapsengine.assets.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -11280,7 +11281,7 @@ impl<'a, C, A> AssetGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11316,7 +11317,7 @@ impl<'a, C, A> AssetGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11326,10 +11327,10 @@ impl<'a, C, A> AssetGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11362,7 +11363,7 @@ impl<'a, C, A> AssetGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AssetGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -11380,12 +11381,12 @@ impl<'a, C, A> AssetGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11402,17 +11403,17 @@ impl<'a, C, A> AssetGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AssetGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AssetGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11478,7 +11479,7 @@ impl<'a, C, A> AssetParentListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.assets.parents.list", + dlg.begin(MethodInfo { id: "mapsengine.assets.parents.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -11526,7 +11527,7 @@ impl<'a, C, A> AssetParentListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11562,7 +11563,7 @@ impl<'a, C, A> AssetParentListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11572,10 +11573,10 @@ impl<'a, C, A> AssetParentListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11608,7 +11609,7 @@ impl<'a, C, A> AssetParentListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> AssetParentListCall<'a, C, A> { self._id = new_value.to_string(); @@ -11640,12 +11641,12 @@ impl<'a, C, A> AssetParentListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11662,17 +11663,17 @@ impl<'a, C, A> AssetParentListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AssetParentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AssetParentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11734,7 +11735,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.delete", + dlg.begin(MethodInfo { id: "mapsengine.tables.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -11775,7 +11776,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11811,7 +11812,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11821,10 +11822,10 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11847,7 +11848,7 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TableDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -11865,12 +11866,12 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11887,17 +11888,17 @@ impl<'a, C, A> TableDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11963,7 +11964,7 @@ impl<'a, C, A> TableFileInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.files.insert", + dlg.begin(MethodInfo { id: "mapsengine.tables.files.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -11979,13 +11980,13 @@ impl<'a, C, A> TableFileInsertCall<'a, C, A> where C: BorrowMut, } - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/mapsengine/v1/tables/{id}/files".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/mapsengine/v1/tables/{id}/files".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -12013,7 +12014,7 @@ impl<'a, C, A> TableFileInsertCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12077,7 +12078,7 @@ impl<'a, C, A> TableFileInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12087,10 +12088,10 @@ impl<'a, C, A> TableFileInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12184,7 +12185,7 @@ impl<'a, C, A> TableFileInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TableFileInsertCall<'a, C, A> { self._id = new_value.to_string(); @@ -12194,7 +12195,7 @@ impl<'a, C, A> TableFileInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *filename* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn filename(mut self, new_value: &str) -> TableFileInsertCall<'a, C, A> { self._filename = new_value.to_string(); @@ -12212,12 +12213,12 @@ impl<'a, C, A> TableFileInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12234,17 +12235,17 @@ impl<'a, C, A> TableFileInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableFileInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableFileInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12321,7 +12322,7 @@ impl<'a, C, A> TableFeatureBatchInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.features.batchInsert", + dlg.begin(MethodInfo { id: "mapsengine.tables.features.batchInsert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -12362,14 +12363,14 @@ impl<'a, C, A> TableFeatureBatchInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12413,7 +12414,7 @@ impl<'a, C, A> TableFeatureBatchInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12423,10 +12424,10 @@ impl<'a, C, A> TableFeatureBatchInsertCall<'a, C, A> where C: BorrowMut TableFeatureBatchInsertCall<'a, C, A> where C: BorrowMut TableFeatureBatchInsertCall<'a, C, A> { self._request = new_value; @@ -12458,7 +12459,7 @@ impl<'a, C, A> TableFeatureBatchInsertCall<'a, C, A> where C: BorrowMut TableFeatureBatchInsertCall<'a, C, A> { self._id = new_value.to_string(); @@ -12476,12 +12477,12 @@ impl<'a, C, A> TableFeatureBatchInsertCall<'a, C, A> where C: BorrowMut TableFeatureBatchInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TableFeatureBatchInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableFeatureBatchInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12595,7 +12596,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.list", + dlg.begin(MethodInfo { id: "mapsengine.tables.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); if let Some(value) = self._tags { @@ -12654,7 +12655,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12690,7 +12691,7 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12700,10 +12701,10 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12834,12 +12835,12 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12856,17 +12857,17 @@ impl<'a, C, A> TableListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12930,7 +12931,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.get", + dlg.begin(MethodInfo { id: "mapsengine.tables.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -12975,7 +12976,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13011,7 +13012,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13021,10 +13022,10 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13057,7 +13058,7 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TableGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -13081,12 +13082,12 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13103,17 +13104,17 @@ impl<'a, C, A> TableGetCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13182,7 +13183,7 @@ impl<'a, C, A> TableFeatureBatchDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.features.batchDelete", + dlg.begin(MethodInfo { id: "mapsengine.tables.features.batchDelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -13223,14 +13224,14 @@ impl<'a, C, A> TableFeatureBatchDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -13274,7 +13275,7 @@ impl<'a, C, A> TableFeatureBatchDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13284,10 +13285,10 @@ impl<'a, C, A> TableFeatureBatchDeleteCall<'a, C, A> where C: BorrowMut TableFeatureBatchDeleteCall<'a, C, A> where C: BorrowMut TableFeatureBatchDeleteCall<'a, C, A> { self._request = new_value; @@ -13319,7 +13320,7 @@ impl<'a, C, A> TableFeatureBatchDeleteCall<'a, C, A> where C: BorrowMut TableFeatureBatchDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -13337,12 +13338,12 @@ impl<'a, C, A> TableFeatureBatchDeleteCall<'a, C, A> where C: BorrowMut TableFeatureBatchDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TableFeatureBatchDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableFeatureBatchDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13449,7 +13450,7 @@ impl<'a, C, A> TableFeatureListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.features.list", + dlg.begin(MethodInfo { id: "mapsengine.tables.features.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -13518,7 +13519,7 @@ impl<'a, C, A> TableFeatureListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13554,7 +13555,7 @@ impl<'a, C, A> TableFeatureListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13564,10 +13565,10 @@ impl<'a, C, A> TableFeatureListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13600,7 +13601,7 @@ impl<'a, C, A> TableFeatureListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TableFeatureListCall<'a, C, A> { self._id = new_value.to_string(); @@ -13681,12 +13682,12 @@ impl<'a, C, A> TableFeatureListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13703,17 +13704,17 @@ impl<'a, C, A> TableFeatureListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableFeatureListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableFeatureListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13775,7 +13776,7 @@ impl<'a, C, A> TableProcesCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.process", + dlg.begin(MethodInfo { id: "mapsengine.tables.process", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -13817,7 +13818,7 @@ impl<'a, C, A> TableProcesCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13853,7 +13854,7 @@ impl<'a, C, A> TableProcesCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13863,10 +13864,10 @@ impl<'a, C, A> TableProcesCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13899,7 +13900,7 @@ impl<'a, C, A> TableProcesCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TableProcesCall<'a, C, A> { self._id = new_value.to_string(); @@ -13917,12 +13918,12 @@ impl<'a, C, A> TableProcesCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13939,17 +13940,17 @@ impl<'a, C, A> TableProcesCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableProcesCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableProcesCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14015,7 +14016,7 @@ impl<'a, C, A> TableParentListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.parents.list", + dlg.begin(MethodInfo { id: "mapsengine.tables.parents.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -14063,7 +14064,7 @@ impl<'a, C, A> TableParentListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -14099,7 +14100,7 @@ impl<'a, C, A> TableParentListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14109,10 +14110,10 @@ impl<'a, C, A> TableParentListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14145,7 +14146,7 @@ impl<'a, C, A> TableParentListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TableParentListCall<'a, C, A> { self._id = new_value.to_string(); @@ -14177,12 +14178,12 @@ impl<'a, C, A> TableParentListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14199,17 +14200,17 @@ impl<'a, C, A> TableParentListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableParentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableParentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14280,7 +14281,7 @@ impl<'a, C, A> TablePermissionBatchUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.permissions.batchUpdate", + dlg.begin(MethodInfo { id: "mapsengine.tables.permissions.batchUpdate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -14322,14 +14323,14 @@ impl<'a, C, A> TablePermissionBatchUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14373,7 +14374,7 @@ impl<'a, C, A> TablePermissionBatchUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14383,10 +14384,10 @@ impl<'a, C, A> TablePermissionBatchUpdateCall<'a, C, A> where C: BorrowMut TablePermissionBatchUpdateCall<'a, C, A> where C: BorrowMut TablePermissionBatchUpdateCall<'a, C, A> { self._request = new_value; @@ -14428,7 +14429,7 @@ impl<'a, C, A> TablePermissionBatchUpdateCall<'a, C, A> where C: BorrowMut TablePermissionBatchUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -14446,12 +14447,12 @@ impl<'a, C, A> TablePermissionBatchUpdateCall<'a, C, A> where C: BorrowMut TablePermissionBatchUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TablePermissionBatchUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TablePermissionBatchUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14548,7 +14549,7 @@ impl<'a, C, A> TableUploadCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.upload", + dlg.begin(MethodInfo { id: "mapsengine.tables.upload", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -14568,14 +14569,14 @@ impl<'a, C, A> TableUploadCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14619,7 +14620,7 @@ impl<'a, C, A> TableUploadCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14629,10 +14630,10 @@ impl<'a, C, A> TableUploadCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14664,7 +14665,7 @@ impl<'a, C, A> TableUploadCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Table) -> TableUploadCall<'a, C, A> { self._request = new_value; @@ -14682,12 +14683,12 @@ impl<'a, C, A> TableUploadCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -14704,17 +14705,17 @@ impl<'a, C, A> TableUploadCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableUploadCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableUploadCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -14797,7 +14798,7 @@ impl<'a, C, A> TableFeatureBatchPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.features.batchPatch", + dlg.begin(MethodInfo { id: "mapsengine.tables.features.batchPatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -14838,14 +14839,14 @@ impl<'a, C, A> TableFeatureBatchPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -14889,7 +14890,7 @@ impl<'a, C, A> TableFeatureBatchPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -14899,10 +14900,10 @@ impl<'a, C, A> TableFeatureBatchPatchCall<'a, C, A> where C: BorrowMut TableFeatureBatchPatchCall<'a, C, A> where C: BorrowMut TableFeatureBatchPatchCall<'a, C, A> { self._request = new_value; @@ -14934,7 +14935,7 @@ impl<'a, C, A> TableFeatureBatchPatchCall<'a, C, A> where C: BorrowMut TableFeatureBatchPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -14952,12 +14953,12 @@ impl<'a, C, A> TableFeatureBatchPatchCall<'a, C, A> where C: BorrowMut TableFeatureBatchPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TableFeatureBatchPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableFeatureBatchPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15053,7 +15054,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.patch", + dlg.begin(MethodInfo { id: "mapsengine.tables.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -15094,14 +15095,14 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15145,7 +15146,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15155,10 +15156,10 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15180,7 +15181,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Table) -> TablePatchCall<'a, C, A> { self._request = new_value; @@ -15190,7 +15191,7 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TablePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -15208,12 +15209,12 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15230,17 +15231,17 @@ impl<'a, C, A> TablePatchCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TablePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TablePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15309,7 +15310,7 @@ impl<'a, C, A> TablePermissionBatchDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.permissions.batchDelete", + dlg.begin(MethodInfo { id: "mapsengine.tables.permissions.batchDelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -15351,14 +15352,14 @@ impl<'a, C, A> TablePermissionBatchDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15402,7 +15403,7 @@ impl<'a, C, A> TablePermissionBatchDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15412,10 +15413,10 @@ impl<'a, C, A> TablePermissionBatchDeleteCall<'a, C, A> where C: BorrowMut TablePermissionBatchDeleteCall<'a, C, A> where C: BorrowMut TablePermissionBatchDeleteCall<'a, C, A> { self._request = new_value; @@ -15457,7 +15458,7 @@ impl<'a, C, A> TablePermissionBatchDeleteCall<'a, C, A> where C: BorrowMut TablePermissionBatchDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -15475,12 +15476,12 @@ impl<'a, C, A> TablePermissionBatchDeleteCall<'a, C, A> where C: BorrowMut TablePermissionBatchDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TablePermissionBatchDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TablePermissionBatchDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15575,7 +15576,7 @@ impl<'a, C, A> TableCreateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.create", + dlg.begin(MethodInfo { id: "mapsengine.tables.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -15595,14 +15596,14 @@ impl<'a, C, A> TableCreateCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -15646,7 +15647,7 @@ impl<'a, C, A> TableCreateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15656,10 +15657,10 @@ impl<'a, C, A> TableCreateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15691,7 +15692,7 @@ impl<'a, C, A> TableCreateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Table) -> TableCreateCall<'a, C, A> { self._request = new_value; @@ -15709,12 +15710,12 @@ impl<'a, C, A> TableCreateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -15731,17 +15732,17 @@ impl<'a, C, A> TableCreateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -15803,7 +15804,7 @@ impl<'a, C, A> TablePermissionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.permissions.list", + dlg.begin(MethodInfo { id: "mapsengine.tables.permissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -15845,7 +15846,7 @@ impl<'a, C, A> TablePermissionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -15881,7 +15882,7 @@ impl<'a, C, A> TablePermissionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -15891,10 +15892,10 @@ impl<'a, C, A> TablePermissionListCall<'a, C, A> where C: BorrowMut TablePermissionListCall<'a, C, A> where C: BorrowMut TablePermissionListCall<'a, C, A> { self._id = new_value.to_string(); @@ -15945,12 +15946,12 @@ impl<'a, C, A> TablePermissionListCall<'a, C, A> where C: BorrowMut TablePermissionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TablePermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TablePermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16044,7 +16045,7 @@ impl<'a, C, A> TableFeatureGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.tables.features.get", + dlg.begin(MethodInfo { id: "mapsengine.tables.features.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("tableId", self._table_id.to_string())); @@ -16093,7 +16094,7 @@ impl<'a, C, A> TableFeatureGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16129,7 +16130,7 @@ impl<'a, C, A> TableFeatureGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16139,10 +16140,10 @@ impl<'a, C, A> TableFeatureGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16175,7 +16176,7 @@ impl<'a, C, A> TableFeatureGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *table id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn table_id(mut self, new_value: &str) -> TableFeatureGetCall<'a, C, A> { self._table_id = new_value.to_string(); @@ -16185,7 +16186,7 @@ impl<'a, C, A> TableFeatureGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TableFeatureGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -16217,12 +16218,12 @@ impl<'a, C, A> TableFeatureGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16239,17 +16240,17 @@ impl<'a, C, A> TableFeatureGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TableFeatureGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TableFeatureGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16336,7 +16337,7 @@ impl<'a, C, A> MapListCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.list", + dlg.begin(MethodInfo { id: "mapsengine.maps.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); if let Some(value) = self._tags { @@ -16395,7 +16396,7 @@ impl<'a, C, A> MapListCall<'a, C, A> where C: BorrowMut, A: oauth self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16431,7 +16432,7 @@ impl<'a, C, A> MapListCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16441,10 +16442,10 @@ impl<'a, C, A> MapListCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16575,12 +16576,12 @@ impl<'a, C, A> MapListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16597,17 +16598,17 @@ impl<'a, C, A> MapListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MapListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16674,7 +16675,7 @@ impl<'a, C, A> MapListPublishedCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.listPublished", + dlg.begin(MethodInfo { id: "mapsengine.maps.listPublished", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._project_id { @@ -16703,7 +16704,7 @@ impl<'a, C, A> MapListPublishedCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -16739,7 +16740,7 @@ impl<'a, C, A> MapListPublishedCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16749,10 +16750,10 @@ impl<'a, C, A> MapListPublishedCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -16814,12 +16815,12 @@ impl<'a, C, A> MapListPublishedCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -16836,17 +16837,17 @@ impl<'a, C, A> MapListPublishedCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MapListPublishedCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapListPublishedCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -16915,7 +16916,7 @@ impl<'a, C, A> MapPatchCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.patch", + dlg.begin(MethodInfo { id: "mapsengine.maps.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -16956,14 +16957,14 @@ impl<'a, C, A> MapPatchCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17007,7 +17008,7 @@ impl<'a, C, A> MapPatchCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17017,10 +17018,10 @@ impl<'a, C, A> MapPatchCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17042,7 +17043,7 @@ impl<'a, C, A> MapPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Map) -> MapPatchCall<'a, C, A> { self._request = new_value; @@ -17052,7 +17053,7 @@ impl<'a, C, A> MapPatchCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> MapPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -17070,12 +17071,12 @@ impl<'a, C, A> MapPatchCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17092,17 +17093,17 @@ impl<'a, C, A> MapPatchCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MapPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17173,7 +17174,7 @@ impl<'a, C, A> MapPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.permissions.batchUpdate", + dlg.begin(MethodInfo { id: "mapsengine.maps.permissions.batchUpdate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -17215,14 +17216,14 @@ impl<'a, C, A> MapPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -17266,7 +17267,7 @@ impl<'a, C, A> MapPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17276,10 +17277,10 @@ impl<'a, C, A> MapPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut MapPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut MapPermissionBatchUpdateCall<'a, C, A> { self._request = new_value; @@ -17321,7 +17322,7 @@ impl<'a, C, A> MapPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut MapPermissionBatchUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -17339,12 +17340,12 @@ impl<'a, C, A> MapPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut MapPermissionBatchUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MapPermissionBatchUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapPermissionBatchUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17433,7 +17434,7 @@ impl<'a, C, A> MapDeleteCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.delete", + dlg.begin(MethodInfo { id: "mapsengine.maps.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -17474,7 +17475,7 @@ impl<'a, C, A> MapDeleteCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17510,7 +17511,7 @@ impl<'a, C, A> MapDeleteCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17520,10 +17521,10 @@ impl<'a, C, A> MapDeleteCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17546,7 +17547,7 @@ impl<'a, C, A> MapDeleteCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> MapDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -17564,12 +17565,12 @@ impl<'a, C, A> MapDeleteCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17586,17 +17587,17 @@ impl<'a, C, A> MapDeleteCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MapDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17658,7 +17659,7 @@ impl<'a, C, A> MapUnpublishCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.unpublish", + dlg.begin(MethodInfo { id: "mapsengine.maps.unpublish", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -17700,7 +17701,7 @@ impl<'a, C, A> MapUnpublishCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17736,7 +17737,7 @@ impl<'a, C, A> MapUnpublishCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17746,10 +17747,10 @@ impl<'a, C, A> MapUnpublishCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17782,7 +17783,7 @@ impl<'a, C, A> MapUnpublishCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> MapUnpublishCall<'a, C, A> { self._id = new_value.to_string(); @@ -17800,12 +17801,12 @@ impl<'a, C, A> MapUnpublishCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -17822,17 +17823,17 @@ impl<'a, C, A> MapUnpublishCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MapUnpublishCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapUnpublishCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -17896,7 +17897,7 @@ impl<'a, C, A> MapPublishCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.publish", + dlg.begin(MethodInfo { id: "mapsengine.maps.publish", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -17941,7 +17942,7 @@ impl<'a, C, A> MapPublishCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -17977,7 +17978,7 @@ impl<'a, C, A> MapPublishCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -17987,10 +17988,10 @@ impl<'a, C, A> MapPublishCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18023,7 +18024,7 @@ impl<'a, C, A> MapPublishCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> MapPublishCall<'a, C, A> { self._id = new_value.to_string(); @@ -18048,12 +18049,12 @@ impl<'a, C, A> MapPublishCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18070,17 +18071,17 @@ impl<'a, C, A> MapPublishCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MapPublishCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapPublishCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18142,7 +18143,7 @@ impl<'a, C, A> MapPermissionListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.permissions.list", + dlg.begin(MethodInfo { id: "mapsengine.maps.permissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -18184,7 +18185,7 @@ impl<'a, C, A> MapPermissionListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18220,7 +18221,7 @@ impl<'a, C, A> MapPermissionListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18230,10 +18231,10 @@ impl<'a, C, A> MapPermissionListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18266,7 +18267,7 @@ impl<'a, C, A> MapPermissionListCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> MapPermissionListCall<'a, C, A> { self._id = new_value.to_string(); @@ -18284,12 +18285,12 @@ impl<'a, C, A> MapPermissionListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18306,17 +18307,17 @@ impl<'a, C, A> MapPermissionListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MapPermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapPermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18384,7 +18385,7 @@ impl<'a, C, A> MapCreateCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.create", + dlg.begin(MethodInfo { id: "mapsengine.maps.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -18404,14 +18405,14 @@ impl<'a, C, A> MapCreateCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -18455,7 +18456,7 @@ impl<'a, C, A> MapCreateCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18465,10 +18466,10 @@ impl<'a, C, A> MapCreateCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18500,7 +18501,7 @@ impl<'a, C, A> MapCreateCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Map) -> MapCreateCall<'a, C, A> { self._request = new_value; @@ -18518,12 +18519,12 @@ impl<'a, C, A> MapCreateCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18540,17 +18541,17 @@ impl<'a, C, A> MapCreateCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MapCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18612,7 +18613,7 @@ impl<'a, C, A> MapGetPublishedCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.getPublished", + dlg.begin(MethodInfo { id: "mapsengine.maps.getPublished", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -18654,7 +18655,7 @@ impl<'a, C, A> MapGetPublishedCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18690,7 +18691,7 @@ impl<'a, C, A> MapGetPublishedCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18700,10 +18701,10 @@ impl<'a, C, A> MapGetPublishedCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18736,7 +18737,7 @@ impl<'a, C, A> MapGetPublishedCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> MapGetPublishedCall<'a, C, A> { self._id = new_value.to_string(); @@ -18754,12 +18755,12 @@ impl<'a, C, A> MapGetPublishedCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -18776,17 +18777,17 @@ impl<'a, C, A> MapGetPublishedCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MapGetPublishedCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapGetPublishedCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -18850,7 +18851,7 @@ impl<'a, C, A> MapGetCall<'a, C, A> where C: BorrowMut, A: oauth2 Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.get", + dlg.begin(MethodInfo { id: "mapsengine.maps.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -18895,7 +18896,7 @@ impl<'a, C, A> MapGetCall<'a, C, A> where C: BorrowMut, A: oauth2 params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -18931,7 +18932,7 @@ impl<'a, C, A> MapGetCall<'a, C, A> where C: BorrowMut, A: oauth2 match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18941,10 +18942,10 @@ impl<'a, C, A> MapGetCall<'a, C, A> where C: BorrowMut, A: oauth2 if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -18977,7 +18978,7 @@ impl<'a, C, A> MapGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> MapGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -19002,12 +19003,12 @@ impl<'a, C, A> MapGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19024,17 +19025,17 @@ impl<'a, C, A> MapGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MapGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19103,7 +19104,7 @@ impl<'a, C, A> MapPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.maps.permissions.batchDelete", + dlg.begin(MethodInfo { id: "mapsengine.maps.permissions.batchDelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -19145,14 +19146,14 @@ impl<'a, C, A> MapPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19196,7 +19197,7 @@ impl<'a, C, A> MapPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19206,10 +19207,10 @@ impl<'a, C, A> MapPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut MapPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut MapPermissionBatchDeleteCall<'a, C, A> { self._request = new_value; @@ -19251,7 +19252,7 @@ impl<'a, C, A> MapPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut MapPermissionBatchDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -19269,12 +19270,12 @@ impl<'a, C, A> MapPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut MapPermissionBatchDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MapPermissionBatchDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MapPermissionBatchDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19369,7 +19370,7 @@ impl<'a, C, A> RasterCollectionCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.create", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -19389,14 +19390,14 @@ impl<'a, C, A> RasterCollectionCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19440,7 +19441,7 @@ impl<'a, C, A> RasterCollectionCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19450,10 +19451,10 @@ impl<'a, C, A> RasterCollectionCreateCall<'a, C, A> where C: BorrowMut RasterCollectionCreateCall<'a, C, A> where C: BorrowMut RasterCollectionCreateCall<'a, C, A> { self._request = new_value; @@ -19503,12 +19504,12 @@ impl<'a, C, A> RasterCollectionCreateCall<'a, C, A> where C: BorrowMut RasterCollectionCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterCollectionCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19604,7 +19605,7 @@ impl<'a, C, A> RasterCollectionPermissionBatchDeleteCall<'a, C, A> where C: Borr Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.permissions.batchDelete", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.permissions.batchDelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -19646,14 +19647,14 @@ impl<'a, C, A> RasterCollectionPermissionBatchDeleteCall<'a, C, A> where C: Borr params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19697,7 +19698,7 @@ impl<'a, C, A> RasterCollectionPermissionBatchDeleteCall<'a, C, A> where C: Borr match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19707,10 +19708,10 @@ impl<'a, C, A> RasterCollectionPermissionBatchDeleteCall<'a, C, A> where C: Borr if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19742,7 +19743,7 @@ impl<'a, C, A> RasterCollectionPermissionBatchDeleteCall<'a, C, A> where C: Borr /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: PermissionsBatchDeleteRequest) -> RasterCollectionPermissionBatchDeleteCall<'a, C, A> { self._request = new_value; @@ -19752,7 +19753,7 @@ impl<'a, C, A> RasterCollectionPermissionBatchDeleteCall<'a, C, A> where C: Borr /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterCollectionPermissionBatchDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -19770,12 +19771,12 @@ impl<'a, C, A> RasterCollectionPermissionBatchDeleteCall<'a, C, A> where C: Borr } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -19792,17 +19793,17 @@ impl<'a, C, A> RasterCollectionPermissionBatchDeleteCall<'a, C, A> where C: Borr } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterCollectionPermissionBatchDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionPermissionBatchDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -19871,7 +19872,7 @@ impl<'a, C, A> RasterCollectionPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.patch", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -19912,14 +19913,14 @@ impl<'a, C, A> RasterCollectionPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -19963,7 +19964,7 @@ impl<'a, C, A> RasterCollectionPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -19973,10 +19974,10 @@ impl<'a, C, A> RasterCollectionPatchCall<'a, C, A> where C: BorrowMut RasterCollectionPatchCall<'a, C, A> where C: BorrowMut RasterCollectionPatchCall<'a, C, A> { self._request = new_value; @@ -20008,7 +20009,7 @@ impl<'a, C, A> RasterCollectionPatchCall<'a, C, A> where C: BorrowMut RasterCollectionPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -20026,12 +20027,12 @@ impl<'a, C, A> RasterCollectionPatchCall<'a, C, A> where C: BorrowMut RasterCollectionPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterCollectionPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20120,7 +20121,7 @@ impl<'a, C, A> RasterCollectionCancelProcessingCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.cancelProcessing", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.cancelProcessing", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -20162,7 +20163,7 @@ impl<'a, C, A> RasterCollectionCancelProcessingCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -20198,7 +20199,7 @@ impl<'a, C, A> RasterCollectionCancelProcessingCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20208,10 +20209,10 @@ impl<'a, C, A> RasterCollectionCancelProcessingCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20244,7 +20245,7 @@ impl<'a, C, A> RasterCollectionCancelProcessingCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterCollectionCancelProcessingCall<'a, C, A> { self._id = new_value.to_string(); @@ -20262,12 +20263,12 @@ impl<'a, C, A> RasterCollectionCancelProcessingCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20284,17 +20285,17 @@ impl<'a, C, A> RasterCollectionCancelProcessingCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterCollectionCancelProcessingCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionCancelProcessingCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20356,7 +20357,7 @@ impl<'a, C, A> RasterCollectionProcesCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.process", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.process", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -20398,7 +20399,7 @@ impl<'a, C, A> RasterCollectionProcesCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -20434,7 +20435,7 @@ impl<'a, C, A> RasterCollectionProcesCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20444,10 +20445,10 @@ impl<'a, C, A> RasterCollectionProcesCall<'a, C, A> where C: BorrowMut RasterCollectionProcesCall<'a, C, A> where C: BorrowMut RasterCollectionProcesCall<'a, C, A> { self._id = new_value.to_string(); @@ -20498,12 +20499,12 @@ impl<'a, C, A> RasterCollectionProcesCall<'a, C, A> where C: BorrowMut RasterCollectionProcesCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterCollectionProcesCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionProcesCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20601,7 +20602,7 @@ impl<'a, C, A> RasterCollectionPermissionBatchUpdateCall<'a, C, A> where C: Borr Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.permissions.batchUpdate", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.permissions.batchUpdate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -20643,14 +20644,14 @@ impl<'a, C, A> RasterCollectionPermissionBatchUpdateCall<'a, C, A> where C: Borr params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -20694,7 +20695,7 @@ impl<'a, C, A> RasterCollectionPermissionBatchUpdateCall<'a, C, A> where C: Borr match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20704,10 +20705,10 @@ impl<'a, C, A> RasterCollectionPermissionBatchUpdateCall<'a, C, A> where C: Borr if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20739,7 +20740,7 @@ impl<'a, C, A> RasterCollectionPermissionBatchUpdateCall<'a, C, A> where C: Borr /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: PermissionsBatchUpdateRequest) -> RasterCollectionPermissionBatchUpdateCall<'a, C, A> { self._request = new_value; @@ -20749,7 +20750,7 @@ impl<'a, C, A> RasterCollectionPermissionBatchUpdateCall<'a, C, A> where C: Borr /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterCollectionPermissionBatchUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -20767,12 +20768,12 @@ impl<'a, C, A> RasterCollectionPermissionBatchUpdateCall<'a, C, A> where C: Borr } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -20789,17 +20790,17 @@ impl<'a, C, A> RasterCollectionPermissionBatchUpdateCall<'a, C, A> where C: Borr } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterCollectionPermissionBatchUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionPermissionBatchUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -20861,7 +20862,7 @@ impl<'a, C, A> RasterCollectionDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.delete", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -20902,7 +20903,7 @@ impl<'a, C, A> RasterCollectionDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -20938,7 +20939,7 @@ impl<'a, C, A> RasterCollectionDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -20948,10 +20949,10 @@ impl<'a, C, A> RasterCollectionDeleteCall<'a, C, A> where C: BorrowMut RasterCollectionDeleteCall<'a, C, A> where C: BorrowMut RasterCollectionDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -20992,12 +20993,12 @@ impl<'a, C, A> RasterCollectionDeleteCall<'a, C, A> where C: BorrowMut RasterCollectionDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterCollectionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21090,7 +21091,7 @@ impl<'a, C, A> RasterCollectionParentListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.parents.list", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.parents.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -21138,7 +21139,7 @@ impl<'a, C, A> RasterCollectionParentListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -21174,7 +21175,7 @@ impl<'a, C, A> RasterCollectionParentListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21184,10 +21185,10 @@ impl<'a, C, A> RasterCollectionParentListCall<'a, C, A> where C: BorrowMut RasterCollectionParentListCall<'a, C, A> where C: BorrowMut RasterCollectionParentListCall<'a, C, A> { self._id = new_value.to_string(); @@ -21252,12 +21253,12 @@ impl<'a, C, A> RasterCollectionParentListCall<'a, C, A> where C: BorrowMut RasterCollectionParentListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterCollectionParentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionParentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21371,7 +21372,7 @@ impl<'a, C, A> RasterCollectionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.list", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((15 + self._additional_params.len())); if let Some(value) = self._tags { @@ -21430,7 +21431,7 @@ impl<'a, C, A> RasterCollectionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -21466,7 +21467,7 @@ impl<'a, C, A> RasterCollectionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21476,10 +21477,10 @@ impl<'a, C, A> RasterCollectionListCall<'a, C, A> where C: BorrowMut RasterCollectionListCall<'a, C, A> where C: BorrowMut RasterCollectionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterCollectionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21713,7 +21714,7 @@ impl<'a, C, A> RasterCollectionRasterBatchInsertCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.rasters.batchInsert", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.rasters.batchInsert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -21755,14 +21756,14 @@ impl<'a, C, A> RasterCollectionRasterBatchInsertCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -21806,7 +21807,7 @@ impl<'a, C, A> RasterCollectionRasterBatchInsertCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21816,10 +21817,10 @@ impl<'a, C, A> RasterCollectionRasterBatchInsertCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -21851,7 +21852,7 @@ impl<'a, C, A> RasterCollectionRasterBatchInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: RasterCollectionsRastersBatchInsertRequest) -> RasterCollectionRasterBatchInsertCall<'a, C, A> { self._request = new_value; @@ -21861,7 +21862,7 @@ impl<'a, C, A> RasterCollectionRasterBatchInsertCall<'a, C, A> where C: BorrowMu /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterCollectionRasterBatchInsertCall<'a, C, A> { self._id = new_value.to_string(); @@ -21879,12 +21880,12 @@ impl<'a, C, A> RasterCollectionRasterBatchInsertCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -21901,17 +21902,17 @@ impl<'a, C, A> RasterCollectionRasterBatchInsertCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterCollectionRasterBatchInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionRasterBatchInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -21982,7 +21983,7 @@ impl<'a, C, A> RasterCollectionRasterBatchDeleteCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.rasters.batchDelete", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.rasters.batchDelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -22024,14 +22025,14 @@ impl<'a, C, A> RasterCollectionRasterBatchDeleteCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -22075,7 +22076,7 @@ impl<'a, C, A> RasterCollectionRasterBatchDeleteCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22085,10 +22086,10 @@ impl<'a, C, A> RasterCollectionRasterBatchDeleteCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22120,7 +22121,7 @@ impl<'a, C, A> RasterCollectionRasterBatchDeleteCall<'a, C, A> where C: BorrowMu /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: RasterCollectionsRasterBatchDeleteRequest) -> RasterCollectionRasterBatchDeleteCall<'a, C, A> { self._request = new_value; @@ -22130,7 +22131,7 @@ impl<'a, C, A> RasterCollectionRasterBatchDeleteCall<'a, C, A> where C: BorrowMu /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> RasterCollectionRasterBatchDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -22148,12 +22149,12 @@ impl<'a, C, A> RasterCollectionRasterBatchDeleteCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22170,17 +22171,17 @@ impl<'a, C, A> RasterCollectionRasterBatchDeleteCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RasterCollectionRasterBatchDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionRasterBatchDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22242,7 +22243,7 @@ impl<'a, C, A> RasterCollectionPermissionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.permissions.list", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.permissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -22284,7 +22285,7 @@ impl<'a, C, A> RasterCollectionPermissionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22320,7 +22321,7 @@ impl<'a, C, A> RasterCollectionPermissionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22330,10 +22331,10 @@ impl<'a, C, A> RasterCollectionPermissionListCall<'a, C, A> where C: BorrowMut RasterCollectionPermissionListCall<'a, C, A> where C: BorrowMut RasterCollectionPermissionListCall<'a, C, A> { self._id = new_value.to_string(); @@ -22384,12 +22385,12 @@ impl<'a, C, A> RasterCollectionPermissionListCall<'a, C, A> where C: BorrowMut RasterCollectionPermissionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterCollectionPermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionPermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22478,7 +22479,7 @@ impl<'a, C, A> RasterCollectionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.get", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -22520,7 +22521,7 @@ impl<'a, C, A> RasterCollectionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22556,7 +22557,7 @@ impl<'a, C, A> RasterCollectionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22566,10 +22567,10 @@ impl<'a, C, A> RasterCollectionGetCall<'a, C, A> where C: BorrowMut RasterCollectionGetCall<'a, C, A> where C: BorrowMut RasterCollectionGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -22620,12 +22621,12 @@ impl<'a, C, A> RasterCollectionGetCall<'a, C, A> where C: BorrowMut RasterCollectionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterCollectionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22736,7 +22737,7 @@ impl<'a, C, A> RasterCollectionRasterListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.rasters.list", + dlg.begin(MethodInfo { id: "mapsengine.rasterCollections.rasters.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((14 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -22811,7 +22812,7 @@ impl<'a, C, A> RasterCollectionRasterListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -22847,7 +22848,7 @@ impl<'a, C, A> RasterCollectionRasterListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22857,10 +22858,10 @@ impl<'a, C, A> RasterCollectionRasterListCall<'a, C, A> where C: BorrowMut RasterCollectionRasterListCall<'a, C, A> where C: BorrowMut RasterCollectionRasterListCall<'a, C, A> { self._id = new_value.to_string(); @@ -22988,12 +22989,12 @@ impl<'a, C, A> RasterCollectionRasterListCall<'a, C, A> where C: BorrowMut RasterCollectionRasterListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RasterCollectionRasterListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RasterCollectionRasterListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23088,7 +23089,7 @@ impl<'a, C, A> ProjectIconGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.projects.icons.get", + dlg.begin(MethodInfo { id: "mapsengine.projects.icons.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -23147,7 +23148,7 @@ impl<'a, C, A> ProjectIconGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23183,7 +23184,7 @@ impl<'a, C, A> ProjectIconGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23193,10 +23194,10 @@ impl<'a, C, A> ProjectIconGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23229,7 +23230,7 @@ impl<'a, C, A> ProjectIconGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectIconGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -23239,7 +23240,7 @@ impl<'a, C, A> ProjectIconGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ProjectIconGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -23257,12 +23258,12 @@ impl<'a, C, A> ProjectIconGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -23279,17 +23280,17 @@ impl<'a, C, A> ProjectIconGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectIconGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectIconGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23360,7 +23361,7 @@ impl<'a, C, A> ProjectIconCreateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.projects.icons.create", + dlg.begin(MethodInfo { id: "mapsengine.projects.icons.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -23376,13 +23377,13 @@ impl<'a, C, A> ProjectIconCreateCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/mapsengine/v1/projects/{projectId}/icons".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/mapsengine/v1/projects/{projectId}/icons".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -23410,14 +23411,14 @@ impl<'a, C, A> ProjectIconCreateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -23494,7 +23495,7 @@ impl<'a, C, A> ProjectIconCreateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23504,10 +23505,10 @@ impl<'a, C, A> ProjectIconCreateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23610,7 +23611,7 @@ impl<'a, C, A> ProjectIconCreateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Icon) -> ProjectIconCreateCall<'a, C, A> { self._request = new_value; @@ -23620,7 +23621,7 @@ impl<'a, C, A> ProjectIconCreateCall<'a, C, A> where C: BorrowMut /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectIconCreateCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -23638,12 +23639,12 @@ impl<'a, C, A> ProjectIconCreateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -23660,17 +23661,17 @@ impl<'a, C, A> ProjectIconCreateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectIconCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectIconCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23731,7 +23732,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.projects.list", + dlg.begin(MethodInfo { id: "mapsengine.projects.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -23751,7 +23752,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23787,7 +23788,7 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23797,10 +23798,10 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -23841,12 +23842,12 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -23863,17 +23864,17 @@ impl<'a, C, A> ProjectListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -23939,7 +23940,7 @@ impl<'a, C, A> ProjectIconListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mapsengine.projects.icons.list", + dlg.begin(MethodInfo { id: "mapsengine.projects.icons.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -23987,7 +23988,7 @@ impl<'a, C, A> ProjectIconListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -24023,7 +24024,7 @@ impl<'a, C, A> ProjectIconListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24033,10 +24034,10 @@ impl<'a, C, A> ProjectIconListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24069,7 +24070,7 @@ impl<'a, C, A> ProjectIconListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectIconListCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -24101,12 +24102,12 @@ impl<'a, C, A> ProjectIconListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -24123,17 +24124,17 @@ impl<'a, C, A> ProjectIconListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectIconListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectIconListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/mirror1-cli/Cargo.toml b/gen/mirror1-cli/Cargo.toml index 84954239f3..3f4ad938b1 100644 --- a/gen/mirror1-cli/Cargo.toml +++ b/gen/mirror1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-mirror1-cli" -version = "0.3.2+20150720" +version = "0.3.3+20151206" authors = ["Sebastian Thiel "] description = "A complete library to interact with mirror (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/mirror1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/mirror1-cli/LICENSE.md b/gen/mirror1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/mirror1-cli/LICENSE.md +++ b/gen/mirror1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/mirror1-cli/README.md b/gen/mirror1-cli/README.md index 54c89d5a0e..820b04c2a0 100644 --- a/gen/mirror1-cli/README.md +++ b/gen/mirror1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *mirror* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/mirror1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/mirror1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/mirror1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/mirror1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/mirror1-cli). # Usage -This documentation was generated from the *mirror* API at revision *20150720*. The CLI is at version *0.3.2*. +This documentation was generated from the *mirror* API at revision *20151206*. The CLI is at version *0.3.3*. ```bash mirror1 [options] @@ -62,18 +62,18 @@ mirror1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/mirror1-cli/mkdocs.yml b/gen/mirror1-cli/mkdocs.yml index 1fb50f7c09..26eaeaf28e 100644 --- a/gen/mirror1-cli/mkdocs.yml +++ b/gen/mirror1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: mirror v0.3.2+20150720 +site_name: mirror v0.3.3+20151206 site_url: http://byron.github.io/google-apis-rs/google-mirror1-cli site_description: Write integrating applications with bcore @@ -36,5 +36,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/mirror1-cli/src/main.rs b/gen/mirror1-cli/src/main.rs index bc9ce6137b..401b434bcf 100644 --- a/gen/mirror1-cli/src/main.rs +++ b/gen/mirror1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Mirror>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _accounts_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _accounts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "password" => Some(("password", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "features" => Some(("features", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -82,7 +82,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Account = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().insert(request, opt.value_of("user-token").unwrap_or(""), opt.value_of("account-type").unwrap_or(""), opt.value_of("account-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -95,7 +95,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -128,10 +128,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _contacts_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _contacts_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.contacts().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -144,7 +144,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -157,7 +157,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -172,10 +172,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _contacts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _contacts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.contacts().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -188,7 +188,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -201,7 +201,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -224,13 +224,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _contacts_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _contacts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -244,8 +244,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -270,7 +270,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Contact = json::value::from_value(object).unwrap(); let mut call = self.hub.contacts().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -283,7 +283,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -296,7 +296,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -319,10 +319,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _contacts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _contacts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.contacts().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -335,7 +335,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -348,7 +348,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -371,13 +371,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _contacts_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _contacts_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -391,8 +391,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -417,7 +417,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Contact = json::value::from_value(object).unwrap(); let mut call = self.hub.contacts().patch(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -430,7 +430,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -443,7 +443,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -466,13 +466,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _contacts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _contacts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -486,8 +486,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -512,7 +512,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Contact = json::value::from_value(object).unwrap(); let mut call = self.hub.contacts().update(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -525,7 +525,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -538,7 +538,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -561,10 +561,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _locations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _locations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.locations().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -577,7 +577,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -590,7 +590,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -613,10 +613,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _locations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _locations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.locations().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -629,7 +629,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -642,7 +642,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -665,10 +665,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _settings_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _settings_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.settings().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -681,7 +681,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -694,7 +694,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -717,10 +717,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subscriptions().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -733,7 +733,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -746,7 +746,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -761,13 +761,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -781,8 +781,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "notification.item-id" => Some(("notification.itemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -809,7 +809,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subscription = json::value::from_value(object).unwrap(); let mut call = self.hub.subscriptions().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -822,7 +822,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -835,7 +835,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -858,10 +858,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subscriptions().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -874,7 +874,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -887,7 +887,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -910,13 +910,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -930,8 +930,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "notification.item-id" => Some(("notification.itemId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -958,7 +958,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subscription = json::value::from_value(object).unwrap(); let mut call = self.hub.subscriptions().update(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -971,7 +971,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -984,7 +984,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1007,10 +1007,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeline_attachments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeline_attachments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.timeline().attachments_delete(opt.value_of("item-id").unwrap_or(""), opt.value_of("attachment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1023,7 +1023,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1036,7 +1036,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1051,11 +1051,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeline_attachments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeline_attachments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.timeline().attachments_get(opt.value_of("item-id").unwrap_or(""), opt.value_of("attachment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1071,7 +1071,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1084,7 +1084,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1112,10 +1112,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeline_attachments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeline_attachments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.timeline().attachments_insert(opt.value_of("item-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1128,7 +1128,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1136,7 +1136,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1144,7 +1144,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1168,10 +1168,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeline_attachments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeline_attachments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.timeline().attachments_list(opt.value_of("item-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1184,7 +1184,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1197,7 +1197,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1220,10 +1220,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeline_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeline_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.timeline().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1236,7 +1236,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1249,7 +1249,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1264,10 +1264,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeline_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeline_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.timeline().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1280,7 +1280,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1293,7 +1293,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1316,13 +1316,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeline_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeline_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1336,8 +1336,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "display-time" => Some(("displayTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creator.kind" => Some(("creator.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1392,7 +1392,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TimelineItem = json::value::from_value(object).unwrap(); let mut call = self.hub.timeline().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1405,7 +1405,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1413,7 +1413,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1421,7 +1421,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1445,10 +1445,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeline_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeline_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.timeline().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source-item-id" => { @@ -1482,7 +1482,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "include-deleted", "max-results", "page-token", "source-item-id", "pinned-only", "bundle-id"].iter().map(|v|*v)); @@ -1496,7 +1496,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1519,13 +1519,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeline_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeline_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1539,8 +1539,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "display-time" => Some(("displayTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creator.kind" => Some(("creator.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1595,7 +1595,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TimelineItem = json::value::from_value(object).unwrap(); let mut call = self.hub.timeline().patch(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1608,7 +1608,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1621,7 +1621,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1644,13 +1644,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _timeline_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _timeline_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1664,8 +1664,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "display-time" => Some(("displayTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "creator.kind" => Some(("creator.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1720,7 +1720,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TimelineItem = json::value::from_value(object).unwrap(); let mut call = self.hub.timeline().update(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1733,7 +1733,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1741,7 +1741,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1749,7 +1749,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1915,14 +1915,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "mirror1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "mirror1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1942,7 +1942,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1982,7 +1982,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("accounts", "methods: 'insert'", vec![ - ("insert", + ("insert", Some(r##"Inserts a new account for a user"##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/accounts_insert", vec![ @@ -2025,7 +2025,7 @@ fn main() { ]), ("contacts", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a contact."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/contacts_delete", vec![ @@ -2041,7 +2041,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a single contact by ID."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/contacts_get", vec![ @@ -2063,7 +2063,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new contact."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/contacts_insert", vec![ @@ -2085,7 +2085,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of contacts for the authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/contacts_list", vec![ @@ -2101,7 +2101,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a contact in place. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/contacts_patch", vec![ @@ -2129,7 +2129,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a contact in place."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/contacts_update", vec![ @@ -2160,7 +2160,7 @@ fn main() { ]), ("locations", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets a single location by ID."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/locations_get", vec![ @@ -2182,7 +2182,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of locations for the user."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/locations_list", vec![ @@ -2201,7 +2201,7 @@ fn main() { ]), ("settings", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Gets a single setting by ID."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/settings_get", vec![ @@ -2228,7 +2228,7 @@ fn main() { ]), ("subscriptions", "methods: 'delete', 'insert', 'list' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a subscription."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/subscriptions_delete", vec![ @@ -2244,7 +2244,7 @@ fn main() { Some(false), Some(true)), ]), - ("insert", + ("insert", Some(r##"Creates a new subscription."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/subscriptions_insert", vec![ @@ -2266,7 +2266,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of subscriptions for the authenticated user and service."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/subscriptions_list", vec![ @@ -2282,7 +2282,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing subscription in place."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/subscriptions_update", vec![ @@ -2313,7 +2313,7 @@ fn main() { ]), ("timeline", "methods: 'attachments-delete', 'attachments-get', 'attachments-insert', 'attachments-list', 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("attachments-delete", + ("attachments-delete", Some(r##"Deletes an attachment from a timeline item."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/timeline_attachments-delete", vec![ @@ -2335,7 +2335,7 @@ fn main() { Some(false), Some(true)), ]), - ("attachments-get", + ("attachments-get", Some(r##"Retrieves an attachment on a timeline item by item ID and attachment ID."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/timeline_attachments-get", vec![ @@ -2363,7 +2363,7 @@ fn main() { Some(false), Some(false)), ]), - ("attachments-insert", + ("attachments-insert", Some(r##"Adds a new attachment to a timeline item."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/timeline_attachments-insert", vec![ @@ -2391,7 +2391,7 @@ fn main() { Some(false), Some(false)), ]), - ("attachments-list", + ("attachments-list", Some(r##"Returns a list of attachments for a timeline item."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/timeline_attachments-list", vec![ @@ -2413,7 +2413,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a timeline item."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/timeline_delete", vec![ @@ -2429,7 +2429,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a single timeline item by ID."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/timeline_get", vec![ @@ -2451,7 +2451,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a new item into the timeline."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/timeline_insert", vec![ @@ -2479,7 +2479,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of timeline items for the authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/timeline_list", vec![ @@ -2495,7 +2495,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a timeline item in place. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/timeline_patch", vec![ @@ -2523,7 +2523,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a timeline item in place."##), "Details at http://byron.github.io/google-apis-rs/google_mirror1_cli/timeline_update", vec![ @@ -2563,7 +2563,7 @@ fn main() { let mut app = App::new("mirror1") .author("Sebastian Thiel ") - .version("0.3.2+20150720") + .version("0.3.3+20151206") .about("API for interacting with Glass users via the timeline.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_mirror1_cli") .arg(Arg::with_name("url") @@ -2587,7 +2587,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -2598,7 +2598,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/mirror1/Cargo.toml b/gen/mirror1/Cargo.toml index 79e8c95ce7..2b2d73997a 100644 --- a/gen/mirror1/Cargo.toml +++ b/gen/mirror1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-mirror1" -version = "0.1.10+20150720" +version = "0.1.11+20151206" authors = ["Sebastian Thiel "] description = "A complete library to interact with mirror (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/mirror1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/mirror1/LICENSE.md b/gen/mirror1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/mirror1/LICENSE.md +++ b/gen/mirror1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/mirror1/README.md b/gen/mirror1/README.md index c9c8c66d6b..26759e4e46 100644 --- a/gen/mirror1/README.md +++ b/gen/mirror1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-mirror1` library allows access to all features of the *Google mirror* service. -This documentation was generated from *mirror* crate version *0.1.10+20150720*, where *20150720* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *mirror* crate version *0.1.11+20151206*, where *20151206* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *mirror* *v1* API can be found at the [official documentation site](https://developers.google.com/glass). diff --git a/gen/mirror1/src/cmn.rs b/gen/mirror1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/mirror1/src/cmn.rs +++ b/gen/mirror1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/mirror1/src/lib.rs b/gen/mirror1/src/lib.rs index bbb83d30ff..f4e7aa3b21 100644 --- a/gen/mirror1/src/lib.rs +++ b/gen/mirror1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *mirror* crate version *0.1.10+20150720*, where *20150720* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *mirror* crate version *0.1.11+20151206*, where *20151206* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *mirror* *v1* API can be found at the //! [official documentation site](https://developers.google.com/glass). diff --git a/gen/mirror1/src/lib.rs.in b/gen/mirror1/src/lib.rs.in index 8b7628be9f..4add18ad94 100644 --- a/gen/mirror1/src/lib.rs.in +++ b/gen/mirror1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -136,7 +137,7 @@ impl<'a, C, A> Mirror Mirror { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -160,7 +161,7 @@ impl<'a, C, A> Mirror } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1532,7 +1533,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.subscriptions.insert", + dlg.begin(MethodInfo { id: "mirror.subscriptions.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1552,14 +1553,14 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1603,7 +1604,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1613,10 +1614,10 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> { self._request = new_value; @@ -1666,12 +1667,12 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1760,7 +1761,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.subscriptions.delete", + dlg.begin(MethodInfo { id: "mirror.subscriptions.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -1801,7 +1802,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1837,7 +1838,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1847,10 +1848,10 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -1891,12 +1892,12 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1992,7 +1993,7 @@ impl<'a, C, A> SubscriptionUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.subscriptions.update", + dlg.begin(MethodInfo { id: "mirror.subscriptions.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -2034,14 +2035,14 @@ impl<'a, C, A> SubscriptionUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2085,7 +2086,7 @@ impl<'a, C, A> SubscriptionUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2095,10 +2096,10 @@ impl<'a, C, A> SubscriptionUpdateCall<'a, C, A> where C: BorrowMut SubscriptionUpdateCall<'a, C, A> where C: BorrowMut SubscriptionUpdateCall<'a, C, A> { self._request = new_value; @@ -2140,7 +2141,7 @@ impl<'a, C, A> SubscriptionUpdateCall<'a, C, A> where C: BorrowMut SubscriptionUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -2158,12 +2159,12 @@ impl<'a, C, A> SubscriptionUpdateCall<'a, C, A> where C: BorrowMut SubscriptionUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2251,7 +2252,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.subscriptions.list", + dlg.begin(MethodInfo { id: "mirror.subscriptions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2271,7 +2272,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::GlasTimeline.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2307,7 +2308,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2317,10 +2318,10 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2361,12 +2362,12 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2383,17 +2384,17 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasTimeline`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubscriptionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2455,7 +2456,7 @@ impl<'a, C, A> TimelineAttachmentListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.timeline.attachments.list", + dlg.begin(MethodInfo { id: "mirror.timeline.attachments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("itemId", self._item_id.to_string())); @@ -2497,7 +2498,7 @@ impl<'a, C, A> TimelineAttachmentListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2533,7 +2534,7 @@ impl<'a, C, A> TimelineAttachmentListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2543,10 +2544,10 @@ impl<'a, C, A> TimelineAttachmentListCall<'a, C, A> where C: BorrowMut TimelineAttachmentListCall<'a, C, A> where C: BorrowMut TimelineAttachmentListCall<'a, C, A> { self._item_id = new_value.to_string(); @@ -2597,12 +2598,12 @@ impl<'a, C, A> TimelineAttachmentListCall<'a, C, A> where C: BorrowMut TimelineAttachmentListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TimelineAttachmentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimelineAttachmentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2699,7 +2700,7 @@ impl<'a, C, A> TimelineInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.timeline.insert", + dlg.begin(MethodInfo { id: "mirror.timeline.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2714,27 +2715,27 @@ impl<'a, C, A> TimelineInsertCall<'a, C, A> where C: BorrowMut, A params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/mirror/v1/timeline".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/mirror/v1/timeline".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { self._scopes.insert(Scope::GlasLocation.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2811,7 +2812,7 @@ impl<'a, C, A> TimelineInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2821,10 +2822,10 @@ impl<'a, C, A> TimelineInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2927,7 +2928,7 @@ impl<'a, C, A> TimelineInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TimelineItem) -> TimelineInsertCall<'a, C, A> { self._request = new_value; @@ -2945,12 +2946,12 @@ impl<'a, C, A> TimelineInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2967,17 +2968,17 @@ impl<'a, C, A> TimelineInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasLocation`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TimelineInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimelineInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3046,7 +3047,7 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.timeline.patch", + dlg.begin(MethodInfo { id: "mirror.timeline.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -3088,14 +3089,14 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3139,7 +3140,7 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3149,10 +3150,10 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3184,7 +3185,7 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TimelineItem) -> TimelinePatchCall<'a, C, A> { self._request = new_value; @@ -3194,7 +3195,7 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TimelinePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -3212,12 +3213,12 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3234,17 +3235,17 @@ impl<'a, C, A> TimelinePatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasLocation`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TimelinePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimelinePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3319,7 +3320,7 @@ impl<'a, C, A> TimelineListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.timeline.list", + dlg.begin(MethodInfo { id: "mirror.timeline.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); if let Some(value) = self._source_item_id { @@ -3360,7 +3361,7 @@ impl<'a, C, A> TimelineListCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::GlasLocation.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3396,7 +3397,7 @@ impl<'a, C, A> TimelineListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3406,10 +3407,10 @@ impl<'a, C, A> TimelineListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3499,12 +3500,12 @@ impl<'a, C, A> TimelineListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3521,17 +3522,17 @@ impl<'a, C, A> TimelineListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasLocation`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TimelineListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimelineListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3595,7 +3596,7 @@ impl<'a, C, A> TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.timeline.attachments.insert", + dlg.begin(MethodInfo { id: "mirror.timeline.attachments.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("itemId", self._item_id.to_string())); @@ -3611,13 +3612,13 @@ impl<'a, C, A> TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3709,7 +3710,7 @@ impl<'a, C, A> TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3719,10 +3720,10 @@ impl<'a, C, A> TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut TimelineAttachmentInsertCall<'a, C, A> { self._item_id = new_value.to_string(); @@ -3844,12 +3845,12 @@ impl<'a, C, A> TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut TimelineAttachmentInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TimelineAttachmentInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimelineAttachmentInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3939,7 +3940,7 @@ impl<'a, C, A> TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.timeline.attachments.delete", + dlg.begin(MethodInfo { id: "mirror.timeline.attachments.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("itemId", self._item_id.to_string())); @@ -3981,7 +3982,7 @@ impl<'a, C, A> TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4017,7 +4018,7 @@ impl<'a, C, A> TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4027,10 +4028,10 @@ impl<'a, C, A> TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut TimelineAttachmentDeleteCall<'a, C, A> { self._item_id = new_value.to_string(); @@ -4063,7 +4064,7 @@ impl<'a, C, A> TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut TimelineAttachmentDeleteCall<'a, C, A> { self._attachment_id = new_value.to_string(); @@ -4081,12 +4082,12 @@ impl<'a, C, A> TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut TimelineAttachmentDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TimelineAttachmentDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimelineAttachmentDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4175,7 +4176,7 @@ impl<'a, C, A> TimelineDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.timeline.delete", + dlg.begin(MethodInfo { id: "mirror.timeline.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -4216,7 +4217,7 @@ impl<'a, C, A> TimelineDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4252,7 +4253,7 @@ impl<'a, C, A> TimelineDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4262,10 +4263,10 @@ impl<'a, C, A> TimelineDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4288,7 +4289,7 @@ impl<'a, C, A> TimelineDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TimelineDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -4306,12 +4307,12 @@ impl<'a, C, A> TimelineDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4328,17 +4329,17 @@ impl<'a, C, A> TimelineDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasLocation`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TimelineDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimelineDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4409,7 +4410,7 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.timeline.update", + dlg.begin(MethodInfo { id: "mirror.timeline.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -4425,13 +4426,13 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/mirror/v1/timeline/{id}".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/mirror/v1/timeline/{id}".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -4459,14 +4460,14 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4543,7 +4544,7 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4553,10 +4554,10 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4659,7 +4660,7 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TimelineItem) -> TimelineUpdateCall<'a, C, A> { self._request = new_value; @@ -4669,7 +4670,7 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TimelineUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -4687,12 +4688,12 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4709,17 +4710,17 @@ impl<'a, C, A> TimelineUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasLocation`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TimelineUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimelineUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4787,7 +4788,7 @@ impl<'a, C, A> TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.timeline.attachments.get", + dlg.begin(MethodInfo { id: "mirror.timeline.attachments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("itemId", self._item_id.to_string())); @@ -4846,7 +4847,7 @@ impl<'a, C, A> TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4882,7 +4883,7 @@ impl<'a, C, A> TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4892,10 +4893,10 @@ impl<'a, C, A> TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut TimelineAttachmentGetCall<'a, C, A> { self._item_id = new_value.to_string(); @@ -4938,7 +4939,7 @@ impl<'a, C, A> TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut TimelineAttachmentGetCall<'a, C, A> { self._attachment_id = new_value.to_string(); @@ -4956,12 +4957,12 @@ impl<'a, C, A> TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut TimelineAttachmentGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TimelineAttachmentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimelineAttachmentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5050,7 +5051,7 @@ impl<'a, C, A> TimelineGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.timeline.get", + dlg.begin(MethodInfo { id: "mirror.timeline.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -5092,7 +5093,7 @@ impl<'a, C, A> TimelineGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5128,7 +5129,7 @@ impl<'a, C, A> TimelineGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5138,10 +5139,10 @@ impl<'a, C, A> TimelineGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5174,7 +5175,7 @@ impl<'a, C, A> TimelineGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TimelineGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -5192,12 +5193,12 @@ impl<'a, C, A> TimelineGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5214,17 +5215,17 @@ impl<'a, C, A> TimelineGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasLocation`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TimelineGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TimelineGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5286,7 +5287,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.settings.get", + dlg.begin(MethodInfo { id: "mirror.settings.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -5328,7 +5329,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5364,7 +5365,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5374,10 +5375,10 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5412,7 +5413,7 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> SettingGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -5430,12 +5431,12 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5452,17 +5453,17 @@ impl<'a, C, A> SettingGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasTimeline`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SettingGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SettingGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5524,7 +5525,7 @@ impl<'a, C, A> LocationGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.locations.get", + dlg.begin(MethodInfo { id: "mirror.locations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -5566,7 +5567,7 @@ impl<'a, C, A> LocationGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5602,7 +5603,7 @@ impl<'a, C, A> LocationGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5612,10 +5613,10 @@ impl<'a, C, A> LocationGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5648,7 +5649,7 @@ impl<'a, C, A> LocationGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> LocationGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -5666,12 +5667,12 @@ impl<'a, C, A> LocationGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5688,17 +5689,17 @@ impl<'a, C, A> LocationGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasLocation`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LocationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LocationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5759,7 +5760,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.locations.list", + dlg.begin(MethodInfo { id: "mirror.locations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -5779,7 +5780,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::GlasLocation.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5815,7 +5816,7 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5825,10 +5826,10 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5869,12 +5870,12 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5891,17 +5892,17 @@ impl<'a, C, A> LocationListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasLocation`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> LocationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LocationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5971,7 +5972,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.accounts.insert", + dlg.begin(MethodInfo { id: "mirror.accounts.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("userToken", self._user_token.to_string())); @@ -6024,14 +6025,14 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6060,7 +6061,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6070,10 +6071,10 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6105,7 +6106,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountInsertCall<'a, C, A> { self._request = new_value; @@ -6115,7 +6116,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user token* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_token(mut self, new_value: &str) -> AccountInsertCall<'a, C, A> { self._user_token = new_value.to_string(); @@ -6125,7 +6126,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *account type* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_type(mut self, new_value: &str) -> AccountInsertCall<'a, C, A> { self._account_type = new_value.to_string(); @@ -6135,7 +6136,7 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *account name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_name(mut self, new_value: &str) -> AccountInsertCall<'a, C, A> { self._account_name = new_value.to_string(); @@ -6153,12 +6154,12 @@ impl<'a, C, A> AccountInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6231,7 +6232,7 @@ impl<'a, C, A> ContactGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.contacts.get", + dlg.begin(MethodInfo { id: "mirror.contacts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -6273,7 +6274,7 @@ impl<'a, C, A> ContactGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6309,7 +6310,7 @@ impl<'a, C, A> ContactGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6319,10 +6320,10 @@ impl<'a, C, A> ContactGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6355,7 +6356,7 @@ impl<'a, C, A> ContactGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ContactGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -6373,12 +6374,12 @@ impl<'a, C, A> ContactGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6395,17 +6396,17 @@ impl<'a, C, A> ContactGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasTimeline`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ContactGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContactGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6467,7 +6468,7 @@ impl<'a, C, A> ContactDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.contacts.delete", + dlg.begin(MethodInfo { id: "mirror.contacts.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -6508,7 +6509,7 @@ impl<'a, C, A> ContactDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6544,7 +6545,7 @@ impl<'a, C, A> ContactDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6554,10 +6555,10 @@ impl<'a, C, A> ContactDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6580,7 +6581,7 @@ impl<'a, C, A> ContactDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ContactDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -6598,12 +6599,12 @@ impl<'a, C, A> ContactDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6620,17 +6621,17 @@ impl<'a, C, A> ContactDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasTimeline`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ContactDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContactDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6698,7 +6699,7 @@ impl<'a, C, A> ContactInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.contacts.insert", + dlg.begin(MethodInfo { id: "mirror.contacts.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -6718,14 +6719,14 @@ impl<'a, C, A> ContactInsertCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::GlasTimeline.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6769,7 +6770,7 @@ impl<'a, C, A> ContactInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6779,10 +6780,10 @@ impl<'a, C, A> ContactInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6814,7 +6815,7 @@ impl<'a, C, A> ContactInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Contact) -> ContactInsertCall<'a, C, A> { self._request = new_value; @@ -6832,12 +6833,12 @@ impl<'a, C, A> ContactInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6854,17 +6855,17 @@ impl<'a, C, A> ContactInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasTimeline`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ContactInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContactInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6933,7 +6934,7 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.contacts.patch", + dlg.begin(MethodInfo { id: "mirror.contacts.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -6975,14 +6976,14 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7026,7 +7027,7 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7036,10 +7037,10 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7071,7 +7072,7 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Contact) -> ContactPatchCall<'a, C, A> { self._request = new_value; @@ -7081,7 +7082,7 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ContactPatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -7099,12 +7100,12 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7121,17 +7122,17 @@ impl<'a, C, A> ContactPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasTimeline`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ContactPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContactPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7192,7 +7193,7 @@ impl<'a, C, A> ContactListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.contacts.list", + dlg.begin(MethodInfo { id: "mirror.contacts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -7212,7 +7213,7 @@ impl<'a, C, A> ContactListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::GlasTimeline.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7248,7 +7249,7 @@ impl<'a, C, A> ContactListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7258,10 +7259,10 @@ impl<'a, C, A> ContactListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7302,12 +7303,12 @@ impl<'a, C, A> ContactListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7324,17 +7325,17 @@ impl<'a, C, A> ContactListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasTimeline`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ContactListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContactListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7403,7 +7404,7 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "mirror.contacts.update", + dlg.begin(MethodInfo { id: "mirror.contacts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -7445,14 +7446,14 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7496,7 +7497,7 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7506,10 +7507,10 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7541,7 +7542,7 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Contact) -> ContactUpdateCall<'a, C, A> { self._request = new_value; @@ -7551,7 +7552,7 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> ContactUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -7569,12 +7570,12 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7591,17 +7592,17 @@ impl<'a, C, A> ContactUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::GlasTimeline`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ContactUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ContactUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/oauth2_v2-cli/Cargo.toml b/gen/oauth2_v2-cli/Cargo.toml index 88f5207b6b..519c8c8dbb 100644 --- a/gen/oauth2_v2-cli/Cargo.toml +++ b/gen/oauth2_v2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-oauth2_v2-cli" -version = "0.3.2+20151002" +version = "0.3.3+20160122" authors = ["Sebastian Thiel "] description = "A complete library to interact with oauth2 (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/oauth2_v2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/oauth2_v2-cli/LICENSE.md b/gen/oauth2_v2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/oauth2_v2-cli/LICENSE.md +++ b/gen/oauth2_v2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/oauth2_v2-cli/README.md b/gen/oauth2_v2-cli/README.md index a63661871d..1372bd9039 100644 --- a/gen/oauth2_v2-cli/README.md +++ b/gen/oauth2_v2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *oauth2* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/oauth2-v2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/oauth2-v2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/oauth2-v2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/oauth2-v2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/oauth2_v2-cli). # Usage -This documentation was generated from the *oauth2* API at revision *20151002*. The CLI is at version *0.3.2*. +This documentation was generated from the *oauth2* API at revision *20160122*. The CLI is at version *0.3.3*. ```bash oauth2-v2 [options] @@ -38,18 +38,18 @@ oauth2-v2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/oauth2_v2-cli/mkdocs.yml b/gen/oauth2_v2-cli/mkdocs.yml index 3a5c2ecb5e..952a6417ea 100644 --- a/gen/oauth2_v2-cli/mkdocs.yml +++ b/gen/oauth2_v2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: oauth2 v0.3.2+20151002 +site_name: oauth2 v0.3.3+20160122 site_url: http://byron.github.io/google-apis-rs/google-oauth2_v2-cli site_description: Write integrating applications with bcore @@ -16,5 +16,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/oauth2_v2-cli/src/main.rs b/gen/oauth2_v2-cli/src/main.rs index 9e4d983e28..ebf9ce1675 100644 --- a/gen/oauth2_v2-cli/src/main.rs +++ b/gen/oauth2_v2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Oauth2>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _methods_get_cert_for_open_id_connect(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _methods_get_cert_for_open_id_connect(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.methods().get_cert_for_open_id_connect(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -94,10 +94,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _methods_tokeninfo(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _methods_tokeninfo(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.methods().tokeninfo(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "token-handle" => { @@ -119,7 +119,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["access-token", "id-token", "token-handle"].iter().map(|v|*v)); @@ -153,10 +153,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _userinfo_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _userinfo_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.userinfo().get(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -169,7 +169,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -182,7 +182,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -205,10 +205,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _userinfo_v2_me_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _userinfo_v2_me_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.userinfo().v2_me_get(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -221,7 +221,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -234,7 +234,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -307,14 +307,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "oauth2-v2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "oauth2-v2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -334,7 +334,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -373,7 +373,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("methods", "methods: 'get-cert-for-open-id-connect' and 'tokeninfo'", vec![ - ("get-cert-for-open-id-connect", + ("get-cert-for-open-id-connect", None, "Details at http://byron.github.io/google-apis-rs/google_oauth2_v2_cli/methods_get-cert-for-open-id-connect", vec![ @@ -389,7 +389,7 @@ fn main() { Some(false), Some(false)), ]), - ("tokeninfo", + ("tokeninfo", None, "Details at http://byron.github.io/google-apis-rs/google_oauth2_v2_cli/methods_tokeninfo", vec![ @@ -408,7 +408,7 @@ fn main() { ]), ("userinfo", "methods: 'get' and 'v2-me-get'", vec![ - ("get", + ("get", None, "Details at http://byron.github.io/google-apis-rs/google_oauth2_v2_cli/userinfo_get", vec![ @@ -424,7 +424,7 @@ fn main() { Some(false), Some(false)), ]), - ("v2-me-get", + ("v2-me-get", None, "Details at http://byron.github.io/google-apis-rs/google_oauth2_v2_cli/userinfo_v2-me-get", vec![ @@ -446,7 +446,7 @@ fn main() { let mut app = App::new("oauth2-v2") .author("Sebastian Thiel ") - .version("0.3.2+20151002") + .version("0.3.3+20160122") .about("Lets you access OAuth2 protocol related APIs.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_oauth2_v2_cli") .arg(Arg::with_name("url") @@ -470,7 +470,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -481,7 +481,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/oauth2_v2/Cargo.toml b/gen/oauth2_v2/Cargo.toml index c56c3d3d9b..dd70db0d8e 100644 --- a/gen/oauth2_v2/Cargo.toml +++ b/gen/oauth2_v2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-oauth2_v2" -version = "0.1.10+20151002" +version = "0.1.11+20160122" authors = ["Sebastian Thiel "] description = "A complete library to interact with oauth2 (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/oauth2_v2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/oauth2_v2/LICENSE.md b/gen/oauth2_v2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/oauth2_v2/LICENSE.md +++ b/gen/oauth2_v2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/oauth2_v2/README.md b/gen/oauth2_v2/README.md index ebeb852c26..46a04c9819 100644 --- a/gen/oauth2_v2/README.md +++ b/gen/oauth2_v2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-oauth2_v2` library allows access to all features of the *Google oauth2* service. -This documentation was generated from *oauth2* crate version *0.1.10+20151002*, where *20151002* is the exact revision of the *oauth2:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *oauth2* crate version *0.1.11+20160122*, where *20160122* is the exact revision of the *oauth2:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *oauth2* *v2* API can be found at the [official documentation site](https://developers.google.com/accounts/docs/OAuth2). diff --git a/gen/oauth2_v2/src/cmn.rs b/gen/oauth2_v2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/oauth2_v2/src/cmn.rs +++ b/gen/oauth2_v2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/oauth2_v2/src/lib.rs b/gen/oauth2_v2/src/lib.rs index 15cc5d351c..e090965bc0 100644 --- a/gen/oauth2_v2/src/lib.rs +++ b/gen/oauth2_v2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *oauth2* crate version *0.1.10+20151002*, where *20151002* is the exact revision of the *oauth2:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *oauth2* crate version *0.1.11+20160122*, where *20160122* is the exact revision of the *oauth2:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *oauth2* *v2* API can be found at the //! [official documentation site](https://developers.google.com/accounts/docs/OAuth2). diff --git a/gen/oauth2_v2/src/lib.rs.in b/gen/oauth2_v2/src/lib.rs.in index 62deeb3865..fc434e6b52 100644 --- a/gen/oauth2_v2/src/lib.rs.in +++ b/gen/oauth2_v2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -138,7 +139,7 @@ impl<'a, C, A> Oauth2 Oauth2 { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -150,7 +151,7 @@ impl<'a, C, A> Oauth2 } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -461,7 +462,7 @@ impl<'a, C, A> UserinfoV2MeGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "oauth2.userinfo.v2.me.get", + dlg.begin(MethodInfo { id: "oauth2.userinfo.v2.me.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -481,7 +482,7 @@ impl<'a, C, A> UserinfoV2MeGetCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::PluLogin.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -517,7 +518,7 @@ impl<'a, C, A> UserinfoV2MeGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -527,10 +528,10 @@ impl<'a, C, A> UserinfoV2MeGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -571,12 +572,12 @@ impl<'a, C, A> UserinfoV2MeGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -593,17 +594,17 @@ impl<'a, C, A> UserinfoV2MeGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluLogin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserinfoV2MeGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserinfoV2MeGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -662,7 +663,7 @@ impl<'a, C, A> UserinfoGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "oauth2.userinfo.get", + dlg.begin(MethodInfo { id: "oauth2.userinfo.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -682,7 +683,7 @@ impl<'a, C, A> UserinfoGetCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::PluLogin.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -718,7 +719,7 @@ impl<'a, C, A> UserinfoGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -728,10 +729,10 @@ impl<'a, C, A> UserinfoGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -772,12 +773,12 @@ impl<'a, C, A> UserinfoGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -794,17 +795,17 @@ impl<'a, C, A> UserinfoGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluLogin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserinfoGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserinfoGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -868,7 +869,7 @@ impl<'a, C, A> MethodTokeninfoCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "oauth2.tokeninfo", + dlg.begin(MethodInfo { id: "oauth2.tokeninfo", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._token_handle { @@ -906,7 +907,7 @@ impl<'a, C, A> MethodTokeninfoCall<'a, C, A> where C: BorrowMut, } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -927,7 +928,7 @@ impl<'a, C, A> MethodTokeninfoCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -937,10 +938,10 @@ impl<'a, C, A> MethodTokeninfoCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -999,12 +1000,12 @@ impl<'a, C, A> MethodTokeninfoCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1073,7 +1074,7 @@ impl<'a, C, A> MethodGetCertForOpenIdConnectCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "oauth2.getCertForOpenIdConnect", + dlg.begin(MethodInfo { id: "oauth2.getCertForOpenIdConnect", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1102,7 +1103,7 @@ impl<'a, C, A> MethodGetCertForOpenIdConnectCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1123,7 +1124,7 @@ impl<'a, C, A> MethodGetCertForOpenIdConnectCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1133,10 +1134,10 @@ impl<'a, C, A> MethodGetCertForOpenIdConnectCall<'a, C, A> where C: BorrowMut MethodGetCertForOpenIdConnectCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with pagespeedonline (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/pagespeedonline2-cli/LICENSE.md b/gen/pagespeedonline2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/pagespeedonline2-cli/LICENSE.md +++ b/gen/pagespeedonline2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/pagespeedonline2-cli/README.md b/gen/pagespeedonline2-cli/README.md index 0f0ee9fc55..cd60adc4fe 100644 --- a/gen/pagespeedonline2-cli/README.md +++ b/gen/pagespeedonline2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *pagespeedonline* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/pagespeedonline2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/pagespeedonline2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/pagespeedonline2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/pagespeedonline2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline2-cli). # Usage -This documentation was generated from the *pagespeedonline* API at revision *20150317*. The CLI is at version *0.3.2*. +This documentation was generated from the *pagespeedonline* API at revision *20150317*. The CLI is at version *0.3.3*. ```bash pagespeedonline2 [options] @@ -34,14 +34,14 @@ pagespeedonline2 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/pagespeedonline2-cli/mkdocs.yml b/gen/pagespeedonline2-cli/mkdocs.yml index ebdedd38eb..589dbb47fa 100644 --- a/gen/pagespeedonline2-cli/mkdocs.yml +++ b/gen/pagespeedonline2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: pagespeedonline v0.3.2+20150317 +site_name: pagespeedonline v0.3.3+20150317 site_url: http://byron.github.io/google-apis-rs/google-pagespeedonline2-cli site_description: Write integrating applications with bcore @@ -13,5 +13,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/pagespeedonline2-cli/src/main.rs b/gen/pagespeedonline2-cli/src/main.rs index ae552d2208..cedf316ab3 100644 --- a/gen/pagespeedonline2-cli/src/main.rs +++ b/gen/pagespeedonline2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Pagespeedonline>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _pagespeedapi_runpagespeed(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _pagespeedapi_runpagespeed(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.pagespeedapi().runpagespeed(opt.value_of("url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "strategy" => { @@ -76,7 +76,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["locale", "filter-third-party-resources", "rule", "screenshot", "strategy"].iter().map(|v|*v)); @@ -143,14 +143,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "pagespeedonline2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "pagespeedonline2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -170,7 +170,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -209,7 +209,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("pagespeedapi", "methods: 'runpagespeed'", vec![ - ("runpagespeed", + ("runpagespeed", Some(r##"Runs PageSpeed analysis on the page at the specified URL, and returns PageSpeed scores, a list of suggestions to make that page faster, and other information."##), "Details at http://byron.github.io/google-apis-rs/google_pagespeedonline2_cli/pagespeedapi_runpagespeed", vec![ @@ -237,7 +237,7 @@ fn main() { let mut app = App::new("pagespeedonline2") .author("Sebastian Thiel ") - .version("0.3.2+20150317") + .version("0.3.3+20150317") .about("Lets you analyze the performance of a web page and get tailored suggestions to make that page faster.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pagespeedonline2_cli") .arg(Arg::with_name("folder") @@ -256,7 +256,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -267,7 +267,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/pagespeedonline2/Cargo.toml b/gen/pagespeedonline2/Cargo.toml index b2617f2985..b95d3f5ebb 100644 --- a/gen/pagespeedonline2/Cargo.toml +++ b/gen/pagespeedonline2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pagespeedonline2" -version = "0.1.10+20150317" +version = "0.1.11+20150317" authors = ["Sebastian Thiel "] description = "A complete library to interact with pagespeedonline (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pagespeedonline2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/pagespeedonline2/LICENSE.md b/gen/pagespeedonline2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/pagespeedonline2/LICENSE.md +++ b/gen/pagespeedonline2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/pagespeedonline2/README.md b/gen/pagespeedonline2/README.md index 561d074b66..1b7db5123f 100644 --- a/gen/pagespeedonline2/README.md +++ b/gen/pagespeedonline2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-pagespeedonline2` library allows access to all features of the *Google pagespeedonline* service. -This documentation was generated from *pagespeedonline* crate version *0.1.10+20150317*, where *20150317* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *pagespeedonline* crate version *0.1.11+20150317*, where *20150317* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *pagespeedonline* *v2* API can be found at the [official documentation site](https://developers.google.com/speed/docs/insights/v2/getting-started). diff --git a/gen/pagespeedonline2/src/cmn.rs b/gen/pagespeedonline2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/pagespeedonline2/src/cmn.rs +++ b/gen/pagespeedonline2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/pagespeedonline2/src/lib.rs b/gen/pagespeedonline2/src/lib.rs index 9689fe04e3..c0a37d7585 100644 --- a/gen/pagespeedonline2/src/lib.rs +++ b/gen/pagespeedonline2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *pagespeedonline* crate version *0.1.10+20150317*, where *20150317* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *pagespeedonline* crate version *0.1.11+20150317*, where *20150317* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *pagespeedonline* *v2* API can be found at the //! [official documentation site](https://developers.google.com/speed/docs/insights/v2/getting-started). diff --git a/gen/pagespeedonline2/src/lib.rs.in b/gen/pagespeedonline2/src/lib.rs.in index dad75060eb..56aa0ab666 100644 --- a/gen/pagespeedonline2/src/lib.rs.in +++ b/gen/pagespeedonline2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -109,7 +110,7 @@ impl<'a, C, A> Pagespeedonline Pagespeedonline { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -118,7 +119,7 @@ impl<'a, C, A> Pagespeedonline } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -585,7 +586,7 @@ impl<'a, C, A> PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pagespeedonline.pagespeedapi.runpagespeed", + dlg.begin(MethodInfo { id: "pagespeedonline.pagespeedapi.runpagespeed", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("url", self._url.to_string())); @@ -634,7 +635,7 @@ impl<'a, C, A> PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -655,7 +656,7 @@ impl<'a, C, A> PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -665,10 +666,10 @@ impl<'a, C, A> PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut PagespeedapiRunpagespeedCall<'a, C, A> { self._url = new_value.to_string(); @@ -755,12 +756,12 @@ impl<'a, C, A> PagespeedapiRunpagespeedCall<'a, C, A> where C: BorrowMut"] description = "A complete library to interact with partners (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/partners2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/partners2-cli/LICENSE.md b/gen/partners2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/partners2-cli/LICENSE.md +++ b/gen/partners2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/partners2-cli/README.md b/gen/partners2-cli/README.md index a176580b1a..c4913c69b5 100644 --- a/gen/partners2-cli/README.md +++ b/gen/partners2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *partners* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/partners2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/partners2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/partners2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/partners2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/partners2-cli). # Usage -This documentation was generated from the *partners* API at revision *20151009*. The CLI is at version *0.3.2*. +This documentation was generated from the *partners* API at revision *20151009*. The CLI is at version *0.3.3*. ```bash partners2 [options] @@ -42,14 +42,14 @@ partners2 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/partners2-cli/mkdocs.yml b/gen/partners2-cli/mkdocs.yml index 09f4c785db..ad6230a299 100644 --- a/gen/partners2-cli/mkdocs.yml +++ b/gen/partners2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: partners v0.3.2+20151009 +site_name: partners v0.3.3+20151009 site_url: http://byron.github.io/google-apis-rs/google-partners2-cli site_description: Write integrating applications with bcore @@ -18,5 +18,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/partners2-cli/src/main.rs b/gen/partners2-cli/src/main.rs index 3850025cfb..9f47fa5dad 100644 --- a/gen/partners2-cli/src/main.rs +++ b/gen/partners2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Partners>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _client_messages_log(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _client_messages_log(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "client-info" => Some(("clientInfo", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "request-metadata.locale" => Some(("requestMetadata.locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -90,7 +90,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LogMessageRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.client_messages().log(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -103,7 +103,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -136,10 +136,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _companies_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _companies_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.companies().get(opt.value_of("company-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "view" => { @@ -185,7 +185,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "request-metadata-locale", "request-metadata-user-overrides-ip-address", "request-metadata-partners-session-id", "request-metadata-traffic-source-traffic-sub-id", "request-metadata-user-overrides-user-id", "address", "request-metadata-experiment-ids", "currency-code", "request-metadata-traffic-source-traffic-source-id", "view"].iter().map(|v|*v)); @@ -219,13 +219,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _companies_leads_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _companies_leads_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -239,8 +239,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "request-metadata.locale" => Some(("requestMetadata.locale", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "request-metadata.partners-session-id" => Some(("requestMetadata.partnersSessionId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -275,7 +275,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreateLeadRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.companies().leads_create(request, opt.value_of("company-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -288,7 +288,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -321,10 +321,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _companies_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _companies_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.companies().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "website-url" => { @@ -409,7 +409,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "page-size", "request-metadata-partners-session-id", "max-monthly-budget-currency-code", "max-monthly-budget-nanos", "language-codes", "min-monthly-budget-nanos", "request-metadata-traffic-source-traffic-sub-id", "industries", "min-monthly-budget-currency-code", "min-monthly-budget-units", "page-token", "request-metadata-locale", "request-metadata-traffic-source-traffic-source-id", "company-name", "address", "services", "request-metadata-experiment-ids", "gps-motivations", "request-metadata-user-overrides-ip-address", "website-url", "request-metadata-user-overrides-user-id", "view", "max-monthly-budget-units"].iter().map(|v|*v)); @@ -443,13 +443,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_events_log(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_events_log(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -463,8 +463,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "lead.gps-motivations" => Some(("lead.gpsMotivations", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "lead.family-name" => Some(("lead.familyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -501,7 +501,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LogUserEventRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.user_events().log(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -514,7 +514,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -547,10 +547,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _user_states_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _user_states_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.user_states().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "request-metadata-user-overrides-user-id" => { @@ -584,7 +584,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["request-metadata-user-overrides-user-id", "request-metadata-user-overrides-ip-address", "request-metadata-partners-session-id", "request-metadata-traffic-source-traffic-sub-id", "request-metadata-locale", "request-metadata-experiment-ids", "request-metadata-traffic-source-traffic-source-id"].iter().map(|v|*v)); @@ -690,14 +690,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "partners2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "partners2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -717,7 +717,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -760,7 +760,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("client-messages", "methods: 'log'", vec![ - ("log", + ("log", Some(r##"Logs a generic message from the client, such as `Failed to render component`, `Profile page is running slow`, `More than 500 users have accessed this result.`, etc."##), "Details at http://byron.github.io/google-apis-rs/google_partners2_cli/client-messages_log", vec![ @@ -785,7 +785,7 @@ fn main() { ]), ("companies", "methods: 'get', 'leads-create' and 'list'", vec![ - ("get", + ("get", Some(r##"Gets a company."##), "Details at http://byron.github.io/google-apis-rs/google_partners2_cli/companies_get", vec![ @@ -807,7 +807,7 @@ fn main() { Some(false), Some(false)), ]), - ("leads-create", + ("leads-create", Some(r##"Creates an advertiser lead for the given company ID."##), "Details at http://byron.github.io/google-apis-rs/google_partners2_cli/companies_leads-create", vec![ @@ -835,7 +835,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists companies."##), "Details at http://byron.github.io/google-apis-rs/google_partners2_cli/companies_list", vec![ @@ -854,7 +854,7 @@ fn main() { ]), ("user-events", "methods: 'log'", vec![ - ("log", + ("log", Some(r##"Logs a user event."##), "Details at http://byron.github.io/google-apis-rs/google_partners2_cli/user-events_log", vec![ @@ -879,7 +879,7 @@ fn main() { ]), ("user-states", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Lists states for current user."##), "Details at http://byron.github.io/google-apis-rs/google_partners2_cli/user-states_list", vec![ @@ -901,7 +901,7 @@ fn main() { let mut app = App::new("partners2") .author("Sebastian Thiel ") - .version("0.3.2+20151009") + .version("0.3.3+20151009") .about("Lets advertisers search certified companies and create contact leads with them, and also audits the usage of clients.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_partners2_cli") .arg(Arg::with_name("folder") @@ -920,7 +920,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -931,7 +931,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/partners2/Cargo.toml b/gen/partners2/Cargo.toml index efd1f6b0bd..f0428fc732 100644 --- a/gen/partners2/Cargo.toml +++ b/gen/partners2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-partners2" -version = "0.1.10+20151009" +version = "0.1.11+20151009" authors = ["Sebastian Thiel "] description = "A complete library to interact with partners (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/partners2" diff --git a/gen/partners2/LICENSE.md b/gen/partners2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/partners2/LICENSE.md +++ b/gen/partners2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/partners2/README.md b/gen/partners2/README.md index 785721c6f3..db2bdf0806 100644 --- a/gen/partners2/README.md +++ b/gen/partners2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-partners2` library allows access to all features of the *Google partners* service. -This documentation was generated from *partners* crate version *0.1.10+20151009*, where *20151009* is the exact revision of the *partners:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *partners* crate version *0.1.11+20151009*, where *20151009* is the exact revision of the *partners:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *partners* *v2* API can be found at the [official documentation site](https://developers.google.com/partners/). diff --git a/gen/partners2/src/cmn.rs b/gen/partners2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/partners2/src/cmn.rs +++ b/gen/partners2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/partners2/src/lib.rs b/gen/partners2/src/lib.rs index 114a1f977f..7b78fd071a 100644 --- a/gen/partners2/src/lib.rs +++ b/gen/partners2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *partners* crate version *0.1.10+20151009*, where *20151009* is the exact revision of the *partners:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *partners* crate version *0.1.11+20151009*, where *20151009* is the exact revision of the *partners:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *partners* *v2* API can be found at the //! [official documentation site](https://developers.google.com/partners/). diff --git a/gen/partners2/src/lib.rs.in b/gen/partners2/src/lib.rs.in index a7e22ff6a3..b5a920b861 100644 --- a/gen/partners2/src/lib.rs.in +++ b/gen/partners2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -110,7 +111,7 @@ impl<'a, C, A> Partners Partners { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -128,7 +129,7 @@ impl<'a, C, A> Partners } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1067,7 +1068,7 @@ impl<'a, C, A> UserEventLogCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "partners.userEvents.log", + dlg.begin(MethodInfo { id: "partners.userEvents.log", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1096,14 +1097,14 @@ impl<'a, C, A> UserEventLogCall<'a, C, A> where C: BorrowMut, A: } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1132,7 +1133,7 @@ impl<'a, C, A> UserEventLogCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1142,10 +1143,10 @@ impl<'a, C, A> UserEventLogCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1177,7 +1178,7 @@ impl<'a, C, A> UserEventLogCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LogUserEventRequest) -> UserEventLogCall<'a, C, A> { self._request = new_value; @@ -1195,12 +1196,12 @@ impl<'a, C, A> UserEventLogCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1284,7 +1285,7 @@ impl<'a, C, A> ClientMessageLogCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "partners.clientMessages.log", + dlg.begin(MethodInfo { id: "partners.clientMessages.log", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1313,14 +1314,14 @@ impl<'a, C, A> ClientMessageLogCall<'a, C, A> where C: BorrowMut, } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1349,7 +1350,7 @@ impl<'a, C, A> ClientMessageLogCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1359,10 +1360,10 @@ impl<'a, C, A> ClientMessageLogCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1394,7 +1395,7 @@ impl<'a, C, A> ClientMessageLogCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: LogMessageRequest) -> ClientMessageLogCall<'a, C, A> { self._request = new_value; @@ -1412,12 +1413,12 @@ impl<'a, C, A> ClientMessageLogCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1517,7 +1518,7 @@ impl<'a, C, A> CompanyGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "partners.companies.get", + dlg.begin(MethodInfo { id: "partners.companies.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((14 + self._additional_params.len())); params.push(("companyId", self._company_id.to_string())); @@ -1605,7 +1606,7 @@ impl<'a, C, A> CompanyGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1626,7 +1627,7 @@ impl<'a, C, A> CompanyGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1636,10 +1637,10 @@ impl<'a, C, A> CompanyGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1672,7 +1673,7 @@ impl<'a, C, A> CompanyGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *company id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn company_id(mut self, new_value: &str) -> CompanyGetCall<'a, C, A> { self._company_id = new_value.to_string(); @@ -1768,12 +1769,12 @@ impl<'a, C, A> CompanyGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1858,7 +1859,7 @@ impl<'a, C, A> CompanyLeadCreateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "partners.companies.leads.create", + dlg.begin(MethodInfo { id: "partners.companies.leads.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("companyId", self._company_id.to_string())); @@ -1909,14 +1910,14 @@ impl<'a, C, A> CompanyLeadCreateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1945,7 +1946,7 @@ impl<'a, C, A> CompanyLeadCreateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1955,10 +1956,10 @@ impl<'a, C, A> CompanyLeadCreateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1990,7 +1991,7 @@ impl<'a, C, A> CompanyLeadCreateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: CreateLeadRequest) -> CompanyLeadCreateCall<'a, C, A> { self._request = new_value; @@ -2000,7 +2001,7 @@ impl<'a, C, A> CompanyLeadCreateCall<'a, C, A> where C: BorrowMut /// /// Sets the *company id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn company_id(mut self, new_value: &str) -> CompanyLeadCreateCall<'a, C, A> { self._company_id = new_value.to_string(); @@ -2018,12 +2019,12 @@ impl<'a, C, A> CompanyLeadCreateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2148,7 +2149,7 @@ impl<'a, C, A> CompanyListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "partners.companies.list", + dlg.begin(MethodInfo { id: "partners.companies.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((26 + self._additional_params.len())); if let Some(value) = self._website_url { @@ -2269,7 +2270,7 @@ impl<'a, C, A> CompanyListCall<'a, C, A> where C: BorrowMut, A: o } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2290,7 +2291,7 @@ impl<'a, C, A> CompanyListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2300,10 +2301,10 @@ impl<'a, C, A> CompanyListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2517,12 +2518,12 @@ impl<'a, C, A> CompanyListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2613,7 +2614,7 @@ impl<'a, C, A> UserStateListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "partners.userStates.list", + dlg.begin(MethodInfo { id: "partners.userStates.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); if let Some(value) = self._request_metadata_user_overrides_user_id { @@ -2667,7 +2668,7 @@ impl<'a, C, A> UserStateListCall<'a, C, A> where C: BorrowMut, A: } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2688,7 +2689,7 @@ impl<'a, C, A> UserStateListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2698,10 +2699,10 @@ impl<'a, C, A> UserStateListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2792,12 +2793,12 @@ impl<'a, C, A> UserStateListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. diff --git a/gen/playmoviespartner1-cli/Cargo.toml b/gen/playmoviespartner1-cli/Cargo.toml index 005e632e27..6c192d1342 100644 --- a/gen/playmoviespartner1-cli/Cargo.toml +++ b/gen/playmoviespartner1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-playmoviespartner1-cli" -version = "0.3.2+20150812" +version = "0.3.3+20150812" authors = ["Sebastian Thiel "] description = "A complete library to interact with playmoviespartner (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/playmoviespartner1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/playmoviespartner1-cli/LICENSE.md b/gen/playmoviespartner1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/playmoviespartner1-cli/LICENSE.md +++ b/gen/playmoviespartner1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/playmoviespartner1-cli/README.md b/gen/playmoviespartner1-cli/README.md index da438fb982..53d6a9336d 100644 --- a/gen/playmoviespartner1-cli/README.md +++ b/gen/playmoviespartner1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *playmoviespartner* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/playmoviespartner1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/playmoviespartner1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/playmoviespartner1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/playmoviespartner1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/playmoviespartner1-cli). # Usage -This documentation was generated from the *playmoviespartner* API at revision *20150812*. The CLI is at version *0.3.2*. +This documentation was generated from the *playmoviespartner* API at revision *20150812*. The CLI is at version *0.3.3*. ```bash playmoviespartner1 [options] @@ -40,18 +40,18 @@ playmoviespartner1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/playmoviespartner1-cli/mkdocs.yml b/gen/playmoviespartner1-cli/mkdocs.yml index 7cfb5d6562..746408d4e2 100644 --- a/gen/playmoviespartner1-cli/mkdocs.yml +++ b/gen/playmoviespartner1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: playmoviespartner v0.3.2+20150812 +site_name: playmoviespartner v0.3.3+20150812 site_url: http://byron.github.io/google-apis-rs/google-playmoviespartner1-cli site_description: Write integrating applications with bcore @@ -19,5 +19,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/playmoviespartner1-cli/src/main.rs b/gen/playmoviespartner1-cli/src/main.rs index a0ba81f058..c2fe56b7f9 100644 --- a/gen/playmoviespartner1-cli/src/main.rs +++ b/gen/playmoviespartner1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Playmoviespartner>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _accounts_avails_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _accounts_avails_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().avails_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "video-ids" => { @@ -85,7 +85,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["pph-names", "alt-id", "video-ids", "page-size", "page-token", "title", "studio-names", "territories"].iter().map(|v|*v)); @@ -99,7 +99,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -122,10 +122,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_experience_locales_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_experience_locales_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().experience_locales_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("el-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -138,7 +138,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -151,7 +151,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -174,10 +174,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_experience_locales_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_experience_locales_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().experience_locales_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "title-level-eidr" => { @@ -217,7 +217,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "pph-names", "title-level-eidr", "page-size", "studio-names", "page-token", "edit-level-eidr", "custom-id", "alt-cut-id"].iter().map(|v|*v)); @@ -231,7 +231,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -254,10 +254,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_orders_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_orders_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().orders_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("order-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -270,7 +270,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -283,7 +283,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -306,10 +306,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_orders_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_orders_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().orders_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "studio-names" => { @@ -343,7 +343,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["status", "pph-names", "name", "page-size", "studio-names", "page-token", "custom-id"].iter().map(|v|*v)); @@ -357,7 +357,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -380,10 +380,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_store_infos_country_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_store_infos_country_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().store_infos_country_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("video-id").unwrap_or(""), opt.value_of("country").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -396,7 +396,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -409,7 +409,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -432,10 +432,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_store_infos_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_store_infos_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().store_infos_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "video-ids" => { @@ -472,7 +472,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["pph-names", "video-ids", "page-size", "countries", "studio-names", "video-id", "page-token", "name"].iter().map(|v|*v)); @@ -486,7 +486,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -560,14 +560,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "playmoviespartner1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "playmoviespartner1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -587,7 +587,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -630,7 +630,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("accounts", "methods: 'avails-list', 'experience-locales-get', 'experience-locales-list', 'orders-get', 'orders-list', 'store-infos-country-get' and 'store-infos-list'", vec![ - ("avails-list", + ("avails-list", Some(r##"List Avails owned or managed by the partner. See _Authentication and Authorization rules_ and _List methods rules_ for more information about this method."##), "Details at http://byron.github.io/google-apis-rs/google_playmoviespartner1_cli/accounts_avails-list", vec![ @@ -652,7 +652,7 @@ fn main() { Some(false), Some(false)), ]), - ("experience-locales-get", + ("experience-locales-get", Some(r##"Get an ExperienceLocale given its id. See _Authentication and Authorization rules_ and _Get methods rules_ for more information about this method."##), "Details at http://byron.github.io/google-apis-rs/google_playmoviespartner1_cli/accounts_experience-locales-get", vec![ @@ -680,7 +680,7 @@ fn main() { Some(false), Some(false)), ]), - ("experience-locales-list", + ("experience-locales-list", Some(r##"List ExperienceLocales owned or managed by the partner. See _Authentication and Authorization rules_ and _List methods rules_ for more information about this method."##), "Details at http://byron.github.io/google-apis-rs/google_playmoviespartner1_cli/accounts_experience-locales-list", vec![ @@ -702,7 +702,7 @@ fn main() { Some(false), Some(false)), ]), - ("orders-get", + ("orders-get", Some(r##"Get an Order given its id. See _Authentication and Authorization rules_ and _Get methods rules_ for more information about this method."##), "Details at http://byron.github.io/google-apis-rs/google_playmoviespartner1_cli/accounts_orders-get", vec![ @@ -730,7 +730,7 @@ fn main() { Some(false), Some(false)), ]), - ("orders-list", + ("orders-list", Some(r##"List Orders owned or managed by the partner. See _Authentication and Authorization rules_ and _List methods rules_ for more information about this method."##), "Details at http://byron.github.io/google-apis-rs/google_playmoviespartner1_cli/accounts_orders-list", vec![ @@ -752,7 +752,7 @@ fn main() { Some(false), Some(false)), ]), - ("store-infos-country-get", + ("store-infos-country-get", Some(r##"Get a StoreInfo given its video id and country. See _Authentication and Authorization rules_ and _Get methods rules_ for more information about this method."##), "Details at http://byron.github.io/google-apis-rs/google_playmoviespartner1_cli/accounts_store-infos-country-get", vec![ @@ -786,7 +786,7 @@ fn main() { Some(false), Some(false)), ]), - ("store-infos-list", + ("store-infos-list", Some(r##"List StoreInfos owned or managed by the partner. See _Authentication and Authorization rules_ and _List methods rules_ for more information about this method."##), "Details at http://byron.github.io/google-apis-rs/google_playmoviespartner1_cli/accounts_store-infos-list", vec![ @@ -814,7 +814,7 @@ fn main() { let mut app = App::new("playmoviespartner1") .author("Sebastian Thiel ") - .version("0.3.2+20150812") + .version("0.3.3+20150812") .about("Lets Google Play Movies Partners get the delivery status of their titles.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_playmoviespartner1_cli") .arg(Arg::with_name("url") @@ -838,7 +838,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -849,7 +849,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/playmoviespartner1/Cargo.toml b/gen/playmoviespartner1/Cargo.toml index 2e2fe106c5..5e56f4e0af 100644 --- a/gen/playmoviespartner1/Cargo.toml +++ b/gen/playmoviespartner1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-playmoviespartner1" -version = "0.1.10+20150812" +version = "0.1.11+20150812" authors = ["Sebastian Thiel "] description = "A complete library to interact with playmoviespartner (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/playmoviespartner1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/playmoviespartner1/LICENSE.md b/gen/playmoviespartner1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/playmoviespartner1/LICENSE.md +++ b/gen/playmoviespartner1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/playmoviespartner1/README.md b/gen/playmoviespartner1/README.md index 31881d6f26..d687e88744 100644 --- a/gen/playmoviespartner1/README.md +++ b/gen/playmoviespartner1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-playmoviespartner1` library allows access to all features of the *Google playmoviespartner* service. -This documentation was generated from *playmoviespartner* crate version *0.1.10+20150812*, where *20150812* is the exact revision of the *playmoviespartner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *playmoviespartner* crate version *0.1.11+20150812*, where *20150812* is the exact revision of the *playmoviespartner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *playmoviespartner* *v1* API can be found at the [official documentation site](https://developers.google.com/playmoviespartner/). diff --git a/gen/playmoviespartner1/src/cmn.rs b/gen/playmoviespartner1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/playmoviespartner1/src/cmn.rs +++ b/gen/playmoviespartner1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/playmoviespartner1/src/lib.rs b/gen/playmoviespartner1/src/lib.rs index b9415d7316..b3281af526 100644 --- a/gen/playmoviespartner1/src/lib.rs +++ b/gen/playmoviespartner1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *playmoviespartner* crate version *0.1.10+20150812*, where *20150812* is the exact revision of the *playmoviespartner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *playmoviespartner* crate version *0.1.11+20150812*, where *20150812* is the exact revision of the *playmoviespartner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *playmoviespartner* *v1* API can be found at the //! [official documentation site](https://developers.google.com/playmoviespartner/). diff --git a/gen/playmoviespartner1/src/lib.rs.in b/gen/playmoviespartner1/src/lib.rs.in index 063deb74cf..1edb9f5744 100644 --- a/gen/playmoviespartner1/src/lib.rs.in +++ b/gen/playmoviespartner1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -126,7 +127,7 @@ impl<'a, C, A> Playmoviespartner Playmoviespartner { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -135,7 +136,7 @@ impl<'a, C, A> Playmoviespartner } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -866,7 +867,7 @@ impl<'a, C, A> AccountOrderListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "playmoviespartner.accounts.orders.list", + dlg.begin(MethodInfo { id: "playmoviespartner.accounts.orders.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -941,7 +942,7 @@ impl<'a, C, A> AccountOrderListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -977,7 +978,7 @@ impl<'a, C, A> AccountOrderListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -987,10 +988,10 @@ impl<'a, C, A> AccountOrderListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1023,7 +1024,7 @@ impl<'a, C, A> AccountOrderListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountOrderListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -1093,12 +1094,12 @@ impl<'a, C, A> AccountOrderListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1121,17 +1122,17 @@ impl<'a, C, A> AccountOrderListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PlaymovyPartnerReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountOrderListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountOrderListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1195,7 +1196,7 @@ impl<'a, C, A> AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "playmoviespartner.accounts.storeInfos.country.get", + dlg.begin(MethodInfo { id: "playmoviespartner.accounts.storeInfos.country.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -1239,7 +1240,7 @@ impl<'a, C, A> AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1275,7 +1276,7 @@ impl<'a, C, A> AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1285,10 +1286,10 @@ impl<'a, C, A> AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut AccountStoreInfoCountryGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -1331,7 +1332,7 @@ impl<'a, C, A> AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut AccountStoreInfoCountryGetCall<'a, C, A> { self._video_id = new_value.to_string(); @@ -1341,7 +1342,7 @@ impl<'a, C, A> AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut AccountStoreInfoCountryGetCall<'a, C, A> { self._country = new_value.to_string(); @@ -1359,12 +1360,12 @@ impl<'a, C, A> AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut AccountStoreInfoCountryGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountStoreInfoCountryGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountStoreInfoCountryGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1460,7 +1461,7 @@ impl<'a, C, A> AccountOrderGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "playmoviespartner.accounts.orders.get", + dlg.begin(MethodInfo { id: "playmoviespartner.accounts.orders.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -1503,7 +1504,7 @@ impl<'a, C, A> AccountOrderGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1539,7 +1540,7 @@ impl<'a, C, A> AccountOrderGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1549,10 +1550,10 @@ impl<'a, C, A> AccountOrderGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1585,7 +1586,7 @@ impl<'a, C, A> AccountOrderGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountOrderGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -1595,7 +1596,7 @@ impl<'a, C, A> AccountOrderGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *order id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn order_id(mut self, new_value: &str) -> AccountOrderGetCall<'a, C, A> { self._order_id = new_value.to_string(); @@ -1613,12 +1614,12 @@ impl<'a, C, A> AccountOrderGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1641,17 +1642,17 @@ impl<'a, C, A> AccountOrderGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PlaymovyPartnerReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountOrderGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountOrderGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1729,7 +1730,7 @@ impl<'a, C, A> AccountAvailListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "playmoviespartner.accounts.avails.list", + dlg.begin(MethodInfo { id: "playmoviespartner.accounts.avails.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -1811,7 +1812,7 @@ impl<'a, C, A> AccountAvailListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1847,7 +1848,7 @@ impl<'a, C, A> AccountAvailListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1857,10 +1858,10 @@ impl<'a, C, A> AccountAvailListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1893,7 +1894,7 @@ impl<'a, C, A> AccountAvailListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountAvailListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -1971,12 +1972,12 @@ impl<'a, C, A> AccountAvailListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1999,17 +2000,17 @@ impl<'a, C, A> AccountAvailListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PlaymovyPartnerReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountAvailListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountAvailListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2072,7 +2073,7 @@ impl<'a, C, A> AccountExperienceLocaleGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "playmoviespartner.accounts.experienceLocales.get", + dlg.begin(MethodInfo { id: "playmoviespartner.accounts.experienceLocales.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2115,7 +2116,7 @@ impl<'a, C, A> AccountExperienceLocaleGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2151,7 +2152,7 @@ impl<'a, C, A> AccountExperienceLocaleGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2161,10 +2162,10 @@ impl<'a, C, A> AccountExperienceLocaleGetCall<'a, C, A> where C: BorrowMut AccountExperienceLocaleGetCall<'a, C, A> where C: BorrowMut AccountExperienceLocaleGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2207,7 +2208,7 @@ impl<'a, C, A> AccountExperienceLocaleGetCall<'a, C, A> where C: BorrowMut AccountExperienceLocaleGetCall<'a, C, A> { self._el_id = new_value.to_string(); @@ -2225,12 +2226,12 @@ impl<'a, C, A> AccountExperienceLocaleGetCall<'a, C, A> where C: BorrowMut AccountExperienceLocaleGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountExperienceLocaleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountExperienceLocaleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2341,7 +2342,7 @@ impl<'a, C, A> AccountStoreInfoListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "playmoviespartner.accounts.storeInfos.list", + dlg.begin(MethodInfo { id: "playmoviespartner.accounts.storeInfos.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2423,7 +2424,7 @@ impl<'a, C, A> AccountStoreInfoListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2459,7 +2460,7 @@ impl<'a, C, A> AccountStoreInfoListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2469,10 +2470,10 @@ impl<'a, C, A> AccountStoreInfoListCall<'a, C, A> where C: BorrowMut AccountStoreInfoListCall<'a, C, A> where C: BorrowMut AccountStoreInfoListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2583,12 +2584,12 @@ impl<'a, C, A> AccountStoreInfoListCall<'a, C, A> where C: BorrowMut AccountStoreInfoListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountStoreInfoListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountStoreInfoListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2701,7 +2702,7 @@ impl<'a, C, A> AccountExperienceLocaleListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "playmoviespartner.accounts.experienceLocales.list", + dlg.begin(MethodInfo { id: "playmoviespartner.accounts.experienceLocales.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2782,7 +2783,7 @@ impl<'a, C, A> AccountExperienceLocaleListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2818,7 +2819,7 @@ impl<'a, C, A> AccountExperienceLocaleListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2828,10 +2829,10 @@ impl<'a, C, A> AccountExperienceLocaleListCall<'a, C, A> where C: BorrowMut AccountExperienceLocaleListCall<'a, C, A> where C: BorrowMut AccountExperienceLocaleListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2948,12 +2949,12 @@ impl<'a, C, A> AccountExperienceLocaleListCall<'a, C, A> where C: BorrowMut AccountExperienceLocaleListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountExperienceLocaleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountExperienceLocaleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/plus1-cli/Cargo.toml b/gen/plus1-cli/Cargo.toml index 082b883257..f272dccfb7 100644 --- a/gen/plus1-cli/Cargo.toml +++ b/gen/plus1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plus1-cli" -version = "0.3.2+20151014" +version = "0.3.3+20160127" authors = ["Sebastian Thiel "] description = "A complete library to interact with plus (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plus1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/plus1-cli/LICENSE.md b/gen/plus1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/plus1-cli/LICENSE.md +++ b/gen/plus1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/plus1-cli/README.md b/gen/plus1-cli/README.md index 414d431f8b..99234baf1a 100644 --- a/gen/plus1-cli/README.md +++ b/gen/plus1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *plus* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/plus1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/plus1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/plus1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/plus1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/plus1-cli). # Usage -This documentation was generated from the *plus* API at revision *20151014*. The CLI is at version *0.3.2*. +This documentation was generated from the *plus* API at revision *20160127*. The CLI is at version *0.3.3*. ```bash plus1 [options] @@ -35,9 +35,6 @@ plus1 [options] comments get [-p ]... [-o ] list [-p ]... [-o ] - moments - insert (-r )... [-p ]... [-o ] - list [-p ]... [-o ] people get [-p ]... [-o ] list [-p ]... [-o ] @@ -47,18 +44,18 @@ plus1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/plus1-cli/mkdocs.yml b/gen/plus1-cli/mkdocs.yml index 40b90ad0e1..d65ea1b76d 100644 --- a/gen/plus1-cli/mkdocs.yml +++ b/gen/plus1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: plus v0.3.2+20151014 +site_name: plus v0.3.3+20160127 site_url: http://byron.github.io/google-apis-rs/google-plus1-cli site_description: Write integrating applications with bcore @@ -14,8 +14,6 @@ pages: - ['activities_search.md', 'Activities', 'Search'] - ['comments_get.md', 'Comments', 'Get'] - ['comments_list.md', 'Comments', 'List'] -- ['moments_insert.md', 'Moments', 'Insert'] -- ['moments_list.md', 'Moments', 'List'] - ['people_get.md', 'People', 'Get'] - ['people_list.md', 'People', 'List'] - ['people_list-by-activity.md', 'People', 'List By Activity'] @@ -23,5 +21,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/plus1-cli/src/main.rs b/gen/plus1-cli/src/main.rs index 1c57804573..f9e03fe803 100644 --- a/gen/plus1-cli/src/main.rs +++ b/gen/plus1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Plus>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _activities_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _activities_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.activities().get(opt.value_of("activity-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _activities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.activities().list(opt.value_of("user-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -119,7 +119,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -133,7 +133,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -156,10 +156,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _activities_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _activities_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.activities().search(opt.value_of("query").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -184,7 +184,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "page-token", "language", "max-results"].iter().map(|v|*v)); @@ -198,7 +198,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -221,10 +221,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().get(opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -237,7 +237,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -250,7 +250,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -273,10 +273,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().list(opt.value_of("activity-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -298,7 +298,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "sort-order", "max-results"].iter().map(|v|*v)); @@ -312,7 +312,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -335,287 +335,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _moments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - - let mut field_cursor = FieldCursor::default(); - let mut object = json::value::Value::Object(Default::default()); - - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - - let type_info: Option<(&'static str, JsonTypeInfo)> = - match &temp_cursor.to_string()[..] { - "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.start-date" => Some(("target.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.end-date" => Some(("target.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.text" => Some(("target.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.image" => Some(("target.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.birth-date" => Some(("target.birthDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.date-published" => Some(("target.datePublished", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.address-locality" => Some(("target.addressLocality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.additional-name" => Some(("target.additionalName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "target.worst-rating" => Some(("target.worstRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.duration" => Some(("target.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.thumbnail-url" => Some(("target.thumbnailUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.id" => Some(("target.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.post-office-box-number" => Some(("target.postOfficeBoxNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.caption" => Some(("target.caption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.best-rating" => Some(("target.bestRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.address-country" => Some(("target.addressCountry", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "target.width" => Some(("target.width", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.street-address" => Some(("target.streetAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.latitude" => Some(("target.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "target.embed-url" => Some(("target.embedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.type" => Some(("target.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.date-modified" => Some(("target.dateModified", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.content-size" => Some(("target.contentSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.content-url" => Some(("target.contentUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.description" => Some(("target.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.family-name" => Some(("target.familyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.date-created" => Some(("target.dateCreated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.postal-code" => Some(("target.postalCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.attendee-count" => Some(("target.attendeeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "target.height" => Some(("target.height", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.ticker-symbol" => Some(("target.tickerSymbol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.player-type" => Some(("target.playerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.kind" => Some(("target.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.name" => Some(("target.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.url" => Some(("target.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.gender" => Some(("target.gender", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.longitude" => Some(("target.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "target.address-region" => Some(("target.addressRegion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.rating-value" => Some(("target.ratingValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "target.given-name" => Some(("target.givenName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.start-date" => Some(("object.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.end-date" => Some(("object.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.text" => Some(("object.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.image" => Some(("object.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.birth-date" => Some(("object.birthDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.date-published" => Some(("object.datePublished", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.address-locality" => Some(("object.addressLocality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.additional-name" => Some(("object.additionalName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "object.worst-rating" => Some(("object.worstRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.duration" => Some(("object.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.thumbnail-url" => Some(("object.thumbnailUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.id" => Some(("object.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.post-office-box-number" => Some(("object.postOfficeBoxNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.caption" => Some(("object.caption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.best-rating" => Some(("object.bestRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.address-country" => Some(("object.addressCountry", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "object.width" => Some(("object.width", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.street-address" => Some(("object.streetAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.latitude" => Some(("object.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "object.embed-url" => Some(("object.embedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.type" => Some(("object.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.date-modified" => Some(("object.dateModified", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.content-size" => Some(("object.contentSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.content-url" => Some(("object.contentUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.description" => Some(("object.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.family-name" => Some(("object.familyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.date-created" => Some(("object.dateCreated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.postal-code" => Some(("object.postalCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.attendee-count" => Some(("object.attendeeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "object.height" => Some(("object.height", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.ticker-symbol" => Some(("object.tickerSymbol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.player-type" => Some(("object.playerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.kind" => Some(("object.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.name" => Some(("object.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.url" => Some(("object.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.gender" => Some(("object.gender", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.longitude" => Some(("object.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "object.address-region" => Some(("object.addressRegion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.rating-value" => Some(("object.ratingValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "object.given-name" => Some(("object.givenName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.start-date" => Some(("result.startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.end-date" => Some(("result.endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.text" => Some(("result.text", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.image" => Some(("result.image", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.birth-date" => Some(("result.birthDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.date-published" => Some(("result.datePublished", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.address-locality" => Some(("result.addressLocality", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.additional-name" => Some(("result.additionalName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "result.worst-rating" => Some(("result.worstRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.duration" => Some(("result.duration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.thumbnail-url" => Some(("result.thumbnailUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.id" => Some(("result.id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.post-office-box-number" => Some(("result.postOfficeBoxNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.caption" => Some(("result.caption", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.best-rating" => Some(("result.bestRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.address-country" => Some(("result.addressCountry", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "result.width" => Some(("result.width", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.street-address" => Some(("result.streetAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.latitude" => Some(("result.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "result.embed-url" => Some(("result.embedUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.type" => Some(("result.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.date-modified" => Some(("result.dateModified", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.content-size" => Some(("result.contentSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.content-url" => Some(("result.contentUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.description" => Some(("result.description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.family-name" => Some(("result.familyName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.date-created" => Some(("result.dateCreated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.postal-code" => Some(("result.postalCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.attendee-count" => Some(("result.attendeeCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), - "result.height" => Some(("result.height", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.ticker-symbol" => Some(("result.tickerSymbol", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.player-type" => Some(("result.playerType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.kind" => Some(("result.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.name" => Some(("result.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.url" => Some(("result.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.gender" => Some(("result.gender", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.longitude" => Some(("result.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), - "result.address-region" => Some(("result.addressRegion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.rating-value" => Some(("result.ratingValue", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "result.given-name" => Some(("result.givenName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["additional-name", "address-country", "address-locality", "address-region", "attendee-count", "best-rating", "birth-date", "caption", "content-size", "content-url", "date-created", "date-modified", "date-published", "description", "duration", "embed-url", "end-date", "family-name", "gender", "given-name", "height", "id", "image", "kind", "latitude", "longitude", "name", "object", "player-type", "post-office-box-number", "postal-code", "rating-value", "result", "start-date", "street-address", "target", "text", "thumbnail-url", "ticker-symbol", "type", "url", "width", "worst-rating"]); - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); - None - } - }; - if let Some((field_cursor_str, type_info)) = type_info { - FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); - } - } - let mut request: api::Moment = json::value::from_value(object).unwrap(); - let mut call = self.hub.moments().insert(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "debug" => { - call = call.debug(arg_from_str(value.unwrap_or("false"), err, "debug", "boolean")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["debug"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _moments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.moments().list(opt.value_of("user-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "type" => { - call = call.type_(value.unwrap_or("")); - }, - "target-url" => { - call = call.target_url(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "type", "max-results", "target-url"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _people_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _people_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.people().get(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -628,7 +351,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -641,7 +364,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -664,10 +387,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _people_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _people_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.people().list(opt.value_of("user-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -689,7 +412,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "page-token", "max-results"].iter().map(|v|*v)); @@ -703,7 +426,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -726,10 +449,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _people_list_by_activity(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _people_list_by_activity(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.people().list_by_activity(opt.value_of("activity-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -748,7 +471,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -762,7 +485,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -785,10 +508,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _people_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _people_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.people().search(opt.value_of("query").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -810,7 +533,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "language", "max-results"].iter().map(|v|*v)); @@ -824,7 +547,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -883,20 +606,6 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, - ("moments", Some(opt)) => { - match opt.subcommand() { - ("insert", Some(opt)) => { - call_result = self._moments_insert(opt, dry_run, &mut err); - }, - ("list", Some(opt)) => { - call_result = self._moments_list(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("moments".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, ("people", Some(opt)) => { match opt.subcommand() { ("get", Some(opt)) => { @@ -934,14 +643,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "plus1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "plus1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -961,7 +670,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1000,7 +709,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("activities", "methods: 'get', 'list' and 'search'", vec![ - ("get", + ("get", Some(r##"Get an activity."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/activities_get", vec![ @@ -1022,7 +731,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all of the activities in the specified collection for a particular user."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/activities_list", vec![ @@ -1050,7 +759,7 @@ fn main() { Some(false), Some(false)), ]), - ("search", + ("search", Some(r##"Search public activities."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/activities_search", vec![ @@ -1075,7 +784,7 @@ fn main() { ]), ("comments", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Get a comment."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/comments_get", vec![ @@ -1097,7 +806,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all of the comments for an activity."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/comments_list", vec![ @@ -1121,73 +830,8 @@ fn main() { ]), ]), - ("moments", "methods: 'insert' and 'list'", vec![ - ("insert", - Some(r##"Record a moment representing a user's action such as making a purchase or commenting on a blog."##), - "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/moments_insert", - vec![ - (Some(r##"user-id"##), - None, - Some(r##"The ID of the user to record actions for. The only valid values are "me" and the ID of the authenticated user."##), - Some(true), - Some(false)), - - (Some(r##"collection"##), - None, - Some(r##"The collection to which to write moments."##), - Some(true), - Some(false)), - - (Some(r##"kv"##), - Some(r##"r"##), - Some(r##"Set various fields of the request structure, matching the key=value form"##), - Some(true), - Some(true)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("list", - Some(r##"List all of the moments for a particular user."##), - "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/moments_list", - vec![ - (Some(r##"user-id"##), - None, - Some(r##"The ID of the user to get moments for. The special value "me" can be used to indicate the authenticated user."##), - Some(true), - Some(false)), - - (Some(r##"collection"##), - None, - Some(r##"The collection of moments to list."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - ("people", "methods: 'get', 'list', 'list-by-activity' and 'search'", vec![ - ("get", + ("get", Some(r##"Get a person's profile. If your app uses scope https://www.googleapis.com/auth/plus.login, this method is guaranteed to return ageRange and language."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/people_get", vec![ @@ -1209,7 +853,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all of the people in the specified collection."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/people_list", vec![ @@ -1237,7 +881,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-by-activity", + ("list-by-activity", Some(r##"List all of the people in the specified collection for a particular activity."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/people_list-by-activity", vec![ @@ -1265,7 +909,7 @@ fn main() { Some(false), Some(false)), ]), - ("search", + ("search", Some(r##"Search all public profiles."##), "Details at http://byron.github.io/google-apis-rs/google_plus1_cli/people_search", vec![ @@ -1293,7 +937,7 @@ fn main() { let mut app = App::new("plus1") .author("Sebastian Thiel ") - .version("0.3.2+20151014") + .version("0.3.3+20160127") .about("The Google+ API enables developers to build on top of the Google+ platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_plus1_cli") .arg(Arg::with_name("url") @@ -1317,7 +961,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1328,7 +972,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/plus1/Cargo.toml b/gen/plus1/Cargo.toml index bbbb74a66b..050e573b08 100644 --- a/gen/plus1/Cargo.toml +++ b/gen/plus1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plus1" -version = "0.1.10+20151014" +version = "0.1.11+20160127" authors = ["Sebastian Thiel "] description = "A complete library to interact with plus (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plus1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/plus1/LICENSE.md b/gen/plus1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/plus1/LICENSE.md +++ b/gen/plus1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/plus1/README.md b/gen/plus1/README.md index 792bd85faf..5dc465873d 100644 --- a/gen/plus1/README.md +++ b/gen/plus1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-plus1` library allows access to all features of the *Google plus* service. -This documentation was generated from *plus* crate version *0.1.10+20151014*, where *20151014* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *plus* crate version *0.1.11+20160127*, where *20160127* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *plus* *v1* API can be found at the [official documentation site](https://developers.google.com/+/api/). @@ -17,8 +17,6 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [*get*](http://byron.github.io/google-apis-rs/google_plus1/struct.ActivityGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_plus1/struct.ActivityListCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_plus1/struct.ActivitySearchCall.html) * [comments](http://byron.github.io/google-apis-rs/google_plus1/struct.Comment.html) * [*get*](http://byron.github.io/google-apis-rs/google_plus1/struct.CommentGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_plus1/struct.CommentListCall.html) -* [moments](http://byron.github.io/google-apis-rs/google_plus1/struct.Moment.html) - * [*insert*](http://byron.github.io/google-apis-rs/google_plus1/struct.MomentInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_plus1/struct.MomentListCall.html) * people * [*get*](http://byron.github.io/google-apis-rs/google_plus1/struct.PeopleGetCall.html), [*list*](http://byron.github.io/google-apis-rs/google_plus1/struct.PeopleListCall.html), [*list by activity*](http://byron.github.io/google-apis-rs/google_plus1/struct.PeopleListByActivityCall.html) and [*search*](http://byron.github.io/google-apis-rs/google_plus1/struct.PeopleSearchCall.html) diff --git a/gen/plus1/src/cmn.rs b/gen/plus1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/plus1/src/cmn.rs +++ b/gen/plus1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/plus1/src/lib.rs b/gen/plus1/src/lib.rs index 3a93571a55..eb22907333 100644 --- a/gen/plus1/src/lib.rs +++ b/gen/plus1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *plus* crate version *0.1.10+20151014*, where *20151014* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *plus* crate version *0.1.11+20160127*, where *20160127* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *plus* *v1* API can be found at the //! [official documentation site](https://developers.google.com/+/api/). @@ -15,8 +15,6 @@ //! * [*get*](struct.ActivityGetCall.html), [*list*](struct.ActivityListCall.html) and [*search*](struct.ActivitySearchCall.html) //! * [comments](struct.Comment.html) //! * [*get*](struct.CommentGetCall.html) and [*list*](struct.CommentListCall.html) -//! * [moments](struct.Moment.html) -//! * [*insert*](struct.MomentInsertCall.html) and [*list*](struct.MomentListCall.html) //! * people //! * [*get*](struct.PeopleGetCall.html), [*list*](struct.PeopleListCall.html), [*list by activity*](struct.PeopleListByActivityCall.html) and [*search*](struct.PeopleSearchCall.html) //! @@ -102,9 +100,9 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.people().list("userId", "collection") -//! .page_token("duo") -//! .order_by("et") -//! .max_results(61) +//! .page_token("labore") +//! .order_by("eirmod") +//! .max_results(68) //! .doit(); //! //! match result { diff --git a/gen/plus1/src/lib.rs.in b/gen/plus1/src/lib.rs.in index 70b4b29813..e21eb1ed4a 100644 --- a/gen/plus1/src/lib.rs.in +++ b/gen/plus1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -141,7 +142,7 @@ impl<'a, C, A> Plus Plus { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -151,15 +152,12 @@ impl<'a, C, A> Plus pub fn comments(&'a self) -> CommentMethods<'a, C, A> { CommentMethods { hub: &self } } - pub fn moments(&'a self) -> MomentMethods<'a, C, A> { - MomentMethods { hub: &self } - } pub fn people(&'a self) -> PeopleMethods<'a, C, A> { PeopleMethods { hub: &self } } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -511,157 +509,6 @@ impl NestedType for CommentObject {} impl Part for CommentObject {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ItemScope { - /// The start date and time of the event (in ISO 8601 date format). - #[serde(rename="startDate")] - pub start_date: Option, - /// The end date and time of the event (in ISO 8601 date format). - #[serde(rename="endDate")] - pub end_date: Option, - /// The text that is the result of the app activity. For example, if a user leaves a review of a restaurant, this might be the text of the review. - pub text: Option, - /// A URL to the image that represents this result. For example, if a user writes a review of a restaurant and attaches a photo of their meal, you might use that photo as the result.image. - pub image: Option, - /// Review rating. - #[serde(rename="reviewRating")] - pub review_rating: Option>>, - /// Date of birth. - #[serde(rename="birthDate")] - pub birth_date: Option, - /// The initial date that the result was published. For example, a user writes a comment on a blog, which has a result.dateCreated of when they submit it. If the blog users comment moderation, the result.datePublished value would match the date when the owner approved the message. - #[serde(rename="datePublished")] - pub date_published: Option, - /// Address locality. - #[serde(rename="addressLocality")] - pub address_locality: Option, - /// The duration of the item (movie, audio recording, event, etc.) in ISO 8601 date format. - pub duration: Option, - /// An additional name for a Person, can be used for a middle name. - #[serde(rename="additionalName")] - pub additional_name: Option>, - /// Worst possible rating value that a result might obtain. This property defines the lower bound for the ratingValue. - #[serde(rename="worstRating")] - pub worst_rating: Option, - /// A list of contributors to this result. - pub contributor: Option>, - /// A URL to a thumbnail image that represents this result. - #[serde(rename="thumbnailUrl")] - pub thumbnail_url: Option, - /// An identifier for the object. Your app can choose how to identify objects. The object.id is required if you are writing an action that does not have a corresponding web page or object.url property. - pub id: Option, - /// Post office box number. - #[serde(rename="postOfficeBoxNumber")] - pub post_office_box_number: Option, - /// A person attending the event. - pub attendees: Option>, - /// The person or persons who created this result. In the example of restaurant reviews, this might be the reviewer's name. - pub author: Option>, - /// The encoding. - pub associated_media: Option>, - /// Best possible rating value that a result might obtain. This property defines the upper bound for the ratingValue. For example, you might have a 5 star rating scale, you would provide 5 as the value for this property. - #[serde(rename="bestRating")] - pub best_rating: Option, - /// Address country. - #[serde(rename="addressCountry")] - pub address_country: Option, - /// The width of the media object. - pub width: Option, - /// Street address. - #[serde(rename="streetAddress")] - pub street_address: Option, - /// The location of the event or organization. - pub location: Option>>, - /// Latitude. - pub latitude: Option, - /// From http://schema.org/MusicRecording, the artist that performed this recording. - #[serde(rename="byArtist")] - pub by_artist: Option>>, - /// The schema.org URL that best describes the referenced object and matches the type of moment. - #[serde(rename="type")] - pub type_: Option, - /// The date the result was last modified such as the date that a review was last edited. - #[serde(rename="dateModified")] - pub date_modified: Option, - /// File size in (mega/kilo) bytes. - #[serde(rename="contentSize")] - pub content_size: Option, - /// Actual bytes of the media object, for example the image file or video file. - #[serde(rename="contentUrl")] - pub content_url: Option, - /// Family name. This property can be used with givenName instead of the name property. - #[serde(rename="familyName")] - pub family_name: Option, - /// The string that describes the content of the result. - pub description: Option, - /// Property of http://schema.org/TVEpisode indicating which series the episode belongs to. - #[serde(rename="partOfTVSeries")] - pub part_of_tv_series: Option>>, - /// The subject matter of the content. - pub about: Option>>, - /// The date the result was created such as the date that a review was first created. - #[serde(rename="dateCreated")] - pub date_created: Option, - /// Postal code. - #[serde(rename="postalCode")] - pub postal_code: Option, - /// Number of attendees. - #[serde(rename="attendeeCount")] - pub attendee_count: Option, - /// From http://schema.org/MusicRecording, which album a song is in. - #[serde(rename="inAlbum")] - pub in_album: Option>>, - /// Postal address. - pub address: Option>>, - /// The height of the media object. - pub height: Option, - /// Geo coordinates. - pub geo: Option>>, - /// A URL pointing to a player for a specific video. In general, this is the information in the src element of an embed tag and should not be the same as the content of the loc tag. - #[serde(rename="embedUrl")] - pub embed_url: Option, - /// The exchange traded instrument associated with a Corporation object. The tickerSymbol is expressed as an exchange and an instrument name separated by a space character. For the exchange component of the tickerSymbol attribute, we recommend using the controlled vocabulary of Market Identifier Codes (MIC) specified in ISO15022. - #[serde(rename="tickerSymbol")] - pub ticker_symbol: Option, - /// The name of the result. In the example of a restaurant review, this might be the summary the user gave their review such as "Great ambiance, but overpriced." - pub name: Option, - /// Identifies this resource as an itemScope. - pub kind: Option, - /// From http://schema.org/MusicRecording, the audio file. - pub audio: Option>>, - /// Player type that is required. For example: Flash or Silverlight. - #[serde(rename="playerType")] - pub player_type: Option, - /// The main performer or performers of the event-for example, a presenter, musician, or actor. - pub performers: Option>, - /// The URL that points to the result object. For example, a permalink directly to a restaurant reviewer's comment. - pub url: Option, - /// Gender of the person. - pub gender: Option, - /// Longitude. - pub longitude: Option, - /// Thumbnail image for an image or video. - pub thumbnail: Option>>, - /// Address region. - #[serde(rename="addressRegion")] - pub address_region: Option, - /// The caption for this object. - pub caption: Option, - /// Rating value. - #[serde(rename="ratingValue")] - pub rating_value: Option, - /// Given name. This property can be used with familyName instead of the name property. - #[serde(rename="givenName")] - pub given_name: Option, -} - -impl Part for ItemScope {} - - /// The preview image for photos or videos. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -775,32 +622,18 @@ impl NestedType for ActivityObjectActorClientSpecificActorInfoYoutubeActorInfo { impl Part for ActivityObjectActorClientSpecificActorInfoYoutubeActorInfo {} -/// The person who performed this activity. +/// The physical address of the place. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ActivityActor { - /// The name of the actor, suitable for display. - #[serde(rename="displayName")] - pub display_name: Option, - /// An object representation of the individual components of name. - pub name: Option, - /// The link to the actor's Google profile. - pub url: Option, - /// The image representation of the actor. - pub image: Option, - /// Actor info specific to particular clients. - #[serde(rename="clientSpecificActorInfo")] - pub client_specific_actor_info: Option, - /// The ID of the actor's Person resource. - pub id: Option, - /// Verification status of actor. - pub verification: Option, +pub struct PlaceAddress { + /// The formatted address for display. + pub formatted: Option, } -impl NestedType for ActivityActor {} -impl Part for ActivityActor {} +impl NestedType for PlaceAddress {} +impl Part for PlaceAddress {} /// The service provider that initially published this activity. @@ -884,41 +717,6 @@ impl NestedType for PersonCoverCoverInfo {} impl Part for PersonCoverCoverInfo {} -/// There is no detailed description. -/// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list moments](struct.MomentListCall.html) (none) -/// * [insert moments](struct.MomentInsertCall.html) (request|response) -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Moment { - /// Time stamp of when the action occurred in RFC3339 format. - #[serde(rename="startDate")] - pub start_date: Option, - /// Identifies this resource as a moment. - pub kind: Option, - /// The object on which the action was performed. - pub target: Option, - /// The object on which the action was performed. Specifying this is equivalent with specifying "target". Note that responses from the server will use the "target" field instead for backward-compatibility with older clients. - pub object: Option, - /// The schema.org type for the type of moment to write. For example, http://schema.org/AddAction. Note that responses from the server will use the Google schema type instead for backward-compatibility with older clients. For example, http://schemas.google.com/AddActivity. - #[serde(rename="type")] - pub type_: Option, - /// The moment ID. - pub id: Option, - /// The object generated by performing the action on the object. For example, a user writes a review of a restaurant, the object is the restaurant and the result is the review. - pub result: Option, -} - -impl RequestValue for Moment {} -impl Resource for Moment {} -impl ResponseResult for Moment {} - - /// The image representation of this actor. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1238,37 +1036,24 @@ impl Part for CommentActorClientSpecificActorInfoYoutubeActorInfo {} /// There is no detailed description. /// -/// # Activities -/// -/// This type is used in activities, which are methods you may call on this type or where this type is involved in. -/// The list links the activity name, along with information about where it is used (one of *request* and *response*). -/// -/// * [list moments](struct.MomentListCall.html) (response) +/// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MomentsFeed { - /// The continuation token, which is used to page through large result sets. Provide this value in a subsequent request to return the next page of results. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Identifies this resource as a collection of moments. Value: "plus#momentsFeed". +pub struct Place { + /// The position of the place. + pub position: Option, + /// Identifies this resource as a place. Value: "plus#place". pub kind: Option, - /// The title of this collection of moments. - pub title: Option, - /// The moments in this page of results. - pub items: Option>, - /// The RFC 339 timestamp for when this collection of moments was last updated. - pub updated: Option, - /// Link to the next page of moments. - #[serde(rename="nextLink")] - pub next_link: Option, - /// ETag of this response for caching purposes. - pub etag: Option, - /// Link to this page of moments. - #[serde(rename="selfLink")] - pub self_link: Option, + /// The display name of the place. + #[serde(rename="displayName")] + pub display_name: Option, + /// The id of the place. + pub id: Option, + /// The physical address of the place. + pub address: Option, } -impl ResponseResult for MomentsFeed {} +impl Part for Place {} /// Verification status of actor. @@ -1286,6 +1071,34 @@ impl NestedType for CommentActorVerification {} impl Part for CommentActorVerification {} +/// The person who performed this activity. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ActivityActor { + /// The name of the actor, suitable for display. + #[serde(rename="displayName")] + pub display_name: Option, + /// An object representation of the individual components of name. + pub name: Option, + /// The link to the actor's Google profile. + pub url: Option, + /// The image representation of the actor. + pub image: Option, + /// Actor info specific to particular clients. + #[serde(rename="clientSpecificActorInfo")] + pub client_specific_actor_info: Option, + /// The ID of the actor's Person resource. + pub id: Option, + /// Verification status of actor. + pub verification: Option, +} + +impl NestedType for ActivityActor {} +impl Part for ActivityActor {} + + /// There is no detailed description. /// /// # Activities @@ -1479,20 +1292,6 @@ impl NestedType for ActivityObjectAttachmentsThumbnailsImage {} impl Part for ActivityObjectAttachmentsThumbnailsImage {} -/// The physical address of the place. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PlaceAddress { - /// The formatted address for display. - pub formatted: Option, -} - -impl NestedType for PlaceAddress {} -impl Part for PlaceAddress {} - - /// The object of this activity. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1529,28 +1328,6 @@ impl NestedType for ActivityObject {} impl Part for ActivityObject {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Place { - /// The position of the place. - pub position: Option, - /// Identifies this resource as a place. Value: "plus#place". - pub kind: Option, - /// The display name of the place. - #[serde(rename="displayName")] - pub display_name: Option, - /// The id of the place. - pub id: Option, - /// The physical address of the place. - pub address: Option, -} - -impl Part for Place {} - - /// Comments in reply to this activity. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1589,92 +1366,6 @@ impl Part for ActivityObjectActorClientSpecificActorInfo {} // MethodBuilders ### // ################# -/// A builder providing access to all methods supported on *moment* resources. -/// It is not used directly, but through the `Plus` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_plus1 as plus1; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use plus1::Plus; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = Plus::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `insert(...)` and `list(...)` -/// // to build up your call. -/// let rb = hub.moments(); -/// # } -/// ``` -pub struct MomentMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Plus, -} - -impl<'a, C, A> MethodsBuilder for MomentMethods<'a, C, A> {} - -impl<'a, C, A> MomentMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Record a moment representing a user's action such as making a purchase or commenting on a blog. - /// - /// # Arguments - /// - /// * `request` - No description provided. - /// * `userId` - The ID of the user to record actions for. The only valid values are "me" and the ID of the authenticated user. - /// * `collection` - The collection to which to write moments. - pub fn insert(&self, request: Moment, user_id: &str, collection: &str) -> MomentInsertCall<'a, C, A> { - MomentInsertCall { - hub: self.hub, - _request: request, - _user_id: user_id.to_string(), - _collection: collection.to_string(), - _debug: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// List all of the moments for a particular user. - /// - /// # Arguments - /// - /// * `userId` - The ID of the user to get moments for. The special value "me" can be used to indicate the authenticated user. - /// * `collection` - The collection of moments to list. - pub fn list(&self, user_id: &str, collection: &str) -> MomentListCall<'a, C, A> { - MomentListCall { - hub: self.hub, - _user_id: user_id.to_string(), - _collection: collection.to_string(), - _type_: Default::default(), - _target_url: Default::default(), - _page_token: Default::default(), - _max_results: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - /// A builder providing access to all methods supported on *activity* resources. /// It is not used directly, but through the `Plus` hub. /// @@ -1980,593 +1671,6 @@ impl<'a, C, A> PeopleMethods<'a, C, A> { // CallBuilders ### // ################# -/// Record a moment representing a user's action such as making a purchase or commenting on a blog. -/// -/// A builder for the *insert* method supported by a *moment* resource. -/// It is not used directly, but through a `MomentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plus1 as plus1; -/// use plus1::Moment; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plus1::Plus; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Plus::new(hyper::Client::new(), 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 ! -/// let mut req = Moment::default(); -/// -/// // 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 ! -/// let result = hub.moments().insert(req, "userId", "collection") -/// .debug(true) -/// .doit(); -/// # } -/// ``` -pub struct MomentInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Plus, - _request: Moment, - _user_id: String, - _collection: String, - _debug: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MomentInsertCall<'a, C, A> {} - -impl<'a, C, A> MomentInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Moment)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plus.moments.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("userId", self._user_id.to_string())); - params.push(("collection", self._collection.to_string())); - if let Some(value) = self._debug { - params.push(("debug", value.to_string())); - } - for &field in ["alt", "userId", "collection", "debug"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/plus/v1/people/{userId}/moments/{collection}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Login.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userId}", "userId"), ("{collection}", "collection")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["collection", "userId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Moment) -> MomentInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The ID of the user to record actions for. The only valid values are "me" and the ID of the authenticated user. - /// - /// Sets the *user id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_id(mut self, new_value: &str) -> MomentInsertCall<'a, C, A> { - self._user_id = new_value.to_string(); - self - } - /// The collection to which to write moments. - /// - /// Sets the *collection* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn collection(mut self, new_value: &str) -> MomentInsertCall<'a, C, A> { - self._collection = new_value.to_string(); - self - } - /// Return the moment as written. Should be used only for debugging. - /// - /// Sets the *debug* query property to the given value. - pub fn debug(mut self, new_value: bool) -> MomentInsertCall<'a, C, A> { - self._debug = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MomentInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MomentInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Login`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MomentInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// List all of the moments for a particular user. -/// -/// A builder for the *list* method supported by a *moment* resource. -/// It is not used directly, but through a `MomentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_plus1 as plus1; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use plus1::Plus; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = Plus::new(hyper::Client::new(), 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 ! -/// let result = hub.moments().list("userId", "collection") -/// .type_("dolores") -/// .target_url("gubergren") -/// .page_token("sadipscing") -/// .max_results(70) -/// .doit(); -/// # } -/// ``` -pub struct MomentListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a Plus, - _user_id: String, - _collection: String, - _type_: Option, - _target_url: Option, - _page_token: Option, - _max_results: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for MomentListCall<'a, C, A> {} - -impl<'a, C, A> MomentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, MomentsFeed)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "plus.moments.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); - params.push(("userId", self._user_id.to_string())); - params.push(("collection", self._collection.to_string())); - if let Some(value) = self._type_ { - params.push(("type", value.to_string())); - } - if let Some(value) = self._target_url { - params.push(("targetUrl", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - for &field in ["alt", "userId", "collection", "type", "targetUrl", "pageToken", "maxResults"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/plus/v1/people/{userId}/moments/{collection}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Login.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{userId}", "userId"), ("{collection}", "collection")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(2); - for param_name in ["collection", "userId"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The ID of the user to get moments for. The special value "me" can be used to indicate the authenticated user. - /// - /// Sets the *user id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn user_id(mut self, new_value: &str) -> MomentListCall<'a, C, A> { - self._user_id = new_value.to_string(); - self - } - /// The collection of moments to list. - /// - /// Sets the *collection* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn collection(mut self, new_value: &str) -> MomentListCall<'a, C, A> { - self._collection = new_value.to_string(); - self - } - /// Only moments of this type will be returned. - /// - /// Sets the *type* query property to the given value. - pub fn type_(mut self, new_value: &str) -> MomentListCall<'a, C, A> { - self._type_ = Some(new_value.to_string()); - self - } - /// Only moments containing this targetUrl will be returned. - /// - /// Sets the *target url* query property to the given value. - pub fn target_url(mut self, new_value: &str) -> MomentListCall<'a, C, A> { - self._target_url = Some(new_value.to_string()); - self - } - /// The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> MomentListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// The maximum number of moments to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> MomentListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> MomentListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> MomentListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Login`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> MomentListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - /// Search public activities. /// /// A builder for the *search* method supported by a *activity* resource. @@ -2594,10 +1698,10 @@ impl<'a, C, A> MomentListCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.activities().search("query") -/// .page_token("no") -/// .order_by("justo") -/// .max_results(80) -/// .language("et") +/// .page_token("erat") +/// .order_by("labore") +/// .max_results(92) +/// .language("nonumy") /// .doit(); /// # } /// ``` @@ -2629,7 +1733,7 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plus.activities.search", + dlg.begin(MethodInfo { id: "plus.activities.search", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("query", self._query.to_string())); @@ -2662,7 +1766,7 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Login.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2698,7 +1802,7 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2708,10 +1812,10 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2744,7 +1848,7 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *query* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn query(mut self, new_value: &str) -> ActivitySearchCall<'a, C, A> { self._query = new_value.to_string(); @@ -2790,12 +1894,12 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2812,17 +1916,17 @@ impl<'a, C, A> ActivitySearchCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Login`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ActivitySearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ActivitySearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2884,7 +1988,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plus.activities.get", + dlg.begin(MethodInfo { id: "plus.activities.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("activityId", self._activity_id.to_string())); @@ -2926,7 +2030,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2962,7 +2066,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2972,10 +2076,10 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3008,7 +2112,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *activity id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn activity_id(mut self, new_value: &str) -> ActivityGetCall<'a, C, A> { self._activity_id = new_value.to_string(); @@ -3026,12 +2130,12 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3048,17 +2152,17 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Login`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ActivityGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ActivityGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3093,8 +2197,8 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.activities().list("userId", "collection") -/// .page_token("Lorem") -/// .max_results(80) +/// .page_token("aliquyam") +/// .max_results(35) /// .doit(); /// # } /// ``` @@ -3125,7 +2229,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plus.activities.list", + dlg.begin(MethodInfo { id: "plus.activities.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -3174,7 +2278,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3210,7 +2314,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3220,10 +2324,10 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3256,7 +2360,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3266,7 +2370,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *collection* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { self._collection = new_value.to_string(); @@ -3298,12 +2402,12 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3320,17 +2424,17 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Login`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ActivityListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ActivityListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3365,9 +2469,9 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.comments().list("activityId") -/// .sort_order("aliquyam") -/// .page_token("sea") -/// .max_results(46) +/// .sort_order("justo") +/// .page_token("justo") +/// .max_results(67) /// .doit(); /// # } /// ``` @@ -3398,7 +2502,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plus.comments.list", + dlg.begin(MethodInfo { id: "plus.comments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("activityId", self._activity_id.to_string())); @@ -3449,7 +2553,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3485,7 +2589,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3495,10 +2599,10 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3531,7 +2635,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *activity id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn activity_id(mut self, new_value: &str) -> CommentListCall<'a, C, A> { self._activity_id = new_value.to_string(); @@ -3570,12 +2674,12 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3592,17 +2696,17 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Login`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3664,7 +2768,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plus.comments.get", + dlg.begin(MethodInfo { id: "plus.comments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("commentId", self._comment_id.to_string())); @@ -3706,7 +2810,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3742,7 +2846,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3752,10 +2856,10 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3788,7 +2892,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> CommentGetCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -3806,12 +2910,12 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3828,17 +2932,17 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Login`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3873,9 +2977,9 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.people().search("query") -/// .page_token("sadipscing") -/// .max_results(53) -/// .language("eirmod") +/// .page_token("ipsum") +/// .max_results(96) +/// .language("et") /// .doit(); /// # } /// ``` @@ -3906,7 +3010,7 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plus.people.search", + dlg.begin(MethodInfo { id: "plus.people.search", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("query", self._query.to_string())); @@ -3936,7 +3040,7 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Login.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3972,7 +3076,7 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3982,10 +3086,10 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4018,7 +3122,7 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *query* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn query(mut self, new_value: &str) -> PeopleSearchCall<'a, C, A> { self._query = new_value.to_string(); @@ -4057,12 +3161,12 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4079,17 +3183,17 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Login`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PeopleSearchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PeopleSearchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4124,8 +3228,8 @@ impl<'a, C, A> PeopleSearchCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.people().list_by_activity("activityId", "collection") -/// .page_token("no") -/// .max_results(65) +/// .page_token("sea") +/// .max_results(46) /// .doit(); /// # } /// ``` @@ -4156,7 +3260,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plus.people.listByActivity", + dlg.begin(MethodInfo { id: "plus.people.listByActivity", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("activityId", self._activity_id.to_string())); @@ -4205,7 +3309,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4241,7 +3345,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4251,10 +3355,10 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> { self._activity_id = new_value.to_string(); @@ -4297,7 +3401,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> { self._collection = new_value.to_string(); @@ -4329,12 +3433,12 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PeopleListByActivityCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PeopleListByActivityCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4396,9 +3500,9 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plus.people.list", + dlg.begin(MethodInfo { id: "plus.people.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -4482,7 +3586,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4518,7 +3622,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4528,10 +3632,10 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4564,7 +3668,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> PeopleListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4574,7 +3678,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *collection* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection(mut self, new_value: &str) -> PeopleListCall<'a, C, A> { self._collection = new_value.to_string(); @@ -4613,12 +3717,12 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4635,17 +3739,17 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Login`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PeopleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PeopleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4707,7 +3811,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plus.people.get", + dlg.begin(MethodInfo { id: "plus.people.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -4749,7 +3853,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4785,7 +3889,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4795,10 +3899,10 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4831,7 +3935,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> PeopleGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4849,12 +3953,12 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4871,17 +3975,17 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Login`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PeopleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PeopleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/plusdomains1-cli/Cargo.toml b/gen/plusdomains1-cli/Cargo.toml index 7179448a57..6bbdebce6c 100644 --- a/gen/plusdomains1-cli/Cargo.toml +++ b/gen/plusdomains1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plusdomains1-cli" -version = "0.3.2+20151014" +version = "0.3.3+20160127" authors = ["Sebastian Thiel "] description = "A complete library to interact with plusDomains (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plusdomains1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/plusdomains1-cli/LICENSE.md b/gen/plusdomains1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/plusdomains1-cli/LICENSE.md +++ b/gen/plusdomains1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/plusdomains1-cli/README.md b/gen/plusdomains1-cli/README.md index 8764d575f2..034f5167d6 100644 --- a/gen/plusdomains1-cli/README.md +++ b/gen/plusdomains1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *plusDomains* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/plusdomains1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/plusdomains1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/plusdomains1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/plusdomains1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/plusdomains1-cli). # Usage -This documentation was generated from the *plusDomains* API at revision *20151014*. The CLI is at version *0.3.2*. +This documentation was generated from the *plusDomains* API at revision *20160127*. The CLI is at version *0.3.3*. ```bash plusdomains1 [options] @@ -58,18 +58,18 @@ plusdomains1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/plusdomains1-cli/mkdocs.yml b/gen/plusdomains1-cli/mkdocs.yml index 22dba92cb5..6598a4aba5 100644 --- a/gen/plusdomains1-cli/mkdocs.yml +++ b/gen/plusdomains1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: plusDomains v0.3.2+20151014 +site_name: plusDomains v0.3.3+20160127 site_url: http://byron.github.io/google-apis-rs/google-plusdomains1-cli site_description: Write integrating applications with bcore @@ -32,5 +32,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/plusdomains1-cli/src/main.rs b/gen/plusdomains1-cli/src/main.rs index c466264ad5..6e93e838d5 100644 --- a/gen/plusdomains1-cli/src/main.rs +++ b/gen/plusdomains1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::PlusDomains>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _activities_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _activities_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.activities().get(opt.value_of("activity-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,13 +97,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _activities_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _activities_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -117,8 +117,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "place-name" => Some(("placeName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -187,7 +187,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Activity = json::value::from_value(object).unwrap(); let mut call = self.hub.activities().insert(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "preview" => { @@ -203,7 +203,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["preview"].iter().map(|v|*v)); @@ -217,7 +217,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -240,10 +240,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _activities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.activities().list(opt.value_of("user-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -262,7 +262,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -276,7 +276,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -299,10 +299,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _audiences_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _audiences_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.audiences().list(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -321,7 +321,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -335,7 +335,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -358,10 +358,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _circles_add_people(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _circles_add_people(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.circles().add_people(opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-id" => { @@ -380,7 +380,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["user-id", "email"].iter().map(|v|*v)); @@ -394,7 +394,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -417,10 +417,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _circles_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _circles_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.circles().get(opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -433,7 +433,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -446,7 +446,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -469,13 +469,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _circles_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _circles_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -489,8 +489,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -511,7 +511,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Circle = json::value::from_value(object).unwrap(); let mut call = self.hub.circles().insert(request, opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -524,7 +524,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -537,7 +537,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -560,10 +560,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _circles_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _circles_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.circles().list(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -582,7 +582,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -596,7 +596,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -619,13 +619,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _circles_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _circles_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -639,8 +639,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -661,7 +661,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Circle = json::value::from_value(object).unwrap(); let mut call = self.hub.circles().patch(request, opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -674,7 +674,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -687,7 +687,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -710,10 +710,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _circles_remove(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _circles_remove(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.circles().remove(opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -726,7 +726,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -739,7 +739,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -754,10 +754,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _circles_remove_people(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _circles_remove_people(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.circles().remove_people(opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "user-id" => { @@ -776,7 +776,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["user-id", "email"].iter().map(|v|*v)); @@ -790,7 +790,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -805,13 +805,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _circles_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _circles_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -825,8 +825,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -847,7 +847,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Circle = json::value::from_value(object).unwrap(); let mut call = self.hub.circles().update(request, opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -860,7 +860,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -873,7 +873,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -896,10 +896,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().get(opt.value_of("comment-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -912,7 +912,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -925,7 +925,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -948,13 +948,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -968,8 +968,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "plusoners.total-items" => Some(("plusoners.totalItems", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -1000,7 +1000,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Comment = json::value::from_value(object).unwrap(); let mut call = self.hub.comments().insert(request, opt.value_of("activity-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1013,7 +1013,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1026,7 +1026,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1049,10 +1049,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().list(opt.value_of("activity-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort-order" => { @@ -1074,7 +1074,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "sort-order", "max-results"].iter().map(|v|*v)); @@ -1088,7 +1088,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1111,13 +1111,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _media_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _media_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1131,8 +1131,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "updated" => Some(("updated", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "display-name" => Some(("displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1166,7 +1166,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Media = json::value::from_value(object).unwrap(); let mut call = self.hub.media().insert(request, opt.value_of("user-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1179,7 +1179,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1187,7 +1187,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -1195,7 +1195,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1219,10 +1219,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _people_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _people_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.people().get(opt.value_of("user-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1235,7 +1235,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1248,7 +1248,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1271,10 +1271,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _people_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _people_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.people().list(opt.value_of("user-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1296,7 +1296,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["order-by", "page-token", "max-results"].iter().map(|v|*v)); @@ -1310,7 +1310,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1333,10 +1333,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _people_list_by_activity(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _people_list_by_activity(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.people().list_by_activity(opt.value_of("activity-id").unwrap_or(""), opt.value_of("collection").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1355,7 +1355,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1369,7 +1369,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1392,10 +1392,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _people_list_by_circle(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _people_list_by_circle(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.people().list_by_circle(opt.value_of("circle-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1414,7 +1414,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1428,7 +1428,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1581,14 +1581,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "plusdomains1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "plusdomains1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1608,7 +1608,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1648,7 +1648,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("activities", "methods: 'get', 'insert' and 'list'", vec![ - ("get", + ("get", Some(r##"Get an activity."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/activities_get", vec![ @@ -1670,7 +1670,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Create a new activity for the authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/activities_insert", vec![ @@ -1698,7 +1698,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all of the activities in the specified collection for a particular user."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/activities_list", vec![ @@ -1729,7 +1729,7 @@ fn main() { ]), ("audiences", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"List all of the audiences to which a user can share."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/audiences_list", vec![ @@ -1754,7 +1754,7 @@ fn main() { ]), ("circles", "methods: 'add-people', 'get', 'insert', 'list', 'patch', 'remove', 'remove-people' and 'update'", vec![ - ("add-people", + ("add-people", Some(r##"Add a person to a circle. Google+ limits certain circle operations, including the number of circle adds. Learn More."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_add-people", vec![ @@ -1776,7 +1776,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Get a circle."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_get", vec![ @@ -1798,7 +1798,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Create a new circle for the authenticated user."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_insert", vec![ @@ -1826,7 +1826,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all of the circles for a user."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_list", vec![ @@ -1848,7 +1848,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update a circle's description. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_patch", vec![ @@ -1876,7 +1876,7 @@ fn main() { Some(false), Some(false)), ]), - ("remove", + ("remove", Some(r##"Delete a circle."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_remove", vec![ @@ -1892,7 +1892,7 @@ fn main() { Some(false), Some(true)), ]), - ("remove-people", + ("remove-people", Some(r##"Remove a person from a circle."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_remove-people", vec![ @@ -1908,7 +1908,7 @@ fn main() { Some(false), Some(true)), ]), - ("update", + ("update", Some(r##"Update a circle's description."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/circles_update", vec![ @@ -1939,7 +1939,7 @@ fn main() { ]), ("comments", "methods: 'get', 'insert' and 'list'", vec![ - ("get", + ("get", Some(r##"Get a comment."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/comments_get", vec![ @@ -1961,7 +1961,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Create a new comment in reply to an activity."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/comments_insert", vec![ @@ -1989,7 +1989,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all of the comments for an activity."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/comments_list", vec![ @@ -2014,7 +2014,7 @@ fn main() { ]), ("media", "methods: 'insert'", vec![ - ("insert", + ("insert", Some(r##"Add a new media item to an album. The current upload size limitations are 36MB for a photo and 1GB for a video. Uploads do not count against quota if photos are less than 2048 pixels on their longest side or videos are less than 15 minutes in length."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/media_insert", vec![ @@ -2057,7 +2057,7 @@ fn main() { ]), ("people", "methods: 'get', 'list', 'list-by-activity' and 'list-by-circle'", vec![ - ("get", + ("get", Some(r##"Get a person's profile."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/people_get", vec![ @@ -2079,7 +2079,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List all of the people in the specified collection."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/people_list", vec![ @@ -2107,7 +2107,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-by-activity", + ("list-by-activity", Some(r##"List all of the people in the specified collection for a particular activity."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/people_list-by-activity", vec![ @@ -2135,7 +2135,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-by-circle", + ("list-by-circle", Some(r##"List all of the people who are members of a circle."##), "Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/people_list-by-circle", vec![ @@ -2163,7 +2163,7 @@ fn main() { let mut app = App::new("plusdomains1") .author("Sebastian Thiel ") - .version("0.3.2+20151014") + .version("0.3.3+20160127") .about("The Google+ API enables developers to build on top of the Google+ platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_plusdomains1_cli") .arg(Arg::with_name("url") @@ -2187,7 +2187,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -2198,7 +2198,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/plusdomains1/Cargo.toml b/gen/plusdomains1/Cargo.toml index b3d2d8b34e..6cf3742040 100644 --- a/gen/plusdomains1/Cargo.toml +++ b/gen/plusdomains1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plusdomains1" -version = "0.1.10+20151014" +version = "0.1.11+20160127" authors = ["Sebastian Thiel "] description = "A complete library to interact with plusDomains (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/plusdomains1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/plusdomains1/LICENSE.md b/gen/plusdomains1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/plusdomains1/LICENSE.md +++ b/gen/plusdomains1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/plusdomains1/README.md b/gen/plusdomains1/README.md index 22d49b7c66..17895233bc 100644 --- a/gen/plusdomains1/README.md +++ b/gen/plusdomains1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-plusdomains1` library allows access to all features of the *Google plusDomains* service. -This documentation was generated from *plusDomains* crate version *0.1.10+20151014*, where *20151014* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *plusDomains* crate version *0.1.11+20160127*, where *20160127* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *plusDomains* *v1* API can be found at the [official documentation site](https://developers.google.com/+/domains/). diff --git a/gen/plusdomains1/src/cmn.rs b/gen/plusdomains1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/plusdomains1/src/cmn.rs +++ b/gen/plusdomains1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/plusdomains1/src/lib.rs b/gen/plusdomains1/src/lib.rs index 31572e181f..e3bfeacf5d 100644 --- a/gen/plusdomains1/src/lib.rs +++ b/gen/plusdomains1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *plusDomains* crate version *0.1.10+20151014*, where *20151014* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *plusDomains* crate version *0.1.11+20160127*, where *20160127* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *plusDomains* *v1* API can be found at the //! [official documentation site](https://developers.google.com/+/domains/). diff --git a/gen/plusdomains1/src/lib.rs.in b/gen/plusdomains1/src/lib.rs.in index 7fc8eea694..05bf06a9a5 100644 --- a/gen/plusdomains1/src/lib.rs.in +++ b/gen/plusdomains1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -164,7 +165,7 @@ impl<'a, C, A> PlusDomains PlusDomains { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -188,7 +189,7 @@ impl<'a, C, A> PlusDomains } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -2399,7 +2400,7 @@ impl<'a, C, A> CircleRemovePeopleCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.circles.removePeople", + dlg.begin(MethodInfo { id: "plusDomains.circles.removePeople", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("circleId", self._circle_id.to_string())); @@ -2454,7 +2455,7 @@ impl<'a, C, A> CircleRemovePeopleCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2490,7 +2491,7 @@ impl<'a, C, A> CircleRemovePeopleCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2500,10 +2501,10 @@ impl<'a, C, A> CircleRemovePeopleCall<'a, C, A> where C: BorrowMut CircleRemovePeopleCall<'a, C, A> where C: BorrowMut CircleRemovePeopleCall<'a, C, A> { self._circle_id = new_value.to_string(); @@ -2560,12 +2561,12 @@ impl<'a, C, A> CircleRemovePeopleCall<'a, C, A> where C: BorrowMut CircleRemovePeopleCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> CircleRemovePeopleCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CircleRemovePeopleCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2661,7 +2662,7 @@ impl<'a, C, A> CircleInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.circles.insert", + dlg.begin(MethodInfo { id: "plusDomains.circles.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -2703,14 +2704,14 @@ impl<'a, C, A> CircleInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2754,7 +2755,7 @@ impl<'a, C, A> CircleInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2764,10 +2765,10 @@ impl<'a, C, A> CircleInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2799,7 +2800,7 @@ impl<'a, C, A> CircleInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Circle) -> CircleInsertCall<'a, C, A> { self._request = new_value; @@ -2809,7 +2810,7 @@ impl<'a, C, A> CircleInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> CircleInsertCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -2827,12 +2828,12 @@ impl<'a, C, A> CircleInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2849,17 +2850,17 @@ impl<'a, C, A> CircleInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluCircleWrite`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CircleInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CircleInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2925,7 +2926,7 @@ impl<'a, C, A> CircleAddPeopleCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.circles.addPeople", + dlg.begin(MethodInfo { id: "plusDomains.circles.addPeople", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("circleId", self._circle_id.to_string())); @@ -2981,7 +2982,7 @@ impl<'a, C, A> CircleAddPeopleCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3017,7 +3018,7 @@ impl<'a, C, A> CircleAddPeopleCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3027,10 +3028,10 @@ impl<'a, C, A> CircleAddPeopleCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3063,7 +3064,7 @@ impl<'a, C, A> CircleAddPeopleCall<'a, C, A> where C: BorrowMut, /// /// Sets the *circle id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn circle_id(mut self, new_value: &str) -> CircleAddPeopleCall<'a, C, A> { self._circle_id = new_value.to_string(); @@ -3097,12 +3098,12 @@ impl<'a, C, A> CircleAddPeopleCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3119,17 +3120,17 @@ impl<'a, C, A> CircleAddPeopleCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluCircleWrite`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CircleAddPeopleCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CircleAddPeopleCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3191,7 +3192,7 @@ impl<'a, C, A> CircleGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.circles.get", + dlg.begin(MethodInfo { id: "plusDomains.circles.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("circleId", self._circle_id.to_string())); @@ -3233,7 +3234,7 @@ impl<'a, C, A> CircleGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3269,7 +3270,7 @@ impl<'a, C, A> CircleGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3279,10 +3280,10 @@ impl<'a, C, A> CircleGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3315,7 +3316,7 @@ impl<'a, C, A> CircleGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *circle id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn circle_id(mut self, new_value: &str) -> CircleGetCall<'a, C, A> { self._circle_id = new_value.to_string(); @@ -3333,12 +3334,12 @@ impl<'a, C, A> CircleGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3355,17 +3356,17 @@ impl<'a, C, A> CircleGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluCircleRead`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CircleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CircleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3431,7 +3432,7 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.circles.list", + dlg.begin(MethodInfo { id: "plusDomains.circles.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -3479,7 +3480,7 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3515,7 +3516,7 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3525,10 +3526,10 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3561,7 +3562,7 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> CircleListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -3593,12 +3594,12 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3615,17 +3616,17 @@ impl<'a, C, A> CircleListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluCircleRead`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CircleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CircleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3694,7 +3695,7 @@ impl<'a, C, A> CircleUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.circles.update", + dlg.begin(MethodInfo { id: "plusDomains.circles.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("circleId", self._circle_id.to_string())); @@ -3736,14 +3737,14 @@ impl<'a, C, A> CircleUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3787,7 +3788,7 @@ impl<'a, C, A> CircleUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3797,10 +3798,10 @@ impl<'a, C, A> CircleUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3832,7 +3833,7 @@ impl<'a, C, A> CircleUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Circle) -> CircleUpdateCall<'a, C, A> { self._request = new_value; @@ -3842,7 +3843,7 @@ impl<'a, C, A> CircleUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *circle id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn circle_id(mut self, new_value: &str) -> CircleUpdateCall<'a, C, A> { self._circle_id = new_value.to_string(); @@ -3860,12 +3861,12 @@ impl<'a, C, A> CircleUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3882,17 +3883,17 @@ impl<'a, C, A> CircleUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluCircleWrite`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CircleUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CircleUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3961,7 +3962,7 @@ impl<'a, C, A> CirclePatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.circles.patch", + dlg.begin(MethodInfo { id: "plusDomains.circles.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("circleId", self._circle_id.to_string())); @@ -4003,14 +4004,14 @@ impl<'a, C, A> CirclePatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4054,7 +4055,7 @@ impl<'a, C, A> CirclePatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4064,10 +4065,10 @@ impl<'a, C, A> CirclePatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4099,7 +4100,7 @@ impl<'a, C, A> CirclePatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Circle) -> CirclePatchCall<'a, C, A> { self._request = new_value; @@ -4109,7 +4110,7 @@ impl<'a, C, A> CirclePatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *circle id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn circle_id(mut self, new_value: &str) -> CirclePatchCall<'a, C, A> { self._circle_id = new_value.to_string(); @@ -4127,12 +4128,12 @@ impl<'a, C, A> CirclePatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4149,17 +4150,17 @@ impl<'a, C, A> CirclePatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluCircleWrite`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CirclePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CirclePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4221,7 +4222,7 @@ impl<'a, C, A> CircleRemoveCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.circles.remove", + dlg.begin(MethodInfo { id: "plusDomains.circles.remove", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("circleId", self._circle_id.to_string())); @@ -4262,7 +4263,7 @@ impl<'a, C, A> CircleRemoveCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4298,7 +4299,7 @@ impl<'a, C, A> CircleRemoveCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4308,10 +4309,10 @@ impl<'a, C, A> CircleRemoveCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4334,7 +4335,7 @@ impl<'a, C, A> CircleRemoveCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *circle id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn circle_id(mut self, new_value: &str) -> CircleRemoveCall<'a, C, A> { self._circle_id = new_value.to_string(); @@ -4352,12 +4353,12 @@ impl<'a, C, A> CircleRemoveCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4374,17 +4375,17 @@ impl<'a, C, A> CircleRemoveCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluCircleWrite`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CircleRemoveCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CircleRemoveCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4455,7 +4456,7 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.activities.insert", + dlg.begin(MethodInfo { id: "plusDomains.activities.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -4500,14 +4501,14 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4551,7 +4552,7 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4561,10 +4562,10 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4596,7 +4597,7 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Activity) -> ActivityInsertCall<'a, C, A> { self._request = new_value; @@ -4606,7 +4607,7 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> ActivityInsertCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -4631,12 +4632,12 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4653,17 +4654,17 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluLogin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ActivityInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ActivityInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4725,7 +4726,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.activities.get", + dlg.begin(MethodInfo { id: "plusDomains.activities.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("activityId", self._activity_id.to_string())); @@ -4767,7 +4768,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4803,7 +4804,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4813,10 +4814,10 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4849,7 +4850,7 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *activity id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn activity_id(mut self, new_value: &str) -> ActivityGetCall<'a, C, A> { self._activity_id = new_value.to_string(); @@ -4867,12 +4868,12 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4889,17 +4890,17 @@ impl<'a, C, A> ActivityGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluLogin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ActivityGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ActivityGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4966,7 +4967,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.activities.list", + dlg.begin(MethodInfo { id: "plusDomains.activities.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -5015,7 +5016,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5051,7 +5052,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5061,10 +5062,10 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5097,7 +5098,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5107,7 +5108,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *collection* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { self._collection = new_value.to_string(); @@ -5139,12 +5140,12 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5161,17 +5162,17 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluLogin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ActivityListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ActivityListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5237,7 +5238,7 @@ impl<'a, C, A> PeopleListByCircleCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.people.listByCircle", + dlg.begin(MethodInfo { id: "plusDomains.people.listByCircle", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("circleId", self._circle_id.to_string())); @@ -5285,7 +5286,7 @@ impl<'a, C, A> PeopleListByCircleCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5321,7 +5322,7 @@ impl<'a, C, A> PeopleListByCircleCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5331,10 +5332,10 @@ impl<'a, C, A> PeopleListByCircleCall<'a, C, A> where C: BorrowMut PeopleListByCircleCall<'a, C, A> where C: BorrowMut PeopleListByCircleCall<'a, C, A> { self._circle_id = new_value.to_string(); @@ -5399,12 +5400,12 @@ impl<'a, C, A> PeopleListByCircleCall<'a, C, A> where C: BorrowMut PeopleListByCircleCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PeopleListByCircleCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PeopleListByCircleCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5500,7 +5501,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.people.list", + dlg.begin(MethodInfo { id: "plusDomains.people.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -5552,7 +5553,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5588,7 +5589,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5598,10 +5599,10 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5634,7 +5635,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> PeopleListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5644,7 +5645,7 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *collection* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection(mut self, new_value: &str) -> PeopleListCall<'a, C, A> { self._collection = new_value.to_string(); @@ -5683,12 +5684,12 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5705,17 +5706,17 @@ impl<'a, C, A> PeopleListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluCircleRead`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PeopleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PeopleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5777,7 +5778,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.people.get", + dlg.begin(MethodInfo { id: "plusDomains.people.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -5819,7 +5820,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5855,7 +5856,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5865,10 +5866,10 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5901,7 +5902,7 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> PeopleGetCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -5919,12 +5920,12 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5941,17 +5942,17 @@ impl<'a, C, A> PeopleGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluLogin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PeopleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PeopleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6018,7 +6019,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.people.listByActivity", + dlg.begin(MethodInfo { id: "plusDomains.people.listByActivity", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("activityId", self._activity_id.to_string())); @@ -6067,7 +6068,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6103,7 +6104,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6113,10 +6114,10 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> { self._activity_id = new_value.to_string(); @@ -6159,7 +6160,7 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> { self._collection = new_value.to_string(); @@ -6191,12 +6192,12 @@ impl<'a, C, A> PeopleListByActivityCall<'a, C, A> where C: BorrowMut PeopleListByActivityCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> PeopleListByActivityCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PeopleListByActivityCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6295,7 +6296,7 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.media.insert", + dlg.begin(MethodInfo { id: "plusDomains.media.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -6312,13 +6313,13 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/plusDomains/v1/people/{userId}/media/{collection}".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/plusDomains/v1/people/{userId}/media/{collection}".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -6346,14 +6347,14 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6428,7 +6429,7 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6438,10 +6439,10 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6542,7 +6543,7 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Media) -> MediaInsertCall<'a, C, A> { self._request = new_value; @@ -6552,7 +6553,7 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> MediaInsertCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -6561,7 +6562,7 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *collection* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn collection(mut self, new_value: &str) -> MediaInsertCall<'a, C, A> { self._collection = new_value.to_string(); @@ -6579,12 +6580,12 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6601,17 +6602,17 @@ impl<'a, C, A> MediaInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluLogin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MediaInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MediaInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6680,7 +6681,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.comments.insert", + dlg.begin(MethodInfo { id: "plusDomains.comments.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("activityId", self._activity_id.to_string())); @@ -6722,14 +6723,14 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6773,7 +6774,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6783,10 +6784,10 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6818,7 +6819,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Comment) -> CommentInsertCall<'a, C, A> { self._request = new_value; @@ -6828,7 +6829,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *activity id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn activity_id(mut self, new_value: &str) -> CommentInsertCall<'a, C, A> { self._activity_id = new_value.to_string(); @@ -6846,12 +6847,12 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6868,17 +6869,17 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluLogin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6946,7 +6947,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.comments.list", + dlg.begin(MethodInfo { id: "plusDomains.comments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("activityId", self._activity_id.to_string())); @@ -6997,7 +6998,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7033,7 +7034,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7043,10 +7044,10 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7079,7 +7080,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *activity id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn activity_id(mut self, new_value: &str) -> CommentListCall<'a, C, A> { self._activity_id = new_value.to_string(); @@ -7118,12 +7119,12 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7140,17 +7141,17 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluLogin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7212,7 +7213,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.comments.get", + dlg.begin(MethodInfo { id: "plusDomains.comments.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("commentId", self._comment_id.to_string())); @@ -7254,7 +7255,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7290,7 +7291,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7300,10 +7301,10 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7336,7 +7337,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *comment id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn comment_id(mut self, new_value: &str) -> CommentGetCall<'a, C, A> { self._comment_id = new_value.to_string(); @@ -7354,12 +7355,12 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7376,17 +7377,17 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluLogin`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CommentGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CommentGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7452,7 +7453,7 @@ impl<'a, C, A> AudienceListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "plusDomains.audiences.list", + dlg.begin(MethodInfo { id: "plusDomains.audiences.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("userId", self._user_id.to_string())); @@ -7500,7 +7501,7 @@ impl<'a, C, A> AudienceListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7536,7 +7537,7 @@ impl<'a, C, A> AudienceListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7546,10 +7547,10 @@ impl<'a, C, A> AudienceListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7582,7 +7583,7 @@ impl<'a, C, A> AudienceListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *user id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn user_id(mut self, new_value: &str) -> AudienceListCall<'a, C, A> { self._user_id = new_value.to_string(); @@ -7614,12 +7615,12 @@ impl<'a, C, A> AudienceListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7636,17 +7637,17 @@ impl<'a, C, A> AudienceListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::PluCircleRead`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AudienceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AudienceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/prediction1d6-cli/Cargo.toml b/gen/prediction1d6-cli/Cargo.toml index d143f2a543..6fd53c32d6 100644 --- a/gen/prediction1d6-cli/Cargo.toml +++ b/gen/prediction1d6-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-prediction1d6-cli" -version = "0.3.2+20140522" +version = "0.3.3+20151102" authors = ["Sebastian Thiel "] description = "A complete library to interact with prediction (protocol v1.6)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/prediction1d6-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/prediction1d6-cli/LICENSE.md b/gen/prediction1d6-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/prediction1d6-cli/LICENSE.md +++ b/gen/prediction1d6-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/prediction1d6-cli/README.md b/gen/prediction1d6-cli/README.md index 23fbbf1d63..72996442ff 100644 --- a/gen/prediction1d6-cli/README.md +++ b/gen/prediction1d6-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *prediction* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/prediction1d6.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/prediction1d6.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/prediction1d6.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/prediction1d6.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/prediction1d6-cli). # Usage -This documentation was generated from the *prediction* API at revision *20140522*. The CLI is at version *0.3.2*. +This documentation was generated from the *prediction* API at revision *20151102*. The CLI is at version *0.3.3*. ```bash prediction1d6 [options] @@ -42,18 +42,18 @@ prediction1d6 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/prediction1d6-cli/mkdocs.yml b/gen/prediction1d6-cli/mkdocs.yml index b5d924ae50..44bbf491be 100644 --- a/gen/prediction1d6-cli/mkdocs.yml +++ b/gen/prediction1d6-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: prediction v0.3.2+20140522 +site_name: prediction v0.3.3+20151102 site_url: http://byron.github.io/google-apis-rs/google-prediction1d6-cli site_description: Write integrating applications with bcore @@ -20,5 +20,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/prediction1d6-cli/src/main.rs b/gen/prediction1d6-cli/src/main.rs index 26649ebacc..269b58a7ad 100644 --- a/gen/prediction1d6-cli/src/main.rs +++ b/gen/prediction1d6-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Prediction>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _hostedmodels_predict(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _hostedmodels_predict(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -80,7 +80,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Input = json::value::from_value(object).unwrap(); let mut call = self.hub.hostedmodels().predict(request, opt.value_of("project").unwrap_or(""), opt.value_of("hosted-model-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -93,7 +93,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -106,7 +106,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -129,10 +129,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _trainedmodels_analyze(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _trainedmodels_analyze(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.trainedmodels().analyze(opt.value_of("project").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -145,7 +145,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -158,7 +158,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -181,10 +181,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _trainedmodels_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _trainedmodels_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.trainedmodels().delete(opt.value_of("project").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -197,7 +197,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -210,7 +210,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -225,10 +225,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _trainedmodels_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _trainedmodels_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.trainedmodels().get(opt.value_of("project").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -241,7 +241,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -254,7 +254,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -277,13 +277,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _trainedmodels_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _trainedmodels_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -297,8 +297,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "storage-data-location" => Some(("storageDataLocation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "model-type" => Some(("modelType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -318,7 +318,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Insert = json::value::from_value(object).unwrap(); let mut call = self.hub.trainedmodels().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -331,7 +331,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -344,7 +344,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -367,10 +367,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _trainedmodels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _trainedmodels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.trainedmodels().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -389,7 +389,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -403,7 +403,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -426,13 +426,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _trainedmodels_predict(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _trainedmodels_predict(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -446,8 +446,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -461,7 +461,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Input = json::value::from_value(object).unwrap(); let mut call = self.hub.trainedmodels().predict(request, opt.value_of("project").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -474,7 +474,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -487,7 +487,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -510,13 +510,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _trainedmodels_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _trainedmodels_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -530,8 +530,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "output" => Some(("output", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -546,7 +546,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Update = json::value::from_value(object).unwrap(); let mut call = self.hub.trainedmodels().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -559,7 +559,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -572,7 +572,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -657,14 +657,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "prediction1d6-secret.json", + match cmn::application_secret_from_directory(&config_dir, "prediction1d6-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -684,7 +684,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -723,7 +723,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("hostedmodels", "methods: 'predict'", vec![ - ("predict", + ("predict", Some(r##"Submit input and request an output against a hosted model."##), "Details at http://byron.github.io/google-apis-rs/google_prediction1d6_cli/hostedmodels_predict", vec![ @@ -760,7 +760,7 @@ fn main() { ]), ("trainedmodels", "methods: 'analyze', 'delete', 'get', 'insert', 'list', 'predict' and 'update'", vec![ - ("analyze", + ("analyze", Some(r##"Get analysis of the model and the data the model was trained on."##), "Details at http://byron.github.io/google-apis-rs/google_prediction1d6_cli/trainedmodels_analyze", vec![ @@ -788,7 +788,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete a trained model."##), "Details at http://byron.github.io/google-apis-rs/google_prediction1d6_cli/trainedmodels_delete", vec![ @@ -810,7 +810,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Check training status of your model."##), "Details at http://byron.github.io/google-apis-rs/google_prediction1d6_cli/trainedmodels_get", vec![ @@ -838,7 +838,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Train a Prediction API model."##), "Details at http://byron.github.io/google-apis-rs/google_prediction1d6_cli/trainedmodels_insert", vec![ @@ -866,7 +866,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List available models."##), "Details at http://byron.github.io/google-apis-rs/google_prediction1d6_cli/trainedmodels_list", vec![ @@ -888,7 +888,7 @@ fn main() { Some(false), Some(false)), ]), - ("predict", + ("predict", Some(r##"Submit model id and request a prediction."##), "Details at http://byron.github.io/google-apis-rs/google_prediction1d6_cli/trainedmodels_predict", vec![ @@ -922,7 +922,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Add new data to a trained model."##), "Details at http://byron.github.io/google-apis-rs/google_prediction1d6_cli/trainedmodels_update", vec![ @@ -962,7 +962,7 @@ fn main() { let mut app = App::new("prediction1d6") .author("Sebastian Thiel ") - .version("0.3.2+20140522") + .version("0.3.3+20151102") .about("Lets you access a cloud hosted machine learning service that makes it easy to build smart apps") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_prediction1d6_cli") .arg(Arg::with_name("url") @@ -986,7 +986,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -997,7 +997,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/prediction1d6/Cargo.toml b/gen/prediction1d6/Cargo.toml index d6a3aa71fe..3b4e8f0113 100644 --- a/gen/prediction1d6/Cargo.toml +++ b/gen/prediction1d6/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-prediction1d6" -version = "0.1.10+20140522" +version = "0.1.11+20151102" authors = ["Sebastian Thiel "] description = "A complete library to interact with prediction (protocol v1.6)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/prediction1d6" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/prediction1d6/LICENSE.md b/gen/prediction1d6/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/prediction1d6/LICENSE.md +++ b/gen/prediction1d6/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/prediction1d6/README.md b/gen/prediction1d6/README.md index 611b2a59bc..132d7be0bf 100644 --- a/gen/prediction1d6/README.md +++ b/gen/prediction1d6/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-prediction1d6` library allows access to all features of the *Google prediction* service. -This documentation was generated from *prediction* crate version *0.1.10+20140522*, where *20140522* is the exact revision of the *prediction:v1.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *prediction* crate version *0.1.11+20151102*, where *20151102* is the exact revision of the *prediction:v1.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *prediction* *v1d6* API can be found at the [official documentation site](https://developers.google.com/prediction/docs/developer-guide). diff --git a/gen/prediction1d6/src/cmn.rs b/gen/prediction1d6/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/prediction1d6/src/cmn.rs +++ b/gen/prediction1d6/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/prediction1d6/src/lib.rs b/gen/prediction1d6/src/lib.rs index e2e6abb672..1d62ca2151 100644 --- a/gen/prediction1d6/src/lib.rs +++ b/gen/prediction1d6/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *prediction* crate version *0.1.10+20140522*, where *20140522* is the exact revision of the *prediction:v1.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *prediction* crate version *0.1.11+20151102*, where *20151102* is the exact revision of the *prediction:v1.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *prediction* *v1d6* API can be found at the //! [official documentation site](https://developers.google.com/prediction/docs/developer-guide). diff --git a/gen/prediction1d6/src/lib.rs.in b/gen/prediction1d6/src/lib.rs.in index c6213f842c..52d17c35c5 100644 --- a/gen/prediction1d6/src/lib.rs.in +++ b/gen/prediction1d6/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -144,7 +145,7 @@ impl<'a, C, A> Prediction Prediction { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -156,7 +157,7 @@ impl<'a, C, A> Prediction } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -941,7 +942,7 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "prediction.trainedmodels.get", + dlg.begin(MethodInfo { id: "prediction.trainedmodels.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -984,7 +985,7 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1020,7 +1021,7 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1030,10 +1031,10 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1066,7 +1067,7 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TrainedmodelGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -1076,7 +1077,7 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> TrainedmodelGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -1094,12 +1095,12 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1116,17 +1117,17 @@ impl<'a, C, A> TrainedmodelGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TrainedmodelGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TrainedmodelGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1196,7 +1197,7 @@ impl<'a, C, A> TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "prediction.trainedmodels.update", + dlg.begin(MethodInfo { id: "prediction.trainedmodels.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1239,14 +1240,14 @@ impl<'a, C, A> TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1290,7 +1291,7 @@ impl<'a, C, A> TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1300,10 +1301,10 @@ impl<'a, C, A> TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut TrainedmodelUpdateCall<'a, C, A> { self._request = new_value; @@ -1345,7 +1346,7 @@ impl<'a, C, A> TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut TrainedmodelUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -1355,7 +1356,7 @@ impl<'a, C, A> TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut TrainedmodelUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -1373,12 +1374,12 @@ impl<'a, C, A> TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut TrainedmodelUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TrainedmodelUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TrainedmodelUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1471,7 +1472,7 @@ impl<'a, C, A> TrainedmodelListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "prediction.trainedmodels.list", + dlg.begin(MethodInfo { id: "prediction.trainedmodels.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1519,7 +1520,7 @@ impl<'a, C, A> TrainedmodelListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1555,7 +1556,7 @@ impl<'a, C, A> TrainedmodelListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1565,10 +1566,10 @@ impl<'a, C, A> TrainedmodelListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1601,7 +1602,7 @@ impl<'a, C, A> TrainedmodelListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TrainedmodelListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1633,12 +1634,12 @@ impl<'a, C, A> TrainedmodelListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1655,17 +1656,17 @@ impl<'a, C, A> TrainedmodelListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TrainedmodelListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TrainedmodelListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1728,7 +1729,7 @@ impl<'a, C, A> TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "prediction.trainedmodels.delete", + dlg.begin(MethodInfo { id: "prediction.trainedmodels.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1770,7 +1771,7 @@ impl<'a, C, A> TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1806,7 +1807,7 @@ impl<'a, C, A> TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1816,10 +1817,10 @@ impl<'a, C, A> TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut TrainedmodelDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -1852,7 +1853,7 @@ impl<'a, C, A> TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut TrainedmodelDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -1870,12 +1871,12 @@ impl<'a, C, A> TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut TrainedmodelDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TrainedmodelDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TrainedmodelDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1971,7 +1972,7 @@ impl<'a, C, A> TrainedmodelInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "prediction.trainedmodels.insert", + dlg.begin(MethodInfo { id: "prediction.trainedmodels.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2013,14 +2014,14 @@ impl<'a, C, A> TrainedmodelInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2064,7 +2065,7 @@ impl<'a, C, A> TrainedmodelInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2074,10 +2075,10 @@ impl<'a, C, A> TrainedmodelInsertCall<'a, C, A> where C: BorrowMut TrainedmodelInsertCall<'a, C, A> where C: BorrowMut TrainedmodelInsertCall<'a, C, A> { self._request = new_value; @@ -2119,7 +2120,7 @@ impl<'a, C, A> TrainedmodelInsertCall<'a, C, A> where C: BorrowMut TrainedmodelInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -2137,12 +2138,12 @@ impl<'a, C, A> TrainedmodelInsertCall<'a, C, A> where C: BorrowMut TrainedmodelInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TrainedmodelInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TrainedmodelInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2232,7 +2233,7 @@ impl<'a, C, A> TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "prediction.trainedmodels.analyze", + dlg.begin(MethodInfo { id: "prediction.trainedmodels.analyze", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2275,7 +2276,7 @@ impl<'a, C, A> TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2311,7 +2312,7 @@ impl<'a, C, A> TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2321,10 +2322,10 @@ impl<'a, C, A> TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut TrainedmodelAnalyzeCall<'a, C, A> { self._project = new_value.to_string(); @@ -2367,7 +2368,7 @@ impl<'a, C, A> TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut TrainedmodelAnalyzeCall<'a, C, A> { self._id = new_value.to_string(); @@ -2385,12 +2386,12 @@ impl<'a, C, A> TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut TrainedmodelAnalyzeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TrainedmodelAnalyzeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TrainedmodelAnalyzeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2487,7 +2488,7 @@ impl<'a, C, A> TrainedmodelPredictCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "prediction.trainedmodels.predict", + dlg.begin(MethodInfo { id: "prediction.trainedmodels.predict", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2530,14 +2531,14 @@ impl<'a, C, A> TrainedmodelPredictCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2581,7 +2582,7 @@ impl<'a, C, A> TrainedmodelPredictCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2591,10 +2592,10 @@ impl<'a, C, A> TrainedmodelPredictCall<'a, C, A> where C: BorrowMut TrainedmodelPredictCall<'a, C, A> where C: BorrowMut TrainedmodelPredictCall<'a, C, A> { self._request = new_value; @@ -2636,7 +2637,7 @@ impl<'a, C, A> TrainedmodelPredictCall<'a, C, A> where C: BorrowMut TrainedmodelPredictCall<'a, C, A> { self._project = new_value.to_string(); @@ -2646,7 +2647,7 @@ impl<'a, C, A> TrainedmodelPredictCall<'a, C, A> where C: BorrowMut TrainedmodelPredictCall<'a, C, A> { self._id = new_value.to_string(); @@ -2664,12 +2665,12 @@ impl<'a, C, A> TrainedmodelPredictCall<'a, C, A> where C: BorrowMut TrainedmodelPredictCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TrainedmodelPredictCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TrainedmodelPredictCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2766,7 +2767,7 @@ impl<'a, C, A> HostedmodelPredictCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "prediction.hostedmodels.predict", + dlg.begin(MethodInfo { id: "prediction.hostedmodels.predict", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2809,14 +2810,14 @@ impl<'a, C, A> HostedmodelPredictCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2860,7 +2861,7 @@ impl<'a, C, A> HostedmodelPredictCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2870,10 +2871,10 @@ impl<'a, C, A> HostedmodelPredictCall<'a, C, A> where C: BorrowMut HostedmodelPredictCall<'a, C, A> where C: BorrowMut HostedmodelPredictCall<'a, C, A> { self._request = new_value; @@ -2915,7 +2916,7 @@ impl<'a, C, A> HostedmodelPredictCall<'a, C, A> where C: BorrowMut HostedmodelPredictCall<'a, C, A> { self._project = new_value.to_string(); @@ -2925,7 +2926,7 @@ impl<'a, C, A> HostedmodelPredictCall<'a, C, A> where C: BorrowMut HostedmodelPredictCall<'a, C, A> { self._hosted_model_name = new_value.to_string(); @@ -2943,12 +2944,12 @@ impl<'a, C, A> HostedmodelPredictCall<'a, C, A> where C: BorrowMut HostedmodelPredictCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> HostedmodelPredictCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> HostedmodelPredictCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/proximitybeacon1_beta1-cli/Cargo.toml b/gen/proximitybeacon1_beta1-cli/Cargo.toml index 4b6da18444..339c8f139a 100644 --- a/gen/proximitybeacon1_beta1-cli/Cargo.toml +++ b/gen/proximitybeacon1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-proximitybeacon1_beta1-cli" -version = "0.3.2+20150729" +version = "0.3.3+20150729" authors = ["Sebastian Thiel "] description = "A complete library to interact with proximitybeacon (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/proximitybeacon1_beta1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/proximitybeacon1_beta1-cli/LICENSE.md b/gen/proximitybeacon1_beta1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/proximitybeacon1_beta1-cli/LICENSE.md +++ b/gen/proximitybeacon1_beta1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/proximitybeacon1_beta1-cli/README.md b/gen/proximitybeacon1_beta1-cli/README.md index fed5042516..69b7057e81 100644 --- a/gen/proximitybeacon1_beta1-cli/README.md +++ b/gen/proximitybeacon1_beta1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *proximitybeacon* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/proximitybeacon1-beta1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/proximitybeacon1-beta1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/proximitybeacon1-beta1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/proximitybeacon1-beta1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/proximitybeacon1_beta1-cli). # Usage -This documentation was generated from the *proximitybeacon* API at revision *20150729*. The CLI is at version *0.3.2*. +This documentation was generated from the *proximitybeacon* API at revision *20150729*. The CLI is at version *0.3.3*. ```bash proximitybeacon1-beta1 [options] @@ -49,14 +49,14 @@ proximitybeacon1-beta1 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/proximitybeacon1_beta1-cli/mkdocs.yml b/gen/proximitybeacon1_beta1-cli/mkdocs.yml index 21fb324dc6..c2d5bde321 100644 --- a/gen/proximitybeacon1_beta1-cli/mkdocs.yml +++ b/gen/proximitybeacon1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: proximitybeacon v0.3.2+20150729 +site_name: proximitybeacon v0.3.3+20150729 site_url: http://byron.github.io/google-apis-rs/google-proximitybeacon1_beta1-cli site_description: Write integrating applications with bcore @@ -26,5 +26,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/proximitybeacon1_beta1-cli/src/main.rs b/gen/proximitybeacon1_beta1-cli/src/main.rs index e30e62fc37..26e81eb331 100644 --- a/gen/proximitybeacon1_beta1-cli/src/main.rs +++ b/gen/proximitybeacon1_beta1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Proximitybeacon>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _beaconinfo_getforobserved(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _beaconinfo_getforobserved(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "namespaced-types" => Some(("namespacedTypes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -81,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::GetInfoForObservedBeaconsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.beaconinfo().getforobserved(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -94,7 +94,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -127,10 +127,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_activate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_activate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.beacons().activate(opt.value_of("beacon-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -143,7 +143,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -176,10 +176,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_attachments_batch_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_attachments_batch_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.beacons().attachments_batch_delete(opt.value_of("beacon-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "namespaced-type" => { @@ -195,7 +195,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["namespaced-type"].iter().map(|v|*v)); @@ -229,13 +229,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_attachments_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_attachments_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -249,8 +249,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "data" => Some(("data", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "attachment-name" => Some(("attachmentName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -267,7 +267,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::BeaconAttachment = json::value::from_value(object).unwrap(); let mut call = self.hub.beacons().attachments_create(request, opt.value_of("beacon-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -280,7 +280,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -313,10 +313,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_attachments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_attachments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.beacons().attachments_delete(opt.value_of("attachment-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -329,7 +329,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -362,10 +362,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_attachments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_attachments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.beacons().attachments_list(opt.value_of("beacon-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "namespaced-type" => { @@ -381,7 +381,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["namespaced-type"].iter().map(|v|*v)); @@ -415,10 +415,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_deactivate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_deactivate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.beacons().deactivate(opt.value_of("beacon-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -431,7 +431,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -464,10 +464,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_decommission(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_decommission(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.beacons().decommission(opt.value_of("beacon-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -480,7 +480,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -513,10 +513,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_diagnostics_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_diagnostics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.beacons().diagnostics_list(opt.value_of("beacon-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -538,7 +538,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "alert-filter", "page-size"].iter().map(|v|*v)); @@ -572,10 +572,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.beacons().get(opt.value_of("beacon-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -588,7 +588,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -621,10 +621,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.beacons().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "q" => { @@ -646,7 +646,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["q", "page-token", "page-size"].iter().map(|v|*v)); @@ -680,13 +680,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_register(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_register(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -700,8 +700,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -726,7 +726,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Beacon = json::value::from_value(object).unwrap(); let mut call = self.hub.beacons().register(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -739,7 +739,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -772,13 +772,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _beacons_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _beacons_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -792,8 +792,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -818,7 +818,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Beacon = json::value::from_value(object).unwrap(); let mut call = self.hub.beacons().update(request, opt.value_of("beacon-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -831,7 +831,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -864,10 +864,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _namespaces_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _namespaces_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.namespaces().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -880,7 +880,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1001,14 +1001,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "proximitybeacon1-beta1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "proximitybeacon1-beta1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1028,7 +1028,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1071,7 +1071,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("beaconinfo", "methods: 'getforobserved'", vec![ - ("getforobserved", + ("getforobserved", Some(r##"Given one or more beacon observations, returns any beacon information and attachments accessible to your application."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beaconinfo_getforobserved", vec![ @@ -1096,7 +1096,7 @@ fn main() { ]), ("beacons", "methods: 'activate', 'attachments-batch-delete', 'attachments-create', 'attachments-delete', 'attachments-list', 'deactivate', 'decommission', 'diagnostics-list', 'get', 'list', 'register' and 'update'", vec![ - ("activate", + ("activate", Some(r##"(Re)activates a beacon. A beacon that is active will return information and attachment data when queried via `beaconinfo.getforobserved`. Calling this method on an already active beacon will do nothing (but will return a successful response code)."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_activate", vec![ @@ -1118,7 +1118,7 @@ fn main() { Some(false), Some(false)), ]), - ("attachments-batch-delete", + ("attachments-batch-delete", Some(r##"Deletes multiple attachments on a given beacon. This operation is permanent and cannot be undone. You can optionally specify `namespacedType` to choose which attachments should be deleted. If you do not specify `namespacedType`, all your attachments on the given beacon will be deleted. You also may explicitly specify `*/*` to delete all."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_attachments-batch-delete", vec![ @@ -1140,7 +1140,7 @@ fn main() { Some(false), Some(false)), ]), - ("attachments-create", + ("attachments-create", Some(r##"Associates the given data with the specified beacon. Attachment data must contain two parts: - A namespaced type. - The actual attachment data itself. The namespaced type consists of two parts, the namespace and the type. The namespace must be one of the values returned by the `namespaces` endpoint, while the type can be a string of any characters except for the forward slash (`/`) up to 100 characters in length. Attachment data can be up to 1024 bytes long."##), @@ -1170,7 +1170,7 @@ fn main() { Some(false), Some(false)), ]), - ("attachments-delete", + ("attachments-delete", Some(r##"Deletes the specified attachment for the given beacon. Each attachment has a unique attachment name (`attachmentName`) which is returned when you fetch the attachment data via this API. You specify this with the delete request to control which attachment is removed. This operation cannot be undone."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_attachments-delete", vec![ @@ -1192,7 +1192,7 @@ fn main() { Some(false), Some(false)), ]), - ("attachments-list", + ("attachments-list", Some(r##"Returns the attachments for the specified beacon that match the specified namespaced-type pattern. To control which namespaced types are returned, you add the `namespacedType` query parameter to the request. You must either use `*/*`, to return all attachments, or the namespace must be one of the ones returned from the `namespaces` endpoint."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_attachments-list", vec![ @@ -1214,7 +1214,7 @@ fn main() { Some(false), Some(false)), ]), - ("deactivate", + ("deactivate", Some(r##"Deactivates a beacon. Once deactivated, the API will not return information nor attachment data for the beacon when queried via `beaconinfo.getforobserved`. Calling this method on an already inactive beacon will do nothing (but will return a successful response code)."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_deactivate", vec![ @@ -1236,7 +1236,7 @@ fn main() { Some(false), Some(false)), ]), - ("decommission", + ("decommission", Some(r##"Decommissions the specified beacon in the service. This beacon will no longer be returned from `beaconinfo.getforobserved`. This operation is permanent -- you will not be able to re-register a beacon with this ID again."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_decommission", vec![ @@ -1258,7 +1258,7 @@ fn main() { Some(false), Some(false)), ]), - ("diagnostics-list", + ("diagnostics-list", Some(r##"List the diagnostics for a single beacon. You can also list diagnostics for all the beacons owned by your Google Developers Console project by using the beacon name `beacons/-`."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_diagnostics-list", vec![ @@ -1280,7 +1280,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns detailed information about the specified beacon."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_get", vec![ @@ -1302,7 +1302,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Searches the beacon registry for beacons that match the given search criteria. Only those beacons that the client has permission to list will be returned."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_list", vec![ @@ -1318,7 +1318,7 @@ fn main() { Some(false), Some(false)), ]), - ("register", + ("register", Some(r##"Registers a previously unregistered beacon given its `advertisedId`. These IDs are unique within the system. An ID can be registered only once."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_register", vec![ @@ -1340,7 +1340,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates the information about the specified beacon. **Any field that you do not populate in the submitted beacon will be permanently erased**, so you should follow the "read, modify, write" pattern to avoid inadvertently destroying data. Changes to the beacon status via this method will be silently ignored. To update beacon status, use the separate methods on this API for (de)activation and decommissioning."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/beacons_update", vec![ @@ -1371,7 +1371,7 @@ fn main() { ]), ("namespaces", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Lists all attachment namespaces owned by your Google Developers Console project. Attachment data associated with a beacon must include a namespaced type, and the namespace must be owned by your project."##), "Details at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli/namespaces_list", vec![ @@ -1393,7 +1393,7 @@ fn main() { let mut app = App::new("proximitybeacon1-beta1") .author("Sebastian Thiel ") - .version("0.3.2+20150729") + .version("0.3.3+20150729") .about("This API provides services to register, manage, index, and search beacons.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_proximitybeacon1_beta1_cli") .arg(Arg::with_name("folder") @@ -1412,7 +1412,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1423,7 +1423,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/proximitybeacon1_beta1/Cargo.toml b/gen/proximitybeacon1_beta1/Cargo.toml index ff571eb6cf..e6de7c32fe 100644 --- a/gen/proximitybeacon1_beta1/Cargo.toml +++ b/gen/proximitybeacon1_beta1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-proximitybeacon1_beta1" -version = "0.1.10+20150729" +version = "0.1.11+20150729" authors = ["Sebastian Thiel "] description = "A complete library to interact with proximitybeacon (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/proximitybeacon1_beta1" diff --git a/gen/proximitybeacon1_beta1/LICENSE.md b/gen/proximitybeacon1_beta1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/proximitybeacon1_beta1/LICENSE.md +++ b/gen/proximitybeacon1_beta1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/proximitybeacon1_beta1/README.md b/gen/proximitybeacon1_beta1/README.md index 3275576d84..947c03a687 100644 --- a/gen/proximitybeacon1_beta1/README.md +++ b/gen/proximitybeacon1_beta1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-proximitybeacon1_beta1` library allows access to all features of the *Google proximitybeacon* service. -This documentation was generated from *proximitybeacon* crate version *0.1.10+20150729*, where *20150729* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *proximitybeacon* crate version *0.1.11+20150729*, where *20150729* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *proximitybeacon* *v1_beta1* API can be found at the [official documentation site](https://developers.google.com/beacons/proximity/). diff --git a/gen/proximitybeacon1_beta1/src/cmn.rs b/gen/proximitybeacon1_beta1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/proximitybeacon1_beta1/src/cmn.rs +++ b/gen/proximitybeacon1_beta1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/proximitybeacon1_beta1/src/lib.rs b/gen/proximitybeacon1_beta1/src/lib.rs index 900f0d1d1a..8b3bd9f5a6 100644 --- a/gen/proximitybeacon1_beta1/src/lib.rs +++ b/gen/proximitybeacon1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *proximitybeacon* crate version *0.1.10+20150729*, where *20150729* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *proximitybeacon* crate version *0.1.11+20150729*, where *20150729* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *proximitybeacon* *v1_beta1* API can be found at the //! [official documentation site](https://developers.google.com/beacons/proximity/). diff --git a/gen/proximitybeacon1_beta1/src/lib.rs.in b/gen/proximitybeacon1_beta1/src/lib.rs.in index 199be1e558..cec13b375f 100644 --- a/gen/proximitybeacon1_beta1/src/lib.rs.in +++ b/gen/proximitybeacon1_beta1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -107,7 +108,7 @@ impl<'a, C, A> Proximitybeacon Proximitybeacon { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -122,7 +123,7 @@ impl<'a, C, A> Proximitybeacon } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -947,7 +948,7 @@ impl<'a, C, A> BeaconAttachmentListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.attachments.list", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.attachments.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("beaconName", self._beacon_name.to_string())); @@ -1004,7 +1005,7 @@ impl<'a, C, A> BeaconAttachmentListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1025,7 +1026,7 @@ impl<'a, C, A> BeaconAttachmentListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1035,10 +1036,10 @@ impl<'a, C, A> BeaconAttachmentListCall<'a, C, A> where C: BorrowMut BeaconAttachmentListCall<'a, C, A> where C: BorrowMut BeaconAttachmentListCall<'a, C, A> { self._beacon_name = new_value.to_string(); @@ -1096,12 +1097,12 @@ impl<'a, C, A> BeaconAttachmentListCall<'a, C, A> where C: BorrowMut BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.get", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("beaconName", self._beacon_name.to_string())); @@ -1234,7 +1235,7 @@ impl<'a, C, A> BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1255,7 +1256,7 @@ impl<'a, C, A> BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1265,10 +1266,10 @@ impl<'a, C, A> BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1301,7 +1302,7 @@ impl<'a, C, A> BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *beacon name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn beacon_name(mut self, new_value: &str) -> BeaconGetCall<'a, C, A> { self._beacon_name = new_value.to_string(); @@ -1319,12 +1320,12 @@ impl<'a, C, A> BeaconGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1412,7 +1413,7 @@ impl<'a, C, A> BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.attachments.create", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.attachments.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("beaconName", self._beacon_name.to_string())); @@ -1466,14 +1467,14 @@ impl<'a, C, A> BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1502,7 +1503,7 @@ impl<'a, C, A> BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1512,10 +1513,10 @@ impl<'a, C, A> BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut BeaconAttachmentCreateCall<'a, C, A> { self._request = new_value; @@ -1557,7 +1558,7 @@ impl<'a, C, A> BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut BeaconAttachmentCreateCall<'a, C, A> { self._beacon_name = new_value.to_string(); @@ -1575,12 +1576,12 @@ impl<'a, C, A> BeaconAttachmentCreateCall<'a, C, A> where C: BorrowMut BeaconDecommissionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.decommission", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.decommission", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("beaconName", self._beacon_name.to_string())); @@ -1713,7 +1714,7 @@ impl<'a, C, A> BeaconDecommissionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1734,7 +1735,7 @@ impl<'a, C, A> BeaconDecommissionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1744,10 +1745,10 @@ impl<'a, C, A> BeaconDecommissionCall<'a, C, A> where C: BorrowMut BeaconDecommissionCall<'a, C, A> where C: BorrowMut BeaconDecommissionCall<'a, C, A> { self._beacon_name = new_value.to_string(); @@ -1798,12 +1799,12 @@ impl<'a, C, A> BeaconDecommissionCall<'a, C, A> where C: BorrowMut BeaconActivateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.activate", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.activate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("beaconName", self._beacon_name.to_string())); @@ -1936,7 +1937,7 @@ impl<'a, C, A> BeaconActivateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1957,7 +1958,7 @@ impl<'a, C, A> BeaconActivateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1967,10 +1968,10 @@ impl<'a, C, A> BeaconActivateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2003,7 +2004,7 @@ impl<'a, C, A> BeaconActivateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *beacon name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn beacon_name(mut self, new_value: &str) -> BeaconActivateCall<'a, C, A> { self._beacon_name = new_value.to_string(); @@ -2021,12 +2022,12 @@ impl<'a, C, A> BeaconActivateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2109,7 +2110,7 @@ impl<'a, C, A> BeaconListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.list", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._q { @@ -2147,7 +2148,7 @@ impl<'a, C, A> BeaconListCall<'a, C, A> where C: BorrowMut, A: oa } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2168,7 +2169,7 @@ impl<'a, C, A> BeaconListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2178,10 +2179,10 @@ impl<'a, C, A> BeaconListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2243,12 +2244,12 @@ impl<'a, C, A> BeaconListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2334,7 +2335,7 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.update", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("beaconName", self._beacon_name.to_string())); @@ -2388,14 +2389,14 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2424,7 +2425,7 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2434,10 +2435,10 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2469,7 +2470,7 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Beacon) -> BeaconUpdateCall<'a, C, A> { self._request = new_value; @@ -2479,7 +2480,7 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *beacon name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn beacon_name(mut self, new_value: &str) -> BeaconUpdateCall<'a, C, A> { self._beacon_name = new_value.to_string(); @@ -2497,12 +2498,12 @@ impl<'a, C, A> BeaconUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2581,7 +2582,7 @@ impl<'a, C, A> BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.attachments.delete", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.attachments.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("attachmentName", self._attachment_name.to_string())); @@ -2635,7 +2636,7 @@ impl<'a, C, A> BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2656,7 +2657,7 @@ impl<'a, C, A> BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2666,10 +2667,10 @@ impl<'a, C, A> BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut BeaconAttachmentDeleteCall<'a, C, A> { self._attachment_name = new_value.to_string(); @@ -2720,12 +2721,12 @@ impl<'a, C, A> BeaconAttachmentDeleteCall<'a, C, A> where C: BorrowMut BeaconDeactivateCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.deactivate", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.deactivate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("beaconName", self._beacon_name.to_string())); @@ -2858,7 +2859,7 @@ impl<'a, C, A> BeaconDeactivateCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2879,7 +2880,7 @@ impl<'a, C, A> BeaconDeactivateCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2889,10 +2890,10 @@ impl<'a, C, A> BeaconDeactivateCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2925,7 +2926,7 @@ impl<'a, C, A> BeaconDeactivateCall<'a, C, A> where C: BorrowMut, /// /// Sets the *beacon name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn beacon_name(mut self, new_value: &str) -> BeaconDeactivateCall<'a, C, A> { self._beacon_name = new_value.to_string(); @@ -2943,12 +2944,12 @@ impl<'a, C, A> BeaconDeactivateCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3032,7 +3033,7 @@ impl<'a, C, A> BeaconRegisterCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.register", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.register", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3061,14 +3062,14 @@ impl<'a, C, A> BeaconRegisterCall<'a, C, A> where C: BorrowMut, A } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3097,7 +3098,7 @@ impl<'a, C, A> BeaconRegisterCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3107,10 +3108,10 @@ impl<'a, C, A> BeaconRegisterCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3142,7 +3143,7 @@ impl<'a, C, A> BeaconRegisterCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Beacon) -> BeaconRegisterCall<'a, C, A> { self._request = new_value; @@ -3160,12 +3161,12 @@ impl<'a, C, A> BeaconRegisterCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3250,7 +3251,7 @@ impl<'a, C, A> BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.diagnostics.list", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.diagnostics.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("beaconName", self._beacon_name.to_string())); @@ -3313,7 +3314,7 @@ impl<'a, C, A> BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3334,7 +3335,7 @@ impl<'a, C, A> BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3344,10 +3345,10 @@ impl<'a, C, A> BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut BeaconDiagnosticListCall<'a, C, A> { self._beacon_name = new_value.to_string(); @@ -3419,12 +3420,12 @@ impl<'a, C, A> BeaconDiagnosticListCall<'a, C, A> where C: BorrowMut BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beacons.attachments.batchDelete", + dlg.begin(MethodInfo { id: "proximitybeacon.beacons.attachments.batchDelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("beaconName", self._beacon_name.to_string())); @@ -3562,7 +3563,7 @@ impl<'a, C, A> BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3583,7 +3584,7 @@ impl<'a, C, A> BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3593,10 +3594,10 @@ impl<'a, C, A> BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut BeaconAttachmentBatchDeleteCall<'a, C, A> { self._beacon_name = new_value.to_string(); @@ -3654,12 +3655,12 @@ impl<'a, C, A> BeaconAttachmentBatchDeleteCall<'a, C, A> where C: BorrowMut BeaconinfoGetforobservedCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.beaconinfo.getforobserved", + dlg.begin(MethodInfo { id: "proximitybeacon.beaconinfo.getforobserved", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3772,14 +3773,14 @@ impl<'a, C, A> BeaconinfoGetforobservedCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3808,7 +3809,7 @@ impl<'a, C, A> BeaconinfoGetforobservedCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3818,10 +3819,10 @@ impl<'a, C, A> BeaconinfoGetforobservedCall<'a, C, A> where C: BorrowMut BeaconinfoGetforobservedCall<'a, C, A> where C: BorrowMut BeaconinfoGetforobservedCall<'a, C, A> { self._request = new_value; @@ -3871,12 +3872,12 @@ impl<'a, C, A> BeaconinfoGetforobservedCall<'a, C, A> where C: BorrowMut NamespaceListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "proximitybeacon.namespaces.list", + dlg.begin(MethodInfo { id: "proximitybeacon.namespaces.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3982,7 +3983,7 @@ impl<'a, C, A> NamespaceListCall<'a, C, A> where C: BorrowMut, A: } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4003,7 +4004,7 @@ impl<'a, C, A> NamespaceListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4013,10 +4014,10 @@ impl<'a, C, A> NamespaceListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4057,12 +4058,12 @@ impl<'a, C, A> NamespaceListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. diff --git a/gen/pubsub1-cli/Cargo.toml b/gen/pubsub1-cli/Cargo.toml index 75d205bcba..3de388e62a 100644 --- a/gen/pubsub1-cli/Cargo.toml +++ b/gen/pubsub1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1-cli" -version = "0.3.2+20150526" +version = "0.3.3+20151103" authors = ["Sebastian Thiel "] description = "A complete library to interact with pubsub (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/pubsub1-cli/LICENSE.md b/gen/pubsub1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/pubsub1-cli/LICENSE.md +++ b/gen/pubsub1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/pubsub1-cli/README.md b/gen/pubsub1-cli/README.md index 1879252892..76a1e55764 100644 --- a/gen/pubsub1-cli/README.md +++ b/gen/pubsub1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *pubsub* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/pubsub1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/pubsub1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/pubsub1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/pubsub1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1-cli). # Usage -This documentation was generated from the *pubsub* API at revision *20150526*. The CLI is at version *0.3.2*. +This documentation was generated from the *pubsub* API at revision *20151103*. The CLI is at version *0.3.3*. ```bash pubsub1 [options] @@ -53,18 +53,18 @@ pubsub1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/pubsub1-cli/mkdocs.yml b/gen/pubsub1-cli/mkdocs.yml index e23ba98383..8a2e4438c0 100644 --- a/gen/pubsub1-cli/mkdocs.yml +++ b/gen/pubsub1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: pubsub v0.3.2+20150526 +site_name: pubsub v0.3.3+20151103 site_url: http://byron.github.io/google-apis-rs/google-pubsub1-cli site_description: Write integrating applications with bcore @@ -32,5 +32,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/pubsub1-cli/src/main.rs b/gen/pubsub1-cli/src/main.rs index 7e810f9531..28de02aa69 100644 --- a/gen/pubsub1-cli/src/main.rs +++ b/gen/pubsub1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Pubsub>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _projects_subscriptions_acknowledge(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _projects_subscriptions_acknowledge(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ack-ids" => Some(("ackIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -81,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AcknowledgeRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_acknowledge(request, opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -94,7 +94,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -107,7 +107,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -130,13 +130,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -150,8 +150,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "topic" => Some(("topic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ack-deadline-seconds" => Some(("ackDeadlineSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -170,7 +170,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subscription = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_create(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -183,7 +183,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -196,7 +196,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -219,10 +219,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().subscriptions_delete(opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -235,7 +235,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -248,7 +248,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -271,10 +271,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().subscriptions_get(opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -287,7 +287,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -300,7 +300,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -323,10 +323,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_get_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().subscriptions_get_iam_policy(opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -339,7 +339,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -352,7 +352,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -375,10 +375,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().subscriptions_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -397,7 +397,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -411,7 +411,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -434,13 +434,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_modify_ack_deadline(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_modify_ack_deadline(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -454,8 +454,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ack-deadline-seconds" => Some(("ackDeadlineSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "ack-ids" => Some(("ackIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -471,7 +471,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ModifyAckDeadlineRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_modify_ack_deadline(request, opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -484,7 +484,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -497,7 +497,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -520,13 +520,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_modify_push_config(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_modify_push_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -540,8 +540,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "push-config.attributes" => Some(("pushConfig.attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "push-config.push-endpoint" => Some(("pushConfig.pushEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -557,7 +557,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ModifyPushConfigRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_modify_push_config(request, opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -570,7 +570,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -583,7 +583,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -606,13 +606,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_pull(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_pull(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -626,8 +626,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "return-immediately" => Some(("returnImmediately", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "max-messages" => Some(("maxMessages", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -643,7 +643,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PullRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_pull(request, opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -656,7 +656,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -669,7 +669,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -692,13 +692,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_set_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -712,8 +712,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -729,7 +729,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -742,7 +742,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -755,7 +755,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -778,13 +778,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_test_iam_permissions(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -798,8 +798,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -814,7 +814,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -827,7 +827,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -840,7 +840,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -863,13 +863,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -883,8 +883,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -899,7 +899,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Topic = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().topics_create(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -912,7 +912,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -925,7 +925,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -948,10 +948,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().topics_delete(opt.value_of("topic").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -964,7 +964,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -977,7 +977,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1000,10 +1000,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().topics_get(opt.value_of("topic").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1016,7 +1016,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1029,7 +1029,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1052,10 +1052,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_get_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().topics_get_iam_policy(opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1068,7 +1068,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1081,7 +1081,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1104,10 +1104,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().topics_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1126,7 +1126,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -1140,7 +1140,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1163,13 +1163,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_publish(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_publish(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1183,8 +1183,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -1198,7 +1198,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PublishRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().topics_publish(request, opt.value_of("topic").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1211,7 +1211,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1224,7 +1224,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1247,13 +1247,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_set_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1267,8 +1267,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1284,7 +1284,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().topics_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1297,7 +1297,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1310,7 +1310,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1333,10 +1333,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_subscriptions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_subscriptions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().topics_subscriptions_list(opt.value_of("topic").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1355,7 +1355,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -1369,7 +1369,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1392,13 +1392,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_test_iam_permissions(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1412,8 +1412,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -1428,7 +1428,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().topics_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1441,7 +1441,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1454,7 +1454,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1567,14 +1567,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "pubsub1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "pubsub1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1594,7 +1594,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1637,7 +1637,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("projects", "methods: 'subscriptions-acknowledge', 'subscriptions-create', 'subscriptions-delete', 'subscriptions-get', 'subscriptions-get-iam-policy', 'subscriptions-list', 'subscriptions-modify-ack-deadline', 'subscriptions-modify-push-config', 'subscriptions-pull', 'subscriptions-set-iam-policy', 'subscriptions-test-iam-permissions', 'topics-create', 'topics-delete', 'topics-get', 'topics-get-iam-policy', 'topics-list', 'topics-publish', 'topics-set-iam-policy', 'topics-subscriptions-list' and 'topics-test-iam-permissions'", vec![ - ("subscriptions-acknowledge", + ("subscriptions-acknowledge", Some(r##"Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription. Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-acknowledge", vec![ @@ -1665,7 +1665,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-create", + ("subscriptions-create", Some(r##"Creates a subscription to a given topic for a given subscriber. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-create", vec![ @@ -1693,7 +1693,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-delete", + ("subscriptions-delete", Some(r##"Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-delete", vec![ @@ -1715,7 +1715,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-get", + ("subscriptions-get", Some(r##"Gets the configuration details of a subscription."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-get", vec![ @@ -1737,13 +1737,13 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-get-iam-policy", + ("subscriptions-get-iam-policy", Some(r##"Gets the access control policy for a `resource`. Is empty if the policy or the resource does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which policy is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective GetIamPolicy rpc."##), Some(true), Some(false)), @@ -1759,7 +1759,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-list", + ("subscriptions-list", Some(r##"Lists matching subscriptions."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-list", vec![ @@ -1781,7 +1781,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-modify-ack-deadline", + ("subscriptions-modify-ack-deadline", Some(r##"Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-modify-ack-deadline", vec![ @@ -1809,7 +1809,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-modify-push-config", + ("subscriptions-modify-push-config", Some(r##"Modifies the `PushConfig` for a specified subscription. This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-modify-push-config", vec![ @@ -1837,7 +1837,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-pull", + ("subscriptions-pull", Some(r##"Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-pull", vec![ @@ -1865,13 +1865,13 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-set-iam-policy", + ("subscriptions-set-iam-policy", Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`."##), + Some(r##"REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc."##), Some(true), Some(false)), @@ -1893,13 +1893,13 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-test-iam-permissions", + ("subscriptions-test-iam-permissions", Some(r##"Returns permissions that a caller has on the specified resource."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_subscriptions-test-iam-permissions", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc."##), Some(true), Some(false)), @@ -1921,7 +1921,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-create", + ("topics-create", Some(r##"Creates the given topic with the given name."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-create", vec![ @@ -1949,7 +1949,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-delete", + ("topics-delete", Some(r##"Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-delete", vec![ @@ -1971,7 +1971,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-get", + ("topics-get", Some(r##"Gets the configuration of a topic."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-get", vec![ @@ -1993,13 +1993,13 @@ fn main() { Some(false), Some(false)), ]), - ("topics-get-iam-policy", + ("topics-get-iam-policy", Some(r##"Gets the access control policy for a `resource`. Is empty if the policy or the resource does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which policy is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective GetIamPolicy rpc."##), Some(true), Some(false)), @@ -2015,7 +2015,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-list", + ("topics-list", Some(r##"Lists matching topics."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-list", vec![ @@ -2037,7 +2037,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-publish", + ("topics-publish", Some(r##"Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-publish", vec![ @@ -2065,13 +2065,13 @@ fn main() { Some(false), Some(false)), ]), - ("topics-set-iam-policy", + ("topics-set-iam-policy", Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`."##), + Some(r##"REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc."##), Some(true), Some(false)), @@ -2093,7 +2093,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-subscriptions-list", + ("topics-subscriptions-list", Some(r##"Lists the name of the subscriptions for this topic."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-subscriptions-list", vec![ @@ -2115,13 +2115,13 @@ fn main() { Some(false), Some(false)), ]), - ("topics-test-iam-permissions", + ("topics-test-iam-permissions", Some(r##"Returns permissions that a caller has on the specified resource."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_cli/projects_topics-test-iam-permissions", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc."##), Some(true), Some(false)), @@ -2149,7 +2149,7 @@ fn main() { let mut app = App::new("pubsub1") .author("Sebastian Thiel ") - .version("0.3.2+20150526") + .version("0.3.3+20151103") .about("Provides reliable, many-to-many, asynchronous messaging between applications.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pubsub1_cli") .arg(Arg::with_name("url") @@ -2173,7 +2173,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -2184,7 +2184,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/pubsub1/Cargo.toml b/gen/pubsub1/Cargo.toml index 128140608a..6dacb35c85 100644 --- a/gen/pubsub1/Cargo.toml +++ b/gen/pubsub1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1" -version = "0.1.10+20150526" +version = "0.1.11+20151103" authors = ["Sebastian Thiel "] description = "A complete library to interact with pubsub (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1" diff --git a/gen/pubsub1/LICENSE.md b/gen/pubsub1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/pubsub1/LICENSE.md +++ b/gen/pubsub1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/pubsub1/README.md b/gen/pubsub1/README.md index 8542d0344a..6311bb2ae0 100644 --- a/gen/pubsub1/README.md +++ b/gen/pubsub1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-pubsub1` library allows access to all features of the *Google pubsub* service. -This documentation was generated from *pubsub* crate version *0.1.10+20150526*, where *20150526* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *pubsub* crate version *0.1.11+20151103*, where *20151103* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *pubsub* *v1* API can be found at the [official documentation site](https://cloud.google.com/pubsub/docs). diff --git a/gen/pubsub1/src/cmn.rs b/gen/pubsub1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/pubsub1/src/cmn.rs +++ b/gen/pubsub1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/pubsub1/src/lib.rs b/gen/pubsub1/src/lib.rs index 45076dc2e2..9a5a3adc9e 100644 --- a/gen/pubsub1/src/lib.rs +++ b/gen/pubsub1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *pubsub* crate version *0.1.10+20150526*, where *20150526* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *pubsub* crate version *0.1.11+20151103*, where *20151103* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *pubsub* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/pubsub/docs). diff --git a/gen/pubsub1/src/lib.rs.in b/gen/pubsub1/src/lib.rs.in index f4804df871..52f25a6440 100644 --- a/gen/pubsub1/src/lib.rs.in +++ b/gen/pubsub1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -136,7 +137,7 @@ impl<'a, C, A> Pubsub Pubsub { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -145,7 +146,7 @@ impl<'a, C, A> Pubsub } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -522,7 +523,10 @@ pub struct PubsubMessage { pub attributes: Option>, /// The message payload. For JSON requests, the value of this field must be base64-encoded. pub data: Option, - /// ID of this message assigned by the server at publication time. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by a publisher in a `Publish` call. + /// The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call. + #[serde(rename="publishTime")] + pub publish_time: Option, + /// ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call. #[serde(rename="messageId")] pub message_id: Option, } @@ -681,7 +685,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc. pub fn topics_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectTopicTestIamPermissionCall<'a, C, A> { ProjectTopicTestIamPermissionCall { hub: self.hub, @@ -754,7 +758,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `resource` - REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which policy is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective GetIamPolicy rpc. pub fn topics_get_iam_policy(&self, resource: &str) -> ProjectTopicGetIamPolicyCall<'a, C, A> { ProjectTopicGetIamPolicyCall { hub: self.hub, @@ -808,7 +812,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// * `resource` - REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc. pub fn topics_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectTopicSetIamPolicyCall<'a, C, A> { ProjectTopicSetIamPolicyCall { hub: self.hub, @@ -864,7 +868,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `resource` - REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which policy is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective GetIamPolicy rpc. pub fn subscriptions_get_iam_policy(&self, resource: &str) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { ProjectSubscriptionGetIamPolicyCall { hub: self.hub, @@ -882,7 +886,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc. pub fn subscriptions_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { ProjectSubscriptionTestIamPermissionCall { hub: self.hub, @@ -973,7 +977,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// * `resource` - REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc. pub fn subscriptions_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> { ProjectSubscriptionSetIamPolicyCall { hub: self.hub, @@ -1053,7 +1057,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.list", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1104,7 +1108,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1140,7 +1144,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1150,10 +1154,10 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1186,7 +1190,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ProjectTopicListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1218,12 +1222,12 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1246,17 +1250,17 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectTopicListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1326,7 +1330,7 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.pull", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.pull", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -1371,14 +1375,14 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1422,7 +1426,7 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1432,10 +1436,10 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> { self._request = new_value; @@ -1477,7 +1481,7 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -1495,12 +1499,12 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionPullCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionPullCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1603,7 +1607,7 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.create", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.create", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -1648,14 +1652,14 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1699,7 +1703,7 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1709,10 +1713,10 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> { self._request = new_value; @@ -1754,7 +1758,7 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> { self._name = new_value.to_string(); @@ -1772,12 +1776,12 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1880,7 +1884,7 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.testIamPermissions", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.testIamPermissions", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -1925,14 +1929,14 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1976,7 +1980,7 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1986,10 +1990,10 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectTopicTestIamPermissionCall<'a, C, A> { self._resource = new_value.to_string(); @@ -2049,12 +2053,12 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicTestIamPermissionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicTestIamPermissionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2157,7 +2161,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.modifyPushConfig", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.modifyPushConfig", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -2202,14 +2206,14 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2253,7 +2257,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2263,10 +2267,10 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2298,7 +2302,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ModifyPushConfigRequest) -> ProjectSubscriptionModifyPushConfigCall<'a, C, A> { self._request = new_value; @@ -2308,7 +2312,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow /// /// Sets the *subscription* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionModifyPushConfigCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -2326,12 +2330,12 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2354,17 +2358,17 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSubscriptionModifyPushConfigCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2434,7 +2438,7 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.publish", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.publish", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("topic", self._topic.to_string())); @@ -2479,14 +2483,14 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2530,7 +2534,7 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2540,10 +2544,10 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> { self._request = new_value; @@ -2585,7 +2589,7 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> { self._topic = new_value.to_string(); @@ -2603,12 +2607,12 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicPublishCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicPublishCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2704,7 +2708,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.get", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("topic", self._topic.to_string())); @@ -2749,7 +2753,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2785,7 +2789,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2795,10 +2799,10 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2831,7 +2835,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *topic* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn topic(mut self, new_value: &str) -> ProjectTopicGetCall<'a, C, A> { self._topic = new_value.to_string(); @@ -2849,12 +2853,12 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2877,17 +2881,17 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectTopicGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2950,7 +2954,7 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.getIamPolicy", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.getIamPolicy", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -2995,7 +2999,7 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3031,7 +3035,7 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3041,10 +3045,10 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -3095,12 +3099,12 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicGetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicGetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3203,7 +3207,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.modifyAckDeadline", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.modifyAckDeadline", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -3248,14 +3252,14 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3299,7 +3303,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3309,10 +3313,10 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3344,7 +3348,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ModifyAckDeadlineRequest) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { self._request = new_value; @@ -3354,7 +3358,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro /// /// Sets the *subscription* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -3372,12 +3376,12 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3400,17 +3404,17 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3473,7 +3477,7 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.delete", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -3518,7 +3522,7 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3554,7 +3558,7 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3564,10 +3568,10 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -3618,12 +3622,12 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3726,7 +3730,7 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.setIamPolicy", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.setIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -3771,14 +3775,14 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3822,7 +3826,7 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3832,10 +3836,10 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectTopicSetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -3895,12 +3899,12 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicSetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicSetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4003,7 +4007,7 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.create", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.create", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -4048,14 +4052,14 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4099,7 +4103,7 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4109,10 +4113,10 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> { self._request = new_value; @@ -4154,7 +4158,7 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> { self._name = new_value.to_string(); @@ -4172,12 +4176,12 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4280,7 +4284,7 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.acknowledge", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.acknowledge", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -4325,14 +4329,14 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4376,7 +4380,7 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4386,10 +4390,10 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> { self._request = new_value; @@ -4431,7 +4435,7 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -4449,12 +4453,12 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4550,7 +4554,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.getIamPolicy", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.getIamPolicy", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -4595,7 +4599,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4631,7 +4635,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4641,10 +4645,10 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4673,11 +4677,11 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } - /// REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`. + /// REQUIRED: The resource for which policy is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective GetIamPolicy rpc. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -4695,12 +4699,12 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4723,17 +4727,17 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4803,7 +4807,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.testIamPermissions", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.testIamPermissions", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -4848,14 +4852,14 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4899,7 +4903,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4909,10 +4913,10 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4944,17 +4948,17 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TestIamPermissionsRequest) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { self._resource = new_value.to_string(); @@ -4972,12 +4976,12 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -5000,17 +5004,17 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5073,7 +5077,7 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.delete", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("topic", self._topic.to_string())); @@ -5118,7 +5122,7 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5154,7 +5158,7 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5164,10 +5168,10 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> { self._topic = new_value.to_string(); @@ -5218,12 +5222,12 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5319,7 +5323,7 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.get", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -5364,7 +5368,7 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5400,7 +5404,7 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5410,10 +5414,10 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -5464,12 +5468,12 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5569,7 +5573,7 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.subscriptions.list", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.subscriptions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("topic", self._topic.to_string())); @@ -5620,7 +5624,7 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5656,7 +5660,7 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5666,10 +5670,10 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> { self._topic = new_value.to_string(); @@ -5734,12 +5738,12 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicSubscriptionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicSubscriptionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5839,7 +5843,7 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.list", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -5890,7 +5894,7 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5926,7 +5930,7 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5936,10 +5940,10 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> { self._project = new_value.to_string(); @@ -6004,12 +6008,12 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6112,7 +6116,7 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.setIamPolicy", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.setIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -6157,14 +6161,14 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6208,7 +6212,7 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6218,10 +6222,10 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6253,17 +6257,17 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SetIamPolicyRequest) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -6281,12 +6285,12 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -6309,17 +6313,17 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/pubsub1_beta2-cli/Cargo.toml b/gen/pubsub1_beta2-cli/Cargo.toml index 240ffc8856..f110519b3f 100644 --- a/gen/pubsub1_beta2-cli/Cargo.toml +++ b/gen/pubsub1_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1_beta2-cli" -version = "0.3.2+20150526" +version = "0.3.3+20151103" authors = ["Sebastian Thiel "] description = "A complete library to interact with pubsub (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1_beta2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/pubsub1_beta2-cli/LICENSE.md b/gen/pubsub1_beta2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/pubsub1_beta2-cli/LICENSE.md +++ b/gen/pubsub1_beta2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/pubsub1_beta2-cli/README.md b/gen/pubsub1_beta2-cli/README.md index e533bd3a2e..ad04024979 100644 --- a/gen/pubsub1_beta2-cli/README.md +++ b/gen/pubsub1_beta2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *pubsub* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/pubsub1-beta2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/pubsub1-beta2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/pubsub1-beta2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/pubsub1-beta2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1_beta2-cli). # Usage -This documentation was generated from the *pubsub* API at revision *20150526*. The CLI is at version *0.3.2*. +This documentation was generated from the *pubsub* API at revision *20151103*. The CLI is at version *0.3.3*. ```bash pubsub1-beta2 [options] @@ -53,18 +53,18 @@ pubsub1-beta2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/pubsub1_beta2-cli/mkdocs.yml b/gen/pubsub1_beta2-cli/mkdocs.yml index 83243cdeec..2bab2e6a82 100644 --- a/gen/pubsub1_beta2-cli/mkdocs.yml +++ b/gen/pubsub1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: pubsub v0.3.2+20150526 +site_name: pubsub v0.3.3+20151103 site_url: http://byron.github.io/google-apis-rs/google-pubsub1_beta2-cli site_description: Write integrating applications with bcore @@ -32,5 +32,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/pubsub1_beta2-cli/src/main.rs b/gen/pubsub1_beta2-cli/src/main.rs index 815235f269..dd2def3729 100644 --- a/gen/pubsub1_beta2-cli/src/main.rs +++ b/gen/pubsub1_beta2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Pubsub>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _projects_subscriptions_acknowledge(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _projects_subscriptions_acknowledge(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ack-ids" => Some(("ackIds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -81,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::AcknowledgeRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_acknowledge(request, opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -94,7 +94,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -107,7 +107,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -130,13 +130,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -150,8 +150,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "topic" => Some(("topic", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ack-deadline-seconds" => Some(("ackDeadlineSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -170,7 +170,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subscription = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_create(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -183,7 +183,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -196,7 +196,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -219,10 +219,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().subscriptions_delete(opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -235,7 +235,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -248,7 +248,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -271,10 +271,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().subscriptions_get(opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -287,7 +287,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -300,7 +300,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -323,10 +323,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_get_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().subscriptions_get_iam_policy(opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -339,7 +339,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -352,7 +352,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -375,10 +375,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().subscriptions_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -397,7 +397,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -411,7 +411,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -434,13 +434,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_modify_ack_deadline(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_modify_ack_deadline(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -454,8 +454,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "ack-deadline-seconds" => Some(("ackDeadlineSeconds", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "ack-id" => Some(("ackId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -472,7 +472,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ModifyAckDeadlineRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_modify_ack_deadline(request, opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -485,7 +485,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -498,7 +498,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -521,13 +521,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_modify_push_config(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_modify_push_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -541,8 +541,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "push-config.attributes" => Some(("pushConfig.attributes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Map })), "push-config.push-endpoint" => Some(("pushConfig.pushEndpoint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -558,7 +558,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ModifyPushConfigRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_modify_push_config(request, opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -571,7 +571,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -584,7 +584,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -607,13 +607,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_pull(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_pull(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -627,8 +627,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "return-immediately" => Some(("returnImmediately", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "max-messages" => Some(("maxMessages", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -644,7 +644,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PullRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_pull(request, opt.value_of("subscription").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -657,7 +657,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -670,7 +670,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -693,13 +693,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_set_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -713,8 +713,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -730,7 +730,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -743,7 +743,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -756,7 +756,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -779,13 +779,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_subscriptions_test_iam_permissions(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_subscriptions_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -799,8 +799,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -815,7 +815,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().subscriptions_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -828,7 +828,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -841,7 +841,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -864,13 +864,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -884,8 +884,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -900,7 +900,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Topic = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().topics_create(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -913,7 +913,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -926,7 +926,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -949,10 +949,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().topics_delete(opt.value_of("topic").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -965,7 +965,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -978,7 +978,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1001,10 +1001,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().topics_get(opt.value_of("topic").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1017,7 +1017,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1030,7 +1030,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1053,10 +1053,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_get_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_get_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().topics_get_iam_policy(opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1069,7 +1069,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1082,7 +1082,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1105,10 +1105,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().topics_list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1127,7 +1127,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -1141,7 +1141,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1164,13 +1164,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_publish(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_publish(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1184,8 +1184,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -1199,7 +1199,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PublishRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().topics_publish(request, opt.value_of("topic").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1212,7 +1212,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1225,7 +1225,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1248,13 +1248,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_set_iam_policy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_set_iam_policy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1268,8 +1268,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "policy.version" => Some(("policy.version", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "policy.etag" => Some(("policy.etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1285,7 +1285,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SetIamPolicyRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().topics_set_iam_policy(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1298,7 +1298,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1311,7 +1311,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1334,10 +1334,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_subscriptions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_subscriptions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.projects().topics_subscriptions_list(opt.value_of("topic").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1356,7 +1356,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "page-size"].iter().map(|v|*v)); @@ -1370,7 +1370,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1393,13 +1393,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _projects_topics_test_iam_permissions(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _projects_topics_test_iam_permissions(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1413,8 +1413,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "permissions" => Some(("permissions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -1429,7 +1429,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TestIamPermissionsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.projects().topics_test_iam_permissions(request, opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1442,7 +1442,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1455,7 +1455,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1568,14 +1568,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "pubsub1-beta2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "pubsub1-beta2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1595,7 +1595,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1638,7 +1638,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("projects", "methods: 'subscriptions-acknowledge', 'subscriptions-create', 'subscriptions-delete', 'subscriptions-get', 'subscriptions-get-iam-policy', 'subscriptions-list', 'subscriptions-modify-ack-deadline', 'subscriptions-modify-push-config', 'subscriptions-pull', 'subscriptions-set-iam-policy', 'subscriptions-test-iam-permissions', 'topics-create', 'topics-delete', 'topics-get', 'topics-get-iam-policy', 'topics-list', 'topics-publish', 'topics-set-iam-policy', 'topics-subscriptions-list' and 'topics-test-iam-permissions'", vec![ - ("subscriptions-acknowledge", + ("subscriptions-acknowledge", Some(r##"Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription. Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-acknowledge", vec![ @@ -1666,7 +1666,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-create", + ("subscriptions-create", Some(r##"Creates a subscription to a given topic for a given subscriber. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-create", vec![ @@ -1694,7 +1694,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-delete", + ("subscriptions-delete", Some(r##"Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-delete", vec![ @@ -1716,7 +1716,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-get", + ("subscriptions-get", Some(r##"Gets the configuration details of a subscription."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-get", vec![ @@ -1738,13 +1738,13 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-get-iam-policy", + ("subscriptions-get-iam-policy", Some(r##"Gets the access control policy for a `resource`. Is empty if the policy or the resource does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which policy is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective GetIamPolicy rpc."##), Some(true), Some(false)), @@ -1760,7 +1760,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-list", + ("subscriptions-list", Some(r##"Lists matching subscriptions."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-list", vec![ @@ -1782,7 +1782,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-modify-ack-deadline", + ("subscriptions-modify-ack-deadline", Some(r##"Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-modify-ack-deadline", vec![ @@ -1810,7 +1810,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-modify-push-config", + ("subscriptions-modify-push-config", Some(r##"Modifies the `PushConfig` for a specified subscription. This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-modify-push-config", vec![ @@ -1838,7 +1838,7 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-pull", + ("subscriptions-pull", Some(r##"Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-pull", vec![ @@ -1866,13 +1866,13 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-set-iam-policy", + ("subscriptions-set-iam-policy", Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`."##), + Some(r##"REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc."##), Some(true), Some(false)), @@ -1894,13 +1894,13 @@ fn main() { Some(false), Some(false)), ]), - ("subscriptions-test-iam-permissions", + ("subscriptions-test-iam-permissions", Some(r##"Returns permissions that a caller has on the specified resource."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_subscriptions-test-iam-permissions", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc."##), Some(true), Some(false)), @@ -1922,7 +1922,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-create", + ("topics-create", Some(r##"Creates the given topic with the given name."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-create", vec![ @@ -1950,7 +1950,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-delete", + ("topics-delete", Some(r##"Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-delete", vec![ @@ -1972,7 +1972,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-get", + ("topics-get", Some(r##"Gets the configuration of a topic."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-get", vec![ @@ -1994,13 +1994,13 @@ fn main() { Some(false), Some(false)), ]), - ("topics-get-iam-policy", + ("topics-get-iam-policy", Some(r##"Gets the access control policy for a `resource`. Is empty if the policy or the resource does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-get-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which policy is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective GetIamPolicy rpc."##), Some(true), Some(false)), @@ -2016,7 +2016,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-list", + ("topics-list", Some(r##"Lists matching topics."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-list", vec![ @@ -2038,7 +2038,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-publish", + ("topics-publish", Some(r##"Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-publish", vec![ @@ -2066,13 +2066,13 @@ fn main() { Some(false), Some(false)), ]), - ("topics-set-iam-policy", + ("topics-set-iam-policy", Some(r##"Sets the access control policy on the specified resource. Replaces any existing policy."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-set-iam-policy", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`."##), + Some(r##"REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc."##), Some(true), Some(false)), @@ -2094,7 +2094,7 @@ fn main() { Some(false), Some(false)), ]), - ("topics-subscriptions-list", + ("topics-subscriptions-list", Some(r##"Lists the name of the subscriptions for this topic."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-subscriptions-list", vec![ @@ -2116,13 +2116,13 @@ fn main() { Some(false), Some(false)), ]), - ("topics-test-iam-permissions", + ("topics-test-iam-permissions", Some(r##"Returns permissions that a caller has on the specified resource."##), "Details at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli/projects_topics-test-iam-permissions", vec![ (Some(r##"resource"##), None, - Some(r##"REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`."##), + Some(r##"REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc."##), Some(true), Some(false)), @@ -2150,7 +2150,7 @@ fn main() { let mut app = App::new("pubsub1-beta2") .author("Sebastian Thiel ") - .version("0.3.2+20150526") + .version("0.3.3+20151103") .about("Provides reliable, many-to-many, asynchronous messaging between applications.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_pubsub1_beta2_cli") .arg(Arg::with_name("url") @@ -2174,7 +2174,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -2185,7 +2185,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/pubsub1_beta2/Cargo.toml b/gen/pubsub1_beta2/Cargo.toml index 485301cc6f..2f4c9261d1 100644 --- a/gen/pubsub1_beta2/Cargo.toml +++ b/gen/pubsub1_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1_beta2" -version = "0.1.10+20150526" +version = "0.1.11+20151103" authors = ["Sebastian Thiel "] description = "A complete library to interact with pubsub (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/pubsub1_beta2" diff --git a/gen/pubsub1_beta2/LICENSE.md b/gen/pubsub1_beta2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/pubsub1_beta2/LICENSE.md +++ b/gen/pubsub1_beta2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/pubsub1_beta2/README.md b/gen/pubsub1_beta2/README.md index 11ff619fd3..9b8a10a892 100644 --- a/gen/pubsub1_beta2/README.md +++ b/gen/pubsub1_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-pubsub1_beta2` library allows access to all features of the *Google pubsub* service. -This documentation was generated from *pubsub* crate version *0.1.10+20150526*, where *20150526* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *pubsub* crate version *0.1.11+20151103*, where *20151103* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *pubsub* *v1_beta2* API can be found at the [official documentation site](https://cloud.google.com/pubsub/docs). diff --git a/gen/pubsub1_beta2/src/cmn.rs b/gen/pubsub1_beta2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/pubsub1_beta2/src/cmn.rs +++ b/gen/pubsub1_beta2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/pubsub1_beta2/src/lib.rs b/gen/pubsub1_beta2/src/lib.rs index ff07fb0d08..bf3d863950 100644 --- a/gen/pubsub1_beta2/src/lib.rs +++ b/gen/pubsub1_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *pubsub* crate version *0.1.10+20150526*, where *20150526* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *pubsub* crate version *0.1.11+20151103*, where *20151103* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *pubsub* *v1_beta2* API can be found at the //! [official documentation site](https://cloud.google.com/pubsub/docs). diff --git a/gen/pubsub1_beta2/src/lib.rs.in b/gen/pubsub1_beta2/src/lib.rs.in index bde211fdb8..972cf42be4 100644 --- a/gen/pubsub1_beta2/src/lib.rs.in +++ b/gen/pubsub1_beta2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -136,7 +137,7 @@ impl<'a, C, A> Pubsub Pubsub { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -145,7 +146,7 @@ impl<'a, C, A> Pubsub } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -525,7 +526,10 @@ pub struct PubsubMessage { pub attributes: Option>, /// The message payload. For JSON requests, the value of this field must be base64-encoded. pub data: Option, - /// ID of this message assigned by the server at publication time. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by a publisher in a `Publish` call. + /// The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call. + #[serde(rename="publishTime")] + pub publish_time: Option, + /// ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call. #[serde(rename="messageId")] pub message_id: Option, } @@ -684,7 +688,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc. pub fn topics_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectTopicTestIamPermissionCall<'a, C, A> { ProjectTopicTestIamPermissionCall { hub: self.hub, @@ -757,7 +761,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `resource` - REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which policy is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective GetIamPolicy rpc. pub fn topics_get_iam_policy(&self, resource: &str) -> ProjectTopicGetIamPolicyCall<'a, C, A> { ProjectTopicGetIamPolicyCall { hub: self.hub, @@ -811,7 +815,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// * `resource` - REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc. pub fn topics_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectTopicSetIamPolicyCall<'a, C, A> { ProjectTopicSetIamPolicyCall { hub: self.hub, @@ -867,7 +871,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// # Arguments /// - /// * `resource` - REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which policy is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective GetIamPolicy rpc. pub fn subscriptions_get_iam_policy(&self, resource: &str) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { ProjectSubscriptionGetIamPolicyCall { hub: self.hub, @@ -885,7 +889,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// * `resource` - REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc. pub fn subscriptions_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { ProjectSubscriptionTestIamPermissionCall { hub: self.hub, @@ -976,7 +980,7 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// # Arguments /// /// * `request` - No description provided. - /// * `resource` - REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// * `resource` - REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc. pub fn subscriptions_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> { ProjectSubscriptionSetIamPolicyCall { hub: self.hub, @@ -1056,7 +1060,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.list", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1107,7 +1111,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1143,7 +1147,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1153,10 +1157,10 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1189,7 +1193,7 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ProjectTopicListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1221,12 +1225,12 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1249,17 +1253,17 @@ impl<'a, C, A> ProjectTopicListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectTopicListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1329,7 +1333,7 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.pull", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.pull", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -1374,14 +1378,14 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1425,7 +1429,7 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1435,10 +1439,10 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> { self._request = new_value; @@ -1480,7 +1484,7 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -1498,12 +1502,12 @@ impl<'a, C, A> ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut ProjectSubscriptionPullCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionPullCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionPullCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1606,7 +1610,7 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.create", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.create", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -1651,14 +1655,14 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1702,7 +1706,7 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1712,10 +1716,10 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> { self._request = new_value; @@ -1757,7 +1761,7 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> { self._name = new_value.to_string(); @@ -1775,12 +1779,12 @@ impl<'a, C, A> ProjectTopicCreateCall<'a, C, A> where C: BorrowMut ProjectTopicCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1883,7 +1887,7 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.testIamPermissions", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.testIamPermissions", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -1928,14 +1932,14 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1979,7 +1983,7 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1989,10 +1993,10 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectTopicTestIamPermissionCall<'a, C, A> { self._resource = new_value.to_string(); @@ -2052,12 +2056,12 @@ impl<'a, C, A> ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut ProjectTopicTestIamPermissionCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicTestIamPermissionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicTestIamPermissionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2160,7 +2164,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.modifyPushConfig", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.modifyPushConfig", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -2205,14 +2209,14 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2256,7 +2260,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2266,10 +2270,10 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2301,7 +2305,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ModifyPushConfigRequest) -> ProjectSubscriptionModifyPushConfigCall<'a, C, A> { self._request = new_value; @@ -2311,7 +2315,7 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow /// /// Sets the *subscription* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionModifyPushConfigCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -2329,12 +2333,12 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2357,17 +2361,17 @@ impl<'a, C, A> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where C: Borrow } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSubscriptionModifyPushConfigCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionModifyPushConfigCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2437,7 +2441,7 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.publish", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.publish", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("topic", self._topic.to_string())); @@ -2482,14 +2486,14 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2533,7 +2537,7 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2543,10 +2547,10 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> { self._request = new_value; @@ -2588,7 +2592,7 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> { self._topic = new_value.to_string(); @@ -2606,12 +2610,12 @@ impl<'a, C, A> ProjectTopicPublishCall<'a, C, A> where C: BorrowMut ProjectTopicPublishCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicPublishCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicPublishCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2707,7 +2711,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.get", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("topic", self._topic.to_string())); @@ -2752,7 +2756,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2788,7 +2792,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2798,10 +2802,10 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2834,7 +2838,7 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *topic* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn topic(mut self, new_value: &str) -> ProjectTopicGetCall<'a, C, A> { self._topic = new_value.to_string(); @@ -2852,12 +2856,12 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2880,17 +2884,17 @@ impl<'a, C, A> ProjectTopicGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectTopicGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2953,7 +2957,7 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.getIamPolicy", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.getIamPolicy", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -2998,7 +3002,7 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3034,7 +3038,7 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3044,10 +3048,10 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -3098,12 +3102,12 @@ impl<'a, C, A> ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicGetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicGetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicGetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3206,7 +3210,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.modifyAckDeadline", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.modifyAckDeadline", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -3251,14 +3255,14 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3302,7 +3306,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3312,10 +3316,10 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3347,7 +3351,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ModifyAckDeadlineRequest) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { self._request = new_value; @@ -3357,7 +3361,7 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro /// /// Sets the *subscription* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn subscription(mut self, new_value: &str) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -3375,12 +3379,12 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3403,17 +3407,17 @@ impl<'a, C, A> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where C: Borro } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionModifyAckDeadlineCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3476,7 +3480,7 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.delete", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -3521,7 +3525,7 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3557,7 +3561,7 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3567,10 +3571,10 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -3621,12 +3625,12 @@ impl<'a, C, A> ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut ProjectSubscriptionDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3729,7 +3733,7 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.setIamPolicy", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.setIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -3774,14 +3778,14 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3825,7 +3829,7 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3835,10 +3839,10 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectTopicSetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -3898,12 +3902,12 @@ impl<'a, C, A> ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut ProjectTopicSetIamPolicyCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicSetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicSetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4006,7 +4010,7 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.create", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.create", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -4051,14 +4055,14 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4102,7 +4106,7 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4112,10 +4116,10 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> { self._request = new_value; @@ -4157,7 +4161,7 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> { self._name = new_value.to_string(); @@ -4175,12 +4179,12 @@ impl<'a, C, A> ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut ProjectSubscriptionCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4283,7 +4287,7 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.acknowledge", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.acknowledge", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -4328,14 +4332,14 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4379,7 +4383,7 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4389,10 +4393,10 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> { self._request = new_value; @@ -4434,7 +4438,7 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -4452,12 +4456,12 @@ impl<'a, C, A> ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut ProjectSubscriptionAcknowledgeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionAcknowledgeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4553,7 +4557,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.getIamPolicy", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.getIamPolicy", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -4598,7 +4602,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4634,7 +4638,7 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4644,10 +4648,10 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4676,11 +4680,11 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } - /// REQUIRED: The resource for which policy is being requested. Resource is usually specified as a path, such as, `projects/{project}`. + /// REQUIRED: The resource for which policy is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective GetIamPolicy rpc. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -4698,12 +4702,12 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -4726,17 +4730,17 @@ impl<'a, C, A> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionGetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4806,7 +4810,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.testIamPermissions", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.testIamPermissions", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -4851,14 +4855,14 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4902,7 +4906,7 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4912,10 +4916,10 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4947,17 +4951,17 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TestIamPermissionsRequest) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}`. + /// REQUIRED: The resource for which policy detail is being requested. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective TestIamPermissions rpc. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> { self._resource = new_value.to_string(); @@ -4975,12 +4979,12 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -5003,17 +5007,17 @@ impl<'a, C, A> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where C: Borro } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionTestIamPermissionCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5076,7 +5080,7 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.delete", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("topic", self._topic.to_string())); @@ -5121,7 +5125,7 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5157,7 +5161,7 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5167,10 +5171,10 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> { self._topic = new_value.to_string(); @@ -5221,12 +5225,12 @@ impl<'a, C, A> ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut ProjectTopicDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5322,7 +5326,7 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.get", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("subscription", self._subscription.to_string())); @@ -5367,7 +5371,7 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5403,7 +5407,7 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5413,10 +5417,10 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> { self._subscription = new_value.to_string(); @@ -5467,12 +5471,12 @@ impl<'a, C, A> ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut ProjectSubscriptionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5572,7 +5576,7 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.topics.subscriptions.list", + dlg.begin(MethodInfo { id: "pubsub.projects.topics.subscriptions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("topic", self._topic.to_string())); @@ -5623,7 +5627,7 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5659,7 +5663,7 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5669,10 +5673,10 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> { self._topic = new_value.to_string(); @@ -5737,12 +5741,12 @@ impl<'a, C, A> ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectTopicSubscriptionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectTopicSubscriptionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectTopicSubscriptionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5842,7 +5846,7 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.list", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -5893,7 +5897,7 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5929,7 +5933,7 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5939,10 +5943,10 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> { self._project = new_value.to_string(); @@ -6007,12 +6011,12 @@ impl<'a, C, A> ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut ProjectSubscriptionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ProjectSubscriptionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6115,7 +6119,7 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.setIamPolicy", + dlg.begin(MethodInfo { id: "pubsub.projects.subscriptions.setIamPolicy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("resource", self._resource.to_string())); @@ -6160,14 +6164,14 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6211,7 +6215,7 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6221,10 +6225,10 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6256,17 +6260,17 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SetIamPolicyRequest) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> { self._request = new_value; self } - /// REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. + /// REQUIRED: The resource for which policy is being specified. `resource` is usually specified as a path, such as, `projects/{project}/zones/{zone}/disks/{disk}`. The format for the path specified in this value is resource specific and is specified in the documentation for the respective SetIamPolicy rpc. /// /// Sets the *resource* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> { self._resource = new_value.to_string(); @@ -6284,12 +6288,12 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -6312,17 +6316,17 @@ impl<'a, C, A> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ProjectSubscriptionSetIamPolicyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/qpxexpress1-cli/Cargo.toml b/gen/qpxexpress1-cli/Cargo.toml index eaa2b908c1..f726669f70 100644 --- a/gen/qpxexpress1-cli/Cargo.toml +++ b/gen/qpxexpress1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-qpxexpress1-cli" -version = "0.3.2+20140321" +version = "0.3.3+20140321" authors = ["Sebastian Thiel "] description = "A complete library to interact with QPX Express (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/qpxexpress1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/qpxexpress1-cli/LICENSE.md b/gen/qpxexpress1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/qpxexpress1-cli/LICENSE.md +++ b/gen/qpxexpress1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/qpxexpress1-cli/README.md b/gen/qpxexpress1-cli/README.md index e5329365f6..127c766dbd 100644 --- a/gen/qpxexpress1-cli/README.md +++ b/gen/qpxexpress1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *QPX Express* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/qpxexpress1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/qpxexpress1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/qpxexpress1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/qpxexpress1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/qpxexpress1-cli). # Usage -This documentation was generated from the *QPX Express* API at revision *20140321*. The CLI is at version *0.3.2*. +This documentation was generated from the *QPX Express* API at revision *20140321*. The CLI is at version *0.3.3*. ```bash qpxexpress1 [options] @@ -34,14 +34,14 @@ qpxexpress1 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/qpxexpress1-cli/mkdocs.yml b/gen/qpxexpress1-cli/mkdocs.yml index 3808ddeabf..a7006174dd 100644 --- a/gen/qpxexpress1-cli/mkdocs.yml +++ b/gen/qpxexpress1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: QPX Express v0.3.2+20140321 +site_name: QPX Express v0.3.3+20140321 site_url: http://byron.github.io/google-apis-rs/google-qpxexpress1-cli site_description: Write integrating applications with bcore @@ -13,5 +13,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/qpxexpress1-cli/src/main.rs b/gen/qpxexpress1-cli/src/main.rs index 3e4c76d290..1d962e6602 100644 --- a/gen/qpxexpress1-cli/src/main.rs +++ b/gen/qpxexpress1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::QPXExpress>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _trips_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _trips_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "request.refundable" => Some(("request.refundable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "request.passengers.kind" => Some(("request.passengers.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -90,7 +90,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TripsSearchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.trips().search(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -103,7 +103,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -169,14 +169,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "qpxexpress1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "qpxexpress1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -196,7 +196,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -235,7 +235,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("trips", "methods: 'search'", vec![ - ("search", + ("search", Some(r##"Returns a list of flights."##), "Details at http://byron.github.io/google-apis-rs/google_qpxexpress1_cli/trips_search", vec![ @@ -263,7 +263,7 @@ fn main() { let mut app = App::new("qpxexpress1") .author("Sebastian Thiel ") - .version("0.3.2+20140321") + .version("0.3.3+20140321") .about("Lets you find the least expensive flights between an origin and a destination.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_qpxexpress1_cli") .arg(Arg::with_name("folder") @@ -282,7 +282,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -293,7 +293,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/qpxexpress1/Cargo.toml b/gen/qpxexpress1/Cargo.toml index 8f921c9acb..d4677c9a41 100644 --- a/gen/qpxexpress1/Cargo.toml +++ b/gen/qpxexpress1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-qpxexpress1" -version = "0.1.10+20140321" +version = "0.1.11+20140321" authors = ["Sebastian Thiel "] description = "A complete library to interact with QPX Express (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/qpxexpress1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/qpxexpress1/LICENSE.md b/gen/qpxexpress1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/qpxexpress1/LICENSE.md +++ b/gen/qpxexpress1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/qpxexpress1/README.md b/gen/qpxexpress1/README.md index d64e2aaabf..516005d14a 100644 --- a/gen/qpxexpress1/README.md +++ b/gen/qpxexpress1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-qpxexpress1` library allows access to all features of the *Google QPX Express* service. -This documentation was generated from *QPX Express* crate version *0.1.10+20140321*, where *20140321* is the exact revision of the *qpxExpress:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *QPX Express* crate version *0.1.11+20140321*, where *20140321* is the exact revision of the *qpxExpress:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *QPX Express* *v1* API can be found at the [official documentation site](http://developers.google.com/qpx-express). diff --git a/gen/qpxexpress1/src/cmn.rs b/gen/qpxexpress1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/qpxexpress1/src/cmn.rs +++ b/gen/qpxexpress1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/qpxexpress1/src/lib.rs b/gen/qpxexpress1/src/lib.rs index 684ecc7923..012f5f27a8 100644 --- a/gen/qpxexpress1/src/lib.rs +++ b/gen/qpxexpress1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *QPX Express* crate version *0.1.10+20140321*, where *20140321* is the exact revision of the *qpxExpress:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *QPX Express* crate version *0.1.11+20140321*, where *20140321* is the exact revision of the *qpxExpress:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *QPX Express* *v1* API can be found at the //! [official documentation site](http://developers.google.com/qpx-express). diff --git a/gen/qpxexpress1/src/lib.rs.in b/gen/qpxexpress1/src/lib.rs.in index b976aaec02..4e0c93db2b 100644 --- a/gen/qpxexpress1/src/lib.rs.in +++ b/gen/qpxexpress1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -110,7 +111,7 @@ impl<'a, C, A> QPXExpress QPXExpress { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -119,7 +120,7 @@ impl<'a, C, A> QPXExpress } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -853,7 +854,7 @@ impl<'a, C, A> TripSearchCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "qpxExpress.trips.search", + dlg.begin(MethodInfo { id: "qpxExpress.trips.search", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -882,14 +883,14 @@ impl<'a, C, A> TripSearchCall<'a, C, A> where C: BorrowMut, A: oa } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -918,7 +919,7 @@ impl<'a, C, A> TripSearchCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -928,10 +929,10 @@ impl<'a, C, A> TripSearchCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -963,7 +964,7 @@ impl<'a, C, A> TripSearchCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TripsSearchRequest) -> TripSearchCall<'a, C, A> { self._request = new_value; @@ -981,12 +982,12 @@ impl<'a, C, A> TripSearchCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/replicapool1_beta2-cli/Cargo.toml b/gen/replicapool1_beta2-cli/Cargo.toml index b7597ccaa0..b3e09e952f 100644 --- a/gen/replicapool1_beta2-cli/Cargo.toml +++ b/gen/replicapool1_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-replicapool1_beta2-cli" -version = "0.3.2+20150708" +version = "0.3.3+20150708" authors = ["Sebastian Thiel "] description = "A complete library to interact with replicapool (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/replicapool1_beta2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/replicapool1_beta2-cli/LICENSE.md b/gen/replicapool1_beta2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/replicapool1_beta2-cli/LICENSE.md +++ b/gen/replicapool1_beta2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/replicapool1_beta2-cli/README.md b/gen/replicapool1_beta2-cli/README.md index 99035b84d2..d52915b8eb 100644 --- a/gen/replicapool1_beta2-cli/README.md +++ b/gen/replicapool1_beta2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *replicapool* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/replicapool1-beta2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/replicapool1-beta2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/replicapool1-beta2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/replicapool1-beta2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/replicapool1_beta2-cli). # Usage -This documentation was generated from the *replicapool* API at revision *20150708*. The CLI is at version *0.3.2*. +This documentation was generated from the *replicapool* API at revision *20150708*. The CLI is at version *0.3.3*. ```bash replicapool1-beta2 [options] @@ -46,18 +46,18 @@ replicapool1-beta2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/replicapool1_beta2-cli/mkdocs.yml b/gen/replicapool1_beta2-cli/mkdocs.yml index 4563612495..74fb08ad8e 100644 --- a/gen/replicapool1_beta2-cli/mkdocs.yml +++ b/gen/replicapool1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: replicapool v0.3.2+20150708 +site_name: replicapool v0.3.3+20150708 site_url: http://byron.github.io/google-apis-rs/google-replicapool1_beta2-cli site_description: Write integrating applications with bcore @@ -24,5 +24,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/replicapool1_beta2-cli/src/main.rs b/gen/replicapool1_beta2-cli/src/main.rs index d4c570bb08..73ac9a37c0 100644 --- a/gen/replicapool1_beta2-cli/src/main.rs +++ b/gen/replicapool1_beta2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Replicapool>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _instance_group_managers_abandon_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _instance_group_managers_abandon_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "instances" => Some(("instances", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -81,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManagersAbandonInstancesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().abandon_instances(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -94,7 +94,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -107,7 +107,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -130,10 +130,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_group_managers().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -146,7 +146,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -159,7 +159,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -182,13 +182,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_delete_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_delete_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -202,8 +202,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "instances" => Some(("instances", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -218,7 +218,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManagersDeleteInstancesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().delete_instances(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -231,7 +231,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -244,7 +244,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -267,10 +267,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_group_managers().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -283,7 +283,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -296,7 +296,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -319,13 +319,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -339,8 +339,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "target-size" => Some(("targetSize", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "group" => Some(("group", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -368,7 +368,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::InstanceGroupManager = json::value::from_value(object).unwrap(); let size: i32 = arg_from_str(&opt.value_of("size").unwrap_or(""), err, "", "integer"); let mut call = self.hub.instance_group_managers().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), size); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -381,7 +381,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -394,7 +394,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -417,10 +417,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instance_group_managers().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -442,7 +442,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -456,7 +456,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -479,13 +479,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_recreate_instances(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_recreate_instances(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -499,8 +499,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "instances" => Some(("instances", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -515,7 +515,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManagersRecreateInstancesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().recreate_instances(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -528,7 +528,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -541,7 +541,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -564,11 +564,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_resize(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_resize(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let size: i32 = arg_from_str(&opt.value_of("size").unwrap_or(""), err, "", "integer"); let mut call = self.hub.instance_group_managers().resize(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or(""), size); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -581,7 +581,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -594,7 +594,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -617,13 +617,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_set_instance_template(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_set_instance_template(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -637,8 +637,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "instance-template" => Some(("instanceTemplate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -653,7 +653,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManagersSetInstanceTemplateRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().set_instance_template(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -666,7 +666,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -679,7 +679,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -702,13 +702,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instance_group_managers_set_target_pools(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instance_group_managers_set_target_pools(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -722,8 +722,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "target-pools" => Some(("targetPools", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -739,7 +739,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstanceGroupManagersSetTargetPoolsRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instance_group_managers().set_target_pools(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("instance-group-manager").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -752,7 +752,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -765,7 +765,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -788,10 +788,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -804,7 +804,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -817,7 +817,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -840,10 +840,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -865,7 +865,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -879,7 +879,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -976,14 +976,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "replicapool1-beta2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "replicapool1-beta2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1003,7 +1003,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1042,7 +1042,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("instance-group-managers", "methods: 'abandon-instances', 'delete', 'delete-instances', 'get', 'insert', 'list', 'recreate-instances', 'resize', 'set-instance-template' and 'set-target-pools'", vec![ - ("abandon-instances", + ("abandon-instances", Some(r##"Removes the specified instances from the managed instance group, and from any target pools of which they were members, without deleting the instances."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/instance-group-managers_abandon-instances", vec![ @@ -1082,7 +1082,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the instance group manager and all instances contained within. If you'd like to delete the manager without deleting the instances, you must first abandon the instances to remove them from the group."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/instance-group-managers_delete", vec![ @@ -1116,7 +1116,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete-instances", + ("delete-instances", Some(r##"Deletes the specified instances. The instances are deleted, then removed from the instance group and any target pools of which they were a member. The targetSize of the instance group manager is reduced by the number of instances deleted."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/instance-group-managers_delete-instances", vec![ @@ -1156,7 +1156,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns the specified Instance Group Manager resource."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/instance-group-managers_get", vec![ @@ -1190,7 +1190,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates an instance group manager, as well as the instance group and the specified number of instances."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/instance-group-managers_insert", vec![ @@ -1230,7 +1230,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of Instance Group Manager resources contained within the specified zone."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/instance-group-managers_list", vec![ @@ -1258,7 +1258,7 @@ fn main() { Some(false), Some(false)), ]), - ("recreate-instances", + ("recreate-instances", Some(r##"Recreates the specified instances. The instances are deleted, then recreated using the instance group manager's current instance template."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/instance-group-managers_recreate-instances", vec![ @@ -1298,7 +1298,7 @@ fn main() { Some(false), Some(false)), ]), - ("resize", + ("resize", Some(r##"Resizes the managed instance group up or down. If resized up, new instances are created using the current instance template. If resized down, instances are removed in the order outlined in Resizing a managed instance group."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/instance-group-managers_resize", vec![ @@ -1338,7 +1338,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-instance-template", + ("set-instance-template", Some(r##"Sets the instance template to use when creating new instances in this group. Existing instances are not affected."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/instance-group-managers_set-instance-template", vec![ @@ -1378,7 +1378,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-target-pools", + ("set-target-pools", Some(r##"Modifies the target pools to which all new instances in this group are assigned. Existing instances in the group are not affected."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/instance-group-managers_set-target-pools", vec![ @@ -1421,7 +1421,7 @@ fn main() { ]), ("zone-operations", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves the specified zone-specific operation resource."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/zone-operations_get", vec![ @@ -1455,7 +1455,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of operation resources contained within the specified zone."##), "Details at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli/zone-operations_list", vec![ @@ -1489,7 +1489,7 @@ fn main() { let mut app = App::new("replicapool1-beta2") .author("Sebastian Thiel ") - .version("0.3.2+20150708") + .version("0.3.3+20150708") .about("The Google Compute Engine Instance Group Manager API provides groups of homogenous Compute Engine Instances.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_replicapool1_beta2_cli") .arg(Arg::with_name("url") @@ -1513,7 +1513,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1524,7 +1524,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/replicapool1_beta2/Cargo.toml b/gen/replicapool1_beta2/Cargo.toml index 8cfd72ee45..df9b2c5bd8 100644 --- a/gen/replicapool1_beta2/Cargo.toml +++ b/gen/replicapool1_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-replicapool1_beta2" -version = "0.1.10+20150708" +version = "0.1.11+20150708" authors = ["Sebastian Thiel "] description = "A complete library to interact with replicapool (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/replicapool1_beta2" diff --git a/gen/replicapool1_beta2/LICENSE.md b/gen/replicapool1_beta2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/replicapool1_beta2/LICENSE.md +++ b/gen/replicapool1_beta2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/replicapool1_beta2/README.md b/gen/replicapool1_beta2/README.md index baaa853359..5160934e73 100644 --- a/gen/replicapool1_beta2/README.md +++ b/gen/replicapool1_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-replicapool1_beta2` library allows access to all features of the *Google replicapool* service. -This documentation was generated from *replicapool* crate version *0.1.10+20150708*, where *20150708* is the exact revision of the *replicapool:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *replicapool* crate version *0.1.11+20150708*, where *20150708* is the exact revision of the *replicapool:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *replicapool* *v1_beta2* API can be found at the [official documentation site](https://developers.google.com/compute/docs/instance-groups/manager/v1beta2). diff --git a/gen/replicapool1_beta2/src/cmn.rs b/gen/replicapool1_beta2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/replicapool1_beta2/src/cmn.rs +++ b/gen/replicapool1_beta2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/replicapool1_beta2/src/lib.rs b/gen/replicapool1_beta2/src/lib.rs index e290f16263..3231e62332 100644 --- a/gen/replicapool1_beta2/src/lib.rs +++ b/gen/replicapool1_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *replicapool* crate version *0.1.10+20150708*, where *20150708* is the exact revision of the *replicapool:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *replicapool* crate version *0.1.11+20150708*, where *20150708* is the exact revision of the *replicapool:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *replicapool* *v1_beta2* API can be found at the //! [official documentation site](https://developers.google.com/compute/docs/instance-groups/manager/v1beta2). diff --git a/gen/replicapool1_beta2/src/lib.rs.in b/gen/replicapool1_beta2/src/lib.rs.in index 040156e401..adc061f48d 100644 --- a/gen/replicapool1_beta2/src/lib.rs.in +++ b/gen/replicapool1_beta2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -141,7 +142,7 @@ impl<'a, C, A> Replicapool Replicapool { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -153,7 +154,7 @@ impl<'a, C, A> Replicapool } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -969,7 +970,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.zoneOperations.list", + dlg.begin(MethodInfo { id: "replicapool.zoneOperations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1021,7 +1022,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1057,7 +1058,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1067,10 +1068,10 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1103,7 +1104,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1113,7 +1114,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1152,12 +1153,12 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1174,17 +1175,17 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1248,7 +1249,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.zoneOperations.get", + dlg.begin(MethodInfo { id: "replicapool.zoneOperations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1292,7 +1293,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1328,7 +1329,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1338,10 +1339,10 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1374,7 +1375,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -1384,7 +1385,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1394,7 +1395,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *operation* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operation(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -1412,12 +1413,12 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1434,17 +1435,17 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1515,7 +1516,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.setTargetPools", + dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.setTargetPools", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1559,14 +1560,14 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1610,7 +1611,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1620,10 +1621,10 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1655,7 +1656,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstanceGroupManagersSetTargetPoolsRequest) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> { self._request = new_value; @@ -1665,7 +1666,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> { self._project = new_value.to_string(); @@ -1675,7 +1676,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1685,7 +1686,7 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -1703,12 +1704,12 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1725,17 +1726,17 @@ impl<'a, C, A> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where C: BorrowMu } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerSetTargetPoolCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1804,7 +1805,7 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.list", + dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1856,7 +1857,7 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1892,7 +1893,7 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1902,10 +1903,10 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> { self._project = new_value.to_string(); @@ -1948,7 +1949,7 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1987,12 +1988,12 @@ impl<'a, C, A> InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut InstanceGroupManagerListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupManagerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2090,7 +2091,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.insert", + dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2134,14 +2135,14 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2185,7 +2186,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2195,10 +2196,10 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> { self._request = new_value; @@ -2240,7 +2241,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -2250,7 +2251,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2260,7 +2261,7 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> { self._size = new_value; @@ -2278,12 +2279,12 @@ impl<'a, C, A> InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut InstanceGroupManagerInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupManagerInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2374,7 +2375,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.get", + dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2418,7 +2419,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2454,7 +2455,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2464,10 +2465,10 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -2510,7 +2511,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2520,7 +2521,7 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -2538,12 +2539,12 @@ impl<'a, C, A> InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut InstanceGroupManagerGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupManagerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2641,7 +2642,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.abandonInstances", + dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.abandonInstances", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2685,14 +2686,14 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2736,7 +2737,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2746,10 +2747,10 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2781,7 +2782,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstanceGroupManagersAbandonInstancesRequest) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> { self._request = new_value; @@ -2791,7 +2792,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -2801,7 +2802,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2811,7 +2812,7 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -2829,12 +2830,12 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2851,17 +2852,17 @@ impl<'a, C, A> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where C: Borrow } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerAbandonInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2932,7 +2933,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.recreateInstances", + dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.recreateInstances", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2976,14 +2977,14 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3027,7 +3028,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3037,10 +3038,10 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3072,7 +3073,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstanceGroupManagersRecreateInstancesRequest) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> { self._request = new_value; @@ -3082,7 +3083,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -3092,7 +3093,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3102,7 +3103,7 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -3120,12 +3121,12 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3142,17 +3143,17 @@ impl<'a, C, A> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where C: Borro } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerRecreateInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3216,7 +3217,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.delete", + dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3260,7 +3261,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3296,7 +3297,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3306,10 +3307,10 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -3352,7 +3353,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3362,7 +3363,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -3380,12 +3381,12 @@ impl<'a, C, A> InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut InstanceGroupManagerDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupManagerDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3483,7 +3484,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.setInstanceTemplate", + dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.setInstanceTemplate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3527,14 +3528,14 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3578,7 +3579,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3588,10 +3589,10 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3623,7 +3624,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstanceGroupManagersSetInstanceTemplateRequest) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> { self._request = new_value; @@ -3633,7 +3634,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> { self._project = new_value.to_string(); @@ -3643,7 +3644,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3653,7 +3654,7 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -3671,12 +3672,12 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3693,17 +3694,17 @@ impl<'a, C, A> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where C: Bo } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerSetInstanceTemplateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3768,7 +3769,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.resize", + dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.resize", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3813,7 +3814,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3849,7 +3850,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3859,10 +3860,10 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> { self._project = new_value.to_string(); @@ -3905,7 +3906,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3915,7 +3916,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -3925,7 +3926,7 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> { self._size = new_value; @@ -3943,12 +3944,12 @@ impl<'a, C, A> InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut InstanceGroupManagerResizeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceGroupManagerResizeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerResizeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4046,7 +4047,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.deleteInstances", + dlg.begin(MethodInfo { id: "replicapool.instanceGroupManagers.deleteInstances", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4090,14 +4091,14 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4141,7 +4142,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4151,10 +4152,10 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4186,7 +4187,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstanceGroupManagersDeleteInstancesRequest) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> { self._request = new_value; @@ -4196,7 +4197,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> { self._project = new_value.to_string(); @@ -4206,7 +4207,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -4216,7 +4217,7 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM /// /// Sets the *instance group manager* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance_group_manager(mut self, new_value: &str) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> { self._instance_group_manager = new_value.to_string(); @@ -4234,12 +4235,12 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4256,17 +4257,17 @@ impl<'a, C, A> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where C: BorrowM } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGroupManagerDeleteInstanceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/replicapoolupdater1_beta1-cli/Cargo.toml b/gen/replicapoolupdater1_beta1-cli/Cargo.toml index b350e0814b..3ea6d12ddb 100644 --- a/gen/replicapoolupdater1_beta1-cli/Cargo.toml +++ b/gen/replicapoolupdater1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-replicapoolupdater1_beta1-cli" -version = "0.3.2+20150904" +version = "0.3.3+20160107" authors = ["Sebastian Thiel "] description = "A complete library to interact with replicapoolupdater (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/replicapoolupdater1_beta1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/replicapoolupdater1_beta1-cli/LICENSE.md b/gen/replicapoolupdater1_beta1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/replicapoolupdater1_beta1-cli/LICENSE.md +++ b/gen/replicapoolupdater1_beta1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/replicapoolupdater1_beta1-cli/README.md b/gen/replicapoolupdater1_beta1-cli/README.md index 247d6e7250..2d169c92a2 100644 --- a/gen/replicapoolupdater1_beta1-cli/README.md +++ b/gen/replicapoolupdater1_beta1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *replicapoolupdater* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/replicapoolupdater1-beta1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/replicapoolupdater1-beta1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/replicapoolupdater1-beta1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/replicapoolupdater1-beta1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/replicapoolupdater1_beta1-cli). # Usage -This documentation was generated from the *replicapoolupdater* API at revision *20150904*. The CLI is at version *0.3.2*. +This documentation was generated from the *replicapoolupdater* API at revision *20160107*. The CLI is at version *0.3.3*. ```bash replicapoolupdater1-beta1 [options] @@ -44,18 +44,18 @@ replicapoolupdater1-beta1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/replicapoolupdater1_beta1-cli/mkdocs.yml b/gen/replicapoolupdater1_beta1-cli/mkdocs.yml index bfd898253c..8b8dc16727 100644 --- a/gen/replicapoolupdater1_beta1-cli/mkdocs.yml +++ b/gen/replicapoolupdater1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: replicapoolupdater v0.3.2+20150904 +site_name: replicapoolupdater v0.3.3+20160107 site_url: http://byron.github.io/google-apis-rs/google-replicapoolupdater1_beta1-cli site_description: Write integrating applications with bcore @@ -22,5 +22,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/replicapoolupdater1_beta1-cli/src/main.rs b/gen/replicapoolupdater1_beta1-cli/src/main.rs index 68494a4deb..92fa7f382a 100644 --- a/gen/replicapoolupdater1_beta1-cli/src/main.rs +++ b/gen/replicapoolupdater1_beta1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Replicapoolupdater>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _rolling_updates_cancel(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _rolling_updates_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rolling_updates().cancel(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("rolling-update").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rolling_updates_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rolling_updates_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rolling_updates().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("rolling-update").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -149,13 +149,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rolling_updates_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rolling_updates_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -169,8 +169,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -203,7 +203,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RollingUpdate = json::value::from_value(object).unwrap(); let mut call = self.hub.rolling_updates().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -216,7 +216,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -229,7 +229,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -252,10 +252,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rolling_updates_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rolling_updates_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rolling_updates().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -277,7 +277,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -291,7 +291,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -314,10 +314,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rolling_updates_list_instance_updates(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rolling_updates_list_instance_updates(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rolling_updates().list_instance_updates(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("rolling-update").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -339,7 +339,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -353,7 +353,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -376,10 +376,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rolling_updates_pause(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rolling_updates_pause(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rolling_updates().pause(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("rolling-update").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -392,7 +392,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -405,7 +405,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -428,10 +428,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rolling_updates_resume(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rolling_updates_resume(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rolling_updates().resume(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("rolling-update").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -444,7 +444,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -457,7 +457,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -480,10 +480,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _rolling_updates_rollback(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _rolling_updates_rollback(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.rolling_updates().rollback(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("rolling-update").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -496,7 +496,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -509,7 +509,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -532,10 +532,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -548,7 +548,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -561,7 +561,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -584,10 +584,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -609,7 +609,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -623,7 +623,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -714,14 +714,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "replicapoolupdater1-beta1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "replicapoolupdater1-beta1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -741,7 +741,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -780,7 +780,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("rolling-updates", "methods: 'cancel', 'get', 'insert', 'list', 'list-instance-updates', 'pause', 'resume' and 'rollback'", vec![ - ("cancel", + ("cancel", Some(r##"Cancels an update. The update must be PAUSED before it can be cancelled. This has no effect if the update is already CANCELLED."##), "Details at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli/rolling-updates_cancel", vec![ @@ -814,7 +814,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Returns information about an update."##), "Details at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli/rolling-updates_get", vec![ @@ -848,7 +848,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts and starts a new update."##), "Details at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli/rolling-updates_insert", vec![ @@ -882,7 +882,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists recent updates for a given managed instance group, in reverse chronological order and paginated format."##), "Details at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli/rolling-updates_list", vec![ @@ -910,7 +910,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-instance-updates", + ("list-instance-updates", Some(r##"Lists the current status for each instance within a given update."##), "Details at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli/rolling-updates_list-instance-updates", vec![ @@ -944,7 +944,7 @@ fn main() { Some(false), Some(false)), ]), - ("pause", + ("pause", Some(r##"Pauses the update in state from ROLLING_FORWARD or ROLLING_BACK. Has no effect if invoked when the state of the update is PAUSED."##), "Details at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli/rolling-updates_pause", vec![ @@ -978,7 +978,7 @@ fn main() { Some(false), Some(false)), ]), - ("resume", + ("resume", Some(r##"Continues an update in PAUSED state. Has no effect if invoked when the state of the update is ROLLED_OUT."##), "Details at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli/rolling-updates_resume", vec![ @@ -1012,7 +1012,7 @@ fn main() { Some(false), Some(false)), ]), - ("rollback", + ("rollback", Some(r##"Rolls back the update in state from ROLLING_FORWARD or PAUSED. Has no effect if invoked when the state of the update is ROLLED_BACK."##), "Details at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli/rolling-updates_rollback", vec![ @@ -1049,7 +1049,7 @@ fn main() { ]), ("zone-operations", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves the specified zone-specific operation resource."##), "Details at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli/zone-operations_get", vec![ @@ -1083,7 +1083,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of Operation resources contained within the specified zone."##), "Details at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli/zone-operations_list", vec![ @@ -1117,7 +1117,7 @@ fn main() { let mut app = App::new("replicapoolupdater1-beta1") .author("Sebastian Thiel ") - .version("0.3.2+20150904") + .version("0.3.3+20160107") .about("The Google Compute Engine Instance Group Updater API provides services for updating groups of Compute Engine Instances.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_replicapoolupdater1_beta1_cli") .arg(Arg::with_name("url") @@ -1141,7 +1141,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1152,7 +1152,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/replicapoolupdater1_beta1/Cargo.toml b/gen/replicapoolupdater1_beta1/Cargo.toml index 2eb92354f5..17b687be63 100644 --- a/gen/replicapoolupdater1_beta1/Cargo.toml +++ b/gen/replicapoolupdater1_beta1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-replicapoolupdater1_beta1" -version = "0.1.10+20150904" +version = "0.1.11+20160107" authors = ["Sebastian Thiel "] description = "A complete library to interact with replicapoolupdater (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/replicapoolupdater1_beta1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/replicapoolupdater1_beta1/LICENSE.md b/gen/replicapoolupdater1_beta1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/replicapoolupdater1_beta1/LICENSE.md +++ b/gen/replicapoolupdater1_beta1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/replicapoolupdater1_beta1/README.md b/gen/replicapoolupdater1_beta1/README.md index f159f8c2bb..149146d988 100644 --- a/gen/replicapoolupdater1_beta1/README.md +++ b/gen/replicapoolupdater1_beta1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-replicapoolupdater1_beta1` library allows access to all features of the *Google replicapoolupdater* service. -This documentation was generated from *replicapoolupdater* crate version *0.1.10+20150904*, where *20150904* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *replicapoolupdater* crate version *0.1.11+20160107*, where *20160107* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *replicapoolupdater* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_service). diff --git a/gen/replicapoolupdater1_beta1/src/cmn.rs b/gen/replicapoolupdater1_beta1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/replicapoolupdater1_beta1/src/cmn.rs +++ b/gen/replicapoolupdater1_beta1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/replicapoolupdater1_beta1/src/lib.rs b/gen/replicapoolupdater1_beta1/src/lib.rs index b82edf3221..61f0bea174 100644 --- a/gen/replicapoolupdater1_beta1/src/lib.rs +++ b/gen/replicapoolupdater1_beta1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *replicapoolupdater* crate version *0.1.10+20150904*, where *20150904* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *replicapoolupdater* crate version *0.1.11+20160107*, where *20160107* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *replicapoolupdater* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_service). diff --git a/gen/replicapoolupdater1_beta1/src/lib.rs.in b/gen/replicapoolupdater1_beta1/src/lib.rs.in index ae89e32861..9ab333faf6 100644 --- a/gen/replicapoolupdater1_beta1/src/lib.rs.in +++ b/gen/replicapoolupdater1_beta1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -141,7 +142,7 @@ impl<'a, C, A> Replicapoolupdater Replicapoolupdater { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -153,7 +154,7 @@ impl<'a, C, A> Replicapoolupdater } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -415,11 +416,11 @@ pub struct OperationList { pub next_page_token: Option, /// [Output Only] The Operation resources. pub items: Option>, - /// [Output Only] Type of resource. Always replicapoolupdater#operations for Operations resource. + /// [Output Only] Type of resource. Always replicapoolupdater#operationList for OperationList resources. pub kind: Option, /// [Output Only] Unique identifier for the resource; defined by the server. pub id: Option, - /// [Output Only] Server-defined URL for this resource. + /// [Output Only] The fully qualified URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, } @@ -509,7 +510,7 @@ pub struct Operation { pub zone: Option, /// [Output Only] URL of the region where the operation resides. pub region: Option, - /// [Output Only] Server defined URL for the resource. + /// [Output Only] The fully qualified URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, /// no description provided @@ -940,7 +941,7 @@ impl<'a, C, A> RollingUpdatePauseCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.pause", + dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.pause", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -984,7 +985,7 @@ impl<'a, C, A> RollingUpdatePauseCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1020,7 +1021,7 @@ impl<'a, C, A> RollingUpdatePauseCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1030,10 +1031,10 @@ impl<'a, C, A> RollingUpdatePauseCall<'a, C, A> where C: BorrowMut RollingUpdatePauseCall<'a, C, A> where C: BorrowMut RollingUpdatePauseCall<'a, C, A> { self._project = new_value.to_string(); @@ -1076,7 +1077,7 @@ impl<'a, C, A> RollingUpdatePauseCall<'a, C, A> where C: BorrowMut RollingUpdatePauseCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1086,7 +1087,7 @@ impl<'a, C, A> RollingUpdatePauseCall<'a, C, A> where C: BorrowMut RollingUpdatePauseCall<'a, C, A> { self._rolling_update = new_value.to_string(); @@ -1104,12 +1105,12 @@ impl<'a, C, A> RollingUpdatePauseCall<'a, C, A> where C: BorrowMut RollingUpdatePauseCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RollingUpdatePauseCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RollingUpdatePauseCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1200,7 +1201,7 @@ impl<'a, C, A> RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.rollback", + dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.rollback", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1244,7 +1245,7 @@ impl<'a, C, A> RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1280,7 +1281,7 @@ impl<'a, C, A> RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1290,10 +1291,10 @@ impl<'a, C, A> RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut RollingUpdateRollbackCall<'a, C, A> { self._project = new_value.to_string(); @@ -1336,7 +1337,7 @@ impl<'a, C, A> RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut RollingUpdateRollbackCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1346,7 +1347,7 @@ impl<'a, C, A> RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut RollingUpdateRollbackCall<'a, C, A> { self._rolling_update = new_value.to_string(); @@ -1364,12 +1365,12 @@ impl<'a, C, A> RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut RollingUpdateRollbackCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RollingUpdateRollbackCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RollingUpdateRollbackCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1460,7 +1461,7 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.get", + dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1504,7 +1505,7 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1540,7 +1541,7 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1550,10 +1551,10 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1586,7 +1587,7 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> RollingUpdateGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -1596,7 +1597,7 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> RollingUpdateGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1606,7 +1607,7 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *rolling update* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn rolling_update(mut self, new_value: &str) -> RollingUpdateGetCall<'a, C, A> { self._rolling_update = new_value.to_string(); @@ -1624,12 +1625,12 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1646,17 +1647,17 @@ impl<'a, C, A> RollingUpdateGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ReplicapoolReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RollingUpdateGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RollingUpdateGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1720,7 +1721,7 @@ impl<'a, C, A> RollingUpdateResumeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.resume", + dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.resume", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1764,7 +1765,7 @@ impl<'a, C, A> RollingUpdateResumeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1800,7 +1801,7 @@ impl<'a, C, A> RollingUpdateResumeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1810,10 +1811,10 @@ impl<'a, C, A> RollingUpdateResumeCall<'a, C, A> where C: BorrowMut RollingUpdateResumeCall<'a, C, A> where C: BorrowMut RollingUpdateResumeCall<'a, C, A> { self._project = new_value.to_string(); @@ -1856,7 +1857,7 @@ impl<'a, C, A> RollingUpdateResumeCall<'a, C, A> where C: BorrowMut RollingUpdateResumeCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1866,7 +1867,7 @@ impl<'a, C, A> RollingUpdateResumeCall<'a, C, A> where C: BorrowMut RollingUpdateResumeCall<'a, C, A> { self._rolling_update = new_value.to_string(); @@ -1884,12 +1885,12 @@ impl<'a, C, A> RollingUpdateResumeCall<'a, C, A> where C: BorrowMut RollingUpdateResumeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RollingUpdateResumeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RollingUpdateResumeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1985,7 +1986,7 @@ impl<'a, C, A> RollingUpdateListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.list", + dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2037,7 +2038,7 @@ impl<'a, C, A> RollingUpdateListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2073,7 +2074,7 @@ impl<'a, C, A> RollingUpdateListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2083,10 +2084,10 @@ impl<'a, C, A> RollingUpdateListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2119,7 +2120,7 @@ impl<'a, C, A> RollingUpdateListCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> RollingUpdateListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2129,7 +2130,7 @@ impl<'a, C, A> RollingUpdateListCall<'a, C, A> where C: BorrowMut /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> RollingUpdateListCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2168,12 +2169,12 @@ impl<'a, C, A> RollingUpdateListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2190,17 +2191,17 @@ impl<'a, C, A> RollingUpdateListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ReplicapoolReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RollingUpdateListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RollingUpdateListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2270,7 +2271,7 @@ impl<'a, C, A> RollingUpdateInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.insert", + dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2313,14 +2314,14 @@ impl<'a, C, A> RollingUpdateInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2364,7 +2365,7 @@ impl<'a, C, A> RollingUpdateInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2374,10 +2375,10 @@ impl<'a, C, A> RollingUpdateInsertCall<'a, C, A> where C: BorrowMut RollingUpdateInsertCall<'a, C, A> where C: BorrowMut RollingUpdateInsertCall<'a, C, A> { self._request = new_value; @@ -2419,7 +2420,7 @@ impl<'a, C, A> RollingUpdateInsertCall<'a, C, A> where C: BorrowMut RollingUpdateInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -2429,7 +2430,7 @@ impl<'a, C, A> RollingUpdateInsertCall<'a, C, A> where C: BorrowMut RollingUpdateInsertCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2447,12 +2448,12 @@ impl<'a, C, A> RollingUpdateInsertCall<'a, C, A> where C: BorrowMut RollingUpdateInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RollingUpdateInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RollingUpdateInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2549,7 +2550,7 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.listInstanceUpdates", + dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.listInstanceUpdates", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2602,7 +2603,7 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2638,7 +2639,7 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2648,10 +2649,10 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2684,7 +2685,7 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> RollingUpdateListInstanceUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -2694,7 +2695,7 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> RollingUpdateListInstanceUpdateCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2704,7 +2705,7 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< /// /// Sets the *rolling update* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn rolling_update(mut self, new_value: &str) -> RollingUpdateListInstanceUpdateCall<'a, C, A> { self._rolling_update = new_value.to_string(); @@ -2743,12 +2744,12 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2765,17 +2766,17 @@ impl<'a, C, A> RollingUpdateListInstanceUpdateCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ReplicapoolReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> RollingUpdateListInstanceUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RollingUpdateListInstanceUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2839,7 +2840,7 @@ impl<'a, C, A> RollingUpdateCancelCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.cancel", + dlg.begin(MethodInfo { id: "replicapoolupdater.rollingUpdates.cancel", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2883,7 +2884,7 @@ impl<'a, C, A> RollingUpdateCancelCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2919,7 +2920,7 @@ impl<'a, C, A> RollingUpdateCancelCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2929,10 +2930,10 @@ impl<'a, C, A> RollingUpdateCancelCall<'a, C, A> where C: BorrowMut RollingUpdateCancelCall<'a, C, A> where C: BorrowMut RollingUpdateCancelCall<'a, C, A> { self._project = new_value.to_string(); @@ -2975,7 +2976,7 @@ impl<'a, C, A> RollingUpdateCancelCall<'a, C, A> where C: BorrowMut RollingUpdateCancelCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2985,7 +2986,7 @@ impl<'a, C, A> RollingUpdateCancelCall<'a, C, A> where C: BorrowMut RollingUpdateCancelCall<'a, C, A> { self._rolling_update = new_value.to_string(); @@ -3003,12 +3004,12 @@ impl<'a, C, A> RollingUpdateCancelCall<'a, C, A> where C: BorrowMut RollingUpdateCancelCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> RollingUpdateCancelCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> RollingUpdateCancelCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3099,7 +3100,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapoolupdater.zoneOperations.get", + dlg.begin(MethodInfo { id: "replicapoolupdater.zoneOperations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3143,7 +3144,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3179,7 +3180,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3189,10 +3190,10 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3225,7 +3226,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -3235,7 +3236,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3245,7 +3246,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *operation* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operation(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -3263,12 +3264,12 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3285,17 +3286,17 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3364,7 +3365,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "replicapoolupdater.zoneOperations.list", + dlg.begin(MethodInfo { id: "replicapoolupdater.zoneOperations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3416,7 +3417,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3452,7 +3453,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3462,10 +3463,10 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3498,7 +3499,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._project = new_value.to_string(); @@ -3508,7 +3509,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3547,12 +3548,12 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3569,17 +3570,17 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/reseller1_sandbox-cli/Cargo.toml b/gen/reseller1_sandbox-cli/Cargo.toml index e2adc94bf0..da45ab3847 100644 --- a/gen/reseller1_sandbox-cli/Cargo.toml +++ b/gen/reseller1_sandbox-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-reseller1_sandbox-cli" -version = "0.3.2+20150603" +version = "0.3.3+20151110" authors = ["Sebastian Thiel "] description = "A complete library to interact with reseller (protocol v1sandbox)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/reseller1_sandbox-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/reseller1_sandbox-cli/LICENSE.md b/gen/reseller1_sandbox-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/reseller1_sandbox-cli/LICENSE.md +++ b/gen/reseller1_sandbox-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/reseller1_sandbox-cli/README.md b/gen/reseller1_sandbox-cli/README.md index 7b82542d85..b26b0f2090 100644 --- a/gen/reseller1_sandbox-cli/README.md +++ b/gen/reseller1_sandbox-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *reseller* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/reseller1-sandbox.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/reseller1-sandbox.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/reseller1-sandbox.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/reseller1-sandbox.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/reseller1_sandbox-cli). # Usage -This documentation was generated from the *reseller* API at revision *20150603*. The CLI is at version *0.3.2*. +This documentation was generated from the *reseller* API at revision *20151110*. The CLI is at version *0.3.3*. ```bash reseller1-sandbox [options] @@ -48,18 +48,18 @@ reseller1-sandbox [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/reseller1_sandbox-cli/mkdocs.yml b/gen/reseller1_sandbox-cli/mkdocs.yml index 7ee0fe7032..3303c972eb 100644 --- a/gen/reseller1_sandbox-cli/mkdocs.yml +++ b/gen/reseller1_sandbox-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: reseller v0.3.2+20150603 +site_name: reseller v0.3.3+20151110 site_url: http://byron.github.io/google-apis-rs/google-reseller1_sandbox-cli site_description: Write integrating applications with bcore @@ -26,5 +26,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/reseller1_sandbox-cli/src/main.rs b/gen/reseller1_sandbox-cli/src/main.rs index 500515edcd..c81275612c 100644 --- a/gen/reseller1_sandbox-cli/src/main.rs +++ b/gen/reseller1_sandbox-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Reseller>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _customers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _customers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.customers().get(opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,13 +97,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customers_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customers_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -117,10 +117,11 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "customer-domain" => Some(("customerDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-domain-verified" => Some(("customerDomainVerified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "alternate-email" => Some(("alternateEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "resource-ui-url" => Some(("resourceUiUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -137,7 +138,7 @@ impl<'n, 'a> Engine<'n, 'a> { "postal-address.postal-code" => Some(("postalAddress.postalCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "customer-id" => Some(("customerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["address-line1", "address-line2", "address-line3", "alternate-email", "contact-name", "country-code", "customer-domain", "customer-id", "kind", "locality", "organization-name", "phone-number", "postal-address", "postal-code", "region", "resource-ui-url"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["address-line1", "address-line2", "address-line3", "alternate-email", "contact-name", "country-code", "customer-domain", "customer-domain-verified", "customer-id", "kind", "locality", "organization-name", "phone-number", "postal-address", "postal-code", "region", "resource-ui-url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -148,7 +149,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Customer = json::value::from_value(object).unwrap(); let mut call = self.hub.customers().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "customer-auth-token" => { @@ -164,7 +165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["customer-auth-token"].iter().map(|v|*v)); @@ -178,7 +179,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -201,13 +202,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customers_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customers_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -221,10 +222,11 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "customer-domain" => Some(("customerDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-domain-verified" => Some(("customerDomainVerified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "alternate-email" => Some(("alternateEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "resource-ui-url" => Some(("resourceUiUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -241,7 +243,7 @@ impl<'n, 'a> Engine<'n, 'a> { "postal-address.postal-code" => Some(("postalAddress.postalCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "customer-id" => Some(("customerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["address-line1", "address-line2", "address-line3", "alternate-email", "contact-name", "country-code", "customer-domain", "customer-id", "kind", "locality", "organization-name", "phone-number", "postal-address", "postal-code", "region", "resource-ui-url"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["address-line1", "address-line2", "address-line3", "alternate-email", "contact-name", "country-code", "customer-domain", "customer-domain-verified", "customer-id", "kind", "locality", "organization-name", "phone-number", "postal-address", "postal-code", "region", "resource-ui-url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -252,7 +254,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Customer = json::value::from_value(object).unwrap(); let mut call = self.hub.customers().patch(request, opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -265,7 +267,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -278,7 +280,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -301,13 +303,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _customers_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _customers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -321,10 +323,11 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "customer-domain" => Some(("customerDomain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-domain-verified" => Some(("customerDomainVerified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "alternate-email" => Some(("alternateEmail", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "resource-ui-url" => Some(("resourceUiUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -341,7 +344,7 @@ impl<'n, 'a> Engine<'n, 'a> { "postal-address.postal-code" => Some(("postalAddress.postalCode", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "customer-id" => Some(("customerId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["address-line1", "address-line2", "address-line3", "alternate-email", "contact-name", "country-code", "customer-domain", "customer-id", "kind", "locality", "organization-name", "phone-number", "postal-address", "postal-code", "region", "resource-ui-url"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["address-line1", "address-line2", "address-line3", "alternate-email", "contact-name", "country-code", "customer-domain", "customer-domain-verified", "customer-id", "kind", "locality", "organization-name", "phone-number", "postal-address", "postal-code", "region", "resource-ui-url"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -352,7 +355,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Customer = json::value::from_value(object).unwrap(); let mut call = self.hub.customers().update(request, opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -365,7 +368,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -378,7 +381,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -401,10 +404,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_activate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_activate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subscriptions().activate(opt.value_of("customer-id").unwrap_or(""), opt.value_of("subscription-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -417,7 +420,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -430,7 +433,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -453,13 +456,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_change_plan(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_change_plan(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -473,8 +476,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "plan-name" => Some(("planName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -495,7 +498,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ChangePlanRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.subscriptions().change_plan(request, opt.value_of("customer-id").unwrap_or(""), opt.value_of("subscription-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -508,7 +511,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -521,7 +524,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -544,13 +547,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_change_renewal_settings(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_change_renewal_settings(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -564,8 +567,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "renewal-type" => Some(("renewalType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -581,7 +584,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::RenewalSettings = json::value::from_value(object).unwrap(); let mut call = self.hub.subscriptions().change_renewal_settings(request, opt.value_of("customer-id").unwrap_or(""), opt.value_of("subscription-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -594,7 +597,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -607,7 +610,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -630,13 +633,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_change_seats(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_change_seats(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -650,8 +653,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "number-of-seats" => Some(("numberOfSeats", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -669,7 +672,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Seats = json::value::from_value(object).unwrap(); let mut call = self.hub.subscriptions().change_seats(request, opt.value_of("customer-id").unwrap_or(""), opt.value_of("subscription-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -682,7 +685,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -695,7 +698,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -718,10 +721,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subscriptions().delete(opt.value_of("customer-id").unwrap_or(""), opt.value_of("subscription-id").unwrap_or(""), opt.value_of("deletion-type").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -734,7 +737,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -747,7 +750,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -762,10 +765,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subscriptions().get(opt.value_of("customer-id").unwrap_or(""), opt.value_of("subscription-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -778,7 +781,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -791,7 +794,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -814,13 +817,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -834,8 +837,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "renewal-settings.kind" => Some(("renewalSettings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "renewal-settings.renewal-type" => Some(("renewalSettings.renewalType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -873,7 +876,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subscription = json::value::from_value(object).unwrap(); let mut call = self.hub.subscriptions().insert(request, opt.value_of("customer-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "customer-auth-token" => { @@ -889,7 +892,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["customer-auth-token"].iter().map(|v|*v)); @@ -903,7 +906,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -926,10 +929,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subscriptions().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -957,7 +960,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["customer-auth-token", "page-token", "customer-id", "max-results", "customer-name-prefix"].iter().map(|v|*v)); @@ -971,7 +974,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -994,10 +997,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_start_paid_service(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_start_paid_service(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subscriptions().start_paid_service(opt.value_of("customer-id").unwrap_or(""), opt.value_of("subscription-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1010,7 +1013,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1023,7 +1026,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1046,10 +1049,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_suspend(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_suspend(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subscriptions().suspend(opt.value_of("customer-id").unwrap_or(""), opt.value_of("subscription-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1062,7 +1065,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1075,7 +1078,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1178,14 +1181,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "reseller1-sandbox-secret.json", + match cmn::application_secret_from_directory(&config_dir, "reseller1-sandbox-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1205,7 +1208,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1244,7 +1247,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("customers", "methods: 'get', 'insert', 'patch' and 'update'", vec![ - ("get", + ("get", Some(r##"Gets a customer resource if one exists and is owned by the reseller."##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/customers_get", vec![ @@ -1266,7 +1269,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a customer resource if one does not already exist."##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/customers_insert", vec![ @@ -1288,7 +1291,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update a customer resource if one it exists and is owned by the reseller. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/customers_patch", vec![ @@ -1316,7 +1319,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update a customer resource if one it exists and is owned by the reseller."##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/customers_update", vec![ @@ -1347,7 +1350,7 @@ fn main() { ]), ("subscriptions", "methods: 'activate', 'change-plan', 'change-renewal-settings', 'change-seats', 'delete', 'get', 'insert', 'list', 'start-paid-service' and 'suspend'", vec![ - ("activate", + ("activate", Some(r##"Activates a subscription previously suspended by the reseller"##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/subscriptions_activate", vec![ @@ -1375,7 +1378,7 @@ fn main() { Some(false), Some(false)), ]), - ("change-plan", + ("change-plan", Some(r##"Changes the plan of a subscription"##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/subscriptions_change-plan", vec![ @@ -1409,7 +1412,7 @@ fn main() { Some(false), Some(false)), ]), - ("change-renewal-settings", + ("change-renewal-settings", Some(r##"Changes the renewal settings of a subscription"##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/subscriptions_change-renewal-settings", vec![ @@ -1443,7 +1446,7 @@ fn main() { Some(false), Some(false)), ]), - ("change-seats", + ("change-seats", Some(r##"Changes the seats configuration of a subscription"##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/subscriptions_change-seats", vec![ @@ -1477,7 +1480,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Cancels/Downgrades a subscription."##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/subscriptions_delete", vec![ @@ -1505,7 +1508,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Gets a subscription of the customer."##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/subscriptions_get", vec![ @@ -1533,7 +1536,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates/Transfers a subscription for the customer."##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/subscriptions_insert", vec![ @@ -1561,7 +1564,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists subscriptions of a reseller, optionally filtered by a customer name prefix."##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/subscriptions_list", vec![ @@ -1577,7 +1580,7 @@ fn main() { Some(false), Some(false)), ]), - ("start-paid-service", + ("start-paid-service", Some(r##"Starts paid service of a trial subscription"##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/subscriptions_start-paid-service", vec![ @@ -1605,7 +1608,7 @@ fn main() { Some(false), Some(false)), ]), - ("suspend", + ("suspend", Some(r##"Suspends an active subscription"##), "Details at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli/subscriptions_suspend", vec![ @@ -1639,7 +1642,7 @@ fn main() { let mut app = App::new("reseller1-sandbox") .author("Sebastian Thiel ") - .version("0.3.2+20150603") + .version("0.3.3+20151110") .about("Lets you create and manage your customers and their subscriptions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_reseller1_sandbox_cli") .arg(Arg::with_name("url") @@ -1663,7 +1666,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1674,7 +1677,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/reseller1_sandbox/Cargo.toml b/gen/reseller1_sandbox/Cargo.toml index 8dc5580200..a2c3c1eaf2 100644 --- a/gen/reseller1_sandbox/Cargo.toml +++ b/gen/reseller1_sandbox/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-reseller1_sandbox" -version = "0.1.10+20150603" +version = "0.1.11+20151110" authors = ["Sebastian Thiel "] description = "A complete library to interact with reseller (protocol v1sandbox)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/reseller1_sandbox" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/reseller1_sandbox/LICENSE.md b/gen/reseller1_sandbox/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/reseller1_sandbox/LICENSE.md +++ b/gen/reseller1_sandbox/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/reseller1_sandbox/README.md b/gen/reseller1_sandbox/README.md index d1ab031465..94e12689f9 100644 --- a/gen/reseller1_sandbox/README.md +++ b/gen/reseller1_sandbox/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-reseller1_sandbox` library allows access to all features of the *Google reseller* service. -This documentation was generated from *reseller* crate version *0.1.10+20150603*, where *20150603* is the exact revision of the *reseller:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *reseller* crate version *0.1.11+20151110*, where *20151110* is the exact revision of the *reseller:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *reseller* *v1_sandbox* API can be found at the [official documentation site](https://developers.google.com/google-apps/reseller/). diff --git a/gen/reseller1_sandbox/src/cmn.rs b/gen/reseller1_sandbox/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/reseller1_sandbox/src/cmn.rs +++ b/gen/reseller1_sandbox/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/reseller1_sandbox/src/lib.rs b/gen/reseller1_sandbox/src/lib.rs index bb8cc5b548..3bdb4f1754 100644 --- a/gen/reseller1_sandbox/src/lib.rs +++ b/gen/reseller1_sandbox/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *reseller* crate version *0.1.10+20150603*, where *20150603* is the exact revision of the *reseller:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *reseller* crate version *0.1.11+20151110*, where *20151110* is the exact revision of the *reseller:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *reseller* *v1_sandbox* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/reseller/). diff --git a/gen/reseller1_sandbox/src/lib.rs.in b/gen/reseller1_sandbox/src/lib.rs.in index 0f4bb7aa81..2a2581ac68 100644 --- a/gen/reseller1_sandbox/src/lib.rs.in +++ b/gen/reseller1_sandbox/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -135,7 +136,7 @@ impl<'a, C, A> Reseller Reseller { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -147,7 +148,7 @@ impl<'a, C, A> Reseller } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -175,23 +176,26 @@ impl<'a, C, A> Reseller /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Customer { - /// The alternate email of the customer. - #[serde(rename="alternateEmail")] - pub alternate_email: Option, /// The domain name of the customer. #[serde(rename="customerDomain")] pub customer_domain: Option, - /// The phone number of the customer. - #[serde(rename="phoneNumber")] - pub phone_number: Option, + /// Whether the customer's primary domain has been verified. + #[serde(rename="customerDomainVerified")] + pub customer_domain_verified: Option, + /// The alternate email of the customer. + #[serde(rename="alternateEmail")] + pub alternate_email: Option, + /// Identifies the resource as a customer. + pub kind: Option, /// Ui url for customer resource. #[serde(rename="resourceUiUrl")] pub resource_ui_url: Option, + /// The phone number of the customer. + #[serde(rename="phoneNumber")] + pub phone_number: Option, /// The postal address of the customer. #[serde(rename="postalAddress")] pub postal_address: Option
, - /// Identifies the resource as a customer. - pub kind: Option, /// The id of the customer. #[serde(rename="customerId")] pub customer_id: Option, @@ -443,7 +447,12 @@ pub struct Subscription { /// Trial Settings of the subscription. #[serde(rename="trialSettings")] pub trial_settings: Option, - /// Suspension Reasons + /// field listing all current reasons the subscription is suspended. It is possible for a subscription to have multiple suspension reasons. A subscription's status is SUSPENDED until all pending suspensions are removed. Possible options include: + /// - PENDING_TOS_ACCEPTANCE — The customer has not logged in and accepted the Google Apps Resold Terms of Services. + /// - RENEWAL_WITH_TYPE_CANCEL — The customer's commitment ended and their service was cancelled at the end of their term. + /// - RESELLER_INITIATED — A manual suspension invoked by a Reseller. + /// - TRIAL_ENDED — The customer's trial expired without a plan selected. + /// - OTHER — The customer is suspended for an internal Google reason (e.g. abuse or otherwise). #[serde(rename="suspensionReasons")] pub suspension_reasons: Option>, /// Ui url for subscription resource. @@ -904,7 +913,7 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.customers.update", + dlg.begin(MethodInfo { id: "reseller.customers.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -946,14 +955,14 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -997,7 +1006,7 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1007,10 +1016,10 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1042,7 +1051,7 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Customer) -> CustomerUpdateCall<'a, C, A> { self._request = new_value; @@ -1052,7 +1061,7 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *customer id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn customer_id(mut self, new_value: &str) -> CustomerUpdateCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -1070,12 +1079,12 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1092,17 +1101,17 @@ impl<'a, C, A> CustomerUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppOrder`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CustomerUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomerUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1172,7 +1181,7 @@ impl<'a, C, A> CustomerInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.customers.insert", + dlg.begin(MethodInfo { id: "reseller.customers.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._customer_auth_token { @@ -1195,14 +1204,14 @@ impl<'a, C, A> CustomerInsertCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::AppOrder.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1246,7 +1255,7 @@ impl<'a, C, A> CustomerInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1256,10 +1265,10 @@ impl<'a, C, A> CustomerInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1291,7 +1300,7 @@ impl<'a, C, A> CustomerInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Customer) -> CustomerInsertCall<'a, C, A> { self._request = new_value; @@ -1316,12 +1325,12 @@ impl<'a, C, A> CustomerInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1338,17 +1347,17 @@ impl<'a, C, A> CustomerInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppOrder`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CustomerInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomerInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1417,7 +1426,7 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.customers.patch", + dlg.begin(MethodInfo { id: "reseller.customers.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -1459,14 +1468,14 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1510,7 +1519,7 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1520,10 +1529,10 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1555,7 +1564,7 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Customer) -> CustomerPatchCall<'a, C, A> { self._request = new_value; @@ -1565,7 +1574,7 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *customer id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn customer_id(mut self, new_value: &str) -> CustomerPatchCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -1583,12 +1592,12 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1605,17 +1614,17 @@ impl<'a, C, A> CustomerPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppOrder`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CustomerPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomerPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1677,7 +1686,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.customers.get", + dlg.begin(MethodInfo { id: "reseller.customers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -1719,7 +1728,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1755,7 +1764,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1765,10 +1774,10 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1801,7 +1810,7 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *customer id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn customer_id(mut self, new_value: &str) -> CustomerGetCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -1819,12 +1828,12 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1841,17 +1850,17 @@ impl<'a, C, A> CustomerGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppOrderReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CustomerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> CustomerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1922,7 +1931,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.subscriptions.insert", + dlg.begin(MethodInfo { id: "reseller.subscriptions.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -1967,14 +1976,14 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2018,7 +2027,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2028,10 +2037,10 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> { self._request = new_value; @@ -2073,7 +2082,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -2098,12 +2107,12 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2194,7 +2203,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.subscriptions.delete", + dlg.begin(MethodInfo { id: "reseller.subscriptions.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -2237,7 +2246,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2273,7 +2282,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2283,10 +2292,10 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -2319,7 +2328,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -2329,7 +2338,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> { self._deletion_type = new_value.to_string(); @@ -2347,12 +2356,12 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2442,7 +2451,7 @@ impl<'a, C, A> SubscriptionGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.subscriptions.get", + dlg.begin(MethodInfo { id: "reseller.subscriptions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -2485,7 +2494,7 @@ impl<'a, C, A> SubscriptionGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2521,7 +2530,7 @@ impl<'a, C, A> SubscriptionGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2531,10 +2540,10 @@ impl<'a, C, A> SubscriptionGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2567,7 +2576,7 @@ impl<'a, C, A> SubscriptionGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *customer id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn customer_id(mut self, new_value: &str) -> SubscriptionGetCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -2577,7 +2586,7 @@ impl<'a, C, A> SubscriptionGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *subscription id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn subscription_id(mut self, new_value: &str) -> SubscriptionGetCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -2595,12 +2604,12 @@ impl<'a, C, A> SubscriptionGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2617,17 +2626,17 @@ impl<'a, C, A> SubscriptionGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppOrderReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubscriptionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2698,7 +2707,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.subscriptions.list", + dlg.begin(MethodInfo { id: "reseller.subscriptions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -2733,7 +2742,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::AppOrderReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2769,7 +2778,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2779,10 +2788,10 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2858,12 +2867,12 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2880,17 +2889,17 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppOrderReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubscriptionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2960,7 +2969,7 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.subscriptions.changeRenewalSettings", + dlg.begin(MethodInfo { id: "reseller.subscriptions.changeRenewalSettings", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -3003,14 +3012,14 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3054,7 +3063,7 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3064,10 +3073,10 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3099,7 +3108,7 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: RenewalSettings) -> SubscriptionChangeRenewalSettingCall<'a, C, A> { self._request = new_value; @@ -3109,7 +3118,7 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut /// /// Sets the *customer id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn customer_id(mut self, new_value: &str) -> SubscriptionChangeRenewalSettingCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -3119,7 +3128,7 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut /// /// Sets the *subscription id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn subscription_id(mut self, new_value: &str) -> SubscriptionChangeRenewalSettingCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -3137,12 +3146,12 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3159,17 +3168,17 @@ impl<'a, C, A> SubscriptionChangeRenewalSettingCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::AppOrder`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubscriptionChangeRenewalSettingCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionChangeRenewalSettingCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3232,7 +3241,7 @@ impl<'a, C, A> SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.subscriptions.startPaidService", + dlg.begin(MethodInfo { id: "reseller.subscriptions.startPaidService", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -3275,7 +3284,7 @@ impl<'a, C, A> SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3311,7 +3320,7 @@ impl<'a, C, A> SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3321,10 +3330,10 @@ impl<'a, C, A> SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut SubscriptionStartPaidServiceCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -3367,7 +3376,7 @@ impl<'a, C, A> SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut SubscriptionStartPaidServiceCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -3385,12 +3394,12 @@ impl<'a, C, A> SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut SubscriptionStartPaidServiceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionStartPaidServiceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionStartPaidServiceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3487,7 +3496,7 @@ impl<'a, C, A> SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.subscriptions.changeSeats", + dlg.begin(MethodInfo { id: "reseller.subscriptions.changeSeats", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -3530,14 +3539,14 @@ impl<'a, C, A> SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3581,7 +3590,7 @@ impl<'a, C, A> SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3591,10 +3600,10 @@ impl<'a, C, A> SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut SubscriptionChangeSeatCall<'a, C, A> { self._request = new_value; @@ -3636,7 +3645,7 @@ impl<'a, C, A> SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut SubscriptionChangeSeatCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -3646,7 +3655,7 @@ impl<'a, C, A> SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut SubscriptionChangeSeatCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -3664,12 +3673,12 @@ impl<'a, C, A> SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut SubscriptionChangeSeatCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionChangeSeatCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionChangeSeatCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3759,7 +3768,7 @@ impl<'a, C, A> SubscriptionSuspendCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.subscriptions.suspend", + dlg.begin(MethodInfo { id: "reseller.subscriptions.suspend", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -3802,7 +3811,7 @@ impl<'a, C, A> SubscriptionSuspendCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3838,7 +3847,7 @@ impl<'a, C, A> SubscriptionSuspendCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3848,10 +3857,10 @@ impl<'a, C, A> SubscriptionSuspendCall<'a, C, A> where C: BorrowMut SubscriptionSuspendCall<'a, C, A> where C: BorrowMut SubscriptionSuspendCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -3894,7 +3903,7 @@ impl<'a, C, A> SubscriptionSuspendCall<'a, C, A> where C: BorrowMut SubscriptionSuspendCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -3912,12 +3921,12 @@ impl<'a, C, A> SubscriptionSuspendCall<'a, C, A> where C: BorrowMut SubscriptionSuspendCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionSuspendCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionSuspendCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4007,7 +4016,7 @@ impl<'a, C, A> SubscriptionActivateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.subscriptions.activate", + dlg.begin(MethodInfo { id: "reseller.subscriptions.activate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -4050,7 +4059,7 @@ impl<'a, C, A> SubscriptionActivateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4086,7 +4095,7 @@ impl<'a, C, A> SubscriptionActivateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4096,10 +4105,10 @@ impl<'a, C, A> SubscriptionActivateCall<'a, C, A> where C: BorrowMut SubscriptionActivateCall<'a, C, A> where C: BorrowMut SubscriptionActivateCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -4142,7 +4151,7 @@ impl<'a, C, A> SubscriptionActivateCall<'a, C, A> where C: BorrowMut SubscriptionActivateCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -4160,12 +4169,12 @@ impl<'a, C, A> SubscriptionActivateCall<'a, C, A> where C: BorrowMut SubscriptionActivateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionActivateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionActivateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4262,7 +4271,7 @@ impl<'a, C, A> SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "reseller.subscriptions.changePlan", + dlg.begin(MethodInfo { id: "reseller.subscriptions.changePlan", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("customerId", self._customer_id.to_string())); @@ -4305,14 +4314,14 @@ impl<'a, C, A> SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4356,7 +4365,7 @@ impl<'a, C, A> SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4366,10 +4375,10 @@ impl<'a, C, A> SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut SubscriptionChangePlanCall<'a, C, A> { self._request = new_value; @@ -4411,7 +4420,7 @@ impl<'a, C, A> SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut SubscriptionChangePlanCall<'a, C, A> { self._customer_id = new_value.to_string(); @@ -4421,7 +4430,7 @@ impl<'a, C, A> SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut SubscriptionChangePlanCall<'a, C, A> { self._subscription_id = new_value.to_string(); @@ -4439,12 +4448,12 @@ impl<'a, C, A> SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut SubscriptionChangePlanCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionChangePlanCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionChangePlanCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/resourceviews1_beta2-cli/Cargo.toml b/gen/resourceviews1_beta2-cli/Cargo.toml index 65e919ddaf..67d54e1f32 100644 --- a/gen/resourceviews1_beta2-cli/Cargo.toml +++ b/gen/resourceviews1_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-resourceviews1_beta2-cli" -version = "0.3.2+20150708" +version = "0.3.3+20150708" authors = ["Sebastian Thiel "] description = "A complete library to interact with resourceviews (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/resourceviews1_beta2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/resourceviews1_beta2-cli/LICENSE.md b/gen/resourceviews1_beta2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/resourceviews1_beta2-cli/LICENSE.md +++ b/gen/resourceviews1_beta2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/resourceviews1_beta2-cli/README.md b/gen/resourceviews1_beta2-cli/README.md index a0ac838693..5c0c49e63e 100644 --- a/gen/resourceviews1_beta2-cli/README.md +++ b/gen/resourceviews1_beta2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *resourceviews* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/resourceviews1-beta2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/resourceviews1-beta2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/resourceviews1-beta2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/resourceviews1-beta2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/resourceviews1_beta2-cli). # Usage -This documentation was generated from the *resourceviews* API at revision *20150708*. The CLI is at version *0.3.2*. +This documentation was generated from the *resourceviews* API at revision *20150708*. The CLI is at version *0.3.3*. ```bash resourceviews1-beta2 [options] @@ -45,18 +45,18 @@ resourceviews1-beta2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/resourceviews1_beta2-cli/mkdocs.yml b/gen/resourceviews1_beta2-cli/mkdocs.yml index 4cd20d6c65..93deaaf1eb 100644 --- a/gen/resourceviews1_beta2-cli/mkdocs.yml +++ b/gen/resourceviews1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: resourceviews v0.3.2+20150708 +site_name: resourceviews v0.3.3+20150708 site_url: http://byron.github.io/google-apis-rs/google-resourceviews1_beta2-cli site_description: Write integrating applications with bcore @@ -23,5 +23,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/resourceviews1_beta2-cli/src/main.rs b/gen/resourceviews1_beta2-cli/src/main.rs index 3e40e09b0e..0c81f23461 100644 --- a/gen/resourceviews1_beta2-cli/src/main.rs +++ b/gen/resourceviews1_beta2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Resourceviews>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _zone_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _zone_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_operations().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -122,7 +122,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); @@ -136,7 +136,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -159,13 +159,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_views_add_resources(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_views_add_resources(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -179,8 +179,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resources" => Some(("resources", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -195,7 +195,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ZoneViewsAddResourcesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.zone_views().add_resources(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource-view").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -208,7 +208,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -221,7 +221,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -244,10 +244,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_views_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_views_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_views().delete(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource-view").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -260,7 +260,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -273,7 +273,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -296,10 +296,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_views_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_views_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_views().get(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource-view").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -312,7 +312,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -325,7 +325,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -348,10 +348,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_views_get_service(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_views_get_service(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_views().get_service(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource-view").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "resource-name" => { @@ -367,7 +367,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["resource-name"].iter().map(|v|*v)); @@ -381,7 +381,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -404,13 +404,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_views_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_views_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -424,8 +424,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "network" => Some(("network", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -449,7 +449,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ResourceView = json::value::from_value(object).unwrap(); let mut call = self.hub.zone_views().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -462,7 +462,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -475,7 +475,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -498,10 +498,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_views_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_views_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_views().list(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -520,7 +520,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -534,7 +534,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -557,10 +557,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_views_list_resources(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_views_list_resources(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.zone_views().list_resources(opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource-view").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "service-name" => { @@ -588,7 +588,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "service-name", "list-state", "max-results", "format"].iter().map(|v|*v)); @@ -602,7 +602,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -625,13 +625,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_views_remove_resources(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_views_remove_resources(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -645,8 +645,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resources" => Some(("resources", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), _ => { @@ -661,7 +661,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ZoneViewsRemoveResourcesRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.zone_views().remove_resources(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource-view").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -674,7 +674,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -687,7 +687,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -710,13 +710,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _zone_views_set_service(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _zone_views_set_service(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -730,8 +730,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-name" => Some(("resourceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -747,7 +747,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ZoneViewsSetServiceRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.zone_views().set_service(request, opt.value_of("project").unwrap_or(""), opt.value_of("zone").unwrap_or(""), opt.value_of("resource-view").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -760,7 +760,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -773,7 +773,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -867,14 +867,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "resourceviews1-beta2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "resourceviews1-beta2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -894,7 +894,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -933,7 +933,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("zone-operations", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves the specified zone-specific operation resource."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-operations_get", vec![ @@ -967,7 +967,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves the list of operation resources contained within the specified zone."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-operations_list", vec![ @@ -998,7 +998,7 @@ fn main() { ]), ("zone-views", "methods: 'add-resources', 'delete', 'get', 'get-service', 'insert', 'list', 'list-resources', 'remove-resources' and 'set-service'", vec![ - ("add-resources", + ("add-resources", Some(r##"Add resources to the view."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-views_add-resources", vec![ @@ -1038,7 +1038,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Delete a resource view."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-views_delete", vec![ @@ -1072,7 +1072,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Get the information of a zonal resource view."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-views_get", vec![ @@ -1106,7 +1106,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-service", + ("get-service", Some(r##"Get the service information of a resource view or a resource."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-views_get-service", vec![ @@ -1140,7 +1140,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Create a resource view."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-views_insert", vec![ @@ -1174,7 +1174,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List resource views."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-views_list", vec![ @@ -1202,7 +1202,7 @@ fn main() { Some(false), Some(false)), ]), - ("list-resources", + ("list-resources", Some(r##"List the resources of the resource view."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-views_list-resources", vec![ @@ -1236,7 +1236,7 @@ fn main() { Some(false), Some(false)), ]), - ("remove-resources", + ("remove-resources", Some(r##"Remove resources from the view."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-views_remove-resources", vec![ @@ -1276,7 +1276,7 @@ fn main() { Some(false), Some(false)), ]), - ("set-service", + ("set-service", Some(r##"Update the service information of a resource view or a resource."##), "Details at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli/zone-views_set-service", vec![ @@ -1322,7 +1322,7 @@ fn main() { let mut app = App::new("resourceviews1-beta2") .author("Sebastian Thiel ") - .version("0.3.2+20150708") + .version("0.3.3+20150708") .about("The Resource View API allows users to create and manage logical sets of Google Compute Engine instances.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_resourceviews1_beta2_cli") .arg(Arg::with_name("url") @@ -1346,7 +1346,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1357,7 +1357,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/resourceviews1_beta2/Cargo.toml b/gen/resourceviews1_beta2/Cargo.toml index b0207c245d..43a237fece 100644 --- a/gen/resourceviews1_beta2/Cargo.toml +++ b/gen/resourceviews1_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-resourceviews1_beta2" -version = "0.1.10+20150708" +version = "0.1.11+20150708" authors = ["Sebastian Thiel "] description = "A complete library to interact with resourceviews (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/resourceviews1_beta2" diff --git a/gen/resourceviews1_beta2/LICENSE.md b/gen/resourceviews1_beta2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/resourceviews1_beta2/LICENSE.md +++ b/gen/resourceviews1_beta2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/resourceviews1_beta2/README.md b/gen/resourceviews1_beta2/README.md index b501ff1d33..e90032875d 100644 --- a/gen/resourceviews1_beta2/README.md +++ b/gen/resourceviews1_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-resourceviews1_beta2` library allows access to all features of the *Google resourceviews* service. -This documentation was generated from *resourceviews* crate version *0.1.10+20150708*, where *20150708* is the exact revision of the *resourceviews:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *resourceviews* crate version *0.1.11+20150708*, where *20150708* is the exact revision of the *resourceviews:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *resourceviews* *v1_beta2* API can be found at the [official documentation site](https://developers.google.com/compute/). diff --git a/gen/resourceviews1_beta2/src/cmn.rs b/gen/resourceviews1_beta2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/resourceviews1_beta2/src/cmn.rs +++ b/gen/resourceviews1_beta2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/resourceviews1_beta2/src/lib.rs b/gen/resourceviews1_beta2/src/lib.rs index 52be2ea14e..5b0f62d227 100644 --- a/gen/resourceviews1_beta2/src/lib.rs +++ b/gen/resourceviews1_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *resourceviews* crate version *0.1.10+20150708*, where *20150708* is the exact revision of the *resourceviews:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *resourceviews* crate version *0.1.11+20150708*, where *20150708* is the exact revision of the *resourceviews:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *resourceviews* *v1_beta2* API can be found at the //! [official documentation site](https://developers.google.com/compute/). diff --git a/gen/resourceviews1_beta2/src/lib.rs.in b/gen/resourceviews1_beta2/src/lib.rs.in index ba09134c17..e246d41841 100644 --- a/gen/resourceviews1_beta2/src/lib.rs.in +++ b/gen/resourceviews1_beta2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -152,7 +153,7 @@ impl<'a, C, A> Resourceviews Resourceviews { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -164,7 +165,7 @@ impl<'a, C, A> Resourceviews } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -966,7 +967,7 @@ impl<'a, C, A> ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneViews.removeResources", + dlg.begin(MethodInfo { id: "resourceviews.zoneViews.removeResources", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1010,14 +1011,14 @@ impl<'a, C, A> ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1061,7 +1062,7 @@ impl<'a, C, A> ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1071,10 +1072,10 @@ impl<'a, C, A> ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut ZoneViewRemoveResourceCall<'a, C, A> { self._request = new_value; @@ -1116,7 +1117,7 @@ impl<'a, C, A> ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut ZoneViewRemoveResourceCall<'a, C, A> { self._project = new_value.to_string(); @@ -1126,7 +1127,7 @@ impl<'a, C, A> ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut ZoneViewRemoveResourceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1136,7 +1137,7 @@ impl<'a, C, A> ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut ZoneViewRemoveResourceCall<'a, C, A> { self._resource_view = new_value.to_string(); @@ -1154,12 +1155,12 @@ impl<'a, C, A> ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut ZoneViewRemoveResourceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ZoneViewRemoveResourceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneViewRemoveResourceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1257,7 +1258,7 @@ impl<'a, C, A> ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneViews.addResources", + dlg.begin(MethodInfo { id: "resourceviews.zoneViews.addResources", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1301,14 +1302,14 @@ impl<'a, C, A> ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1352,7 +1353,7 @@ impl<'a, C, A> ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1362,10 +1363,10 @@ impl<'a, C, A> ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut ZoneViewAddResourceCall<'a, C, A> { self._request = new_value; @@ -1407,7 +1408,7 @@ impl<'a, C, A> ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut ZoneViewAddResourceCall<'a, C, A> { self._project = new_value.to_string(); @@ -1417,7 +1418,7 @@ impl<'a, C, A> ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut ZoneViewAddResourceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1427,7 +1428,7 @@ impl<'a, C, A> ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut ZoneViewAddResourceCall<'a, C, A> { self._resource_view = new_value.to_string(); @@ -1445,12 +1446,12 @@ impl<'a, C, A> ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut ZoneViewAddResourceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ZoneViewAddResourceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneViewAddResourceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1551,7 +1552,7 @@ impl<'a, C, A> ZoneViewListResourceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneViews.listResources", + dlg.begin(MethodInfo { id: "resourceviews.zoneViews.listResources", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1610,7 +1611,7 @@ impl<'a, C, A> ZoneViewListResourceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1646,7 +1647,7 @@ impl<'a, C, A> ZoneViewListResourceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1656,10 +1657,10 @@ impl<'a, C, A> ZoneViewListResourceCall<'a, C, A> where C: BorrowMut ZoneViewListResourceCall<'a, C, A> where C: BorrowMut ZoneViewListResourceCall<'a, C, A> { self._project = new_value.to_string(); @@ -1702,7 +1703,7 @@ impl<'a, C, A> ZoneViewListResourceCall<'a, C, A> where C: BorrowMut ZoneViewListResourceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -1712,7 +1713,7 @@ impl<'a, C, A> ZoneViewListResourceCall<'a, C, A> where C: BorrowMut ZoneViewListResourceCall<'a, C, A> { self._resource_view = new_value.to_string(); @@ -1765,12 +1766,12 @@ impl<'a, C, A> ZoneViewListResourceCall<'a, C, A> where C: BorrowMut ZoneViewListResourceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ZoneViewListResourceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneViewListResourceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1861,7 +1862,7 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneViews.get", + dlg.begin(MethodInfo { id: "resourceviews.zoneViews.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1905,7 +1906,7 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1941,7 +1942,7 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1951,10 +1952,10 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1987,7 +1988,7 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneViewGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -1997,7 +1998,7 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneViewGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2007,7 +2008,7 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *resource view* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource_view(mut self, new_value: &str) -> ZoneViewGetCall<'a, C, A> { self._resource_view = new_value.to_string(); @@ -2025,12 +2026,12 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2047,17 +2048,17 @@ impl<'a, C, A> ZoneViewGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ComputeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneViewGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneViewGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2124,7 +2125,7 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneViews.list", + dlg.begin(MethodInfo { id: "resourceviews.zoneViews.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2173,7 +2174,7 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2209,7 +2210,7 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2219,10 +2220,10 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2255,7 +2256,7 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneViewListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2265,7 +2266,7 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneViewListCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2297,12 +2298,12 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2319,17 +2320,17 @@ impl<'a, C, A> ZoneViewListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ComputeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneViewListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneViewListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2399,7 +2400,7 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneViews.insert", + dlg.begin(MethodInfo { id: "resourceviews.zoneViews.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2442,14 +2443,14 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2493,7 +2494,7 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2503,10 +2504,10 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2538,7 +2539,7 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ResourceView) -> ZoneViewInsertCall<'a, C, A> { self._request = new_value; @@ -2548,7 +2549,7 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneViewInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -2558,7 +2559,7 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneViewInsertCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2576,12 +2577,12 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2598,17 +2599,17 @@ impl<'a, C, A> ZoneViewInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneViewInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneViewInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2672,7 +2673,7 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneViews.delete", + dlg.begin(MethodInfo { id: "resourceviews.zoneViews.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2716,7 +2717,7 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2752,7 +2753,7 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2762,10 +2763,10 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2798,7 +2799,7 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneViewDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -2808,7 +2809,7 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneViewDeleteCall<'a, C, A> { self._zone = new_value.to_string(); @@ -2818,7 +2819,7 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *resource view* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource_view(mut self, new_value: &str) -> ZoneViewDeleteCall<'a, C, A> { self._resource_view = new_value.to_string(); @@ -2836,12 +2837,12 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2858,17 +2859,17 @@ impl<'a, C, A> ZoneViewDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneViewDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneViewDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2939,7 +2940,7 @@ impl<'a, C, A> ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneViews.setService", + dlg.begin(MethodInfo { id: "resourceviews.zoneViews.setService", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2983,14 +2984,14 @@ impl<'a, C, A> ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3034,7 +3035,7 @@ impl<'a, C, A> ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3044,10 +3045,10 @@ impl<'a, C, A> ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut ZoneViewSetServiceCall<'a, C, A> { self._request = new_value; @@ -3089,7 +3090,7 @@ impl<'a, C, A> ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut ZoneViewSetServiceCall<'a, C, A> { self._project = new_value.to_string(); @@ -3099,7 +3100,7 @@ impl<'a, C, A> ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut ZoneViewSetServiceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3109,7 +3110,7 @@ impl<'a, C, A> ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut ZoneViewSetServiceCall<'a, C, A> { self._resource_view = new_value.to_string(); @@ -3127,12 +3128,12 @@ impl<'a, C, A> ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut ZoneViewSetServiceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ZoneViewSetServiceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneViewSetServiceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3225,7 +3226,7 @@ impl<'a, C, A> ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneViews.getService", + dlg.begin(MethodInfo { id: "resourceviews.zoneViews.getService", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3272,7 +3273,7 @@ impl<'a, C, A> ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3308,7 +3309,7 @@ impl<'a, C, A> ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3318,10 +3319,10 @@ impl<'a, C, A> ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut ZoneViewGetServiceCall<'a, C, A> { self._project = new_value.to_string(); @@ -3364,7 +3365,7 @@ impl<'a, C, A> ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut ZoneViewGetServiceCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3374,7 +3375,7 @@ impl<'a, C, A> ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut ZoneViewGetServiceCall<'a, C, A> { self._resource_view = new_value.to_string(); @@ -3399,12 +3400,12 @@ impl<'a, C, A> ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut ZoneViewGetServiceCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ZoneViewGetServiceCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneViewGetServiceCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3495,7 +3496,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneOperations.get", + dlg.begin(MethodInfo { id: "resourceviews.zoneOperations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3539,7 +3540,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3575,7 +3576,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3585,10 +3586,10 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3621,7 +3622,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -3631,7 +3632,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3641,7 +3642,7 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, /// /// Sets the *operation* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operation(mut self, new_value: &str) -> ZoneOperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -3659,12 +3660,12 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3681,17 +3682,17 @@ impl<'a, C, A> ZoneOperationGetCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ComputeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3760,7 +3761,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "resourceviews.zoneOperations.list", + dlg.begin(MethodInfo { id: "resourceviews.zoneOperations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3812,7 +3813,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3848,7 +3849,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3858,10 +3859,10 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3894,7 +3895,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._project = new_value.to_string(); @@ -3904,7 +3905,7 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut /// /// Sets the *zone* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ZoneOperationListCall<'a, C, A> { self._zone = new_value.to_string(); @@ -3943,12 +3944,12 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3965,17 +3966,17 @@ impl<'a, C, A> ZoneOperationListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ComputeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ZoneOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ZoneOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/script1-cli/Cargo.toml b/gen/script1-cli/Cargo.toml index 215cfad336..491a2ab8cd 100644 --- a/gen/script1-cli/Cargo.toml +++ b/gen/script1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-script1-cli" -version = "0.3.2+20150922" +version = "0.3.3+20150922" authors = ["Sebastian Thiel "] description = "A complete library to interact with script (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/script1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/script1-cli/LICENSE.md b/gen/script1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/script1-cli/LICENSE.md +++ b/gen/script1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/script1-cli/README.md b/gen/script1-cli/README.md index b03f3e47f5..4703d18e15 100644 --- a/gen/script1-cli/README.md +++ b/gen/script1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *script* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/script1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/script1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/script1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/script1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/script1-cli). # Usage -This documentation was generated from the *script* API at revision *20150922*. The CLI is at version *0.3.2*. +This documentation was generated from the *script* API at revision *20150922*. The CLI is at version *0.3.3*. ```bash script1 [options] @@ -34,18 +34,18 @@ script1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/script1-cli/mkdocs.yml b/gen/script1-cli/mkdocs.yml index 50276bda00..e709860681 100644 --- a/gen/script1-cli/mkdocs.yml +++ b/gen/script1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: script v0.3.2+20150922 +site_name: script v0.3.3+20150922 site_url: http://byron.github.io/google-apis-rs/google-script1-cli site_description: Write integrating applications with bcore @@ -13,5 +13,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/script1-cli/src/main.rs b/gen/script1-cli/src/main.rs index 05d9fcae59..258818c5ce 100644 --- a/gen/script1-cli/src/main.rs +++ b/gen/script1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Script>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _scripts_run(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _scripts_run(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "function" => Some(("function", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "dev-mode" => Some(("devMode", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -83,7 +83,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ExecutionRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.scripts().run(request, opt.value_of("script-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -96,7 +96,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -109,7 +109,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -165,14 +165,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "script1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "script1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -192,7 +192,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -235,7 +235,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("scripts", "methods: 'run'", vec![ - ("run", + ("run", Some(r##"Runs a function in an Apps Script project that has been deployed for use with the Apps Script Execution API. This method requires authorization with an OAuth 2.0 token that includes at least one of the scopes listed in the [Authentication](#authentication) section; script projects that do not require authorization cannot be executed through this API. To find the correct scopes to include in the authentication token, open the project in the script editor, then select **File > Project properties** and click the **Scopes** tab."##), "Details at http://byron.github.io/google-apis-rs/google_script1_cli/scripts_run", vec![ @@ -269,7 +269,7 @@ fn main() { let mut app = App::new("script1") .author("Sebastian Thiel ") - .version("0.3.2+20150922") + .version("0.3.3+20150922") .about("An API for executing Google Apps Script projects.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_script1_cli") .arg(Arg::with_name("url") @@ -293,7 +293,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -304,7 +304,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/script1/Cargo.toml b/gen/script1/Cargo.toml index 4c7d8df263..be9ce68d86 100644 --- a/gen/script1/Cargo.toml +++ b/gen/script1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-script1" -version = "0.1.10+20150922" +version = "0.1.11+20150922" authors = ["Sebastian Thiel "] description = "A complete library to interact with script (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/script1" diff --git a/gen/script1/LICENSE.md b/gen/script1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/script1/LICENSE.md +++ b/gen/script1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/script1/README.md b/gen/script1/README.md index c9a96a2532..51690a6f5c 100644 --- a/gen/script1/README.md +++ b/gen/script1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-script1` library allows access to all features of the *Google script* service. -This documentation was generated from *script* crate version *0.1.10+20150922*, where *20150922* is the exact revision of the *script:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *script* crate version *0.1.11+20150922*, where *20150922* is the exact revision of the *script:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *script* *v1* API can be found at the [official documentation site](https://developers.google.com/apps-script/execution/rest/v1/run). diff --git a/gen/script1/src/cmn.rs b/gen/script1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/script1/src/cmn.rs +++ b/gen/script1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/script1/src/lib.rs b/gen/script1/src/lib.rs index ead69aabb7..160aba2f84 100644 --- a/gen/script1/src/lib.rs +++ b/gen/script1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *script* crate version *0.1.10+20150922*, where *20150922* is the exact revision of the *script:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *script* crate version *0.1.11+20150922*, where *20150922* is the exact revision of the *script:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *script* *v1* API can be found at the //! [official documentation site](https://developers.google.com/apps-script/execution/rest/v1/run). diff --git a/gen/script1/src/lib.rs.in b/gen/script1/src/lib.rs.in index 69b6108e0f..9d410ecc12 100644 --- a/gen/script1/src/lib.rs.in +++ b/gen/script1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -168,7 +169,7 @@ impl<'a, C, A> Script Script { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -177,7 +178,7 @@ impl<'a, C, A> Script } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -397,7 +398,7 @@ impl<'a, C, A> ScriptRunCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "script.scripts.run", + dlg.begin(MethodInfo { id: "script.scripts.run", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("scriptId", self._script_id.to_string())); @@ -439,14 +440,14 @@ impl<'a, C, A> ScriptRunCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -490,7 +491,7 @@ impl<'a, C, A> ScriptRunCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -500,10 +501,10 @@ impl<'a, C, A> ScriptRunCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -535,7 +536,7 @@ impl<'a, C, A> ScriptRunCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ExecutionRequest) -> ScriptRunCall<'a, C, A> { self._request = new_value; @@ -545,7 +546,7 @@ impl<'a, C, A> ScriptRunCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *script id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn script_id(mut self, new_value: &str) -> ScriptRunCall<'a, C, A> { self._script_id = new_value.to_string(); @@ -563,12 +564,12 @@ impl<'a, C, A> ScriptRunCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -591,17 +592,17 @@ impl<'a, C, A> ScriptRunCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Scrip`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ScriptRunCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ScriptRunCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/serviceregistryalpha-cli/Cargo.toml b/gen/serviceregistryalpha-cli/Cargo.toml new file mode 100644 index 0000000000..ae59f256fc --- /dev/null +++ b/gen/serviceregistryalpha-cli/Cargo.toml @@ -0,0 +1,35 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-serviceregistryalpha-cli" +version = "0.3.3+20160111" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Service Registry (protocol alpha)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/serviceregistryalpha-cli" +homepage = "https://developers.google.com/cloud-serviceregistry/" +documentation = "http://byron.github.io/google-apis-rs/google_serviceregistryalpha_cli" +license = "MIT" +keywords = ["serviceregistry", "google", "cli"] + +[[bin]] +name = "serviceregistryalpha" + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +strsim = "0.4" +yup-hyper-mock = "1.0" +clap = "2.0" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + + +[dependencies.google-serviceregistryalpha] +path = "../serviceregistryalpha" diff --git a/gen/serviceregistryalpha-cli/LICENSE.md b/gen/serviceregistryalpha-cli/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/serviceregistryalpha-cli/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/deploymentmanager2_beta1-cli/README.md b/gen/serviceregistryalpha-cli/README.md similarity index 71% rename from gen/deploymentmanager2_beta1-cli/README.md rename to gen/serviceregistryalpha-cli/README.md index aed45794cd..1547d1c6cf 100644 --- a/gen/deploymentmanager2_beta1-cli/README.md +++ b/gen/serviceregistryalpha-cli/README.md @@ -3,70 +3,64 @@ DO NOT EDIT ! This file was generated automatically from 'src/mako/cli/README.md.mako' DO NOT EDIT ! --> -The `deploymentmanager2-beta1` command-line interface *(CLI)* allows to use most features of the *Google deploymentmanager* service from the comfort of your terminal. +The `serviceregistryalpha` command-line interface *(CLI)* allows to use most features of the *Google Service Registry* service from the comfort of your terminal. By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero. If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. -Everything else about the *deploymentmanager* API can be found at the -[official documentation site](https://developers.google.com/deployment-manager/). +Everything else about the *Service Registry* API can be found at the +[official documentation site](https://developers.google.com/cloud-serviceregistry/). # Downloads You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.0/ubuntu/deploymentmanager2-beta1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.0/osx/deploymentmanager2-beta1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/serviceregistryalpha.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/serviceregistryalpha.tar.gz) -Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2_beta1-cli). +Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/serviceregistryalpha-cli). # Usage -This documentation was generated from the *deploymentmanager* API at revision *20150415*. The CLI is at version *0.3.0*. +This documentation was generated from the *Service Registry* API at revision *20160111*. The CLI is at version *0.3.3*. ```bash -deploymentmanager2-beta1 [options] - deployments - delete [-p ]... [-o ] - get [-p ]... [-o ] +serviceregistryalpha [options] + endpoints + delete [-p ]... [-o ] + get [-p ]... [-o ] insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] - manifests - get [-p ]... [-o ] - list [-p ]... [-o ] + patch (-r )... [-p ]... [-o ] + update (-r )... [-p ]... [-o ] operations get [-p ]... [-o ] list [-p ]... [-o ] - resources - get [-p ]... [-o ] - list [-p ]... [-o ] - types - list [-p ]... [-o ] - deploymentmanager2-beta1 --help + serviceregistryalpha --help Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` # Configuration -The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `deploymentmanager2-beta1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. +The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `serviceregistryalpha-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis. More information about the various kinds of persistent data are given in the following paragraphs. @@ -84,7 +78,7 @@ The first time a scope is used, the user is asked for permission. Follow the ins by the CLI to grant permissions, or to decline. If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration -directory, e.g. `~/.google-service-cli/deploymentmanager2-beta1-token-.json`. No manual management of these tokens +directory, e.g. `~/.google-service-cli/serviceregistryalpha-token-.json`. No manual management of these tokens is necessary. To revoke granted authentication, please refer to the [official documentation][revoke-access]. @@ -100,7 +94,7 @@ comes with a default application secret that is configured accordingly. This als all around the world may deplete the daily quota. You can workaround this limitation by putting your own secrets file at this location: -`~/.google-service-cli/deploymentmanager2-beta1-secret.json`, assuming that the required *deploymentmanager* API +`~/.google-service-cli/serviceregistryalpha-secret.json`, assuming that the required *serviceregistry* API was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at *APIs & auth -> Credentials -> Download JSON* and used as is. @@ -118,7 +112,7 @@ will cause all communication related to authentication to standard error. If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the issue at hand. -You may consider redirecting standard error into a file for ease of use, e.g. `deploymentmanager2-beta1 --debug [options] 2>debug.txt`. +You may consider redirecting standard error into a file for ease of use, e.g. `serviceregistryalpha --debug [options] 2>debug.txt`. [scopes]: https://developers.google.com/+/api/oauth#scopes diff --git a/gen/serviceregistryalpha-cli/mkdocs.yml b/gen/serviceregistryalpha-cli/mkdocs.yml new file mode 100644 index 0000000000..82a07df56d --- /dev/null +++ b/gen/serviceregistryalpha-cli/mkdocs.yml @@ -0,0 +1,24 @@ +site_name: Service Registry v0.3.3+20160111 +site_url: http://byron.github.io/google-apis-rs/google-serviceregistryalpha-cli +site_description: Write integrating applications with bcore + +repo_url: https://github.com/Byron/google-apis-rs/tree/master/gen/serviceregistryalpha-cli + +docs_dir: docs +site_dir: build_html + +pages: +- ['index.md', 'Home'] +- ['endpoints_delete.md', 'Endpoints', 'Delete'] +- ['endpoints_get.md', 'Endpoints', 'Get'] +- ['endpoints_insert.md', 'Endpoints', 'Insert'] +- ['endpoints_list.md', 'Endpoints', 'List'] +- ['endpoints_patch.md', 'Endpoints', 'Patch'] +- ['endpoints_update.md', 'Endpoints', 'Update'] +- ['operations_get.md', 'Operations', 'Get'] +- ['operations_list.md', 'Operations', 'List'] + +theme: readthedocs + +copyright: Copyright © 2015-2016, `Sebastian Thiel` + diff --git a/gen/serviceregistryalpha-cli/src/cmn.rs b/gen/serviceregistryalpha-cli/src/cmn.rs new file mode 100644 index 0000000000..ae86fdef65 --- /dev/null +++ b/gen/serviceregistryalpha-cli/src/cmn.rs @@ -0,0 +1,721 @@ +// COPY OF 'src/rust/cli/cmn.rs' +// DO NOT EDIT +use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; +use serde_json as json; +use serde_json::value::Value; +use mime::Mime; +use clap::{App, SubCommand}; +use strsim; + +use std::fs; +use std::env; +use std::io; +use std::fmt; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use std::string::ToString; +use std::io::{Write, Read, stdout}; + +use std::default::Default; + +const FIELD_SEP: char = '.'; + + +pub enum ComplexType { + Pod, + Vec, + Map, +} + + // Null, + // Bool(bool), + // I64(i64), + // U64(u64), + // F64(f64), + // String(String), + +pub enum JsonType { + Boolean, + Int, + Uint, + Float, + String, +} + +pub struct JsonTypeInfo { + pub jtype: JsonType, + pub ctype: ComplexType, +} + +// Based on @erickt user comment. Thanks for the idea ! +// Remove all keys whose values are null from given value (changed in place) +pub fn remove_json_null_values(value: &mut Value) { + match *value { + Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} + +fn did_you_mean<'a>(v: &str, possible_values: &[&'a str]) -> Option<&'a str> { + + let mut candidate: Option<(f64, &str)> = None; + for pv in possible_values { + let confidence = strsim::jaro_winkler(v, pv); + if confidence > 0.8 && (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { + candidate = Some((confidence, pv)); + } + } + match candidate { + None => None, + Some((_, candidate)) => Some(candidate), + } +} + +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +arg_enum!{ + pub enum UploadProtocol { + Simple, + Resumable + } +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +#[derive(Clone, Default)] +pub struct FieldCursor(Vec); + +impl ToString for FieldCursor { + fn to_string(&self) -> String { + self.0.join(".") + } +} + +impl From<&'static str> for FieldCursor { + fn from(value: &'static str) -> FieldCursor { + let mut res = FieldCursor::default(); + res.set(value).unwrap(); + res + } +} + +impl FieldCursor { + pub fn set(&mut self, value: &str) -> Result<(), CLIError> { + if value.len() == 0 { + return Err(CLIError::Field(FieldError::Empty)) + } + + let mut first_is_field_sep = false; + let mut char_count: usize = 0; + let mut last_c = FIELD_SEP; + let mut num_conscutive_field_seps = 0; + + let mut field = String::new(); + let mut fields = self.0.clone(); + + let push_field = |fs: &mut Vec, f: &mut String| { + if f.len() > 0 { + fs.push(f.clone()); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + char_count += 1; + + if c == FIELD_SEP { + if cid == 0 { + first_is_field_sep = true; + } + num_conscutive_field_seps += 1; + if cid > 0 && last_c == FIELD_SEP { + if fields.pop().is_none() { + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))) + } + } else { + push_field(&mut fields, &mut field); + } + } else { + num_conscutive_field_seps = 0; + if cid == 1 { + if first_is_field_sep { + fields.truncate(0); + } + } + field.push(c); + } + + last_c = c; + } + + push_field(&mut fields, &mut field); + + if char_count == 1 && first_is_field_sep { + fields.truncate(0); + } + if char_count > 1 && num_conscutive_field_seps == 1 { + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + } + + self.0 = fields; + Ok(()) + } + + pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { + if value.len() == 0 { + return None + } + + let mut last_c = FIELD_SEP; + + let mut field = String::new(); + let mut output = String::new(); + + let push_field = |fs: &mut String, f: &mut String| { + if f.len() > 0 { + fs.push_str( + match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); + f.truncate(0); + } + }; + + for (cid, c) in value.chars().enumerate() { + if c == FIELD_SEP { + if last_c != FIELD_SEP { + push_field(&mut output, &mut field); + } + output.push(c); + } else { + field.push(c); + } + + last_c = c; + } + + push_field(&mut output, &mut field); + + if &output == value { + None + } else { + Some(output) + } + } + + pub fn set_json_value(&self, mut object: &mut Value, + value: &str, type_info: JsonTypeInfo, + err: &mut InvalidOptionsError, + orig_cursor: &FieldCursor) { + assert!(self.0.len() > 0); + + for field in &self.0[..self.0.len()-1] { + let tmp = object; + object = + match *tmp { + Value::Object(ref mut mapping) => { + mapping.entry(field.to_owned()).or_insert( + Value::Object(Default::default()) + ) + }, + _ => panic!("We don't expect non-object Values here ...") + }; + } + + match *object { + Value::Object(ref mut mapping) => { + let field = &self.0[self.0.len()-1]; + let to_jval = + |value: &str, jtype: JsonType, err: &mut InvalidOptionsError| + -> Value { + match jtype { + JsonType::Boolean => + Value::Bool(arg_from_str(value, err, &field, "boolean")), + JsonType::Int => + Value::I64(arg_from_str(value, err, &field, "int")), + JsonType::Uint => + Value::U64(arg_from_str(value, err, &field, "uint")), + JsonType::Float => + Value::F64(arg_from_str(value, err, &field, "float")), + JsonType::String => + Value::String(value.to_owned()), + } + }; + + match type_info.ctype { + ComplexType::Pod => { + if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + }, + ComplexType::Vec => { + match *mapping.entry(field.to_owned()) + .or_insert(Value::Array(Default::default())) { + Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), + _ => unreachable!() + } + }, + ComplexType::Map => { + let (key, value) = parse_kv_arg(value, err, true); + let jval = to_jval(value.unwrap_or(""), type_info.jtype, err); + + match *mapping.entry(field.to_owned()) + .or_insert(Value::Object(Default::default())) { + Value::Object(ref mut value_map) => { + if value_map.insert(key.to_owned(), jval).is_some() { + err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string()))); + } + } + _ => unreachable!() + } + } + } + }, + _ => unreachable!() + } + } + + pub fn num_fields(&self) -> usize { + self.0.len() + } +} + +pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap: bool) + -> (&'a str, Option<&'a str>) { + let mut add_err = || err.issues.push(CLIError::InvalidKeyValueSyntax(kv.to_string(),for_hashmap)); + match kv.find('=') { + None => { + add_err(); + return (kv, None) + }, + Some(pos) => { + let key = &kv[..pos]; + if kv.len() <= pos + 1 { + add_err(); + return (key, Some("")) + } + (key, Some(&kv[pos+1..])) + } + } +} + +pub fn calltype_from_str(name: &str, valid_protocols: Vec, err: &mut InvalidOptionsError) -> CallType { + CallType::Upload( + match UploadProtocol::from_str(name) { + Ok(up) => up, + Err(msg) => { + err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols)); + UploadProtocol::Simple + } + }) +} + +pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option { + match fs::File::open(file_path) { + Ok(f) => Some(f), + Err(io_err) => { + err.issues.push(CLIError::Input(InputError::IOError((file_path.to_string(), io_err)))); + None + } + } +} + +pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option { + match mime.parse() { + Ok(m) => Some(m), + Err(_) => { + err.issues.push(CLIError::Input(InputError::Mime(mime.to_string()))); + None + } + } +} + +pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { + let f = arg.unwrap_or("-"); + match f { + "-" => Ok(Box::new(stdout())), + _ => match fs::OpenOptions::new().create(true).write(true).open(f) { + Ok(f) => Ok(Box::new(f)), + Err(io_err) => Err(io_err), + } + } +} + + +pub fn arg_from_str<'a, T>(arg: &str, err: &mut InvalidOptionsError, + arg_name: &'a str, + arg_type: &'a str) -> T + where T: FromStr + Default, + ::Err: fmt::Display { + match FromStr::from_str(arg) { + Err(perr) => { + err.issues.push( + CLIError::ParseError(arg_name.to_owned(), arg_type.to_owned(), arg.to_string(), format!("{}", perr)) + ); + Default::default() + }, + Ok(v) => v, + } +} + +pub struct JsonTokenStorage { + pub program_name: &'static str, + pub db_dir: String, +} + +impl JsonTokenStorage { + fn path(&self, scope_hash: u64) -> PathBuf { + Path::new(&self.db_dir).join(&format!("{}-token-{}.json", self.program_name, scope_hash)) + } +} + +impl TokenStorage for JsonTokenStorage { + type Error = json::Error; + + // NOTE: logging might be interesting, currently we swallow all errors + fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), json::Error> { + match token { + None => { + match fs::remove_file(self.path(scope_hash)) { + Err(err) => + match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(json::Error::IoError(err)) + }, + Ok(_) => Ok(()), + } + } + Some(token) => { + match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) { + Ok(mut f) => { + match json::to_writer_pretty(&mut f, &token) { + Ok(_) => Ok(()), + Err(serde_err) => Err(serde_err), + } + }, + Err(io_err) => Err(json::Error::IoError(io_err)) + } + } + } + } + + fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { + match fs::File::open(&self.path(scope_hash)) { + Ok(f) => { + match json::de::from_reader(f) { + Ok(token) => Ok(Some(token)), + Err(err) => Err(err), + } + }, + Err(io_err) => { + match io_err.kind() { + io::ErrorKind::NotFound => Ok(None), + _ => Err(json::Error::IoError(io_err)) + } + } + } + } +} + + +#[derive(Debug)] +pub enum ApplicationSecretError { + DecoderError((String, json::Error)), + FormatError(String), +} + +impl fmt::Display for ApplicationSecretError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ApplicationSecretError::DecoderError((ref path, ref err)) + => writeln!(f, "Could not decode file at '{}' with error: {}.", + path, err), + ApplicationSecretError::FormatError(ref path) + => writeln!(f, "'installed' field is unset in secret file at '{}'.", + path), + } + } +} + +#[derive(Debug)] +pub enum ConfigurationError { + DirectoryCreationFailed((String, io::Error)), + DirectoryUnset, + HomeExpansionFailed(String), + Secret(ApplicationSecretError), + IOError((String, io::Error)), +} + +impl fmt::Display for ConfigurationError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + ConfigurationError::DirectoryCreationFailed((ref dir, ref err)) + => writeln!(f, "Directory '{}' could not be created with error: {}.", dir, err), + ConfigurationError::DirectoryUnset + => writeln!(f, "--config-dir was unset or empty."), + ConfigurationError::HomeExpansionFailed(ref dir) + => writeln!(f, "Couldn't find HOME directory of current user, failed to expand '{}'.", dir), + ConfigurationError::Secret(ref err) + => writeln!(f, "Secret -> {}", err), + ConfigurationError::IOError((ref path, ref err)) + => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + } + } +} + +#[derive(Debug)] +pub enum InputError { + IOError((String, io::Error)), + Mime(String), +} + +impl fmt::Display for InputError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + InputError::IOError((ref file_path, ref io_err)) + => writeln!(f, "Failed to open '{}' for reading with error: {}.", file_path, io_err), + InputError::Mime(ref mime) + => writeln!(f, "'{}' is not a known mime-type.", mime), + } + } +} + +#[derive(Debug)] +pub enum FieldError { + PopOnEmpty(String), + TrailingFieldSep(String), + Unknown(String, Option, Option), + Duplicate(String), + Empty, +} + + +impl fmt::Display for FieldError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + FieldError::PopOnEmpty(ref field) + => writeln!(f, "'{}': Cannot move up on empty field cursor.", field), + FieldError::TrailingFieldSep(ref field) + => writeln!(f, "'{}': Single field separator may not be last character.", field), + FieldError::Unknown(ref field, ref suggestion, ref value) => { + let suffix = + match *suggestion { + Some(ref s) => { + let kv = + match *value { + Some(ref v) => format!("{}={}", s, v), + None => s.clone(), + }; + format!(" Did you mean '{}' ?", kv) + }, + None => String::new(), + }; + writeln!(f, "Field '{}' does not exist.{}", field, suffix) + }, + FieldError::Duplicate(ref cursor) + => writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty + => writeln!(f, "Field names must not be empty."), + } + } +} + + +#[derive(Debug)] +pub enum CLIError { + Configuration(ConfigurationError), + ParseError(String, String, String, String), + UnknownParameter(String, Vec<&'static str>), + InvalidUploadProtocol(String, Vec), + InvalidKeyValueSyntax(String, bool), + Input(InputError), + Field(FieldError), + MissingCommandError, + MissingMethodError(String), +} + +impl fmt::Display for CLIError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + match *self { + CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err), + CLIError::Input(ref err) => write!(f, "Input -> {}", err), + CLIError::Field(ref err) => write!(f, "Field -> {}", err), + CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names) + => writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}.", proto_name, valid_names.join(", ")), + CLIError::ParseError(ref arg_name, ref type_name, ref value, ref err_desc) + => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", + arg_name, value, type_name, err_desc), + CLIError::UnknownParameter(ref param_name, ref possible_values) => { + let suffix = + match did_you_mean(param_name, &possible_values) { + Some(v) => format!(" Did you mean '{}' ?", v), + None => String::new(), + }; + write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix) + }, + CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => { + let hashmap_info = if is_hashmap { "hashmap " } else { "" }; + writeln!(f, "'{}' does not match {}pattern =.", kv, hashmap_info) + }, + CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command."), + CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command.", cmd), + } + } +} + +#[derive(Debug)] +pub struct InvalidOptionsError { + pub issues: Vec, + pub exit_code: i32, +} + +impl fmt::Display for InvalidOptionsError { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + for issue in &self.issues { + try!(issue.fmt(f)); + } + Ok(()) + } +} + +impl InvalidOptionsError { + pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError { + InvalidOptionsError { + issues: vec![err], + exit_code: exit_code, + } + } + + pub fn new() -> InvalidOptionsError { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + +pub fn assure_config_dir_exists(dir: &str) -> Result { + let trdir = dir.trim(); + if trdir.len() == 0 { + return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + } + + let expanded_config_dir = + if trdir.as_bytes()[0] == b'~' { + match env::var("HOME").ok().or(env::var("UserProfile").ok()) { + None => return Err(CLIError::Configuration(ConfigurationError::HomeExpansionFailed(trdir.to_string()))), + Some(mut user) => { + user.push_str(&trdir[1..]); + user + } + } + } else { + trdir.to_string() + }; + + if let Err(err) = fs::create_dir(&expanded_config_dir) { + if err.kind() != io::ErrorKind::AlreadyExists { + return Err(CLIError::Configuration( + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))) + } + } + + Ok(expanded_config_dir) +} + +pub fn application_secret_from_directory(dir: &str, + secret_basename: &str, + json_console_secret: &str) + -> Result { + let secret_path = Path::new(dir).join(secret_basename); + let secret_str = || secret_path.as_path().to_str().unwrap().to_string(); + let secret_io_error = |io_err: io::Error| { + Err(CLIError::Configuration(ConfigurationError::IOError( + (secret_str(), io_err) + ))) + }; + + for _ in 0..2 { + match fs::File::open(&secret_path) { + Err(mut err) => { + if err.kind() == io::ErrorKind::NotFound { + // Write our built-in one - user may adjust the written file at will + + err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) { + Err(cfe) => cfe, + Ok(mut f) => { + // Assure we convert 'ugly' json string into pretty one + let console_secret: ConsoleApplicationSecret + = json::from_str(json_console_secret).unwrap(); + match json::to_writer_pretty(&mut f, &console_secret) { + Err(serde_err) => match serde_err { + json::Error::IoError(err) => err, + _ => panic!("Unexpected serde error: {:#?}", serde_err) + }, + Ok(_) => continue, + } + } + }; + // fall through to IO error handling + } + return secret_io_error(err) + }, + Ok(f) => { + match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { + Err(json::Error::IoError(err)) => + return secret_io_error(err), + Err(json_err) => + return Err(CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::DecoderError( + (secret_str(), json_err) + )))), + Ok(console_secret) => + match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( + CLIError::Configuration( + ConfigurationError::Secret( + ApplicationSecretError::FormatError(secret_str()) + ))) + }, + } + } + } + } + unreachable!(); +} diff --git a/gen/deploymentmanager2_beta1-cli/src/main.rs b/gen/serviceregistryalpha-cli/src/main.rs similarity index 62% rename from gen/deploymentmanager2_beta1-cli/src/main.rs rename to gen/serviceregistryalpha-cli/src/main.rs index 2bf4eb0cac..ebbb3dab87 100644 --- a/gen/deploymentmanager2_beta1-cli/src/main.rs +++ b/gen/serviceregistryalpha-cli/src/main.rs @@ -8,10 +8,11 @@ extern crate clap; extern crate yup_oauth2 as oauth2; extern crate yup_hyper_mock as mock; extern crate serde; +extern crate serde_json; extern crate hyper; extern crate mime; extern crate strsim; -extern crate google_deploymentmanager2_beta1 as api; +extern crate google_serviceregistryalpha as api; use std::env; use std::io::{self, Write}; @@ -19,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -27,7 +28,7 @@ use std::default::Default; use std::str::FromStr; use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; -use serde::json; +use serde_json as json; use clap::ArgMatches; enum DoitError { @@ -35,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, - hub: api::Deploymentmanager>, +struct Engine<'n> { + opt: ArgMatches<'n>, + hub: api::ServiceRegistry>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _deployments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _endpoints_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.deployments().delete(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.endpoints().delete(opt.value_of("project").unwrap_or(""), opt.value_of("endpoint").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -60,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -73,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -89,16 +90,17 @@ impl<'n, 'a> Engine<'n, 'a> { let mut value = json::value::to_value(&output_schema); remove_json_null_values(&mut value); json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); Ok(()) } } } } - fn _deployments_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _endpoints_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.deployments().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.endpoints().get(opt.value_of("project").unwrap_or(""), opt.value_of("endpoint").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -111,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -124,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -140,19 +142,20 @@ impl<'n, 'a> Engine<'n, 'a> { let mut value = json::value::to_value(&output_schema); remove_json_null_values(&mut value); json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); Ok(()) } } } } - fn _deployments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _endpoints_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -166,16 +169,22 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { - "target-config" => Some(("targetConfig", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "manifest" => Some(("manifest", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address" => Some(("address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "visibility.networks" => Some(("visibility.networks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "visibility.projects" => Some(("visibility.projects", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["description", "id", "manifest", "name", "target-config"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "creation-timestamp", "description", "fingerprint", "id", "name", "networks", "port", "projects", "self-link", "state", "visibility"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -184,9 +193,9 @@ impl<'n, 'a> Engine<'n, 'a> { FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); } } - let mut request: api::Deployment = json::value::from_value(object).unwrap(); - let mut call = self.hub.deployments().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut request: api::Endpoint = json::value::from_value(object).unwrap(); + let mut call = self.hub.endpoints().insert(request, opt.value_of("project").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -199,7 +208,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -212,7 +221,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -228,24 +237,31 @@ impl<'n, 'a> Engine<'n, 'a> { let mut value = json::value::to_value(&output_schema); remove_json_null_values(&mut value); json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); Ok(()) } } } } - fn _deployments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _endpoints_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.deployments().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.endpoints().list(opt.value_of("project").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { call = call.page_token(value.unwrap_or("")); }, + "order-by" => { + call = call.order_by(value.unwrap_or("")); + }, "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -256,10 +272,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "max-results"].iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); v } )); } } @@ -270,7 +286,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -286,16 +302,60 @@ impl<'n, 'a> Engine<'n, 'a> { let mut value = json::value::to_value(&output_schema); remove_json_null_values(&mut value); json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); Ok(()) } } } } - fn _manifests_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _endpoints_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.manifests().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or(""), opt.value_of("manifest").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address" => Some(("address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "visibility.networks" => Some(("visibility.networks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "visibility.projects" => Some(("visibility.projects", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "creation-timestamp", "description", "fingerprint", "id", "name", "networks", "port", "projects", "self-link", "state", "visibility"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Endpoint = json::value::from_value(object).unwrap(); + let mut call = self.hub.endpoints().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("endpoint").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -308,7 +368,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -321,7 +381,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -337,24 +397,62 @@ impl<'n, 'a> Engine<'n, 'a> { let mut value = json::value::to_value(&output_schema); remove_json_null_values(&mut value); json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); Ok(()) } } } } - fn _manifests_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _endpoints_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.manifests().list(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "description" => Some(("description", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "address" => Some(("address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "visibility.networks" => Some(("visibility.networks", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "visibility.projects" => Some(("visibility.projects", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), + "port" => Some(("port", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "creation-timestamp" => Some(("creationTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["address", "creation-timestamp", "description", "fingerprint", "id", "name", "networks", "port", "projects", "self-link", "state", "visibility"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::Endpoint = json::value::from_value(object).unwrap(); + let mut call = self.hub.endpoints().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("endpoint").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, _ => { let mut found = false; for param in &self.gp { @@ -365,10 +463,9 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "max-results"].iter().map(|v|*v)); v } )); } } @@ -379,7 +476,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -395,16 +492,17 @@ impl<'n, 'a> Engine<'n, 'a> { let mut value = json::value::to_value(&output_schema); remove_json_null_values(&mut value); json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); Ok(()) } } } } - fn _operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -417,7 +515,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -430,7 +528,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -446,133 +544,31 @@ impl<'n, 'a> Engine<'n, 'a> { let mut value = json::value::to_value(&output_schema); remove_json_null_values(&mut value); json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); Ok(()) } } } } - fn _operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operations().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { call = call.page_token(value.unwrap_or("")); }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "max-results"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _resources_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.resources().get(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or(""), opt.value_of("resource").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _resources_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.resources().list(opt.value_of("project").unwrap_or(""), opt.value_of("deployment").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); + "order-by" => { + call = call.order_by(value.unwrap_or("")); }, "max-results" => { call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -583,10 +579,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "max-results"].iter().map(|v|*v)); + v.extend(["order-by", "page-token", "filter", "max-results"].iter().map(|v|*v)); v } )); } } @@ -597,65 +593,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - Ok(()) - } - } - } - } - - fn _types_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.types().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "max-results"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -671,6 +609,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut value = json::value::to_value(&output_schema); remove_json_null_values(&mut value); json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); Ok(()) } } @@ -682,36 +621,28 @@ impl<'n, 'a> Engine<'n, 'a> { let mut call_result: Result<(), DoitError> = Ok(()); let mut err_opt: Option = None; match self.opt.subcommand() { - ("deployments", Some(opt)) => { + ("endpoints", Some(opt)) => { match opt.subcommand() { ("delete", Some(opt)) => { - call_result = self._deployments_delete(opt, dry_run, &mut err); + call_result = self._endpoints_delete(opt, dry_run, &mut err); }, ("get", Some(opt)) => { - call_result = self._deployments_get(opt, dry_run, &mut err); + call_result = self._endpoints_get(opt, dry_run, &mut err); }, ("insert", Some(opt)) => { - call_result = self._deployments_insert(opt, dry_run, &mut err); + call_result = self._endpoints_insert(opt, dry_run, &mut err); }, ("list", Some(opt)) => { - call_result = self._deployments_list(opt, dry_run, &mut err); + call_result = self._endpoints_list(opt, dry_run, &mut err); + }, + ("patch", Some(opt)) => { + call_result = self._endpoints_patch(opt, dry_run, &mut err); + }, + ("update", Some(opt)) => { + call_result = self._endpoints_update(opt, dry_run, &mut err); }, _ => { - err.issues.push(CLIError::MissingMethodError("deployments".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("manifests", Some(opt)) => { - match opt.subcommand() { - ("get", Some(opt)) => { - call_result = self._manifests_get(opt, dry_run, &mut err); - }, - ("list", Some(opt)) => { - call_result = self._manifests_list(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("manifests".to_string())); + err.issues.push(CLIError::MissingMethodError("endpoints".to_string())); writeln!(io::stderr(), "{}\n", opt.usage()).ok(); } } @@ -730,31 +661,6 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, - ("resources", Some(opt)) => { - match opt.subcommand() { - ("get", Some(opt)) => { - call_result = self._resources_get(opt, dry_run, &mut err); - }, - ("list", Some(opt)) => { - call_result = self._resources_list(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("resources".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, - ("types", Some(opt)) => { - match opt.subcommand() { - ("list", Some(opt)) => { - call_result = self._types_list(opt, dry_run, &mut err); - }, - _ => { - err.issues.push(CLIError::MissingMethodError("types".to_string())); - writeln!(io::stderr(), "{}\n", opt.usage()).ok(); - } - } - }, _ => { err.issues.push(CLIError::MissingCommandError); writeln!(io::stderr(), "{}\n", self.opt.usage()).ok(); @@ -772,14 +678,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "deploymentmanager2-beta1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "serviceregistryalpha-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -789,27 +695,27 @@ impl<'n, 'a> Engine<'n, 'a> { let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, if opt.is_present("debug-auth") { hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) + connector: hyper::net::HttpsConnector::::default() }) } else { hyper::Client::new() }, JsonTokenStorage { - program_name: "deploymentmanager2-beta1", + program_name: "serviceregistryalpha", db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) + connector: hyper::net::HttpsConnector::::default() }) } else { hyper::Client::new() }; let engine = Engine { opt: opt, - hub: api::Deploymentmanager::new(client, auth), + hub: api::ServiceRegistry::new(client, auth), gp: vec!["alt", "fields", "key", "oauth-token", "pretty-print", "quota-user", "user-ip"], gpm: vec![ ("oauth-token", "oauth_token"), @@ -837,20 +743,20 @@ impl<'n, 'a> Engine<'n, 'a> { fn main() { let mut exit_status = 0i32; let arg_data = [ - ("deployments", "methods: 'delete', 'get', 'insert' and 'list'", vec![ - ("delete", - Some(r##"! Deletes a deployment and all of the resources in the deployment."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/deployments_delete", + ("endpoints", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ + ("delete", + Some(r##"Deletes an endpoint."##), + "Details at http://byron.github.io/google-apis-rs/google_serviceregistryalpha_cli/endpoints_delete", vec![ (Some(r##"project"##), None, - Some(r##"! The project ID for this request."##), + Some(r##"The project ID for this request."##), Some(true), Some(false)), - (Some(r##"deployment"##), + (Some(r##"endpoint"##), None, - Some(r##"! The name of the deployment for this request."##), + Some(r##"The name of the endpoint for this request."##), Some(true), Some(false)), @@ -866,19 +772,19 @@ fn main() { Some(false), Some(false)), ]), - ("get", - Some(r##"! Gets information about a specific deployment."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/deployments_get", + ("get", + Some(r##"Gets an endpoint."##), + "Details at http://byron.github.io/google-apis-rs/google_serviceregistryalpha_cli/endpoints_get", vec![ (Some(r##"project"##), None, - Some(r##"! The project ID for this request."##), + Some(r##"The project ID for this request."##), Some(true), Some(false)), - (Some(r##"deployment"##), + (Some(r##"endpoint"##), None, - Some(r##"! The name of the deployment for this request."##), + Some(r##"The name of the endpoint for this request."##), Some(true), Some(false)), @@ -894,13 +800,13 @@ fn main() { Some(false), Some(false)), ]), - ("insert", - Some(r##"! Creates a deployment and all of the resources described by the ! deployment manifest."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/deployments_insert", + ("insert", + Some(r##"Creates an endpoint."##), + "Details at http://byron.github.io/google-apis-rs/google_serviceregistryalpha_cli/endpoints_insert", vec![ (Some(r##"project"##), None, - Some(r##"! The project ID for this request."##), + Some(r##"The project ID for this request."##), Some(true), Some(false)), @@ -922,13 +828,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"! Lists all deployments for a given project."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/deployments_list", + ("list", + Some(r##"Lists endpoints for a project."##), + "Details at http://byron.github.io/google-apis-rs/google_serviceregistryalpha_cli/endpoints_list", vec![ (Some(r##"project"##), None, - Some(r##"! The project ID for this request."##), + Some(r##"The project ID for this request."##), Some(true), Some(false)), @@ -944,30 +850,27 @@ fn main() { Some(false), Some(false)), ]), - ]), - - ("manifests", "methods: 'get' and 'list'", vec![ - ("get", - Some(r##"! Gets information about a specific manifest."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/manifests_get", + ("patch", + Some(r##"Updates an endpoint. This method supports patch semantics."##), + "Details at http://byron.github.io/google-apis-rs/google_serviceregistryalpha_cli/endpoints_patch", vec![ (Some(r##"project"##), None, - Some(r##"! The project ID for this request."##), + Some(r##"The project ID for this request."##), Some(true), Some(false)), - (Some(r##"deployment"##), + (Some(r##"endpoint"##), None, - Some(r##"! The name of the deployment for this request."##), + Some(r##"The name of the endpoint for this request."##), Some(true), Some(false)), - (Some(r##"manifest"##), - None, - Some(r##"! The name of the manifest for this request."##), + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), Some(true), - Some(false)), + Some(true)), (Some(r##"v"##), Some(r##"p"##), @@ -981,22 +884,28 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"! Lists all manifests for a given deployment."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/manifests_list", + ("update", + Some(r##"Updates an endpoint."##), + "Details at http://byron.github.io/google-apis-rs/google_serviceregistryalpha_cli/endpoints_update", vec![ (Some(r##"project"##), None, - Some(r##"! The project ID for this request."##), + Some(r##"The project ID for this request."##), Some(true), Some(false)), - (Some(r##"deployment"##), + (Some(r##"endpoint"##), None, - Some(r##"! The name of the deployment for this request."##), + Some(r##"The name of the endpoint for this request."##), Some(true), Some(false)), + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + (Some(r##"v"##), Some(r##"p"##), Some(r##"Set various optional parameters, matching the key=value form"##), @@ -1012,19 +921,19 @@ fn main() { ]), ("operations", "methods: 'get' and 'list'", vec![ - ("get", - Some(r##"! Gets information about a specific Operation."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/operations_get", + ("get", + Some(r##"Gets information about a specific operation."##), + "Details at http://byron.github.io/google-apis-rs/google_serviceregistryalpha_cli/operations_get", vec![ (Some(r##"project"##), None, - Some(r##"! The project ID for this request."##), + Some(r##"The project ID for this request."##), Some(true), Some(false)), (Some(r##"operation"##), None, - Some(r##"! The name of the operation for this request."##), + Some(r##"The name of the operation for this request."##), Some(true), Some(false)), @@ -1040,103 +949,13 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"! Lists all Operations for a project."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/operations_list", + ("list", + Some(r##"Lists all operations for a project."##), + "Details at http://byron.github.io/google-apis-rs/google_serviceregistryalpha_cli/operations_list", vec![ (Some(r##"project"##), None, - Some(r##"! The project ID for this request."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("resources", "methods: 'get' and 'list'", vec![ - ("get", - Some(r##"! Gets information about a single resource."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/resources_get", - vec![ - (Some(r##"project"##), - None, - Some(r##"! The project ID for this request."##), - Some(true), - Some(false)), - - (Some(r##"deployment"##), - None, - Some(r##"! The name of the deployment for this request."##), - Some(true), - Some(false)), - - (Some(r##"resource"##), - None, - Some(r##"! The name of the resource for this request."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("list", - Some(r##"! Lists all resources in a given deployment."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/resources_list", - vec![ - (Some(r##"project"##), - None, - Some(r##"! The project ID for this request."##), - Some(true), - Some(false)), - - (Some(r##"deployment"##), - None, - Some(r##"! The name of the deployment for this request."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ]), - - ("types", "methods: 'list'", vec![ - ("list", - Some(r##"! Lists all Types for Deployment Manager."##), - "Details at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli/types_list", - vec![ - (Some(r##"project"##), - None, - Some(r##"! The project ID for this request."##), + Some(r##"The project ID for this request."##), Some(true), Some(false)), @@ -1156,11 +975,11 @@ fn main() { ]; - let mut app = App::new("deploymentmanager2-beta1") + let mut app = App::new("serviceregistryalpha") .author("Sebastian Thiel ") - .version("0.3.0+20150415") - .about("The Deployment Manager API allows users to declaratively configure, deploy and run complex solutions on the Google Cloud Platform.") - .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1_cli") + .version("0.3.3+20160111") + .about("The Service Registry API allows users to manage service endpoints in Service Registry and use DNS-based service discovery / name resolution.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_serviceregistryalpha_cli") .arg(Arg::with_name("url") .long("scope") .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") @@ -1182,18 +1001,18 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { - let mut mcmd = SubCommand::new(main_command_name).about(about); + for &(main_command_name, about, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { - let mut scmd = SubCommand::new(sub_command_name); + let mut scmd = SubCommand::with_name(sub_command_name); if let &Some(desc) = desc { scmd = scmd.about(desc); } scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, @@ -1240,7 +1059,7 @@ fn main() { }, DoitError::ApiError(err) => { if debug { - writeln!(io::stderr(), "{:?}", err).ok(); + writeln!(io::stderr(), "{:#?}", err).ok(); } else { writeln!(io::stderr(), "{}", err).ok(); } diff --git a/gen/serviceregistryalpha/Cargo.toml b/gen/serviceregistryalpha/Cargo.toml new file mode 100644 index 0000000000..08a364dcf9 --- /dev/null +++ b/gen/serviceregistryalpha/Cargo.toml @@ -0,0 +1,29 @@ +# DO NOT EDIT ! +# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# DO NOT EDIT ! +[package] + +name = "google-serviceregistryalpha" +version = "0.1.11+20160111" +authors = ["Sebastian Thiel "] +description = "A complete library to interact with Service Registry (protocol alpha)" +repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/serviceregistryalpha" +homepage = "https://developers.google.com/cloud-serviceregistry/" +documentation = "http://byron.github.io/google-apis-rs/google_serviceregistryalpha" +license = "MIT" +keywords = ["serviceregistry", "google", "protocol", "web", "api"] +build = "src/build.rs" + + +[dependencies] +hyper = "0.7" +mime = "0.1.0" +serde = ">= 0.6.0" +serde_json = ">= 0.6.0" +yup-oauth2 = ">= 0.5.4" +url = ">= 0.5" + +[build-dependencies] +syntex = { version = ">= 0.23" } +serde_codegen = { version = ">= 0.6" } + diff --git a/gen/serviceregistryalpha/LICENSE.md b/gen/serviceregistryalpha/LICENSE.md new file mode 100644 index 0000000000..ff523b4547 --- /dev/null +++ b/gen/serviceregistryalpha/LICENSE.md @@ -0,0 +1,30 @@ + +The MIT License (MIT) +===================== + +Copyright © `2015-2016` `Sebastian Thiel` + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/gen/deploymentmanager2_beta1/README.md b/gen/serviceregistryalpha/README.md similarity index 53% rename from gen/deploymentmanager2_beta1/README.md rename to gen/serviceregistryalpha/README.md index c313655dfc..e5c1abcb13 100644 --- a/gen/deploymentmanager2_beta1/README.md +++ b/gen/serviceregistryalpha/README.md @@ -3,26 +3,20 @@ DO NOT EDIT ! This file was generated automatically from 'src/mako/api/README.md.mako' DO NOT EDIT ! --> -The `google-deploymentmanager2_beta1` library allows access to all features of the *Google deploymentmanager* service. +The `google-serviceregistryalpha` library allows access to all features of the *Google Service Registry* service. -This documentation was generated from *deploymentmanager* crate version *0.1.8+20150415*, where *20150415* is the exact revision of the *deploymentmanager:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.8*. +This documentation was generated from *Service Registry* crate version *0.1.11+20160111*, where *20160111* is the exact revision of the *serviceregistry:alpha* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. -Everything else about the *deploymentmanager* *v2_beta1* API can be found at the -[official documentation site](https://developers.google.com/deployment-manager/). +Everything else about the *Service Registry* *alpha* API can be found at the +[official documentation site](https://developers.google.com/cloud-serviceregistry/). # Features -Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.Deploymentmanager.html) ... +Handle the following *Resources* with ease from the central [hub](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.ServiceRegistry.html) ... -* [deployments](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.Deployment.html) - * [*delete*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.DeploymentDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.DeploymentGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.DeploymentInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.DeploymentListCall.html) -* [manifests](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.Manifest.html) - * [*get*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.ManifestGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.ManifestListCall.html) -* [operations](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.Operation.html) - * [*get*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.OperationGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.OperationListCall.html) -* [resources](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.ResourceType.html) - * [*get*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.ResourceGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.ResourceListCall.html) -* [types](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.Type.html) - * [*list*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.TypeListCall.html) +* [endpoints](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.Endpoint.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.EndpointDeleteCall.html), [*get*](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.EndpointGetCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.EndpointInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.EndpointListCall.html), [*patch*](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.EndpointPatchCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.EndpointUpdateCall.html) +* [operations](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.Operation.html) + * [*get*](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.OperationGetCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.OperationListCall.html) @@ -31,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g The API is structured into the following primary items: -* **[Hub](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/struct.Deploymentmanager.html)** +* **[Hub](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/struct.ServiceRegistry.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.CallBuilder.html) -* **[Resources](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.Resource.html)** + * creates [*Method Builders*](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.CallBuilder.html) +* **[Resources](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.Part.html)** + * **[Parts](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.CallBuilder.html)** +* **[Activities](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -55,10 +49,12 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.operations().list(...).doit() -let r = hub.deployments().delete(...).doit() +let r = hub.endpoints().insert(...).doit() +let r = hub.endpoints().delete(...).doit() +let r = hub.endpoints().update(...).doit() let r = hub.operations().get(...).doit() -let r = hub.deployments().insert(...).doit() +let r = hub.operations().list(...).doit() +let r = hub.endpoints().patch(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -74,7 +70,7 @@ To use this library, you would put the following lines into your `Cargo.toml` fi ```toml [dependencies] -google-deploymentmanager2_beta1 = "*" +google-serviceregistryalpha = "*" ``` ## A complete example @@ -82,11 +78,11 @@ google-deploymentmanager2_beta1 = "*" ```Rust extern crate hyper; extern crate yup_oauth2 as oauth2; -extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -use deploymentmanager2_beta1::{Result, Error}; +extern crate google_serviceregistryalpha as serviceregistryalpha; +use serviceregistryalpha::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -use deploymentmanager2_beta1::Deploymentmanager; +use serviceregistryalpha::ServiceRegistry; // Get an ApplicationSecret instance by some means. It contains the `client_id` and // `client_secret`, among other things. @@ -99,13 +95,15 @@ let secret: ApplicationSecret = Default::default(); let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::new(), ::default(), None); -let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! let result = hub.operations().list("project") .page_token("sit") - .max_results(-65) + .order_by("Stet") + .max_results(59) + .filter("et") .doit(); match result { @@ -128,17 +126,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/../yup-oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.Delegate.html), or the [Authenticator Delegate](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/../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](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.ResponseResult.html), 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")`. @@ -148,29 +146,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](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.Delegate.html) to the -[Method Builder](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.Delegate.html) to the +[Method Builder](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.CallBuilder.html) 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](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.Delegate.html) 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 [enocodable](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.RequestValue.html) and -[decodable](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [enocodable](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.RequestValue.html) and +[decodable](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.Part.html) 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](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.CallBuilder.html), 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](http://byron.github.io/google-apis-rs/google_deploymentmanager2_beta1/trait.RequestValue.html) are moved +* [request values](http://byron.github.io/google-apis-rs/google_serviceregistryalpha/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. @@ -179,7 +177,7 @@ Arguments will always be copied or cloned into the builder, to make them indepen [google-go-api]: https://github.com/google/google-api-go-client # License -The **deploymentmanager2_beta1** library was generated by Sebastian Thiel, and is placed +The **serviceregistryalpha** 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]. diff --git a/gen/serviceregistryalpha/src/build.rs b/gen/serviceregistryalpha/src/build.rs new file mode 100644 index 0000000000..eae48c100d --- /dev/null +++ b/gen/serviceregistryalpha/src/build.rs @@ -0,0 +1,16 @@ +extern crate syntex; +extern crate serde_codegen; + +use std::env; +use std::path::Path; + +pub fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + + let src = Path::new("src/lib.rs.in"); + let dst = Path::new(&out_dir).join("lib.rs"); + + let mut registry = syntex::Registry::new(); + serde_codegen::register(&mut registry); + registry.expand("google-serviceregistryalpha", &src, &dst).unwrap(); +} diff --git a/gen/serviceregistryalpha/src/cmn.rs b/gen/serviceregistryalpha/src/cmn.rs new file mode 100644 index 0000000000..87b91a8986 --- /dev/null +++ b/gen/serviceregistryalpha/src/cmn.rs @@ -0,0 +1,771 @@ +// COPY OF 'src/rust/api/cmn.rs' +// DO NOT EDIT +use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; +use std; +use std::fmt::{self, Display}; +use std::str::FromStr; +use std::error; +use std::thread::sleep; +use std::time::Duration; + +use mime::{Mime, TopLevel, SubLevel, Attr, Value}; +use oauth2::{TokenType, Retry, self}; +use hyper; +use hyper::header::{ContentType, ContentLength, Headers, UserAgent, Authorization, Header, + HeaderFormat}; +use hyper::http::h1::LINE_ENDING; +use hyper::method::Method; +use hyper::status::StatusCode; + +use serde_json as json; + +/// Identifies the Hub. There is only one per library, this trait is supposed +/// to make intended use more explicit. +/// The hub allows to access all resource methods more easily. +pub trait Hub {} + +/// Identifies types for building methods of a particular resource type +pub trait MethodsBuilder {} + +/// Identifies types which represent builders for a particular resource method +pub trait CallBuilder {} + +/// Identifies types which can be inserted and deleted. +/// Types with this trait are most commonly used by clients of this API. +pub trait Resource {} + +/// Identifies types which are used in API responses. +pub trait ResponseResult {} + +/// Identifies types which are used in API requests. +pub trait RequestValue {} + +/// Identifies types which are not actually used by the API +/// This might be a bug within the google API schema. +pub trait UnusedType {} + +/// Identifies types which are only used as part of other types, which +/// usually are carrying the `Resource` trait. +pub trait Part {} + +/// Identifies types which are only used by other types internally. +/// They have no special meaning, this trait just marks them for completeness. +pub trait NestedType {} + +/// A utility to specify reader types which provide seeking capabilities too +pub trait ReadSeek: Seek + Read {} +impl ReadSeek for T {} + +/// A trait for all types that can convert themselves into a *parts* string +pub trait ToParts { + fn to_parts(&self) -> String; +} + +/// A utility type which can decode a server response that indicates error +#[derive(Deserialize)] +pub struct JsonServerError { + pub error: String, + pub error_description: Option +} + +/// A utility to represent detailed errors we might see in case there are BadRequests. +/// The latter happen if the sent parameters or request structures are unsound +#[derive(Deserialize, Serialize, Debug)] +pub struct ErrorResponse { + error: ServerError, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerError { + errors: Vec, + code: u16, + message: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct ServerMessage { + domain: String, + reason: String, + message: String, + #[serde(rename="locationType")] + location_type: Option, + location: Option +} + +#[derive(Copy, Clone)] +pub struct DummyNetworkStream; + +impl Read for DummyNetworkStream { + fn read(&mut self, _: &mut [u8]) -> io::Result { + Ok(0) + } +} + +impl Write for DummyNetworkStream { + fn write(&mut self, _: &[u8]) -> io::Result { + Ok(0) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl hyper::net::NetworkStream for DummyNetworkStream { + fn peer_addr(&mut self) -> io::Result { + Ok("127.0.0.1:1337".parse().unwrap()) + } + + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } + + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + Ok(()) + } +} + + +/// A trait specifying functionality to help controlling any request performed by the API. +/// The trait has a conservative default implementation. +/// +/// It contains methods to deal with all common issues, as well with the ones related to +/// uploading media +pub trait Delegate { + + /// Called at the beginning of any API request. The delegate should store the method + /// information if he is interesting in knowing more context when further calls to it + /// are made. + /// The matching `finished()` call will always be made, no matter whether or not the API + /// request was successful. That way, the delegate may easily maintain a clean state + /// between various API calls. + fn begin(&mut self, MethodInfo) {} + + /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + /// + /// Return retry information. + fn http_error(&mut self, &hyper::Error) -> Retry { + Retry::Abort + } + + /// Called whenever there is the need for your applications API key after + /// the official authenticator implementation didn't provide one, for some reason. + /// If this method returns None as well, the underlying operation will fail + fn api_key(&mut self) -> Option { + None + } + + /// Called whenever the Authenticator didn't yield a token. The delegate + /// may attempt to provide one, or just take it as a general information about the + /// impending failure. + /// The given Error provides information about why the token couldn't be acquired in the + /// first place + fn token(&mut self, err: &error::Error) -> Option { + let _ = err; + None + } + + /// Called during resumable uploads to provide a URL for the impending upload. + /// It was saved after a previous call to `store_upload_url(...)`, and if not None, + /// will be used instead of asking the server for a new upload URL. + /// This is useful in case a previous resumable upload was aborted/canceled, but should now + /// be resumed. + /// The returned URL will be used exactly once - if it fails again and the delegate allows + /// to retry, we will ask the server for a new upload URL. + fn upload_url(&mut self) -> Option { + None + } + + /// Called after we have retrieved a new upload URL for a resumable upload to store it + /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// see `upload_url()`. + /// It will also be called with None after a successful upload, which allows the delegate + /// to forget the URL. That way, we will not attempt to resume an upload that has already + /// finished. + fn store_upload_url(&mut self, url: Option<&str>) { + let _ = url; + } + + /// Called whenever a server response could not be decoded from json. + /// It's for informational purposes only, the caller will return with an error + /// accordingly. + /// + /// # Arguments + /// + /// * `json_encoded_value` - The json-encoded value which failed to decode. + /// * `json_decode_error` - The decoder error + fn response_json_decode_error(&mut self, json_encoded_value: &str, json_decode_error: &json::Error) { + let _ = json_encoded_value; + let _ = json_decode_error; + } + + /// Called whenever the http request returns with a non-success status code. + /// This can involve authentication issues, or anything else that very much + /// depends on the used API method. + /// The delegate should check the status, header and decoded json error to decide + /// whether to retry or not. In the latter case, the underlying call will fail. + /// + /// If you choose to retry after a duration, the duration should be chosen using the + /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). + fn http_failure(&mut self, _: &hyper::client::Response, Option, _: Option) -> Retry { + Retry::Abort + } + + /// Called prior to sending the main request of the given method. It can be used to time + /// the call or to print progress information. + /// It's also useful as you can be sure that a request will definitely be made. + fn pre_request(&mut self) { } + + /// Return the size of each chunk of a resumable upload. + /// Must be a power of two, with 1<<18 being the smallest allowed chunk size. + /// Will be called once before starting any resumable upload. + fn chunk_size(&mut self) -> u64 { + 1 << 23 + } + + /// Called before the given chunk is uploaded to the server. + /// If true is returned, the upload will be interrupted. + /// However, it may be resumable if you stored the upload URL in a previous call + /// to `store_upload_url()` + fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { + let _ = chunk; + false + } + + /// Called before the API request method returns, in every case. It can be used to clean up + /// internal state between calls to the API. + /// This call always has a matching call to `begin(...)`. + /// + /// # Arguments + /// + /// * `is_success` - a true value indicates the operation was successful. If false, you should + /// discard all values stored during `store_upload_url`. + fn finished(&mut self, is_success: bool) { + let _ = is_success; + } +} + +/// A delegate with a conservative default implementation, which is used if no other delegate is +/// set. +#[derive(Default)] +pub struct DefaultDelegate; + +impl Delegate for DefaultDelegate {} + + +#[derive(Debug)] +pub enum Error { + /// The http connection failed + HttpError(hyper::Error), + + /// An attempt was made to upload a resource with size stored in field `.0` + /// even though the maximum upload size is what is stored in field `.1`. + UploadSizeLimitExceeded(u64, u64), + + /// Represents information about a request that was not understood by the server. + /// Details are included. + BadRequest(ErrorResponse), + + /// We needed an API key for authentication, but didn't obtain one. + /// Neither through the authenticator, nor through the Delegate. + MissingAPIKey, + + /// We required a Token, but didn't get one from the Authenticator + MissingToken(Box), + + /// The delgate instructed to cancel the operation + Cancelled, + + /// An additional, free form field clashed with one of the built-in optional ones + FieldClash(&'static str), + + /// Shows that we failed to decode the server response. + /// This can happen if the protocol changes in conjunction with strict json decoding. + JsonDecodeError(String, json::Error), + + /// Indicates an HTTP repsonse with a non-success status code + Failure(hyper::client::Response), +} + + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Error::HttpError(ref err) => err.fmt(f), + Error::UploadSizeLimitExceeded(ref resource_size, ref max_size) => + writeln!(f, "The media size {} exceeds the maximum allowed upload size of {}" + , resource_size, max_size), + Error::MissingAPIKey => { + (writeln!(f, "The application's API key was not found in the configuration")).ok(); + writeln!(f, "It is used as there are no Scopes defined for this method.") + }, + Error::BadRequest(ref err) => { + try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); + for err in err.error.errors.iter() { + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, + err.reason, + match &err.location { + &Some(ref loc) => format!("@{}", loc), + &None => String::new(), + })); + } + Ok(()) + }, + Error::MissingToken(ref err) => + writeln!(f, "Token retrieval failed with error: {}", err), + Error::Cancelled => + writeln!(f, "Operation cancelled by delegate"), + Error::FieldClash(field) => + writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), + Error::JsonDecodeError(ref json_str, ref err) + => writeln!(f, "{}: {}", err, json_str), + Error::Failure(ref response) => + writeln!(f, "Http status indicates failure: {:?}", response), + } + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + match *self { + Error::HttpError(ref err) => err.description(), + Error::JsonDecodeError(_, ref err) => err.description(), + _ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead" + } + } + + fn cause(&self) -> Option<&error::Error> { + match *self { + Error::HttpError(ref err) => err.cause(), + Error::JsonDecodeError(_, ref err) => err.cause(), + _ => None + } + } +} + +/// A universal result type used as return for all calls. +pub type Result = std::result::Result; + +/// Contains information about an API request. +pub struct MethodInfo { + pub id: &'static str, + pub http_method: Method, +} + +const BOUNDARY: &'static str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d"; + +/// Provides a `Read` interface that converts multiple parts into the protocol +/// identified by [RFC2387](https://tools.ietf.org/html/rfc2387). +/// **Note**: This implementation is just as rich as it needs to be to perform uploads +/// to google APIs, and might not be a fully-featured implementation. +#[derive(Default)] +pub struct MultiPartReader<'a> { + raw_parts: Vec<(Headers, &'a mut Read)>, + current_part: Option<(Cursor>, &'a mut Read)>, + last_part_boundary: Option>>, +} + +impl<'a> MultiPartReader<'a> { + + /// Reserve memory for exactly the given amount of parts + pub fn reserve_exact(&mut self, cap: usize) { + self.raw_parts.reserve_exact(cap); + } + + /// Add a new part to the queue of parts to be read on the first `read` call. + /// + /// # Arguments + /// + /// `headers` - identifying the body of the part. It's similar to the header + /// in an ordinary single-part call, and should thus contain the + /// same information. + /// `reader` - a reader providing the part's body + /// `size` - the amount of bytes provided by the reader. It will be put onto the header as + /// content-size. + /// `mime` - It will be put onto the content type + pub fn add_part(&mut self, reader: &'a mut Read, size: u64, mime_type: Mime) -> &mut MultiPartReader<'a> { + let mut headers = Headers::new(); + headers.set(ContentType(mime_type)); + headers.set(ContentLength(size)); + self.raw_parts.push((headers, reader)); + self + } + + /// Returns the mime-type representing our multi-part message. + /// Use it with the ContentType header. + pub fn mime_type(&self) -> Mime { + Mime( + TopLevel::Multipart, + SubLevel::Ext("Related".to_string()), + vec![(Attr::Ext("boundary".to_string()), Value::Ext(BOUNDARY.to_string()))], + ) + } + + /// Returns true if we are totally used + fn is_depleted(&self) -> bool { + self.raw_parts.len() == 0 && 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() + } +} + +impl<'a> Read for MultiPartReader<'a> { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING)).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); + } + _ => {}, + } + + // read headers as long as possible + let (hb, rr) = { + let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); + let b = c.read(buf).unwrap_or(0); + (b, reader.read(&mut buf[b..])) + }; + + match rr { + Ok(bytes_read) => { + if hb < buf.len() && bytes_read == 0 { + if self.is_last_part() { + // before clearing the last part, we will add the boundary that + // will be written last + self.last_part_boundary = Some(Cursor::new( + format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) + } + // We are depleted - this can trigger the next part to come in + self.current_part = None; + } + let mut total_bytes_read = hb + bytes_read; + while total_bytes_read < buf.len() && !self.is_depleted() { + match self.read(&mut buf[total_bytes_read ..]) { + Ok(br) => total_bytes_read += br, + Err(err) => return Err(err), + } + } + Ok(total_bytes_read) + } + Err(err) => { + // fail permanently + self.current_part = None; + self.last_part_boundary = None; + self.raw_parts.clear(); + Err(err) + } + } + } +} + +// The following macro invocation needs to be expanded, as `include!` +// doens't support external macros +// header!{ +// #[doc="The `X-Upload-Content-Type` header."] +// (XUploadContentType, "X-Upload-Content-Type") => [Mime] + +// xupload_content_type { +// test_header!( +// test1, +// vec![b"text/plain"], +// Some(HeaderField( +// vec![Mime(TopLevel::Text, SubLevel::Plain, Vec::new())] +// ))); + +// } +// } + +/// The `X-Upload-Content-Type` header. +/// +/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// processed to be more readable. +#[derive(PartialEq, Debug, Clone)] +pub struct XUploadContentType(pub Mime); + +impl ::std::ops::Deref for XUploadContentType { + type Target = Mime; + fn deref<'a>(&'a self) -> &'a Mime { &self.0 } +} +impl ::std::ops::DerefMut for XUploadContentType { + fn deref_mut<'a>(&'a mut self) -> &'a mut Mime { &mut self.0 } +} +impl Header for XUploadContentType { + fn header_name() -> &'static str { "X-Upload-Content-Type" } + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + hyper::header::parsing::from_one_raw_str(raw).map(XUploadContentType) + } +} +impl HeaderFormat for XUploadContentType { + fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result { + Display::fmt(&**self, f) + } +} +impl Display for XUploadContentType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&**self, f) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct Chunk { + pub first: u64, + pub last: u64 +} + +impl fmt::Display for Chunk { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + (write!(fmt, "{}-{}", self.first, self.last)).ok(); + Ok(()) + } +} + +impl FromStr for Chunk { + type Err = &'static str; + + /// NOTE: only implements `%i-%i`, not `*` + fn from_str(s: &str) -> std::result::Result { + let parts: Vec<&str> = s.split('-').collect(); + if parts.len() != 2 { + return Err("Expected two parts: %i-%i") + } + Ok( + Chunk { + first: match FromStr::from_str(parts[0]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'first' as digit") + }, + last: match FromStr::from_str(parts[1]) { + Ok(d) => d, + _ => return Err("Couldn't parse 'last' as digit") + } + } + ) + } +} + +/// Implements the Content-Range header, for serialization only +#[derive(Clone, PartialEq, Debug)] +pub struct ContentRange { + pub range: Option, + pub total_length: u64, +} + +impl Header for ContentRange { + fn header_name() -> &'static str { + "Content-Range" + } + + /// We are not parsable, as parsing is done by the `Range` header + fn parse_header(_: &[Vec]) -> hyper::error::Result { + Err(hyper::error::Error::Method) + } +} + + +impl HeaderFormat for ContentRange { + fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + try!(fmt.write_str("bytes ")); + match self.range { + Some(ref c) => try!(c.fmt(fmt)), + None => try!(fmt.write_str("*")) + } + (write!(fmt, "/{}", self.total_length)).ok(); + Ok(()) + } +} + +#[derive(Clone, PartialEq, Debug)] +pub struct RangeResponseHeader(pub Chunk); + +impl Header for RangeResponseHeader { + fn header_name() -> &'static str { + "Range" + } + + fn parse_header(raw: &[Vec]) -> hyper::error::Result { + if raw.len() > 0 { + let v = &raw[0]; + if let Ok(s) = std::str::from_utf8(v) { + const PREFIX: &'static str = "bytes "; + if s.starts_with(PREFIX) { + if let Ok(c) = ::from_str(&s[PREFIX.len()..]) { + return Ok(RangeResponseHeader(c)) + } + } + } + } + Err(hyper::error::Error::Method) + } +} + +impl HeaderFormat for RangeResponseHeader { + /// No implmentation necessary, we just need to parse + fn fmt_header(&self, _: &mut fmt::Formatter) -> fmt::Result { + Err(fmt::Error) + } +} + +/// 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 delegate: &'a mut Delegate, + pub start_at: Option, + pub auth: &'a mut A, + pub user_agent: &'a str, + pub auth_header: Authorization, + pub url: &'a str, + pub reader: &'a mut ReadSeek, + pub media_type: Mime, + pub content_length: u64 +} + +impl<'a, A> ResumableUploadHelper<'a, A> + where A: oauth2::GetToken { + + fn query_transfer_status(&mut self) -> std::result::Result> { + loop { + match self.client.post(self.url) + .header(UserAgent(self.user_agent.to_string())) + .header(ContentRange { range: None, total_length: self.content_length }) + .header(self.auth_header.clone()) + .send() { + Ok(r) => { + // 308 = resume-incomplete == PermanentRedirect + let headers = r.headers.clone(); + let h: &RangeResponseHeader = match headers.get() { + Some(hh) if r.status == StatusCode::PermanentRedirect => hh, + None|Some(_) => { + if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { + sleep(d); + continue; + } + return Err(Ok(r)) + } + }; + return Ok(h.0.last) + } + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Err(Err(err)) + } + } + } + } + + /// returns None if operation was cancelled by delegate, or the HttpResult. + /// It can be that we return the result just because we didn't understand the status code - + /// caller should check for status himself before assuming it's OK to use + pub fn upload(&mut self) -> Option> { + let mut start = match self.start_at { + Some(s) => s, + None => match self.query_transfer_status() { + Ok(s) => s, + Err(result) => return Some(result) + } + }; + + const MIN_CHUNK_SIZE: u64 = 1 << 18; + let chunk_size = match self.delegate.chunk_size() { + cs if cs > MIN_CHUNK_SIZE => cs, + _ => MIN_CHUNK_SIZE + }; + + self.reader.seek(SeekFrom::Start(start)).unwrap(); + loop { + let request_size = match self.content_length - start { + rs if rs > chunk_size => chunk_size, + rs => rs + }; + + let mut section_reader = self.reader.take(request_size); + let range_header = ContentRange { + range: Some(Chunk {first: start, last: start + request_size - 1}), + total_length: self.content_length + }; + start += request_size; + if self.delegate.cancel_chunk_upload(&range_header) { + return None + } + // workaround https://github.com/rust-lang/rust/issues/22252 + let res = self.client.post(self.url) + .header(range_header) + .header(ContentType(self.media_type.clone())) + .header(UserAgent(self.user_agent.to_string())) + .body(&mut section_reader) + .send(); + match res { + Ok(mut res) => { + if res.status == StatusCode::PermanentRedirect { + continue + } + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let Retry::After(d) = self.delegate.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + } + return Some(Ok(res)) + }, + Err(err) => { + if let Retry::After(d) = self.delegate.http_error(&err) { + sleep(d); + continue; + } + return Some(Err(err)) + } + } + } + } +} + +// Copy of src/rust/cli/cmn.rs +// TODO(ST): Allow sharing common code between program types +pub fn remove_json_null_values(value: &mut json::value::Value) { + match *value { + json::value::Value::Object(ref mut map) => { + let mut for_removal = Vec::new(); + + for (key, mut value) in map.iter_mut() { + if value.is_null() { + for_removal.push(key.clone()); + } else { + remove_json_null_values(&mut value); + } + } + + for key in &for_removal { + map.remove(key); + } + } + _ => {} + } +} diff --git a/gen/deploymentmanager2_beta1/src/lib.rs b/gen/serviceregistryalpha/src/lib.rs similarity index 83% rename from gen/deploymentmanager2_beta1/src/lib.rs rename to gen/serviceregistryalpha/src/lib.rs index 2ed408e53e..0d467f2d31 100644 --- a/gen/deploymentmanager2_beta1/src/lib.rs +++ b/gen/serviceregistryalpha/src/lib.rs @@ -2,25 +2,19 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *deploymentmanager* crate version *0.1.8+20150415*, where *20150415* is the exact revision of the *deploymentmanager:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.8*. +//! This documentation was generated from *Service Registry* crate version *0.1.11+20160111*, where *20160111* is the exact revision of the *serviceregistry:alpha* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! -//! Everything else about the *deploymentmanager* *v2_beta1* API can be found at the -//! [official documentation site](https://developers.google.com/deployment-manager/). -//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/deploymentmanager2_beta1). +//! Everything else about the *Service Registry* *alpha* API can be found at the +//! [official documentation site](https://developers.google.com/cloud-serviceregistry/). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/serviceregistryalpha). //! # Features //! -//! Handle the following *Resources* with ease from the central [hub](struct.Deploymentmanager.html) ... +//! Handle the following *Resources* with ease from the central [hub](struct.ServiceRegistry.html) ... //! -//! * [deployments](struct.Deployment.html) -//! * [*delete*](struct.DeploymentDeleteCall.html), [*get*](struct.DeploymentGetCall.html), [*insert*](struct.DeploymentInsertCall.html) and [*list*](struct.DeploymentListCall.html) -//! * [manifests](struct.Manifest.html) -//! * [*get*](struct.ManifestGetCall.html) and [*list*](struct.ManifestListCall.html) +//! * [endpoints](struct.Endpoint.html) +//! * [*delete*](struct.EndpointDeleteCall.html), [*get*](struct.EndpointGetCall.html), [*insert*](struct.EndpointInsertCall.html), [*list*](struct.EndpointListCall.html), [*patch*](struct.EndpointPatchCall.html) and [*update*](struct.EndpointUpdateCall.html) //! * [operations](struct.Operation.html) //! * [*get*](struct.OperationGetCall.html) and [*list*](struct.OperationListCall.html) -//! * [resources](struct.ResourceType.html) -//! * [*get*](struct.ResourceGetCall.html) and [*list*](struct.ResourceListCall.html) -//! * [types](struct.Type.html) -//! * [*list*](struct.TypeListCall.html) //! //! //! @@ -31,7 +25,7 @@ //! //! The API is structured into the following primary items: //! -//! * **[Hub](struct.Deploymentmanager.html)** +//! * **[Hub](struct.ServiceRegistry.html)** //! * a central object to maintain state and allow accessing all *Activities* //! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn //! allow access to individual [*Call Builders*](trait.CallBuilder.html) @@ -55,10 +49,12 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.operations().list(...).doit() -//! let r = hub.deployments().delete(...).doit() +//! let r = hub.endpoints().insert(...).doit() +//! let r = hub.endpoints().delete(...).doit() +//! let r = hub.endpoints().update(...).doit() //! let r = hub.operations().get(...).doit() -//! let r = hub.deployments().insert(...).doit() +//! let r = hub.operations().list(...).doit() +//! let r = hub.endpoints().patch(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -74,7 +70,7 @@ //! //! ```toml //! [dependencies] -//! google-deploymentmanager2_beta1 = "*" +//! google-serviceregistryalpha = "*" //! ``` //! //! ## A complete example @@ -82,12 +78,12 @@ //! ```test_harness,no_run //! extern crate hyper; //! extern crate yup_oauth2 as oauth2; -//! extern crate google_deploymentmanager2_beta1 as deploymentmanager2_beta1; -//! use deploymentmanager2_beta1::{Result, Error}; +//! extern crate google_serviceregistryalpha as serviceregistryalpha; +//! use serviceregistryalpha::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; //! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -//! use deploymentmanager2_beta1::Deploymentmanager; +//! use serviceregistryalpha::ServiceRegistry; //! //! // Get an ApplicationSecret instance by some means. It contains the `client_id` and //! // `client_secret`, among other things. @@ -100,13 +96,15 @@ //! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, //! hyper::Client::new(), //! ::default(), None); -//! let mut hub = Deploymentmanager::new(hyper::Client::new(), auth); +//! let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! //! let result = hub.operations().list("project") -//! .page_token("eirmod") -//! .max_results(-43) +//! .page_token("Lorem") +//! .order_by("eos") +//! .max_results(20) +//! .filter("sadipscing") //! .doit(); //! //! match result { diff --git a/gen/serviceregistryalpha/src/lib.rs.in b/gen/serviceregistryalpha/src/lib.rs.in new file mode 100644 index 0000000000..d6c0ee41d1 --- /dev/null +++ b/gen/serviceregistryalpha/src/lib.rs.in @@ -0,0 +1,2835 @@ +// DO NOT EDIT ! +// This file was generated automatically from 'src/mako/api/lib.rs.in.mako' +// DO NOT EDIT ! + +extern crate hyper; +extern crate serde; +extern crate serde_json; +extern crate yup_oauth2 as oauth2; +extern crate mime; +extern crate url; + +mod cmn; + +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; +use std::io; +use std::fs; +use std::thread::sleep; +use std::time::Duration; + +pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + Resource, ErrorResponse, remove_json_null_values}; + + +// ############## +// UTILITIES ### +// ############ + +/// Identifies the an OAuth2 authorization scope. +/// A scope is needed when requesting an +/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). +#[derive(PartialEq, Eq, Hash)] +pub enum Scope { + /// View your Google Cloud Platform management resources and deployment status information + NdevCloudmanReadonly, + + /// View and manage your data across Google Cloud Platform services + CloudPlatform, + + /// View and manage your Google Cloud Platform management resources and deployment status information + NdevCloudman, + + /// View your data across Google Cloud Platform services + CloudPlatformReadOnly, +} + +impl AsRef for Scope { + fn as_ref(&self) -> &str { + match *self { + Scope::NdevCloudmanReadonly => "https://www.googleapis.com/auth/ndev.cloudman.readonly", + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::NdevCloudman => "https://www.googleapis.com/auth/ndev.cloudman", + Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", + } + } +} + +impl Default for Scope { + fn default() -> Scope { + Scope::NdevCloudmanReadonly + } +} + + + +// ######## +// HUB ### +// ###### + +/// Central instance to access all ServiceRegistry related resource activities +/// +/// # Examples +/// +/// Instantiate a new hub +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_serviceregistryalpha as serviceregistryalpha; +/// use serviceregistryalpha::{Result, Error}; +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use serviceregistryalpha::ServiceRegistry; +/// +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. +/// let secret: ApplicationSecret = Default::default(); +/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! +/// let result = hub.operations().list("project") +/// .page_token("kasd") +/// .order_by("accusam") +/// .max_results(93) +/// .filter("justo") +/// .doit(); +/// +/// match result { +/// Err(e) => match e { +/// // The Error enum provides details about what exactly happened. +/// // You can also just use its `Debug`, `Display` or `Error` traits +/// Error::HttpError(_) +/// |Error::MissingAPIKey +/// |Error::MissingToken(_) +/// |Error::Cancelled +/// |Error::UploadSizeLimitExceeded(_, _) +/// |Error::Failure(_) +/// |Error::BadRequest(_) +/// |Error::FieldClash(_) +/// |Error::JsonDecodeError(_, _) => println!("{}", e), +/// }, +/// Ok(res) => println!("Success: {:?}", res), +/// } +/// # } +/// ``` +pub struct ServiceRegistry { + client: RefCell, + auth: RefCell, + _user_agent: String, +} + +impl<'a, C, A> Hub for ServiceRegistry {} + +impl<'a, C, A> ServiceRegistry + where C: BorrowMut, A: oauth2::GetToken { + + pub fn new(client: C, authenticator: A) -> ServiceRegistry { + ServiceRegistry { + client: RefCell::new(client), + auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/0.1.11".to_string(), + } + } + + pub fn endpoints(&'a self) -> EndpointMethods<'a, C, A> { + EndpointMethods { hub: &self } + } + pub fn operations(&'a self) -> OperationMethods<'a, C, A> { + OperationMethods { hub: &self } + } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/0.1.11`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } +} + + +// ############ +// SCHEMAS ### +// ########## +/// A response containing a partial list of Endpoints and a page token used to build the next request if the request has been truncated. Next available tag: 5 +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list endpoints](struct.EndpointListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EndpointsListResponse { + /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The endpoints contained in this response. + pub endpoints: Option>, +} + +impl ResponseResult for EndpointsListResponse {} + + +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert endpoints](struct.EndpointInsertCall.html) (request) +/// * [delete endpoints](struct.EndpointDeleteCall.html) (none) +/// * [update endpoints](struct.EndpointUpdateCall.html) (request) +/// * [get endpoints](struct.EndpointGetCall.html) (response) +/// * [list endpoints](struct.EndpointListCall.html) (none) +/// * [patch endpoints](struct.EndpointPatchCall.html) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Endpoint { + /// An optional user-provided description of the endpoint. + pub description: Option, + /// A user-provided address of the service represented by this endpoint. This can be an IPv4 or IPv6 address, or a hostname. + pub address: Option, + /// The visibility of this endpoint. This must be a list of fully-qualified URLs to Compute Engine networks. + pub visibility: Option, + /// [Output Only] Unique identifier for the resource; defined by the server. + pub id: Option, + /// [Output Only] The current state of the endpoint, as determined by the system. + pub state: Option, + /// Supply the fingerprint value for update requests. The fingerprint value is generated by the server and ensures optimistic concurrency (so that only one update can be performed at a time). The fingerprint changes after each update. + pub fingerprint: Option, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// An optional user-provided port of the service represented by this endpoint. + pub port: Option, + /// [Output Only] Self link for the endpoint. + #[serde(rename="selfLink")] + pub self_link: Option, + /// A user-provided name of the endpoint, which must be unique within the project. The name must comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. + pub name: Option, +} + +impl RequestValue for Endpoint {} +impl Resource for Endpoint {} +impl ResponseResult for Endpoint {} + + +/// [Output Only] Metadata about this warning in key: value format. For example: +/// "data": [ { "key": "scope", "value": "zones/us-east1-d" } +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationWarningsData { + /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource, and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). + pub key: Option, + /// [Output Only] A warning data value corresponding to the key. + pub value: Option, +} + +impl NestedType for OperationWarningsData {} +impl Part for OperationWarningsData {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct EndpointEndpointVisibility { + /// Google Compute Engine networks for which the name of this endpoint should be resolvable through DNS. + pub networks: Option>, + /// Google Cloud projects for which the name of this endpoint should be resolvable through DNS. + pub projects: Option>, +} + +impl Part for EndpointEndpointVisibility {} + + +/// [Output Only] If warning messages are generated during processing of the operation, this field will be populated. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationWarnings { + /// [Output Only] A human-readable description of the warning code. + pub message: Option, + /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. + pub code: Option, + /// [Output Only] Metadata about this warning in key: value format. For example: + /// "data": [ { "key": "scope", "value": "zones/us-east1-d" } + pub data: Option>, +} + +impl NestedType for OperationWarnings {} +impl Part for OperationWarnings {} + + +/// [Output Only] The array of errors encountered while processing this operation. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationErrorErrors { + /// [Output Only] An optional, human-readable error message. + pub message: Option, + /// [Output Only] The error type identifier for this error. + pub code: Option, + /// [Output Only] Indicates the field in the request which caused the error. This property is optional. + pub location: Option, +} + +impl NestedType for OperationErrorErrors {} +impl Part for OperationErrorErrors {} + + +/// [Output Only] If errors are generated during processing of the operation, this field will be populated. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationError { + /// [Output Only] The array of errors encountered while processing this operation. + pub errors: Option>, +} + +impl NestedType for OperationError {} +impl Part for OperationError {} + + +/// A response containing a partial list of operations and a page token used to build the next request if the request has been truncated. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list operations](struct.OperationListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationsListResponse { + /// [Output Only] A token used to continue a truncated list request. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// [Output Only] Operations contained in this list response. + pub operations: Option>, +} + +impl ResponseResult for OperationsListResponse {} + + +/// An Operation resource, used to manage asynchronous API requests. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert endpoints](struct.EndpointInsertCall.html) (response) +/// * [delete endpoints](struct.EndpointDeleteCall.html) (response) +/// * [update endpoints](struct.EndpointUpdateCall.html) (response) +/// * [get operations](struct.OperationGetCall.html) (response) +/// * [list operations](struct.OperationListCall.html) (none) +/// * [patch endpoints](struct.EndpointPatchCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. + pub status: Option, + /// [Output Only] A textual description of the operation, which is set when the operation is created. + pub description: Option, + /// [Output Only] If warning messages are generated during processing of the operation, this field will be populated. + pub warnings: Option>, + /// [Output Only] If errors are generated during processing of the operation, this field will be populated. + pub error: Option, + /// [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. + #[serde(rename="targetId")] + pub target_id: Option, + /// [Output Only] User who requested the operation, for example: user@example.com. + pub user: Option, + /// [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. + #[serde(rename="startTime")] + pub start_time: Option, + /// [Output Only] A unique client ID generated by the server. + #[serde(rename="clientOperationId")] + pub client_operation_id: Option, + /// [Output Only] Creation timestamp in RFC3339 text format. + #[serde(rename="creationTimestamp")] + pub creation_timestamp: Option, + /// [Output Only] The unique identifier for the resource. This identifier is defined by the server. + pub id: Option, + /// [Output Only] Type of the resource. Always compute#operation for Operation resources. + pub kind: Option, + /// [Output Only] Name of the resource. + pub name: Option, + /// [Output Only] URL of the zone where the operation resides. Only available when performing per-zone operations. + pub zone: Option, + /// [Output Only] URL of the region where the operation resides. Only available when performing regional operations. + pub region: Option, + /// [Output Only] The type of operation, which can be insert, update, or delete. + #[serde(rename="operationType")] + pub operation_type: Option, + /// [Output Only] Server-defined URL for the resource. + #[serde(rename="selfLink")] + pub self_link: Option, + /// [Output Only] The time that this operation was requested. This value is in RFC3339 text format. + #[serde(rename="insertTime")] + pub insert_time: Option, + /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. + #[serde(rename="httpErrorMessage")] + pub http_error_message: Option, + /// [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. + pub progress: Option, + /// [Output Only] The time that this operation was completed. This value is in RFC3339 text format. + #[serde(rename="endTime")] + pub end_time: Option, + /// [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. + #[serde(rename="httpErrorStatusCode")] + pub http_error_status_code: Option, + /// [Output Only] An optional textual description of the current status of the operation. + #[serde(rename="statusMessage")] + pub status_message: Option, + /// [Output Only] The URL of the resource that the operation is modifying. + #[serde(rename="targetLink")] + pub target_link: Option, +} + +impl Resource for Operation {} +impl ResponseResult for Operation {} + + + +// ################### +// MethodBuilders ### +// ################# + +/// A builder providing access to all methods supported on *operation* resources. +/// It is not used directly, but through the `ServiceRegistry` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_serviceregistryalpha as serviceregistryalpha; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use serviceregistryalpha::ServiceRegistry; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = ServiceRegistry::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.operations(); +/// # } +/// ``` +pub struct OperationMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceRegistry, +} + +impl<'a, C, A> MethodsBuilder for OperationMethods<'a, C, A> {} + +impl<'a, C, A> OperationMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Gets information about a specific operation. + /// + /// # Arguments + /// + /// * `project` - The project ID for this request. + /// * `operation` - The name of the operation for this request. + pub fn get(&self, project: &str, operation: &str) -> OperationGetCall<'a, C, A> { + OperationGetCall { + hub: self.hub, + _project: project.to_string(), + _operation: operation.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists all operations for a project. + /// + /// # Arguments + /// + /// * `project` - The project ID for this request. + pub fn list(&self, project: &str) -> OperationListCall<'a, C, A> { + OperationListCall { + hub: self.hub, + _project: project.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *endpoint* resources. +/// It is not used directly, but through the `ServiceRegistry` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_serviceregistryalpha as serviceregistryalpha; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use serviceregistryalpha::ServiceRegistry; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = ServiceRegistry::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.endpoints(); +/// # } +/// ``` +pub struct EndpointMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceRegistry, +} + +impl<'a, C, A> MethodsBuilder for EndpointMethods<'a, C, A> {} + +impl<'a, C, A> EndpointMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Creates an endpoint. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - The project ID for this request. + pub fn insert(&self, request: Endpoint, project: &str) -> EndpointInsertCall<'a, C, A> { + EndpointInsertCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes an endpoint. + /// + /// # Arguments + /// + /// * `project` - The project ID for this request. + /// * `endpoint` - The name of the endpoint for this request. + pub fn delete(&self, project: &str, endpoint: &str) -> EndpointDeleteCall<'a, C, A> { + EndpointDeleteCall { + hub: self.hub, + _project: project.to_string(), + _endpoint: endpoint.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an endpoint. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - The project ID for this request. + /// * `endpoint` - The name of the endpoint for this request. + pub fn update(&self, request: Endpoint, project: &str, endpoint: &str) -> EndpointUpdateCall<'a, C, A> { + EndpointUpdateCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _endpoint: endpoint.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an endpoint. This method supports patch semantics. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - The project ID for this request. + /// * `endpoint` - The name of the endpoint for this request. + pub fn patch(&self, request: Endpoint, project: &str, endpoint: &str) -> EndpointPatchCall<'a, C, A> { + EndpointPatchCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _endpoint: endpoint.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists endpoints for a project. + /// + /// # Arguments + /// + /// * `project` - The project ID for this request. + pub fn list(&self, project: &str) -> EndpointListCall<'a, C, A> { + EndpointListCall { + hub: self.hub, + _project: project.to_string(), + _page_token: Default::default(), + _order_by: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Gets an endpoint. + /// + /// # Arguments + /// + /// * `project` - The project ID for this request. + /// * `endpoint` - The name of the endpoint for this request. + pub fn get(&self, project: &str, endpoint: &str) -> EndpointGetCall<'a, C, A> { + EndpointGetCall { + hub: self.hub, + _project: project.to_string(), + _endpoint: endpoint.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + + + +// ################### +// CallBuilders ### +// ################# + +/// Gets information about a specific operation. +/// +/// A builder for the *get* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_serviceregistryalpha as serviceregistryalpha; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use serviceregistryalpha::ServiceRegistry; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! +/// let result = hub.operations().get("project", "operation") +/// .doit(); +/// # } +/// ``` +pub struct OperationGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceRegistry, + _project: String, + _operation: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationGetCall<'a, C, A> {} + +impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "serviceregistry.operations.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("operation", self._operation.to_string())); + for &field in ["alt", "project", "operation"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/operations/{operation}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{operation}", "operation")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["operation", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the operation for this request. + /// + /// Sets the *operation* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn operation(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { + self._operation = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OperationGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperationGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::NdevCloudmanReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OperationGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists all operations for a project. +/// +/// A builder for the *list* method supported by a *operation* resource. +/// It is not used directly, but through a `OperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_serviceregistryalpha as serviceregistryalpha; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use serviceregistryalpha::ServiceRegistry; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! +/// let result = hub.operations().list("project") +/// .page_token("sea") +/// .order_by("nonumy") +/// .max_results(82) +/// .filter("gubergren") +/// .doit(); +/// # } +/// ``` +pub struct OperationListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceRegistry, + _project: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for OperationListCall<'a, C, A> {} + +impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, OperationsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "serviceregistry.operations.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/operations".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevCloudmanReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> OperationListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. + /// + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// + /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> OperationListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> OperationListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::NdevCloudmanReadonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> OperationListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates an endpoint. +/// +/// A builder for the *insert* method supported by a *endpoint* resource. +/// It is not used directly, but through a `EndpointMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_serviceregistryalpha as serviceregistryalpha; +/// use serviceregistryalpha::Endpoint; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use serviceregistryalpha::ServiceRegistry; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! +/// let mut req = Endpoint::default(); +/// +/// // 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 ! +/// let result = hub.endpoints().insert(req, "project") +/// .doit(); +/// # } +/// ``` +pub struct EndpointInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceRegistry, + _request: Endpoint, + _project: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EndpointInsertCall<'a, C, A> {} + +impl<'a, C, A> EndpointInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "serviceregistry.endpoints.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + for &field in ["alt", "project"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Endpoint) -> EndpointInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> EndpointInsertCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EndpointInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EndpointInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EndpointInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes an endpoint. +/// +/// A builder for the *delete* method supported by a *endpoint* resource. +/// It is not used directly, but through a `EndpointMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_serviceregistryalpha as serviceregistryalpha; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use serviceregistryalpha::ServiceRegistry; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! +/// let result = hub.endpoints().delete("project", "endpoint") +/// .doit(); +/// # } +/// ``` +pub struct EndpointDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceRegistry, + _project: String, + _endpoint: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EndpointDeleteCall<'a, C, A> {} + +impl<'a, C, A> EndpointDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "serviceregistry.endpoints.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("endpoint", self._endpoint.to_string())); + for &field in ["alt", "project", "endpoint"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{endpoint}", "endpoint")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["endpoint", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> EndpointDeleteCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the endpoint for this request. + /// + /// Sets the *endpoint* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn endpoint(mut self, new_value: &str) -> EndpointDeleteCall<'a, C, A> { + self._endpoint = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EndpointDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EndpointDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EndpointDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an endpoint. +/// +/// A builder for the *update* method supported by a *endpoint* resource. +/// It is not used directly, but through a `EndpointMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_serviceregistryalpha as serviceregistryalpha; +/// use serviceregistryalpha::Endpoint; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use serviceregistryalpha::ServiceRegistry; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! +/// let mut req = Endpoint::default(); +/// +/// // 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 ! +/// let result = hub.endpoints().update(req, "project", "endpoint") +/// .doit(); +/// # } +/// ``` +pub struct EndpointUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceRegistry, + _request: Endpoint, + _project: String, + _endpoint: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EndpointUpdateCall<'a, C, A> {} + +impl<'a, C, A> EndpointUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "serviceregistry.endpoints.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("endpoint", self._endpoint.to_string())); + for &field in ["alt", "project", "endpoint"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{endpoint}", "endpoint")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["endpoint", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Endpoint) -> EndpointUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> EndpointUpdateCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the endpoint for this request. + /// + /// Sets the *endpoint* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn endpoint(mut self, new_value: &str) -> EndpointUpdateCall<'a, C, A> { + self._endpoint = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EndpointUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EndpointUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EndpointUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates an endpoint. This method supports patch semantics. +/// +/// A builder for the *patch* method supported by a *endpoint* resource. +/// It is not used directly, but through a `EndpointMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_serviceregistryalpha as serviceregistryalpha; +/// use serviceregistryalpha::Endpoint; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use serviceregistryalpha::ServiceRegistry; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! +/// let mut req = Endpoint::default(); +/// +/// // 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 ! +/// let result = hub.endpoints().patch(req, "project", "endpoint") +/// .doit(); +/// # } +/// ``` +pub struct EndpointPatchCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceRegistry, + _request: Endpoint, + _project: String, + _endpoint: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EndpointPatchCall<'a, C, A> {} + +impl<'a, C, A> EndpointPatchCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "serviceregistry.endpoints.patch", + http_method: hyper::method::Method::Patch }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("endpoint", self._endpoint.to_string())); + for &field in ["alt", "project", "endpoint"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{endpoint}", "endpoint")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["endpoint", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Endpoint) -> EndpointPatchCall<'a, C, A> { + self._request = new_value; + self + } + /// The project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> EndpointPatchCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the endpoint for this request. + /// + /// Sets the *endpoint* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn endpoint(mut self, new_value: &str) -> EndpointPatchCall<'a, C, A> { + self._endpoint = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EndpointPatchCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EndpointPatchCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EndpointPatchCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists endpoints for a project. +/// +/// A builder for the *list* method supported by a *endpoint* resource. +/// It is not used directly, but through a `EndpointMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_serviceregistryalpha as serviceregistryalpha; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use serviceregistryalpha::ServiceRegistry; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! +/// let result = hub.endpoints().list("project") +/// .page_token("diam") +/// .order_by("ipsum") +/// .max_results(96) +/// .filter("et") +/// .doit(); +/// # } +/// ``` +pub struct EndpointListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceRegistry, + _project: String, + _page_token: Option, + _order_by: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EndpointListCall<'a, C, A> {} + +impl<'a, C, A> EndpointListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, EndpointsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "serviceregistry.endpoints.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order_by { + params.push(("orderBy", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "project", "pageToken", "orderBy", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> EndpointListCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> EndpointListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. + /// + /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. + /// + /// Currently, only sorting by name or creationTimestamp desc is supported. + /// + /// Sets the *order by* query property to the given value. + pub fn order_by(mut self, new_value: &str) -> EndpointListCall<'a, C, A> { + self._order_by = Some(new_value.to_string()); + self + } + /// The maximum number of results per page that Compute Engine should return. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> EndpointListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string. + /// + /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field. + /// + /// For example, filter=name ne example-instance. + /// + /// Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values. + /// + /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions meaning that resources must match all expressions to pass the filters. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> EndpointListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EndpointListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EndpointListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EndpointListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Gets an endpoint. +/// +/// A builder for the *get* method supported by a *endpoint* resource. +/// It is not used directly, but through a `EndpointMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_serviceregistryalpha as serviceregistryalpha; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use serviceregistryalpha::ServiceRegistry; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = ServiceRegistry::new(hyper::Client::new(), 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 ! +/// let result = hub.endpoints().get("project", "endpoint") +/// .doit(); +/// # } +/// ``` +pub struct EndpointGetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a ServiceRegistry, + _project: String, + _endpoint: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for EndpointGetCall<'a, C, A> {} + +impl<'a, C, A> EndpointGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Endpoint)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "serviceregistry.endpoints.get", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("project", self._project.to_string())); + params.push(("endpoint", self._endpoint.to_string())); + for &field in ["alt", "project", "endpoint"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/serviceregistry/alpha/projects/{project}/global/endpoints/{endpoint}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{endpoint}", "endpoint")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(2); + for param_name in ["endpoint", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The project ID for this request. + /// + /// Sets the *project* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn project(mut self, new_value: &str) -> EndpointGetCall<'a, C, A> { + self._project = new_value.to_string(); + self + } + /// The name of the endpoint for this request. + /// + /// Sets the *endpoint* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn endpoint(mut self, new_value: &str) -> EndpointGetCall<'a, C, A> { + self._endpoint = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> EndpointGetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> EndpointGetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::CloudPlatform`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> EndpointGetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + diff --git a/gen/siteverification1-cli/Cargo.toml b/gen/siteverification1-cli/Cargo.toml index e7a18c88b5..77bc823402 100644 --- a/gen/siteverification1-cli/Cargo.toml +++ b/gen/siteverification1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-siteverification1-cli" -version = "0.3.2+20151007" +version = "0.3.3+20151007" authors = ["Sebastian Thiel "] description = "A complete library to interact with siteVerification (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/siteverification1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/siteverification1-cli/LICENSE.md b/gen/siteverification1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/siteverification1-cli/LICENSE.md +++ b/gen/siteverification1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/siteverification1-cli/README.md b/gen/siteverification1-cli/README.md index 0ba4f23b91..2eb34c8839 100644 --- a/gen/siteverification1-cli/README.md +++ b/gen/siteverification1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *siteVerification* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/siteverification1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/siteverification1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/siteverification1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/siteverification1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/siteverification1-cli). # Usage -This documentation was generated from the *siteVerification* API at revision *20151007*. The CLI is at version *0.3.2*. +This documentation was generated from the *siteVerification* API at revision *20151007*. The CLI is at version *0.3.3*. ```bash siteverification1 [options] @@ -40,18 +40,18 @@ siteverification1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/siteverification1-cli/mkdocs.yml b/gen/siteverification1-cli/mkdocs.yml index 3a7022e30b..ff142314ba 100644 --- a/gen/siteverification1-cli/mkdocs.yml +++ b/gen/siteverification1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: siteVerification v0.3.2+20151007 +site_name: siteVerification v0.3.3+20151007 site_url: http://byron.github.io/google-apis-rs/google-siteverification1-cli site_description: Write integrating applications with bcore @@ -19,5 +19,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/siteverification1-cli/src/main.rs b/gen/siteverification1-cli/src/main.rs index 6e39a0259b..73cf8b82f0 100644 --- a/gen/siteverification1-cli/src/main.rs +++ b/gen/siteverification1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::SiteVerification>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _web_resource_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _web_resource_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.web_resource().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -89,10 +89,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _web_resource_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _web_resource_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.web_resource().get(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -105,7 +105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -141,13 +141,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _web_resource_get_token(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _web_resource_get_token(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -161,8 +161,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "verification-method" => Some(("verificationMethod", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "site.identifier" => Some(("site.identifier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -179,7 +179,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SiteVerificationWebResourceGettokenRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.web_resource().get_token(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -192,7 +192,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -205,7 +205,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -228,13 +228,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _web_resource_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _web_resource_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -248,8 +248,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "owners" => Some(("owners", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -267,7 +267,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SiteVerificationWebResourceResource = json::value::from_value(object).unwrap(); let mut call = self.hub.web_resource().insert(request, opt.value_of("verification-method").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -280,7 +280,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -293,7 +293,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -316,10 +316,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _web_resource_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _web_resource_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.web_resource().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -332,7 +332,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -345,7 +345,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -368,13 +368,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _web_resource_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _web_resource_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -388,8 +388,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "owners" => Some(("owners", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -407,7 +407,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SiteVerificationWebResourceResource = json::value::from_value(object).unwrap(); let mut call = self.hub.web_resource().patch(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -420,7 +420,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -433,7 +433,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -456,13 +456,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _web_resource_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _web_resource_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -476,8 +476,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "owners" => Some(("owners", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -495,7 +495,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SiteVerificationWebResourceResource = json::value::from_value(object).unwrap(); let mut call = self.hub.web_resource().update(request, opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -508,7 +508,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -521,7 +521,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -595,14 +595,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "siteverification1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "siteverification1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -622,7 +622,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -661,7 +661,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("web-resource", "methods: 'delete', 'get', 'get-token', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Relinquish ownership of a website or domain."##), "Details at http://byron.github.io/google-apis-rs/google_siteverification1_cli/web-resource_delete", vec![ @@ -677,7 +677,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Get the most current data for a website or domain."##), "Details at http://byron.github.io/google-apis-rs/google_siteverification1_cli/web-resource_get", vec![ @@ -699,7 +699,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-token", + ("get-token", Some(r##"Get a verification token for placing on a website or domain."##), "Details at http://byron.github.io/google-apis-rs/google_siteverification1_cli/web-resource_get-token", vec![ @@ -721,7 +721,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Attempt verification of a website or domain."##), "Details at http://byron.github.io/google-apis-rs/google_siteverification1_cli/web-resource_insert", vec![ @@ -749,7 +749,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Get the list of your verified websites and domains."##), "Details at http://byron.github.io/google-apis-rs/google_siteverification1_cli/web-resource_list", vec![ @@ -765,7 +765,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Modify the list of owners for your website or domain. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_siteverification1_cli/web-resource_patch", vec![ @@ -793,7 +793,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Modify the list of owners for your website or domain."##), "Details at http://byron.github.io/google-apis-rs/google_siteverification1_cli/web-resource_update", vec![ @@ -827,7 +827,7 @@ fn main() { let mut app = App::new("siteverification1") .author("Sebastian Thiel ") - .version("0.3.2+20151007") + .version("0.3.3+20151007") .about("Lets you programatically verify ownership of websites or domains with Google.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_siteverification1_cli") .arg(Arg::with_name("url") @@ -851,7 +851,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -862,7 +862,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/siteverification1/Cargo.toml b/gen/siteverification1/Cargo.toml index 2cf0ecb974..01ba3c59b2 100644 --- a/gen/siteverification1/Cargo.toml +++ b/gen/siteverification1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-siteverification1" -version = "0.1.10+20151007" +version = "0.1.11+20151007" authors = ["Sebastian Thiel "] description = "A complete library to interact with siteVerification (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/siteverification1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/siteverification1/LICENSE.md b/gen/siteverification1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/siteverification1/LICENSE.md +++ b/gen/siteverification1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/siteverification1/README.md b/gen/siteverification1/README.md index 7682ba4e07..00a6052a99 100644 --- a/gen/siteverification1/README.md +++ b/gen/siteverification1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-siteverification1` library allows access to all features of the *Google siteVerification* service. -This documentation was generated from *siteVerification* crate version *0.1.10+20151007*, where *20151007* is the exact revision of the *siteVerification:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *siteVerification* crate version *0.1.11+20151007*, where *20151007* is the exact revision of the *siteVerification:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *siteVerification* *v1* API can be found at the [official documentation site](https://developers.google.com/site-verification/). diff --git a/gen/siteverification1/src/cmn.rs b/gen/siteverification1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/siteverification1/src/cmn.rs +++ b/gen/siteverification1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/siteverification1/src/lib.rs b/gen/siteverification1/src/lib.rs index bfbca8541c..f66bac9031 100644 --- a/gen/siteverification1/src/lib.rs +++ b/gen/siteverification1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *siteVerification* crate version *0.1.10+20151007*, where *20151007* is the exact revision of the *siteVerification:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *siteVerification* crate version *0.1.11+20151007*, where *20151007* is the exact revision of the *siteVerification:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *siteVerification* *v1* API can be found at the //! [official documentation site](https://developers.google.com/site-verification/). diff --git a/gen/siteverification1/src/lib.rs.in b/gen/siteverification1/src/lib.rs.in index 492fafdc47..cae551a4ca 100644 --- a/gen/siteverification1/src/lib.rs.in +++ b/gen/siteverification1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -136,7 +137,7 @@ impl<'a, C, A> SiteVerification SiteVerification { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -145,7 +146,7 @@ impl<'a, C, A> SiteVerification } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -504,7 +505,7 @@ impl<'a, C, A> WebResourceGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "siteVerification.webResource.get", + dlg.begin(MethodInfo { id: "siteVerification.webResource.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -546,7 +547,7 @@ impl<'a, C, A> WebResourceGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -582,7 +583,7 @@ impl<'a, C, A> WebResourceGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -592,10 +593,10 @@ impl<'a, C, A> WebResourceGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -628,7 +629,7 @@ impl<'a, C, A> WebResourceGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> WebResourceGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -646,12 +647,12 @@ impl<'a, C, A> WebResourceGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -668,17 +669,17 @@ impl<'a, C, A> WebResourceGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> WebResourceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> WebResourceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -747,7 +748,7 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "siteVerification.webResource.patch", + dlg.begin(MethodInfo { id: "siteVerification.webResource.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -789,14 +790,14 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -840,7 +841,7 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -850,10 +851,10 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -885,7 +886,7 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SiteVerificationWebResourceResource) -> WebResourcePatchCall<'a, C, A> { self._request = new_value; @@ -895,7 +896,7 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> WebResourcePatchCall<'a, C, A> { self._id = new_value.to_string(); @@ -913,12 +914,12 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -935,17 +936,17 @@ impl<'a, C, A> WebResourcePatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> WebResourcePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> WebResourcePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1006,7 +1007,7 @@ impl<'a, C, A> WebResourceListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "siteVerification.webResource.list", + dlg.begin(MethodInfo { id: "siteVerification.webResource.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1026,7 +1027,7 @@ impl<'a, C, A> WebResourceListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1062,7 +1063,7 @@ impl<'a, C, A> WebResourceListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1072,10 +1073,10 @@ impl<'a, C, A> WebResourceListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1116,12 +1117,12 @@ impl<'a, C, A> WebResourceListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1138,17 +1139,17 @@ impl<'a, C, A> WebResourceListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> WebResourceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> WebResourceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1210,7 +1211,7 @@ impl<'a, C, A> WebResourceDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "siteVerification.webResource.delete", + dlg.begin(MethodInfo { id: "siteVerification.webResource.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -1251,7 +1252,7 @@ impl<'a, C, A> WebResourceDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1287,7 +1288,7 @@ impl<'a, C, A> WebResourceDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1297,10 +1298,10 @@ impl<'a, C, A> WebResourceDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1323,7 +1324,7 @@ impl<'a, C, A> WebResourceDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> WebResourceDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -1341,12 +1342,12 @@ impl<'a, C, A> WebResourceDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1363,17 +1364,17 @@ impl<'a, C, A> WebResourceDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> WebResourceDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> WebResourceDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1441,7 +1442,7 @@ impl<'a, C, A> WebResourceGetTokenCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "siteVerification.webResource.getToken", + dlg.begin(MethodInfo { id: "siteVerification.webResource.getToken", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1461,14 +1462,14 @@ impl<'a, C, A> WebResourceGetTokenCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1512,7 +1513,7 @@ impl<'a, C, A> WebResourceGetTokenCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1522,10 +1523,10 @@ impl<'a, C, A> WebResourceGetTokenCall<'a, C, A> where C: BorrowMut WebResourceGetTokenCall<'a, C, A> where C: BorrowMut WebResourceGetTokenCall<'a, C, A> { self._request = new_value; @@ -1575,12 +1576,12 @@ impl<'a, C, A> WebResourceGetTokenCall<'a, C, A> where C: BorrowMut WebResourceGetTokenCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> WebResourceGetTokenCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> WebResourceGetTokenCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1676,7 +1677,7 @@ impl<'a, C, A> WebResourceUpdateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "siteVerification.webResource.update", + dlg.begin(MethodInfo { id: "siteVerification.webResource.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -1718,14 +1719,14 @@ impl<'a, C, A> WebResourceUpdateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1769,7 +1770,7 @@ impl<'a, C, A> WebResourceUpdateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1779,10 +1780,10 @@ impl<'a, C, A> WebResourceUpdateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1814,7 +1815,7 @@ impl<'a, C, A> WebResourceUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SiteVerificationWebResourceResource) -> WebResourceUpdateCall<'a, C, A> { self._request = new_value; @@ -1824,7 +1825,7 @@ impl<'a, C, A> WebResourceUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> WebResourceUpdateCall<'a, C, A> { self._id = new_value.to_string(); @@ -1842,12 +1843,12 @@ impl<'a, C, A> WebResourceUpdateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1864,17 +1865,17 @@ impl<'a, C, A> WebResourceUpdateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> WebResourceUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> WebResourceUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1943,7 +1944,7 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "siteVerification.webResource.insert", + dlg.begin(MethodInfo { id: "siteVerification.webResource.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("verificationMethod", self._verification_method.to_string())); @@ -1964,14 +1965,14 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2015,7 +2016,7 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2025,10 +2026,10 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2060,7 +2061,7 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SiteVerificationWebResourceResource) -> WebResourceInsertCall<'a, C, A> { self._request = new_value; @@ -2070,7 +2071,7 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *verification method* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn verification_method(mut self, new_value: &str) -> WebResourceInsertCall<'a, C, A> { self._verification_method = new_value.to_string(); @@ -2088,12 +2089,12 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2110,17 +2111,17 @@ impl<'a, C, A> WebResourceInsertCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> WebResourceInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> WebResourceInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/spectrum1_explorer-cli/Cargo.toml b/gen/spectrum1_explorer-cli/Cargo.toml index d6d39a5fc0..fd493c7648 100644 --- a/gen/spectrum1_explorer-cli/Cargo.toml +++ b/gen/spectrum1_explorer-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-spectrum1_explorer-cli" -version = "0.3.2+20150716" +version = "0.3.3+20151209" authors = ["Sebastian Thiel "] description = "A complete library to interact with spectrum (protocol v1explorer)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/spectrum1_explorer-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/spectrum1_explorer-cli/LICENSE.md b/gen/spectrum1_explorer-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/spectrum1_explorer-cli/LICENSE.md +++ b/gen/spectrum1_explorer-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/spectrum1_explorer-cli/README.md b/gen/spectrum1_explorer-cli/README.md index f27598b9d1..1923cbe4d0 100644 --- a/gen/spectrum1_explorer-cli/README.md +++ b/gen/spectrum1_explorer-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *spectrum* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/spectrum1-explorer.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/spectrum1-explorer.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/spectrum1-explorer.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/spectrum1-explorer.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/spectrum1_explorer-cli). # Usage -This documentation was generated from the *spectrum* API at revision *20150716*. The CLI is at version *0.3.2*. +This documentation was generated from the *spectrum* API at revision *20151209*. The CLI is at version *0.3.3*. ```bash spectrum1-explorer [options] @@ -39,14 +39,14 @@ spectrum1-explorer [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/spectrum1_explorer-cli/mkdocs.yml b/gen/spectrum1_explorer-cli/mkdocs.yml index 86a920bf27..f2232c0330 100644 --- a/gen/spectrum1_explorer-cli/mkdocs.yml +++ b/gen/spectrum1_explorer-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: spectrum v0.3.2+20150716 +site_name: spectrum v0.3.3+20151209 site_url: http://byron.github.io/google-apis-rs/google-spectrum1_explorer-cli site_description: Write integrating applications with bcore @@ -18,5 +18,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/spectrum1_explorer-cli/src/main.rs b/gen/spectrum1_explorer-cli/src/main.rs index 13ad970c31..32fdd0cdfd 100644 --- a/gen/spectrum1_explorer-cli/src/main.rs +++ b/gen/spectrum1_explorer-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Spectrum>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _paws_get_spectrum(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _paws_get_spectrum(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "device-desc.etsi-en-device-type" => Some(("deviceDesc.etsiEnDeviceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device-desc.fcc-id" => Some(("deviceDesc.fccId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -132,7 +132,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PawsGetSpectrumRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.paws().get_spectrum(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -145,7 +145,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -178,13 +178,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _paws_get_spectrum_batch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _paws_get_spectrum_batch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -198,8 +198,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "device-desc.etsi-en-device-type" => Some(("deviceDesc.etsiEnDeviceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device-desc.fcc-id" => Some(("deviceDesc.fccId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -259,7 +259,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PawsGetSpectrumBatchRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.paws().get_spectrum_batch(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -272,7 +272,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -305,13 +305,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _paws_init(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _paws_init(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -325,8 +325,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "device-desc.etsi-en-device-type" => Some(("deviceDesc.etsiEnDeviceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device-desc.fcc-id" => Some(("deviceDesc.fccId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -358,7 +358,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PawsInitRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.paws().init(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -371,7 +371,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -404,13 +404,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _paws_notify_spectrum_use(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _paws_notify_spectrum_use(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -424,8 +424,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "device-desc.etsi-en-device-type" => Some(("deviceDesc.etsiEnDeviceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device-desc.fcc-id" => Some(("deviceDesc.fccId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -457,7 +457,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PawsNotifySpectrumUseRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.paws().notify_spectrum_use(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -470,7 +470,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -503,13 +503,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _paws_register(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _paws_register(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -523,8 +523,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "device-desc.etsi-en-device-type" => Some(("deviceDesc.etsiEnDeviceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "device-desc.fcc-id" => Some(("deviceDesc.fccId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -579,7 +579,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PawsRegisterRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.paws().register(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -592,7 +592,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -625,13 +625,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _paws_verify_device(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _paws_verify_device(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -645,8 +645,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "version" => Some(("version", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "type" => Some(("type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -662,7 +662,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PawsVerifyDeviceRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.paws().verify_device(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -675,7 +675,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -756,14 +756,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "spectrum1-explorer-secret.json", + match cmn::application_secret_from_directory(&config_dir, "spectrum1-explorer-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -783,7 +783,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -822,7 +822,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("paws", "methods: 'get-spectrum', 'get-spectrum-batch', 'init', 'notify-spectrum-use', 'register' and 'verify-device'", vec![ - ("get-spectrum", + ("get-spectrum", Some(r##"Requests information about the available spectrum for a device at a location. Requests from a fixed-mode device must include owner information so the device can be registered with the database."##), "Details at http://byron.github.io/google-apis-rs/google_spectrum1_explorer_cli/paws_get-spectrum", vec![ @@ -844,7 +844,7 @@ fn main() { Some(false), Some(false)), ]), - ("get-spectrum-batch", + ("get-spectrum-batch", Some(r##"The Google Spectrum Database does not support batch requests, so this method always yields an UNIMPLEMENTED error."##), "Details at http://byron.github.io/google-apis-rs/google_spectrum1_explorer_cli/paws_get-spectrum-batch", vec![ @@ -866,7 +866,7 @@ fn main() { Some(false), Some(false)), ]), - ("init", + ("init", Some(r##"Initializes the connection between a white space device and the database."##), "Details at http://byron.github.io/google-apis-rs/google_spectrum1_explorer_cli/paws_init", vec![ @@ -888,7 +888,7 @@ fn main() { Some(false), Some(false)), ]), - ("notify-spectrum-use", + ("notify-spectrum-use", Some(r##"Notifies the database that the device has selected certain frequency ranges for transmission. Only to be invoked when required by the regulator. The Google Spectrum Database does not operate in domains that require notification, so this always yields an UNIMPLEMENTED error."##), "Details at http://byron.github.io/google-apis-rs/google_spectrum1_explorer_cli/paws_notify-spectrum-use", vec![ @@ -910,7 +910,7 @@ fn main() { Some(false), Some(false)), ]), - ("register", + ("register", Some(r##"The Google Spectrum Database implements registration in the getSpectrum method. As such this always returns an UNIMPLEMENTED error."##), "Details at http://byron.github.io/google-apis-rs/google_spectrum1_explorer_cli/paws_register", vec![ @@ -932,7 +932,7 @@ fn main() { Some(false), Some(false)), ]), - ("verify-device", + ("verify-device", Some(r##"Validates a device for white space use in accordance with regulatory rules. The Google Spectrum Database does not support master/slave configurations, so this always yields an UNIMPLEMENTED error."##), "Details at http://byron.github.io/google-apis-rs/google_spectrum1_explorer_cli/paws_verify-device", vec![ @@ -960,7 +960,7 @@ fn main() { let mut app = App::new("spectrum1-explorer") .author("Sebastian Thiel ") - .version("0.3.2+20150716") + .version("0.3.3+20151209") .about("API for spectrum-management functions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_spectrum1_explorer_cli") .arg(Arg::with_name("folder") @@ -979,7 +979,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -990,7 +990,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/spectrum1_explorer/Cargo.toml b/gen/spectrum1_explorer/Cargo.toml index 01d33b8ac8..7e0dc182fb 100644 --- a/gen/spectrum1_explorer/Cargo.toml +++ b/gen/spectrum1_explorer/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-spectrum1_explorer" -version = "0.1.10+20150716" +version = "0.1.11+20151209" authors = ["Sebastian Thiel "] description = "A complete library to interact with spectrum (protocol v1explorer)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/spectrum1_explorer" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/spectrum1_explorer/LICENSE.md b/gen/spectrum1_explorer/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/spectrum1_explorer/LICENSE.md +++ b/gen/spectrum1_explorer/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/spectrum1_explorer/README.md b/gen/spectrum1_explorer/README.md index d3130f8883..2e45d5bcbb 100644 --- a/gen/spectrum1_explorer/README.md +++ b/gen/spectrum1_explorer/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-spectrum1_explorer` library allows access to all features of the *Google spectrum* service. -This documentation was generated from *spectrum* crate version *0.1.10+20150716*, where *20150716* is the exact revision of the *spectrum:v1explorer* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *spectrum* crate version *0.1.11+20151209*, where *20151209* is the exact revision of the *spectrum:v1explorer* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *spectrum* *v1_explorer* API can be found at the [official documentation site](http://developers.google.com/spectrum). diff --git a/gen/spectrum1_explorer/src/cmn.rs b/gen/spectrum1_explorer/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/spectrum1_explorer/src/cmn.rs +++ b/gen/spectrum1_explorer/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/spectrum1_explorer/src/lib.rs b/gen/spectrum1_explorer/src/lib.rs index b4ad0a73ac..3e375e70f8 100644 --- a/gen/spectrum1_explorer/src/lib.rs +++ b/gen/spectrum1_explorer/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *spectrum* crate version *0.1.10+20150716*, where *20150716* is the exact revision of the *spectrum:v1explorer* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *spectrum* crate version *0.1.11+20151209*, where *20151209* is the exact revision of the *spectrum:v1explorer* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *spectrum* *v1_explorer* API can be found at the //! [official documentation site](http://developers.google.com/spectrum). diff --git a/gen/spectrum1_explorer/src/lib.rs.in b/gen/spectrum1_explorer/src/lib.rs.in index 0b3c20929c..d7c64475fd 100644 --- a/gen/spectrum1_explorer/src/lib.rs.in +++ b/gen/spectrum1_explorer/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -110,7 +111,7 @@ impl<'a, C, A> Spectrum Spectrum { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -119,7 +120,7 @@ impl<'a, C, A> Spectrum } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1180,7 +1181,7 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "spectrum.paws.notifySpectrumUse", + dlg.begin(MethodInfo { id: "spectrum.paws.notifySpectrumUse", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1209,14 +1210,14 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1245,7 +1246,7 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1255,10 +1256,10 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut PawNotifySpectrumUseCall<'a, C, A> { self._request = new_value; @@ -1308,12 +1309,12 @@ impl<'a, C, A> PawNotifySpectrumUseCall<'a, C, A> where C: BorrowMut PawRegisterCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "spectrum.paws.register", + dlg.begin(MethodInfo { id: "spectrum.paws.register", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1420,14 +1421,14 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut, A: o } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1456,7 +1457,7 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1466,10 +1467,10 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1501,7 +1502,7 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: PawsRegisterRequest) -> PawRegisterCall<'a, C, A> { self._request = new_value; @@ -1519,12 +1520,12 @@ impl<'a, C, A> PawRegisterCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1602,7 +1603,7 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "spectrum.paws.getSpectrum", + dlg.begin(MethodInfo { id: "spectrum.paws.getSpectrum", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1631,14 +1632,14 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut, A } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1667,7 +1668,7 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1677,10 +1678,10 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1712,7 +1713,7 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: PawsGetSpectrumRequest) -> PawGetSpectrumCall<'a, C, A> { self._request = new_value; @@ -1730,12 +1731,12 @@ impl<'a, C, A> PawGetSpectrumCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1813,7 +1814,7 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "spectrum.paws.init", + dlg.begin(MethodInfo { id: "spectrum.paws.init", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -1842,14 +1843,14 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut, A: oauth } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1878,7 +1879,7 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1888,10 +1889,10 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1923,7 +1924,7 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: PawsInitRequest) -> PawInitCall<'a, C, A> { self._request = new_value; @@ -1941,12 +1942,12 @@ impl<'a, C, A> PawInitCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2024,7 +2025,7 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "spectrum.paws.getSpectrumBatch", + dlg.begin(MethodInfo { id: "spectrum.paws.getSpectrumBatch", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2053,14 +2054,14 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2089,7 +2090,7 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2099,10 +2100,10 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut PawGetSpectrumBatchCall<'a, C, A> { self._request = new_value; @@ -2152,12 +2153,12 @@ impl<'a, C, A> PawGetSpectrumBatchCall<'a, C, A> where C: BorrowMut PawVerifyDeviceCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "spectrum.paws.verifyDevice", + dlg.begin(MethodInfo { id: "spectrum.paws.verifyDevice", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2264,14 +2265,14 @@ impl<'a, C, A> PawVerifyDeviceCall<'a, C, A> where C: BorrowMut, } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2300,7 +2301,7 @@ impl<'a, C, A> PawVerifyDeviceCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2310,10 +2311,10 @@ impl<'a, C, A> PawVerifyDeviceCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2345,7 +2346,7 @@ impl<'a, C, A> PawVerifyDeviceCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: PawsVerifyDeviceRequest) -> PawVerifyDeviceCall<'a, C, A> { self._request = new_value; @@ -2363,12 +2364,12 @@ impl<'a, C, A> PawVerifyDeviceCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/sqladmin1_beta4-cli/Cargo.toml b/gen/sqladmin1_beta4-cli/Cargo.toml index a403e8318e..67ab521608 100644 --- a/gen/sqladmin1_beta4-cli/Cargo.toml +++ b/gen/sqladmin1_beta4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-sqladmin1_beta4-cli" -version = "0.3.2+20151013" +version = "0.3.3+20151201" authors = ["Sebastian Thiel "] description = "A complete library to interact with SQL Admin (protocol v1beta4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/sqladmin1_beta4-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/sqladmin1_beta4-cli/LICENSE.md b/gen/sqladmin1_beta4-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/sqladmin1_beta4-cli/LICENSE.md +++ b/gen/sqladmin1_beta4-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/sqladmin1_beta4-cli/README.md b/gen/sqladmin1_beta4-cli/README.md index a5351f019e..333b2a7829 100644 --- a/gen/sqladmin1_beta4-cli/README.md +++ b/gen/sqladmin1_beta4-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *SQL Admin* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/sqladmin1-beta4.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/sqladmin1-beta4.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/sqladmin1-beta4.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/sqladmin1-beta4.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/sqladmin1_beta4-cli). # Usage -This documentation was generated from the *SQL Admin* API at revision *20151013*. The CLI is at version *0.3.2*. +This documentation was generated from the *SQL Admin* API at revision *20151201*. The CLI is at version *0.3.3*. ```bash sqladmin1-beta4 [options] @@ -78,18 +78,18 @@ sqladmin1-beta4 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/sqladmin1_beta4-cli/mkdocs.yml b/gen/sqladmin1_beta4-cli/mkdocs.yml index b9a3db07bf..8e1821b98f 100644 --- a/gen/sqladmin1_beta4-cli/mkdocs.yml +++ b/gen/sqladmin1_beta4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: SQL Admin v0.3.2+20151013 +site_name: SQL Admin v0.3.3+20151201 site_url: http://byron.github.io/google-apis-rs/google-sqladmin1_beta4-cli site_description: Write integrating applications with bcore @@ -50,5 +50,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/sqladmin1_beta4-cli/src/main.rs b/gen/sqladmin1_beta4-cli/src/main.rs index d3d29440e6..2d6ffef11b 100644 --- a/gen/sqladmin1_beta4-cli/src/main.rs +++ b/gen/sqladmin1_beta4-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::SQLAdmin>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _backup_runs_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _backup_runs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.backup_runs().delete(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _backup_runs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _backup_runs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.backup_runs().get(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -149,10 +149,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _backup_runs_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _backup_runs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.backup_runs().list(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -171,7 +171,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -185,7 +185,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -208,10 +208,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _databases_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _databases_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.databases().delete(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("database").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -224,7 +224,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -237,7 +237,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -260,10 +260,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _databases_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _databases_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.databases().get(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("database").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -276,7 +276,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -289,7 +289,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -312,13 +312,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _databases_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _databases_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -332,8 +332,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -355,7 +355,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Database = json::value::from_value(object).unwrap(); let mut call = self.hub.databases().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -368,7 +368,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -381,7 +381,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -404,10 +404,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _databases_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _databases_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.databases().list(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -420,7 +420,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -433,7 +433,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -456,13 +456,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _databases_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _databases_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -476,8 +476,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -499,7 +499,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Database = json::value::from_value(object).unwrap(); let mut call = self.hub.databases().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("database").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -512,7 +512,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -525,7 +525,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -548,13 +548,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _databases_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _databases_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -568,8 +568,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -591,7 +591,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Database = json::value::from_value(object).unwrap(); let mut call = self.hub.databases().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("database").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -604,7 +604,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -617,7 +617,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -640,10 +640,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _flags_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _flags_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.flags().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -656,7 +656,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -669,7 +669,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -692,13 +692,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_clone(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_clone(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -712,8 +712,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "clone-context.bin-log-coordinates.bin-log-position" => Some(("cloneContext.binLogCoordinates.binLogPosition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "clone-context.bin-log-coordinates.kind" => Some(("cloneContext.binLogCoordinates.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -732,7 +732,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstancesCloneRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().clone(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -745,7 +745,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -758,7 +758,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -781,10 +781,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().delete(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -797,7 +797,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -810,7 +810,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -833,13 +833,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_export(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_export(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -853,8 +853,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "export-context.kind" => Some(("exportContext.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "export-context.file-type" => Some(("exportContext.fileType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -875,7 +875,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstancesExportRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().export(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -888,7 +888,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -901,7 +901,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -924,13 +924,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_failover(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_failover(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -944,8 +944,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "failover-context.kind" => Some(("failoverContext.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "failover-context.settings-version" => Some(("failoverContext.settingsVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -961,7 +961,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstancesFailoverRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().failover(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -974,7 +974,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -987,7 +987,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1010,10 +1010,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().get(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1026,7 +1026,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1039,7 +1039,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1062,13 +1062,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_import(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_import(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1082,8 +1082,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "import-context.file-type" => Some(("importContext.fileType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "import-context.database" => Some(("importContext.database", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1103,7 +1103,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstancesImportRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().import(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1116,7 +1116,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1129,7 +1129,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1152,13 +1152,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1172,13 +1172,14 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "on-premises-configuration.kind" => Some(("onPremisesConfiguration.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "on-premises-configuration.host-port" => Some(("onPremisesConfiguration.hostPort", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "max-disk-size" => Some(("maxDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "failover-replica.available" => Some(("failoverReplica.available", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "failover-replica.name" => Some(("failoverReplica.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ipv6-address" => Some(("ipv6Address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "server-ca-cert.cert-serial-number" => Some(("serverCaCert.certSerialNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "server-ca-cert.kind" => Some(("serverCaCert.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1193,6 +1194,11 @@ impl<'n, 'a> Engine<'n, 'a> { "project" => Some(("project", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.kind" => Some(("settings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.data-disk-type" => Some(("settings.dataDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.maintenance-window.kind" => Some(("settings.maintenanceWindow.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.maintenance-window.update-track" => Some(("settings.maintenanceWindow.updateTrack", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.maintenance-window.day" => Some(("settings.maintenanceWindow.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "settings.maintenance-window.hour" => Some(("settings.maintenanceWindow.hour", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "settings.authorized-gae-applications" => Some(("settings.authorizedGaeApplications", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "settings.activation-policy" => Some(("settings.activationPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.backup-configuration.kind" => Some(("settings.backupConfiguration.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1201,10 +1207,10 @@ impl<'n, 'a> Engine<'n, 'a> { "settings.backup-configuration.binary-log-enabled" => Some(("settings.backupConfiguration.binaryLogEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.ip-configuration.ipv4-enabled" => Some(("settings.ipConfiguration.ipv4Enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.ip-configuration.require-ssl" => Some(("settings.ipConfiguration.requireSsl", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "settings.tier" => Some(("settings.tier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.crash-safe-replication-enabled" => Some(("settings.crashSafeReplicationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.database-replication-enabled" => Some(("settings.databaseReplicationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.replication-type" => Some(("settings.replicationType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "settings.crash-safe-replication-enabled" => Some(("settings.crashSafeReplicationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.tier" => Some(("settings.tier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.pricing-plan" => Some(("settings.pricingPlan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.settings-version" => Some(("settings.settingsVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.location-preference.kind" => Some(("settings.locationPreference.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1212,6 +1218,7 @@ impl<'n, 'a> Engine<'n, 'a> { "settings.location-preference.follow-gae-application" => Some(("settings.locationPreference.followGaeApplication", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.data-disk-size-gb" => Some(("settings.dataDiskSizeGb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "master-instance-name" => Some(("masterInstanceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "current-disk-size" => Some(("currentDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1232,9 +1239,9 @@ impl<'n, 'a> Engine<'n, 'a> { "database-version" => Some(("databaseVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "instance-type" => Some(("instanceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "max-disk-size" => Some(("maxDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "database-replication-enabled", "database-version", "dump-file-path", "enabled", "etag", "expiration-time", "failover-target", "follow-gae-application", "host-port", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "location-preference", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "project", "region", "replica-configuration", "replica-names", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "tier", "username", "verify-server-certificate", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "available", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "data-disk-type", "database-replication-enabled", "database-version", "day", "dump-file-path", "enabled", "etag", "expiration-time", "failover-replica", "failover-target", "follow-gae-application", "host-port", "hour", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "location-preference", "maintenance-window", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "project", "region", "replica-configuration", "replica-names", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "tier", "update-track", "username", "verify-server-certificate", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1245,7 +1252,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DatabaseInstance = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1258,7 +1265,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1271,7 +1278,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1294,10 +1301,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1316,7 +1323,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -1330,7 +1337,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1353,13 +1360,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1373,13 +1380,14 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "on-premises-configuration.kind" => Some(("onPremisesConfiguration.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "on-premises-configuration.host-port" => Some(("onPremisesConfiguration.hostPort", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "max-disk-size" => Some(("maxDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "failover-replica.available" => Some(("failoverReplica.available", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "failover-replica.name" => Some(("failoverReplica.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ipv6-address" => Some(("ipv6Address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "server-ca-cert.cert-serial-number" => Some(("serverCaCert.certSerialNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "server-ca-cert.kind" => Some(("serverCaCert.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1394,6 +1402,11 @@ impl<'n, 'a> Engine<'n, 'a> { "project" => Some(("project", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.kind" => Some(("settings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.data-disk-type" => Some(("settings.dataDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.maintenance-window.kind" => Some(("settings.maintenanceWindow.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.maintenance-window.update-track" => Some(("settings.maintenanceWindow.updateTrack", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.maintenance-window.day" => Some(("settings.maintenanceWindow.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "settings.maintenance-window.hour" => Some(("settings.maintenanceWindow.hour", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "settings.authorized-gae-applications" => Some(("settings.authorizedGaeApplications", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "settings.activation-policy" => Some(("settings.activationPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.backup-configuration.kind" => Some(("settings.backupConfiguration.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1402,10 +1415,10 @@ impl<'n, 'a> Engine<'n, 'a> { "settings.backup-configuration.binary-log-enabled" => Some(("settings.backupConfiguration.binaryLogEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.ip-configuration.ipv4-enabled" => Some(("settings.ipConfiguration.ipv4Enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.ip-configuration.require-ssl" => Some(("settings.ipConfiguration.requireSsl", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "settings.tier" => Some(("settings.tier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.crash-safe-replication-enabled" => Some(("settings.crashSafeReplicationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.database-replication-enabled" => Some(("settings.databaseReplicationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.replication-type" => Some(("settings.replicationType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "settings.crash-safe-replication-enabled" => Some(("settings.crashSafeReplicationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.tier" => Some(("settings.tier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.pricing-plan" => Some(("settings.pricingPlan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.settings-version" => Some(("settings.settingsVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.location-preference.kind" => Some(("settings.locationPreference.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1413,6 +1426,7 @@ impl<'n, 'a> Engine<'n, 'a> { "settings.location-preference.follow-gae-application" => Some(("settings.locationPreference.followGaeApplication", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.data-disk-size-gb" => Some(("settings.dataDiskSizeGb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "master-instance-name" => Some(("masterInstanceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "current-disk-size" => Some(("currentDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1433,9 +1447,9 @@ impl<'n, 'a> Engine<'n, 'a> { "database-version" => Some(("databaseVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "instance-type" => Some(("instanceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "max-disk-size" => Some(("maxDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "database-replication-enabled", "database-version", "dump-file-path", "enabled", "etag", "expiration-time", "failover-target", "follow-gae-application", "host-port", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "location-preference", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "project", "region", "replica-configuration", "replica-names", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "tier", "username", "verify-server-certificate", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "available", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "data-disk-type", "database-replication-enabled", "database-version", "day", "dump-file-path", "enabled", "etag", "expiration-time", "failover-replica", "failover-target", "follow-gae-application", "host-port", "hour", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "location-preference", "maintenance-window", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "project", "region", "replica-configuration", "replica-names", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "tier", "update-track", "username", "verify-server-certificate", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1446,7 +1460,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DatabaseInstance = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1459,7 +1473,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1472,7 +1486,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1495,10 +1509,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_promote_replica(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_promote_replica(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().promote_replica(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1511,7 +1525,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1524,7 +1538,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1547,10 +1561,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_reset_ssl_config(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_reset_ssl_config(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().reset_ssl_config(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1563,7 +1577,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1576,7 +1590,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1599,10 +1613,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_restart(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_restart(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().restart(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1615,7 +1629,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1628,7 +1642,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1651,13 +1665,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_restore_backup(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_restore_backup(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1671,8 +1685,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "restore-backup-context.instance-id" => Some(("restoreBackupContext.instanceId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "restore-backup-context.kind" => Some(("restoreBackupContext.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1689,7 +1703,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InstancesRestoreBackupRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().restore_backup(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1702,7 +1716,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1715,7 +1729,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1738,10 +1752,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_start_replica(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_start_replica(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().start_replica(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1754,7 +1768,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1767,7 +1781,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1790,10 +1804,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_stop_replica(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_stop_replica(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.instances().stop_replica(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1806,7 +1820,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1819,7 +1833,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1842,13 +1856,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _instances_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _instances_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1862,13 +1876,14 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "on-premises-configuration.kind" => Some(("onPremisesConfiguration.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "on-premises-configuration.host-port" => Some(("onPremisesConfiguration.hostPort", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "max-disk-size" => Some(("maxDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "failover-replica.available" => Some(("failoverReplica.available", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "failover-replica.name" => Some(("failoverReplica.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "ipv6-address" => Some(("ipv6Address", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "server-ca-cert.cert-serial-number" => Some(("serverCaCert.certSerialNumber", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "server-ca-cert.kind" => Some(("serverCaCert.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1883,6 +1898,11 @@ impl<'n, 'a> Engine<'n, 'a> { "project" => Some(("project", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "region" => Some(("region", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.kind" => Some(("settings.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.data-disk-type" => Some(("settings.dataDiskType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.maintenance-window.kind" => Some(("settings.maintenanceWindow.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.maintenance-window.update-track" => Some(("settings.maintenanceWindow.updateTrack", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.maintenance-window.day" => Some(("settings.maintenanceWindow.day", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), + "settings.maintenance-window.hour" => Some(("settings.maintenanceWindow.hour", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), "settings.authorized-gae-applications" => Some(("settings.authorizedGaeApplications", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "settings.activation-policy" => Some(("settings.activationPolicy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.backup-configuration.kind" => Some(("settings.backupConfiguration.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1891,10 +1911,10 @@ impl<'n, 'a> Engine<'n, 'a> { "settings.backup-configuration.binary-log-enabled" => Some(("settings.backupConfiguration.binaryLogEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.ip-configuration.ipv4-enabled" => Some(("settings.ipConfiguration.ipv4Enabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.ip-configuration.require-ssl" => Some(("settings.ipConfiguration.requireSsl", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), - "settings.tier" => Some(("settings.tier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "settings.crash-safe-replication-enabled" => Some(("settings.crashSafeReplicationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.database-replication-enabled" => Some(("settings.databaseReplicationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "settings.replication-type" => Some(("settings.replicationType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "settings.crash-safe-replication-enabled" => Some(("settings.crashSafeReplicationEnabled", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "settings.tier" => Some(("settings.tier", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.pricing-plan" => Some(("settings.pricingPlan", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.settings-version" => Some(("settings.settingsVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.location-preference.kind" => Some(("settings.locationPreference.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1902,6 +1922,7 @@ impl<'n, 'a> Engine<'n, 'a> { "settings.location-preference.follow-gae-application" => Some(("settings.locationPreference.followGaeApplication", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "settings.data-disk-size-gb" => Some(("settings.dataDiskSizeGb", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "master-instance-name" => Some(("masterInstanceName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "current-disk-size" => Some(("currentDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "state" => Some(("state", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1922,9 +1943,9 @@ impl<'n, 'a> Engine<'n, 'a> { "database-version" => Some(("databaseVersion", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "instance-type" => Some(("instanceType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "max-disk-size" => Some(("maxDiskSize", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "database-replication-enabled", "database-version", "dump-file-path", "enabled", "etag", "expiration-time", "failover-target", "follow-gae-application", "host-port", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "location-preference", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "project", "region", "replica-configuration", "replica-names", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "tier", "username", "verify-server-certificate", "zone"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["activation-policy", "authorized-gae-applications", "available", "backup-configuration", "binary-log-enabled", "ca-certificate", "cert", "cert-serial-number", "client-certificate", "client-key", "common-name", "connect-retry-interval", "crash-safe-replication-enabled", "create-time", "current-disk-size", "data-disk-size-gb", "data-disk-type", "database-replication-enabled", "database-version", "day", "dump-file-path", "enabled", "etag", "expiration-time", "failover-replica", "failover-target", "follow-gae-application", "host-port", "hour", "instance", "instance-type", "ip-configuration", "ipv4-enabled", "ipv6-address", "kind", "location-preference", "maintenance-window", "master-heartbeat-period", "master-instance-name", "max-disk-size", "mysql-replica-configuration", "name", "on-premises-configuration", "password", "pricing-plan", "project", "region", "replica-configuration", "replica-names", "replication-type", "require-ssl", "self-link", "server-ca-cert", "service-account-email-address", "settings", "settings-version", "sha1-fingerprint", "ssl-cipher", "start-time", "state", "tier", "update-track", "username", "verify-server-certificate", "zone"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -1935,7 +1956,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::DatabaseInstance = json::value::from_value(object).unwrap(); let mut call = self.hub.instances().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1948,7 +1969,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1961,7 +1982,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1984,10 +2005,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operations().get(opt.value_of("project").unwrap_or(""), opt.value_of("operation").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2000,7 +2021,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2013,7 +2034,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2036,10 +2057,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.operations().list(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2058,7 +2079,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -2072,7 +2093,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2095,13 +2116,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ssl_certs_create_ephemeral(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ssl_certs_create_ephemeral(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2115,8 +2136,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "public-key" => Some(("public_key", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -2131,7 +2152,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SslCertsCreateEphemeralRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.ssl_certs().create_ephemeral(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2144,7 +2165,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2157,7 +2178,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2180,10 +2201,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ssl_certs_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ssl_certs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ssl_certs().delete(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("sha1-fingerprint").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2196,7 +2217,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2209,7 +2230,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2232,10 +2253,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ssl_certs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ssl_certs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ssl_certs().get(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("sha1-fingerprint").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2248,7 +2269,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2261,7 +2282,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2284,13 +2305,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ssl_certs_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ssl_certs_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2304,8 +2325,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "common-name" => Some(("commonName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { @@ -2320,7 +2341,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SslCertsInsertRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.ssl_certs().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2333,7 +2354,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2346,7 +2367,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2369,10 +2390,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _ssl_certs_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _ssl_certs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.ssl_certs().list(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2385,7 +2406,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2398,7 +2419,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2421,10 +2442,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tiers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tiers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tiers().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2437,7 +2458,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2450,7 +2471,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2473,10 +2494,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().delete(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("host").unwrap_or(""), opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2489,7 +2510,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2502,7 +2523,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2525,13 +2546,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2545,8 +2566,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2567,7 +2588,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::User = json::value::from_value(object).unwrap(); let mut call = self.hub.users().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2580,7 +2601,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2593,7 +2614,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2616,10 +2637,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.users().list(opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2632,7 +2653,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2645,7 +2666,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2668,13 +2689,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _users_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _users_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2688,8 +2709,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2710,7 +2731,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::User = json::value::from_value(object).unwrap(); let mut call = self.hub.users().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("instance").unwrap_or(""), opt.value_of("host").unwrap_or(""), opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2723,7 +2744,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2736,7 +2757,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2959,14 +2980,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "sqladmin1-beta4-secret.json", + match cmn::application_secret_from_directory(&config_dir, "sqladmin1-beta4-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -2986,7 +3007,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -3025,7 +3046,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("backup-runs", "methods: 'delete', 'get' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes the backup taken by a backup run."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/backup-runs_delete", vec![ @@ -3059,7 +3080,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves a resource containing information about a backup run."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/backup-runs_get", vec![ @@ -3093,7 +3114,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all backup runs associated with a given instance and configuration in the reverse chronological order of the enqueued time."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/backup-runs_list", vec![ @@ -3124,7 +3145,7 @@ fn main() { ]), ("databases", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a resource containing information about a database inside a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/databases_delete", vec![ @@ -3158,7 +3179,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves a resource containing information about a database inside a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/databases_get", vec![ @@ -3192,7 +3213,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Inserts a resource containing information about a database inside a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/databases_insert", vec![ @@ -3226,7 +3247,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists databases in the specified Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/databases_list", vec![ @@ -3254,7 +3275,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/databases_patch", vec![ @@ -3294,7 +3315,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a resource containing information about a database inside a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/databases_update", vec![ @@ -3337,7 +3358,7 @@ fn main() { ]), ("flags", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"List all available database flags for Google Cloud SQL instances."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/flags_list", vec![ @@ -3356,7 +3377,7 @@ fn main() { ]), ("instances", "methods: 'clone', 'delete', 'export', 'failover', 'get', 'import', 'insert', 'list', 'patch', 'promote-replica', 'reset-ssl-config', 'restart', 'restore-backup', 'start-replica', 'stop-replica' and 'update'", vec![ - ("clone", + ("clone", Some(r##"Creates a Cloud SQL instance as a clone of the source instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_clone", vec![ @@ -3390,7 +3411,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_delete", vec![ @@ -3418,7 +3439,7 @@ fn main() { Some(false), Some(false)), ]), - ("export", + ("export", Some(r##"Exports data from a Cloud SQL instance to a Google Cloud Storage bucket as a MySQL dump file."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_export", vec![ @@ -3452,7 +3473,7 @@ fn main() { Some(false), Some(false)), ]), - ("failover", + ("failover", Some(r##"Failover the instance to its failover replica instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_failover", vec![ @@ -3486,7 +3507,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves a resource containing information about a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_get", vec![ @@ -3514,7 +3535,7 @@ fn main() { Some(false), Some(false)), ]), - ("import", + ("import", Some(r##"Imports data into a Cloud SQL instance from a MySQL dump file in Google Cloud Storage."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_import", vec![ @@ -3548,7 +3569,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_insert", vec![ @@ -3576,7 +3597,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists instances under a given project in the alphabetical order of the instance name."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_list", vec![ @@ -3598,7 +3619,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates settings of a Cloud SQL instance. Caution: This is not a partial update, so you must include values for all the settings that you want to retain. For partial updates, use patch.. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_patch", vec![ @@ -3632,7 +3653,7 @@ fn main() { Some(false), Some(false)), ]), - ("promote-replica", + ("promote-replica", Some(r##"Promotes the read replica instance to be a stand-alone Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_promote-replica", vec![ @@ -3660,7 +3681,7 @@ fn main() { Some(false), Some(false)), ]), - ("reset-ssl-config", + ("reset-ssl-config", Some(r##"Deletes all client certificates and generates a new server SSL certificate for the instance. The changes will not take effect until the instance is restarted. Existing instances without a server certificate will need to call this once to set a server certificate."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_reset-ssl-config", vec![ @@ -3688,7 +3709,7 @@ fn main() { Some(false), Some(false)), ]), - ("restart", + ("restart", Some(r##"Restarts a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_restart", vec![ @@ -3716,7 +3737,7 @@ fn main() { Some(false), Some(false)), ]), - ("restore-backup", + ("restore-backup", Some(r##"Restores a backup of a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_restore-backup", vec![ @@ -3750,7 +3771,7 @@ fn main() { Some(false), Some(false)), ]), - ("start-replica", + ("start-replica", Some(r##"Starts the replication in the read replica instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_start-replica", vec![ @@ -3778,7 +3799,7 @@ fn main() { Some(false), Some(false)), ]), - ("stop-replica", + ("stop-replica", Some(r##"Stops the replication in the read replica instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_stop-replica", vec![ @@ -3806,7 +3827,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates settings of a Cloud SQL instance. Caution: This is not a partial update, so you must include values for all the settings that you want to retain. For partial updates, use patch."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/instances_update", vec![ @@ -3843,7 +3864,7 @@ fn main() { ]), ("operations", "methods: 'get' and 'list'", vec![ - ("get", + ("get", Some(r##"Retrieves an instance operation that has been performed on an instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/operations_get", vec![ @@ -3871,7 +3892,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/operations_list", vec![ @@ -3902,7 +3923,7 @@ fn main() { ]), ("ssl-certs", "methods: 'create-ephemeral', 'delete', 'get', 'insert' and 'list'", vec![ - ("create-ephemeral", + ("create-ephemeral", Some(r##"Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/ssl-certs_create-ephemeral", vec![ @@ -3936,7 +3957,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes the SSL certificate. The change will not take effect until the instance is restarted."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/ssl-certs_delete", vec![ @@ -3970,7 +3991,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/ssl-certs_get", vec![ @@ -4004,7 +4025,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/ssl-certs_insert", vec![ @@ -4038,7 +4059,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all of the current SSL certificates for the instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/ssl-certs_list", vec![ @@ -4069,7 +4090,7 @@ fn main() { ]), ("tiers", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Lists all available service tiers for Google Cloud SQL, for example D1, D2. For related information, see Pricing."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/tiers_list", vec![ @@ -4094,7 +4115,7 @@ fn main() { ]), ("users", "methods: 'delete', 'insert', 'list' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a user from a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/users_delete", vec![ @@ -4134,7 +4155,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new user in a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/users_insert", vec![ @@ -4168,7 +4189,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists users in the specified Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/users_list", vec![ @@ -4196,7 +4217,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an existing user in a Cloud SQL instance."##), "Details at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli/users_update", vec![ @@ -4248,7 +4269,7 @@ fn main() { let mut app = App::new("sqladmin1-beta4") .author("Sebastian Thiel ") - .version("0.3.2+20151013") + .version("0.3.3+20151201") .about("API for Cloud SQL database instance management.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_sqladmin1_beta4_cli") .arg(Arg::with_name("url") @@ -4272,7 +4293,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -4283,7 +4304,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/sqladmin1_beta4/Cargo.toml b/gen/sqladmin1_beta4/Cargo.toml index 32e872e400..861f6a4309 100644 --- a/gen/sqladmin1_beta4/Cargo.toml +++ b/gen/sqladmin1_beta4/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-sqladmin1_beta4" -version = "0.1.10+20151013" +version = "0.1.11+20151201" authors = ["Sebastian Thiel "] description = "A complete library to interact with SQL Admin (protocol v1beta4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/sqladmin1_beta4" diff --git a/gen/sqladmin1_beta4/LICENSE.md b/gen/sqladmin1_beta4/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/sqladmin1_beta4/LICENSE.md +++ b/gen/sqladmin1_beta4/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/sqladmin1_beta4/README.md b/gen/sqladmin1_beta4/README.md index 69d6be8fe3..fd74a54a10 100644 --- a/gen/sqladmin1_beta4/README.md +++ b/gen/sqladmin1_beta4/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-sqladmin1_beta4` library allows access to all features of the *Google SQL Admin* service. -This documentation was generated from *SQL Admin* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *SQL Admin* crate version *0.1.11+20151201*, where *20151201* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *SQL Admin* *v1_beta4* API can be found at the [official documentation site](https://cloud.google.com/sql/docs/reference/latest). diff --git a/gen/sqladmin1_beta4/src/cmn.rs b/gen/sqladmin1_beta4/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/sqladmin1_beta4/src/cmn.rs +++ b/gen/sqladmin1_beta4/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/sqladmin1_beta4/src/lib.rs b/gen/sqladmin1_beta4/src/lib.rs index 7353610394..5474241162 100644 --- a/gen/sqladmin1_beta4/src/lib.rs +++ b/gen/sqladmin1_beta4/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *SQL Admin* crate version *0.1.10+20151013*, where *20151013* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *SQL Admin* crate version *0.1.11+20151201*, where *20151201* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *SQL Admin* *v1_beta4* API can be found at the //! [official documentation site](https://cloud.google.com/sql/docs/reference/latest). diff --git a/gen/sqladmin1_beta4/src/lib.rs.in b/gen/sqladmin1_beta4/src/lib.rs.in index cfe870c7d2..1fccd7475d 100644 --- a/gen/sqladmin1_beta4/src/lib.rs.in +++ b/gen/sqladmin1_beta4/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -136,7 +137,7 @@ impl<'a, C, A> SQLAdmin SQLAdmin { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -166,7 +167,7 @@ impl<'a, C, A> SQLAdmin } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -669,15 +670,18 @@ pub struct Flag { /// The database version this flag applies to. Can be MYSQL_5_5, MYSQL_5_6, or both. #[serde(rename="appliesTo")] pub applies_to: Option>, - /// The type of the flag. Flags are typed to being BOOLEAN, STRING, INTEGER or NONE. NONE is used for flags which do not take a value, such as skip_grant_tables. - #[serde(rename="type")] - pub type_: Option, /// For INTEGER flags, the maximum allowed value. #[serde(rename="maxValue")] pub max_value: Option, + /// Indicates whether changing this flag will trigger a database restart. Only applicable to Second Generation instances. + #[serde(rename="requiresRestart")] + pub requires_restart: Option, /// For INTEGER flags, the minimum allowed value. #[serde(rename="minValue")] pub min_value: Option, + /// The type of the flag. Flags are typed to being BOOLEAN, STRING, INTEGER or NONE. NONE is used for flags which do not take a value, such as skip_grant_tables. + #[serde(rename="type")] + pub type_: Option, } impl Resource for Flag {} @@ -798,6 +802,22 @@ pub struct DatabaseFlags { impl Part for DatabaseFlags {} +/// The name and status of the failover replica. Only applies to Second Generation instances. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct DatabaseInstanceFailoverReplica { + /// no description provided + pub available: Option, + /// no description provided + pub name: Option, +} + +impl NestedType for DatabaseInstanceFailoverReplica {} +impl Part for DatabaseInstanceFailoverReplica {} + + /// Flags list response. /// /// # Activities @@ -865,29 +885,15 @@ impl Part for MySqlReplicaConfiguration {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Settings { - /// The database flags passed to the instance at startup. - #[serde(rename="databaseFlags")] - pub database_flags: Option>, - /// This is always sql#settings. - pub kind: Option, - /// The App Engine app IDs that can access this instance. - #[serde(rename="authorizedGaeApplications")] - pub authorized_gae_applications: Option>, /// The activation policy for this instance. This specifies when the instance should be activated and is applicable only when the instance state is RUNNABLE. This can be one of the following. /// ALWAYS: The instance should always be active. /// NEVER: The instance should never be activated. /// ON_DEMAND: The instance is activated upon receiving requests. #[serde(rename="activationPolicy")] pub activation_policy: Option, - /// The daily backup configuration for the instance. - #[serde(rename="backupConfiguration")] - pub backup_configuration: Option, /// The settings for IP Management. This allows to enable or disable the instance IP and manage which external networks can connect to the instance. #[serde(rename="ipConfiguration")] pub ip_configuration: Option, - /// Configuration specific to read replica instances. Indicates whether database flags for crash-safe replication are enabled. - #[serde(rename="crashSafeReplicationEnabled")] - pub crash_safe_replication_enabled: Option, /// Configuration specific to read replica instances. Indicates whether replication is enabled or not. #[serde(rename="databaseReplicationEnabled")] pub database_replication_enabled: Option, @@ -896,18 +902,38 @@ pub struct Settings { pub replication_type: Option, /// The tier of service for this instance, for example D1, D2. For more information, see pricing. pub tier: Option, - /// The pricing plan for this instance. This can be either PER_USE or PACKAGE. - #[serde(rename="pricingPlan")] - pub pricing_plan: Option, /// The version of instance settings. This is a required field for update method to make sure concurrent updates are handled properly. During update, use the most recent settingsVersion value for this instance and do not try to update this value. #[serde(rename="settingsVersion")] pub settings_version: Option, /// The location preference settings. This allows the instance to be located as near as possible to either an App Engine app or GCE zone for better performance. #[serde(rename="locationPreference")] pub location_preference: Option, - /// The size of data disk for the performance instance, specified in GB. Setting this value for non-performance instances will result in an error. + /// The size of data disk, in GB. Only supported for 2nd Generation instances. The data disk size minimum is 10GB. #[serde(rename="dataDiskSizeGb")] pub data_disk_size_gb: Option, + /// The database flags passed to the instance at startup. + #[serde(rename="databaseFlags")] + pub database_flags: Option>, + /// This is always sql#settings. + pub kind: Option, + /// The type of data disk. Only supported for 2nd Generation instances. The default type is SSD. + #[serde(rename="dataDiskType")] + pub data_disk_type: Option, + /// The App Engine app IDs that can access this instance. + #[serde(rename="authorizedGaeApplications")] + pub authorized_gae_applications: Option>, + /// The daily backup configuration for the instance. + #[serde(rename="backupConfiguration")] + pub backup_configuration: Option, + /// Configuration specific to read replica instances. Indicates whether database flags for crash-safe replication are enabled. + #[serde(rename="crashSafeReplicationEnabled")] + pub crash_safe_replication_enabled: Option, + /// The pricing plan for this instance. This can be either PER_USE or PACKAGE. + #[serde(rename="pricingPlan")] + pub pricing_plan: Option, + /// The maintenance window for this instance. This specifies when the instance may be restarted for maintenance purposes. + #[serde(rename="maintenanceWindow")] + pub maintenance_window: Option, } impl Part for Settings {} @@ -1009,6 +1035,26 @@ pub struct SslCertsCreateEphemeralRequest { impl RequestValue for SslCertsCreateEphemeralRequest {} +/// Maintenance window. This specifies when a v2 Cloud SQL instance should preferably be restarted for system maintenance puruposes. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct MaintenanceWindow { + /// This is always sql#maintenanceWindow. + pub kind: Option, + /// no description provided + #[serde(rename="updateTrack")] + pub update_track: Option, + /// day of week (1-7), starting on Monday. + pub day: Option, + /// hour of day - 0 to 23. + pub hour: Option, +} + +impl Part for MaintenanceWindow {} + + /// Database instances list response. /// /// # Activities @@ -1088,9 +1134,9 @@ impl ResponseResult for UsersListResponse {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DatabaseInstance { - /// The maximum disk size of the instance in bytes. - #[serde(rename="maxDiskSize")] - pub max_disk_size: Option, + /// The name and status of the failover replica. Only applies to Second Generation instances. + #[serde(rename="failoverReplica")] + pub failover_replica: Option, /// The replicas of the instance. #[serde(rename="replicaNames")] pub replica_names: Option>, @@ -1112,6 +1158,9 @@ pub struct DatabaseInstance { /// READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica. #[serde(rename="instanceType")] pub instance_type: Option, + /// The maximum disk size of the instance in bytes. + #[serde(rename="maxDiskSize")] + pub max_disk_size: Option, /// Configuration specific to on-premises instances. #[serde(rename="onPremisesConfiguration")] pub on_premises_configuration: Option, @@ -2529,7 +2578,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.operations.list", + dlg.begin(MethodInfo { id: "sql.operations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2578,7 +2627,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2614,7 +2663,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2624,10 +2673,10 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2660,7 +2709,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> OperationListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2670,7 +2719,7 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> OperationListCall<'a, C, A> { self._instance = new_value.to_string(); @@ -2702,12 +2751,12 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2724,17 +2773,17 @@ impl<'a, C, A> OperationListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2797,7 +2846,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.operations.get", + dlg.begin(MethodInfo { id: "sql.operations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2840,7 +2889,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2876,7 +2925,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2886,10 +2935,10 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2922,7 +2971,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -2932,7 +2981,7 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *operation* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operation(mut self, new_value: &str) -> OperationGetCall<'a, C, A> { self._operation = new_value.to_string(); @@ -2950,12 +2999,12 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2972,17 +3021,17 @@ impl<'a, C, A> OperationGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> OperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> OperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3044,7 +3093,7 @@ impl<'a, C, A> TierListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.tiers.list", + dlg.begin(MethodInfo { id: "sql.tiers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3086,7 +3135,7 @@ impl<'a, C, A> TierListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3122,7 +3171,7 @@ impl<'a, C, A> TierListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3132,10 +3181,10 @@ impl<'a, C, A> TierListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3168,7 +3217,7 @@ impl<'a, C, A> TierListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TierListCall<'a, C, A> { self._project = new_value.to_string(); @@ -3186,12 +3235,12 @@ impl<'a, C, A> TierListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3208,17 +3257,17 @@ impl<'a, C, A> TierListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TierListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TierListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3281,7 +3330,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.users.list", + dlg.begin(MethodInfo { id: "sql.users.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3324,7 +3373,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3360,7 +3409,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3370,10 +3419,10 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3406,7 +3455,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UserListCall<'a, C, A> { self._project = new_value.to_string(); @@ -3416,7 +3465,7 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> UserListCall<'a, C, A> { self._instance = new_value.to_string(); @@ -3434,12 +3483,12 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3456,17 +3505,17 @@ impl<'a, C, A> UserListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3531,7 +3580,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.users.delete", + dlg.begin(MethodInfo { id: "sql.users.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3576,7 +3625,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3612,7 +3661,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3622,10 +3671,10 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3658,7 +3707,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UserDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -3668,7 +3717,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> UserDeleteCall<'a, C, A> { self._instance = new_value.to_string(); @@ -3678,7 +3727,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *host* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn host(mut self, new_value: &str) -> UserDeleteCall<'a, C, A> { self._host = new_value.to_string(); @@ -3688,7 +3737,7 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *name* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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) -> UserDeleteCall<'a, C, A> { self._name = new_value.to_string(); @@ -3706,12 +3755,12 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3728,17 +3777,17 @@ impl<'a, C, A> UserDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3810,7 +3859,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.users.update", + dlg.begin(MethodInfo { id: "sql.users.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -3855,14 +3904,14 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3906,7 +3955,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3916,10 +3965,10 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3951,7 +4000,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: User) -> UserUpdateCall<'a, C, A> { self._request = new_value; @@ -3961,7 +4010,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UserUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -3971,7 +4020,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> UserUpdateCall<'a, C, A> { self._instance = new_value.to_string(); @@ -3981,7 +4030,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *host* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn host(mut self, new_value: &str) -> UserUpdateCall<'a, C, A> { self._host = new_value.to_string(); @@ -3991,7 +4040,7 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *name* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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) -> UserUpdateCall<'a, C, A> { self._name = new_value.to_string(); @@ -4009,12 +4058,12 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4031,17 +4080,17 @@ impl<'a, C, A> UserUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4111,7 +4160,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.users.insert", + dlg.begin(MethodInfo { id: "sql.users.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4154,14 +4203,14 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4205,7 +4254,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4215,10 +4264,10 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4250,7 +4299,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: User) -> UserInsertCall<'a, C, A> { self._request = new_value; @@ -4260,7 +4309,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> UserInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -4270,7 +4319,7 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> UserInsertCall<'a, C, A> { self._instance = new_value.to_string(); @@ -4288,12 +4337,12 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4310,17 +4359,17 @@ impl<'a, C, A> UserInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UserInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UserInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4390,7 +4439,7 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.failover", + dlg.begin(MethodInfo { id: "sql.instances.failover", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4433,14 +4482,14 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4484,7 +4533,7 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4494,10 +4543,10 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4529,7 +4578,7 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstancesFailoverRequest) -> InstanceFailoverCall<'a, C, A> { self._request = new_value; @@ -4539,7 +4588,7 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceFailoverCall<'a, C, A> { self._project = new_value.to_string(); @@ -4549,7 +4598,7 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceFailoverCall<'a, C, A> { self._instance = new_value.to_string(); @@ -4567,12 +4616,12 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4589,17 +4638,17 @@ impl<'a, C, A> InstanceFailoverCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceFailoverCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceFailoverCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4662,7 +4711,7 @@ impl<'a, C, A> InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.resetSslConfig", + dlg.begin(MethodInfo { id: "sql.instances.resetSslConfig", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4705,7 +4754,7 @@ impl<'a, C, A> InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4741,7 +4790,7 @@ impl<'a, C, A> InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4751,10 +4800,10 @@ impl<'a, C, A> InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut InstanceResetSslConfigCall<'a, C, A> { self._project = new_value.to_string(); @@ -4797,7 +4846,7 @@ impl<'a, C, A> InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut InstanceResetSslConfigCall<'a, C, A> { self._instance = new_value.to_string(); @@ -4815,12 +4864,12 @@ impl<'a, C, A> InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut InstanceResetSslConfigCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceResetSslConfigCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceResetSslConfigCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4910,7 +4959,7 @@ impl<'a, C, A> InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.promoteReplica", + dlg.begin(MethodInfo { id: "sql.instances.promoteReplica", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -4953,7 +5002,7 @@ impl<'a, C, A> InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4989,7 +5038,7 @@ impl<'a, C, A> InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4999,10 +5048,10 @@ impl<'a, C, A> InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut InstancePromoteReplicaCall<'a, C, A> { self._project = new_value.to_string(); @@ -5045,7 +5094,7 @@ impl<'a, C, A> InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut InstancePromoteReplicaCall<'a, C, A> { self._instance = new_value.to_string(); @@ -5063,12 +5112,12 @@ impl<'a, C, A> InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut InstancePromoteReplicaCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstancePromoteReplicaCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstancePromoteReplicaCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5158,7 +5207,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.get", + dlg.begin(MethodInfo { id: "sql.instances.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -5201,7 +5250,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5237,7 +5286,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5247,10 +5296,10 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5283,7 +5332,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -5293,7 +5342,7 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceGetCall<'a, C, A> { self._instance = new_value.to_string(); @@ -5311,12 +5360,12 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5333,17 +5382,17 @@ impl<'a, C, A> InstanceGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5413,7 +5462,7 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.patch", + dlg.begin(MethodInfo { id: "sql.instances.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -5456,14 +5505,14 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5507,7 +5556,7 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5517,10 +5566,10 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5552,7 +5601,7 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: DatabaseInstance) -> InstancePatchCall<'a, C, A> { self._request = new_value; @@ -5562,7 +5611,7 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstancePatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -5572,7 +5621,7 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstancePatchCall<'a, C, A> { self._instance = new_value.to_string(); @@ -5590,12 +5639,12 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5612,17 +5661,17 @@ impl<'a, C, A> InstancePatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstancePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstancePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5692,7 +5741,7 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.clone", + dlg.begin(MethodInfo { id: "sql.instances.clone", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -5735,14 +5784,14 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5786,7 +5835,7 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5796,10 +5845,10 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5831,7 +5880,7 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstancesCloneRequest) -> InstanceCloneCall<'a, C, A> { self._request = new_value; @@ -5841,7 +5890,7 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceCloneCall<'a, C, A> { self._project = new_value.to_string(); @@ -5851,7 +5900,7 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceCloneCall<'a, C, A> { self._instance = new_value.to_string(); @@ -5869,12 +5918,12 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5891,17 +5940,17 @@ impl<'a, C, A> InstanceCloneCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceCloneCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceCloneCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5964,7 +6013,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.delete", + dlg.begin(MethodInfo { id: "sql.instances.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -6007,7 +6056,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6043,7 +6092,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6053,10 +6102,10 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6089,7 +6138,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -6099,7 +6148,7 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceDeleteCall<'a, C, A> { self._instance = new_value.to_string(); @@ -6117,12 +6166,12 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6139,17 +6188,17 @@ impl<'a, C, A> InstanceDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6212,7 +6261,7 @@ impl<'a, C, A> InstanceStopReplicaCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.stopReplica", + dlg.begin(MethodInfo { id: "sql.instances.stopReplica", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -6255,7 +6304,7 @@ impl<'a, C, A> InstanceStopReplicaCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6291,7 +6340,7 @@ impl<'a, C, A> InstanceStopReplicaCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6301,10 +6350,10 @@ impl<'a, C, A> InstanceStopReplicaCall<'a, C, A> where C: BorrowMut InstanceStopReplicaCall<'a, C, A> where C: BorrowMut InstanceStopReplicaCall<'a, C, A> { self._project = new_value.to_string(); @@ -6347,7 +6396,7 @@ impl<'a, C, A> InstanceStopReplicaCall<'a, C, A> where C: BorrowMut InstanceStopReplicaCall<'a, C, A> { self._instance = new_value.to_string(); @@ -6365,12 +6414,12 @@ impl<'a, C, A> InstanceStopReplicaCall<'a, C, A> where C: BorrowMut InstanceStopReplicaCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceStopReplicaCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceStopReplicaCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6460,7 +6509,7 @@ impl<'a, C, A> InstanceStartReplicaCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.startReplica", + dlg.begin(MethodInfo { id: "sql.instances.startReplica", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -6503,7 +6552,7 @@ impl<'a, C, A> InstanceStartReplicaCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6539,7 +6588,7 @@ impl<'a, C, A> InstanceStartReplicaCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6549,10 +6598,10 @@ impl<'a, C, A> InstanceStartReplicaCall<'a, C, A> where C: BorrowMut InstanceStartReplicaCall<'a, C, A> where C: BorrowMut InstanceStartReplicaCall<'a, C, A> { self._project = new_value.to_string(); @@ -6595,7 +6644,7 @@ impl<'a, C, A> InstanceStartReplicaCall<'a, C, A> where C: BorrowMut InstanceStartReplicaCall<'a, C, A> { self._instance = new_value.to_string(); @@ -6613,12 +6662,12 @@ impl<'a, C, A> InstanceStartReplicaCall<'a, C, A> where C: BorrowMut InstanceStartReplicaCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceStartReplicaCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceStartReplicaCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6714,7 +6763,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.insert", + dlg.begin(MethodInfo { id: "sql.instances.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -6756,14 +6805,14 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6807,7 +6856,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6817,10 +6866,10 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6852,7 +6901,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: DatabaseInstance) -> InstanceInsertCall<'a, C, A> { self._request = new_value; @@ -6862,7 +6911,7 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -6880,12 +6929,12 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6902,17 +6951,17 @@ impl<'a, C, A> InstanceInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6978,7 +7027,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.list", + dlg.begin(MethodInfo { id: "sql.instances.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -7026,7 +7075,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7062,7 +7111,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7072,10 +7121,10 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7108,7 +7157,7 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceListCall<'a, C, A> { self._project = new_value.to_string(); @@ -7140,12 +7189,12 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7162,17 +7211,17 @@ impl<'a, C, A> InstanceListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7242,7 +7291,7 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.import", + dlg.begin(MethodInfo { id: "sql.instances.import", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -7285,14 +7334,14 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7336,7 +7385,7 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7346,10 +7395,10 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7381,7 +7430,7 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstancesImportRequest) -> InstanceImportCall<'a, C, A> { self._request = new_value; @@ -7391,7 +7440,7 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceImportCall<'a, C, A> { self._project = new_value.to_string(); @@ -7401,7 +7450,7 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceImportCall<'a, C, A> { self._instance = new_value.to_string(); @@ -7419,12 +7468,12 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7441,17 +7490,17 @@ impl<'a, C, A> InstanceImportCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceImportCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceImportCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7521,7 +7570,7 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.update", + dlg.begin(MethodInfo { id: "sql.instances.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -7564,14 +7613,14 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7615,7 +7664,7 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7625,10 +7674,10 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7660,7 +7709,7 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: DatabaseInstance) -> InstanceUpdateCall<'a, C, A> { self._request = new_value; @@ -7670,7 +7719,7 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -7680,7 +7729,7 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceUpdateCall<'a, C, A> { self._instance = new_value.to_string(); @@ -7698,12 +7747,12 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7720,17 +7769,17 @@ impl<'a, C, A> InstanceUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7793,7 +7842,7 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.restart", + dlg.begin(MethodInfo { id: "sql.instances.restart", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -7836,7 +7885,7 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7872,7 +7921,7 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7882,10 +7931,10 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7918,7 +7967,7 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceRestartCall<'a, C, A> { self._project = new_value.to_string(); @@ -7928,7 +7977,7 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceRestartCall<'a, C, A> { self._instance = new_value.to_string(); @@ -7946,12 +7995,12 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7968,17 +8017,17 @@ impl<'a, C, A> InstanceRestartCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceRestartCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceRestartCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8048,7 +8097,7 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.export", + dlg.begin(MethodInfo { id: "sql.instances.export", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -8091,14 +8140,14 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8142,7 +8191,7 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8152,10 +8201,10 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8187,7 +8236,7 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: InstancesExportRequest) -> InstanceExportCall<'a, C, A> { self._request = new_value; @@ -8197,7 +8246,7 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> InstanceExportCall<'a, C, A> { self._project = new_value.to_string(); @@ -8207,7 +8256,7 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> InstanceExportCall<'a, C, A> { self._instance = new_value.to_string(); @@ -8225,12 +8274,12 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8247,17 +8296,17 @@ impl<'a, C, A> InstanceExportCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> InstanceExportCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceExportCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8327,7 +8376,7 @@ impl<'a, C, A> InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.instances.restoreBackup", + dlg.begin(MethodInfo { id: "sql.instances.restoreBackup", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -8370,14 +8419,14 @@ impl<'a, C, A> InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8421,7 +8470,7 @@ impl<'a, C, A> InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8431,10 +8480,10 @@ impl<'a, C, A> InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut InstanceRestoreBackupCall<'a, C, A> { self._request = new_value; @@ -8476,7 +8525,7 @@ impl<'a, C, A> InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut InstanceRestoreBackupCall<'a, C, A> { self._project = new_value.to_string(); @@ -8486,7 +8535,7 @@ impl<'a, C, A> InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut InstanceRestoreBackupCall<'a, C, A> { self._instance = new_value.to_string(); @@ -8504,12 +8553,12 @@ impl<'a, C, A> InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut InstanceRestoreBackupCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> InstanceRestoreBackupCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> InstanceRestoreBackupCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8597,7 +8646,7 @@ impl<'a, C, A> FlagListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.flags.list", + dlg.begin(MethodInfo { id: "sql.flags.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -8617,7 +8666,7 @@ impl<'a, C, A> FlagListCall<'a, C, A> where C: BorrowMut, A: oaut self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8653,7 +8702,7 @@ impl<'a, C, A> FlagListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8663,10 +8712,10 @@ impl<'a, C, A> FlagListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8707,12 +8756,12 @@ impl<'a, C, A> FlagListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8729,17 +8778,17 @@ impl<'a, C, A> FlagListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> FlagListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FlagListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8803,7 +8852,7 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.databases.delete", + dlg.begin(MethodInfo { id: "sql.databases.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -8847,7 +8896,7 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8883,7 +8932,7 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8893,10 +8942,10 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8929,7 +8978,7 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DatabaseDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -8939,7 +8988,7 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> DatabaseDeleteCall<'a, C, A> { self._instance = new_value.to_string(); @@ -8949,7 +8998,7 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *database* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn database(mut self, new_value: &str) -> DatabaseDeleteCall<'a, C, A> { self._database = new_value.to_string(); @@ -8967,12 +9016,12 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8989,17 +9038,17 @@ impl<'a, C, A> DatabaseDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatabaseDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatabaseDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9070,7 +9119,7 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.databases.patch", + dlg.begin(MethodInfo { id: "sql.databases.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -9114,14 +9163,14 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9165,7 +9214,7 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9175,10 +9224,10 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9210,7 +9259,7 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Database) -> DatabasePatchCall<'a, C, A> { self._request = new_value; @@ -9220,7 +9269,7 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DatabasePatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -9230,7 +9279,7 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> DatabasePatchCall<'a, C, A> { self._instance = new_value.to_string(); @@ -9240,7 +9289,7 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *database* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn database(mut self, new_value: &str) -> DatabasePatchCall<'a, C, A> { self._database = new_value.to_string(); @@ -9258,12 +9307,12 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9280,17 +9329,17 @@ impl<'a, C, A> DatabasePatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatabasePatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatabasePatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9353,7 +9402,7 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.databases.list", + dlg.begin(MethodInfo { id: "sql.databases.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -9396,7 +9445,7 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9432,7 +9481,7 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9442,10 +9491,10 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9478,7 +9527,7 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DatabaseListCall<'a, C, A> { self._project = new_value.to_string(); @@ -9488,7 +9537,7 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> DatabaseListCall<'a, C, A> { self._instance = new_value.to_string(); @@ -9506,12 +9555,12 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9528,17 +9577,17 @@ impl<'a, C, A> DatabaseListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatabaseListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatabaseListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9608,7 +9657,7 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.databases.insert", + dlg.begin(MethodInfo { id: "sql.databases.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -9651,14 +9700,14 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9702,7 +9751,7 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9712,10 +9761,10 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9747,7 +9796,7 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Database) -> DatabaseInsertCall<'a, C, A> { self._request = new_value; @@ -9757,7 +9806,7 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DatabaseInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -9767,7 +9816,7 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> DatabaseInsertCall<'a, C, A> { self._instance = new_value.to_string(); @@ -9785,12 +9834,12 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9807,17 +9856,17 @@ impl<'a, C, A> DatabaseInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatabaseInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatabaseInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9881,7 +9930,7 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.databases.get", + dlg.begin(MethodInfo { id: "sql.databases.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -9925,7 +9974,7 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9961,7 +10010,7 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9971,10 +10020,10 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10007,7 +10056,7 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DatabaseGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -10017,7 +10066,7 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> DatabaseGetCall<'a, C, A> { self._instance = new_value.to_string(); @@ -10027,7 +10076,7 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *database* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn database(mut self, new_value: &str) -> DatabaseGetCall<'a, C, A> { self._database = new_value.to_string(); @@ -10045,12 +10094,12 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10067,17 +10116,17 @@ impl<'a, C, A> DatabaseGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatabaseGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatabaseGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10148,7 +10197,7 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.databases.update", + dlg.begin(MethodInfo { id: "sql.databases.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -10192,14 +10241,14 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10243,7 +10292,7 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10253,10 +10302,10 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10288,7 +10337,7 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Database) -> DatabaseUpdateCall<'a, C, A> { self._request = new_value; @@ -10298,7 +10347,7 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> DatabaseUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -10308,7 +10357,7 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> DatabaseUpdateCall<'a, C, A> { self._instance = new_value.to_string(); @@ -10318,7 +10367,7 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *database* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn database(mut self, new_value: &str) -> DatabaseUpdateCall<'a, C, A> { self._database = new_value.to_string(); @@ -10336,12 +10385,12 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10358,17 +10407,17 @@ impl<'a, C, A> DatabaseUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DatabaseUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DatabaseUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10438,7 +10487,7 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.sslCerts.insert", + dlg.begin(MethodInfo { id: "sql.sslCerts.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -10481,14 +10530,14 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10532,7 +10581,7 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10542,10 +10591,10 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10577,7 +10626,7 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: SslCertsInsertRequest) -> SslCertInsertCall<'a, C, A> { self._request = new_value; @@ -10587,7 +10636,7 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> SslCertInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -10597,7 +10646,7 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> SslCertInsertCall<'a, C, A> { self._instance = new_value.to_string(); @@ -10615,12 +10664,12 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10637,17 +10686,17 @@ impl<'a, C, A> SslCertInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SslCertInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SslCertInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10711,7 +10760,7 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.sslCerts.delete", + dlg.begin(MethodInfo { id: "sql.sslCerts.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -10755,7 +10804,7 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10791,7 +10840,7 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10801,10 +10850,10 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10837,7 +10886,7 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> SslCertDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -10847,7 +10896,7 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> SslCertDeleteCall<'a, C, A> { self._instance = new_value.to_string(); @@ -10857,7 +10906,7 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *sha1 fingerprint* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sha1_fingerprint(mut self, new_value: &str) -> SslCertDeleteCall<'a, C, A> { self._sha1_fingerprint = new_value.to_string(); @@ -10875,12 +10924,12 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10897,17 +10946,17 @@ impl<'a, C, A> SslCertDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SslCertDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SslCertDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10971,7 +11020,7 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.sslCerts.get", + dlg.begin(MethodInfo { id: "sql.sslCerts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -11015,7 +11064,7 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11051,7 +11100,7 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11061,10 +11110,10 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11097,7 +11146,7 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> SslCertGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -11107,7 +11156,7 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> SslCertGetCall<'a, C, A> { self._instance = new_value.to_string(); @@ -11117,7 +11166,7 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *sha1 fingerprint* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn sha1_fingerprint(mut self, new_value: &str) -> SslCertGetCall<'a, C, A> { self._sha1_fingerprint = new_value.to_string(); @@ -11135,12 +11184,12 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11157,17 +11206,17 @@ impl<'a, C, A> SslCertGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SslCertGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SslCertGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11237,7 +11286,7 @@ impl<'a, C, A> SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.sslCerts.createEphemeral", + dlg.begin(MethodInfo { id: "sql.sslCerts.createEphemeral", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -11280,14 +11329,14 @@ impl<'a, C, A> SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11331,7 +11380,7 @@ impl<'a, C, A> SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11341,10 +11390,10 @@ impl<'a, C, A> SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut SslCertCreateEphemeralCall<'a, C, A> { self._request = new_value; @@ -11386,7 +11435,7 @@ impl<'a, C, A> SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut SslCertCreateEphemeralCall<'a, C, A> { self._project = new_value.to_string(); @@ -11396,7 +11445,7 @@ impl<'a, C, A> SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut SslCertCreateEphemeralCall<'a, C, A> { self._instance = new_value.to_string(); @@ -11414,12 +11463,12 @@ impl<'a, C, A> SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut SslCertCreateEphemeralCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SslCertCreateEphemeralCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SslCertCreateEphemeralCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11509,7 +11558,7 @@ impl<'a, C, A> SslCertListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.sslCerts.list", + dlg.begin(MethodInfo { id: "sql.sslCerts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -11552,7 +11601,7 @@ impl<'a, C, A> SslCertListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11588,7 +11637,7 @@ impl<'a, C, A> SslCertListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11598,10 +11647,10 @@ impl<'a, C, A> SslCertListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11634,7 +11683,7 @@ impl<'a, C, A> SslCertListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> SslCertListCall<'a, C, A> { self._project = new_value.to_string(); @@ -11644,7 +11693,7 @@ impl<'a, C, A> SslCertListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> SslCertListCall<'a, C, A> { self._instance = new_value.to_string(); @@ -11662,12 +11711,12 @@ impl<'a, C, A> SslCertListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11684,17 +11733,17 @@ impl<'a, C, A> SslCertListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SslCertListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SslCertListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11761,7 +11810,7 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.backupRuns.list", + dlg.begin(MethodInfo { id: "sql.backupRuns.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -11810,7 +11859,7 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11846,7 +11895,7 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11856,10 +11905,10 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11892,7 +11941,7 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> BackupRunListCall<'a, C, A> { self._project = new_value.to_string(); @@ -11902,7 +11951,7 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> BackupRunListCall<'a, C, A> { self._instance = new_value.to_string(); @@ -11934,12 +11983,12 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11956,17 +12005,17 @@ impl<'a, C, A> BackupRunListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BackupRunListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackupRunListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12030,7 +12079,7 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.backupRuns.get", + dlg.begin(MethodInfo { id: "sql.backupRuns.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -12074,7 +12123,7 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12110,7 +12159,7 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12120,10 +12169,10 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12156,7 +12205,7 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> BackupRunGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -12166,7 +12215,7 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> BackupRunGetCall<'a, C, A> { self._instance = new_value.to_string(); @@ -12176,7 +12225,7 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> BackupRunGetCall<'a, C, A> { self._id = new_value.to_string(); @@ -12194,12 +12243,12 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12216,17 +12265,17 @@ impl<'a, C, A> BackupRunGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BackupRunGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackupRunGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12290,7 +12339,7 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "sql.backupRuns.delete", + dlg.begin(MethodInfo { id: "sql.backupRuns.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -12334,7 +12383,7 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12370,7 +12419,7 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12380,10 +12429,10 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12416,7 +12465,7 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> BackupRunDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -12426,7 +12475,7 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *instance* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn instance(mut self, new_value: &str) -> BackupRunDeleteCall<'a, C, A> { self._instance = new_value.to_string(); @@ -12436,7 +12485,7 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> BackupRunDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -12454,12 +12503,12 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12476,17 +12525,17 @@ impl<'a, C, A> BackupRunDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BackupRunDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BackupRunDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/storage1-cli/Cargo.toml b/gen/storage1-cli/Cargo.toml index 796c52b529..8d5a77af80 100644 --- a/gen/storage1-cli/Cargo.toml +++ b/gen/storage1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-storage1-cli" -version = "0.3.2+20151007" +version = "0.3.3+20151229" authors = ["Sebastian Thiel "] description = "A complete library to interact with storage (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/storage1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/storage1-cli/LICENSE.md b/gen/storage1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/storage1-cli/LICENSE.md +++ b/gen/storage1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/storage1-cli/README.md b/gen/storage1-cli/README.md index f0f05b2653..4f503219b4 100644 --- a/gen/storage1-cli/README.md +++ b/gen/storage1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *storage* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/storage1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/storage1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/storage1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/storage1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/storage1-cli). # Usage -This documentation was generated from the *storage* API at revision *20151007*. The CLI is at version *0.3.2*. +This documentation was generated from the *storage* API at revision *20151229*. The CLI is at version *0.3.3*. ```bash storage1 [options] @@ -73,18 +73,18 @@ storage1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/storage1-cli/mkdocs.yml b/gen/storage1-cli/mkdocs.yml index 3af7e6c665..517593fa77 100644 --- a/gen/storage1-cli/mkdocs.yml +++ b/gen/storage1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: storage v0.3.2+20151007 +site_name: storage v0.3.3+20151229 site_url: http://byron.github.io/google-apis-rs/google-storage1-cli site_description: Write integrating applications with bcore @@ -47,5 +47,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/storage1-cli/src/main.rs b/gen/storage1-cli/src/main.rs index 3adf6b6929..ad120f1bb5 100644 --- a/gen/storage1-cli/src/main.rs +++ b/gen/storage1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Storage>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _bucket_access_controls_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _bucket_access_controls_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.bucket_access_controls().delete(opt.value_of("bucket").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -89,10 +89,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _bucket_access_controls_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _bucket_access_controls_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.bucket_access_controls().get(opt.value_of("bucket").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -105,7 +105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -141,13 +141,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _bucket_access_controls_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _bucket_access_controls_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -161,8 +161,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "bucket" => Some(("bucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -188,7 +188,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::BucketAccessControl = json::value::from_value(object).unwrap(); let mut call = self.hub.bucket_access_controls().insert(request, opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -201,7 +201,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -214,7 +214,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -237,10 +237,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _bucket_access_controls_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _bucket_access_controls_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.bucket_access_controls().list(opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -253,7 +253,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -266,7 +266,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -289,13 +289,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _bucket_access_controls_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _bucket_access_controls_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -309,8 +309,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "bucket" => Some(("bucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -336,7 +336,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::BucketAccessControl = json::value::from_value(object).unwrap(); let mut call = self.hub.bucket_access_controls().patch(request, opt.value_of("bucket").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -349,7 +349,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -362,7 +362,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -385,13 +385,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _bucket_access_controls_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _bucket_access_controls_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -405,8 +405,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "bucket" => Some(("bucket", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -432,7 +432,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::BucketAccessControl = json::value::from_value(object).unwrap(); let mut call = self.hub.bucket_access_controls().update(request, opt.value_of("bucket").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -445,7 +445,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -458,7 +458,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -481,10 +481,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _buckets_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _buckets_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.buckets().delete(opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "if-metageneration-not-match" => { @@ -503,7 +503,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-metageneration-not-match", "if-metageneration-match"].iter().map(|v|*v)); @@ -517,7 +517,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -532,10 +532,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _buckets_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _buckets_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.buckets().get(opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -557,7 +557,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-metageneration-match", "if-metageneration-not-match", "projection"].iter().map(|v|*v)); @@ -571,7 +571,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -594,13 +594,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _buckets_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _buckets_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -614,8 +614,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "website.not-found-page" => Some(("website.notFoundPage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "website.main-page-suffix" => Some(("website.mainPageSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -647,7 +647,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Bucket = json::value::from_value(object).unwrap(); let mut call = self.hub.buckets().insert(request, opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -669,7 +669,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["predefined-acl", "projection", "predefined-default-object-acl"].iter().map(|v|*v)); @@ -683,7 +683,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -706,10 +706,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _buckets_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _buckets_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.buckets().list(opt.value_of("project").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -734,7 +734,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "prefix", "projection", "max-results"].iter().map(|v|*v)); @@ -748,7 +748,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -771,13 +771,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _buckets_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _buckets_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -791,8 +791,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "website.not-found-page" => Some(("website.notFoundPage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "website.main-page-suffix" => Some(("website.mainPageSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -824,7 +824,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Bucket = json::value::from_value(object).unwrap(); let mut call = self.hub.buckets().patch(request, opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -852,7 +852,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-metageneration-match", "if-metageneration-not-match", "predefined-acl", "projection", "predefined-default-object-acl"].iter().map(|v|*v)); @@ -866,7 +866,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -889,13 +889,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _buckets_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _buckets_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -909,8 +909,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "website.not-found-page" => Some(("website.notFoundPage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "website.main-page-suffix" => Some(("website.mainPageSuffix", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -942,7 +942,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Bucket = json::value::from_value(object).unwrap(); let mut call = self.hub.buckets().update(request, opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -970,7 +970,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-metageneration-match", "if-metageneration-not-match", "predefined-acl", "projection", "predefined-default-object-acl"].iter().map(|v|*v)); @@ -984,7 +984,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1007,13 +1007,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channels_stop(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channels_stop(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1027,8 +1027,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1052,7 +1052,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.channels().stop(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1065,7 +1065,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1078,7 +1078,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1093,10 +1093,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _default_object_access_controls_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _default_object_access_controls_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.default_object_access_controls().delete(opt.value_of("bucket").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1109,7 +1109,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1122,7 +1122,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1137,10 +1137,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _default_object_access_controls_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _default_object_access_controls_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.default_object_access_controls().get(opt.value_of("bucket").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1153,7 +1153,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1166,7 +1166,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1189,13 +1189,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _default_object_access_controls_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _default_object_access_controls_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1209,8 +1209,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1238,7 +1238,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ObjectAccessControl = json::value::from_value(object).unwrap(); let mut call = self.hub.default_object_access_controls().insert(request, opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1251,7 +1251,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1264,7 +1264,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1287,10 +1287,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _default_object_access_controls_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _default_object_access_controls_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.default_object_access_controls().list(opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "if-metageneration-not-match" => { @@ -1309,7 +1309,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-metageneration-not-match", "if-metageneration-match"].iter().map(|v|*v)); @@ -1323,7 +1323,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1346,13 +1346,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _default_object_access_controls_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _default_object_access_controls_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1366,8 +1366,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1395,7 +1395,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ObjectAccessControl = json::value::from_value(object).unwrap(); let mut call = self.hub.default_object_access_controls().patch(request, opt.value_of("bucket").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1408,7 +1408,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1421,7 +1421,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1444,13 +1444,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _default_object_access_controls_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _default_object_access_controls_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1464,8 +1464,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1493,7 +1493,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ObjectAccessControl = json::value::from_value(object).unwrap(); let mut call = self.hub.default_object_access_controls().update(request, opt.value_of("bucket").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1506,7 +1506,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1519,7 +1519,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1542,10 +1542,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _object_access_controls_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _object_access_controls_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.object_access_controls().delete(opt.value_of("bucket").unwrap_or(""), opt.value_of("object").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "generation" => { @@ -1561,7 +1561,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["generation"].iter().map(|v|*v)); @@ -1575,7 +1575,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1590,10 +1590,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _object_access_controls_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _object_access_controls_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.object_access_controls().get(opt.value_of("bucket").unwrap_or(""), opt.value_of("object").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "generation" => { @@ -1609,7 +1609,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["generation"].iter().map(|v|*v)); @@ -1623,7 +1623,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1646,13 +1646,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _object_access_controls_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _object_access_controls_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1666,8 +1666,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1695,7 +1695,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ObjectAccessControl = json::value::from_value(object).unwrap(); let mut call = self.hub.object_access_controls().insert(request, opt.value_of("bucket").unwrap_or(""), opt.value_of("object").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "generation" => { @@ -1711,7 +1711,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["generation"].iter().map(|v|*v)); @@ -1725,7 +1725,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1748,10 +1748,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _object_access_controls_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _object_access_controls_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.object_access_controls().list(opt.value_of("bucket").unwrap_or(""), opt.value_of("object").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "generation" => { @@ -1767,7 +1767,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["generation"].iter().map(|v|*v)); @@ -1781,7 +1781,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1804,13 +1804,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _object_access_controls_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _object_access_controls_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1824,8 +1824,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1853,7 +1853,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ObjectAccessControl = json::value::from_value(object).unwrap(); let mut call = self.hub.object_access_controls().patch(request, opt.value_of("bucket").unwrap_or(""), opt.value_of("object").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "generation" => { @@ -1869,7 +1869,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["generation"].iter().map(|v|*v)); @@ -1883,7 +1883,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1906,13 +1906,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _object_access_controls_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _object_access_controls_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1926,8 +1926,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "domain" => Some(("domain", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1955,7 +1955,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ObjectAccessControl = json::value::from_value(object).unwrap(); let mut call = self.hub.object_access_controls().update(request, opt.value_of("bucket").unwrap_or(""), opt.value_of("object").unwrap_or(""), opt.value_of("entity").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "generation" => { @@ -1971,7 +1971,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["generation"].iter().map(|v|*v)); @@ -1985,7 +1985,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2008,13 +2008,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _objects_compose(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _objects_compose(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2028,8 +2028,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination.generation" => Some(("destination.generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2050,6 +2050,8 @@ impl<'n, 'a> Engine<'n, 'a> { "destination.content-type" => Some(("destination.contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination.content-disposition" => Some(("destination.contentDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination.content-language" => Some(("destination.contentLanguage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination.customer-encryption.encryption-algorithm" => Some(("destination.customerEncryption.encryptionAlgorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "destination.customer-encryption.key-sha256" => Some(("destination.customerEncryption.keySha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination.metageneration" => Some(("destination.metageneration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination.kind" => Some(("destination.kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination.name" => Some(("destination.name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2058,7 +2060,7 @@ impl<'n, 'a> Engine<'n, 'a> { "destination.storage-class" => Some(("destination.storageClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "destination.self-link" => Some(("destination.selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "destination", "entity", "entity-id", "etag", "generation", "id", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "customer-encryption", "destination", "encryption-algorithm", "entity", "entity-id", "etag", "generation", "id", "key-sha256", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2070,7 +2072,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::ComposeRequest = json::value::from_value(object).unwrap(); let mut download_mode = false; let mut call = self.hub.objects().compose(request, opt.value_of("destination-bucket").unwrap_or(""), opt.value_of("destination-object").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "if-metageneration-match" => { @@ -2095,7 +2097,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-metageneration-match", "if-generation-match", "destination-predefined-acl"].iter().map(|v|*v)); @@ -2109,7 +2111,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2137,13 +2139,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _objects_copy(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _objects_copy(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2157,8 +2159,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "component-count" => Some(("componentCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2178,6 +2180,8 @@ impl<'n, 'a> Engine<'n, 'a> { "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-disposition" => Some(("contentDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-language" => Some(("contentLanguage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-encryption.encryption-algorithm" => Some(("customerEncryption.encryptionAlgorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-encryption.key-sha256" => Some(("customerEncryption.keySha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metageneration" => Some(("metageneration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2186,7 +2190,7 @@ impl<'n, 'a> Engine<'n, 'a> { "storage-class" => Some(("storageClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "entity", "entity-id", "etag", "generation", "id", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "customer-encryption", "encryption-algorithm", "entity", "entity-id", "etag", "generation", "id", "key-sha256", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2198,7 +2202,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Object = json::value::from_value(object).unwrap(); let mut download_mode = false; let mut call = self.hub.objects().copy(request, opt.value_of("source-bucket").unwrap_or(""), opt.value_of("source-object").unwrap_or(""), opt.value_of("destination-bucket").unwrap_or(""), opt.value_of("destination-object").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source-generation" => { @@ -2247,7 +2251,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-source-generation-match", "projection", "if-source-metageneration-not-match", "if-metageneration-not-match", "source-generation", "destination-predefined-acl", "if-source-generation-not-match", "if-source-metageneration-match", "if-generation-match", "if-metageneration-match", "if-generation-not-match"].iter().map(|v|*v)); @@ -2261,7 +2265,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2289,10 +2293,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _objects_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _objects_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.objects().delete(opt.value_of("bucket").unwrap_or(""), opt.value_of("object").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "if-metageneration-not-match" => { @@ -2320,7 +2324,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["generation", "if-metageneration-not-match", "if-generation-match", "if-metageneration-match", "if-generation-not-match"].iter().map(|v|*v)); @@ -2334,7 +2338,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2349,11 +2353,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _objects_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _objects_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.objects().get(opt.value_of("bucket").unwrap_or(""), opt.value_of("object").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -2387,7 +2391,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["projection", "generation", "if-metageneration-match", "if-generation-match", "if-metageneration-not-match", "if-generation-not-match"].iter().map(|v|*v)); @@ -2401,7 +2405,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2429,13 +2433,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _objects_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _objects_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2449,8 +2453,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "component-count" => Some(("componentCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2470,6 +2474,8 @@ impl<'n, 'a> Engine<'n, 'a> { "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-disposition" => Some(("contentDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-language" => Some(("contentLanguage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-encryption.encryption-algorithm" => Some(("customerEncryption.encryptionAlgorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-encryption.key-sha256" => Some(("customerEncryption.keySha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metageneration" => Some(("metageneration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2478,7 +2484,7 @@ impl<'n, 'a> Engine<'n, 'a> { "storage-class" => Some(("storageClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "entity", "entity-id", "etag", "generation", "id", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "customer-encryption", "encryption-algorithm", "entity", "entity-id", "etag", "generation", "id", "key-sha256", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2489,7 +2495,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Object = json::value::from_value(object).unwrap(); let mut call = self.hub.objects().insert(request, opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -2526,7 +2532,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-generation-match", "if-generation-not-match", "content-encoding", "if-metageneration-match", "name", "predefined-acl", "if-metageneration-not-match", "projection"].iter().map(|v|*v)); @@ -2535,7 +2541,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -2543,7 +2549,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2569,10 +2575,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _objects_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _objects_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.objects().list(opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "versions" => { @@ -2603,7 +2609,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["projection", "versions", "prefix", "max-results", "page-token", "delimiter"].iter().map(|v|*v)); @@ -2617,7 +2623,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2640,13 +2646,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _objects_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _objects_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2660,8 +2666,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "component-count" => Some(("componentCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2681,6 +2687,8 @@ impl<'n, 'a> Engine<'n, 'a> { "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-disposition" => Some(("contentDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-language" => Some(("contentLanguage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-encryption.encryption-algorithm" => Some(("customerEncryption.encryptionAlgorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-encryption.key-sha256" => Some(("customerEncryption.keySha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metageneration" => Some(("metageneration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2689,7 +2697,7 @@ impl<'n, 'a> Engine<'n, 'a> { "storage-class" => Some(("storageClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "entity", "entity-id", "etag", "generation", "id", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "customer-encryption", "encryption-algorithm", "entity", "entity-id", "etag", "generation", "id", "key-sha256", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2700,7 +2708,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Object = json::value::from_value(object).unwrap(); let mut call = self.hub.objects().patch(request, opt.value_of("bucket").unwrap_or(""), opt.value_of("object").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -2734,7 +2742,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-generation-match", "projection", "generation", "if-metageneration-match", "predefined-acl", "if-metageneration-not-match", "if-generation-not-match"].iter().map(|v|*v)); @@ -2748,7 +2756,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2771,13 +2779,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _objects_rewrite(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _objects_rewrite(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2791,8 +2799,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "component-count" => Some(("componentCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2812,6 +2820,8 @@ impl<'n, 'a> Engine<'n, 'a> { "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-disposition" => Some(("contentDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-language" => Some(("contentLanguage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-encryption.encryption-algorithm" => Some(("customerEncryption.encryptionAlgorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-encryption.key-sha256" => Some(("customerEncryption.keySha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metageneration" => Some(("metageneration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2820,7 +2830,7 @@ impl<'n, 'a> Engine<'n, 'a> { "storage-class" => Some(("storageClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "entity", "entity-id", "etag", "generation", "id", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "customer-encryption", "encryption-algorithm", "entity", "entity-id", "etag", "generation", "id", "key-sha256", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2831,7 +2841,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Object = json::value::from_value(object).unwrap(); let mut call = self.hub.objects().rewrite(request, opt.value_of("source-bucket").unwrap_or(""), opt.value_of("source-object").unwrap_or(""), opt.value_of("destination-bucket").unwrap_or(""), opt.value_of("destination-object").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source-generation" => { @@ -2883,7 +2893,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-source-generation-match", "if-generation-match", "projection", "if-source-metageneration-not-match", "if-metageneration-not-match", "source-generation", "max-bytes-rewritten-per-call", "if-source-generation-not-match", "destination-predefined-acl", "if-source-metageneration-match", "rewrite-token", "if-metageneration-match", "if-generation-not-match"].iter().map(|v|*v)); @@ -2897,7 +2907,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2920,13 +2930,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _objects_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _objects_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2940,8 +2950,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "generation" => Some(("generation", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "component-count" => Some(("componentCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -2961,6 +2971,8 @@ impl<'n, 'a> Engine<'n, 'a> { "content-type" => Some(("contentType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-disposition" => Some(("contentDisposition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-language" => Some(("contentLanguage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-encryption.encryption-algorithm" => Some(("customerEncryption.encryptionAlgorithm", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "customer-encryption.key-sha256" => Some(("customerEncryption.keySha256", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "metageneration" => Some(("metageneration", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2969,7 +2981,7 @@ impl<'n, 'a> Engine<'n, 'a> { "storage-class" => Some(("storageClass", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "self-link" => Some(("selfLink", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "entity", "entity-id", "etag", "generation", "id", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["bucket", "cache-control", "component-count", "content-disposition", "content-encoding", "content-language", "content-type", "crc32c", "customer-encryption", "encryption-algorithm", "entity", "entity-id", "etag", "generation", "id", "key-sha256", "kind", "md5-hash", "media-link", "metadata", "metageneration", "name", "owner", "self-link", "size", "storage-class", "time-created", "time-deleted", "updated"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2981,7 +2993,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Object = json::value::from_value(object).unwrap(); let mut download_mode = false; let mut call = self.hub.objects().update(request, opt.value_of("bucket").unwrap_or(""), opt.value_of("object").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -3018,7 +3030,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["if-generation-match", "projection", "generation", "if-metageneration-match", "predefined-acl", "if-metageneration-not-match", "if-generation-not-match"].iter().map(|v|*v)); @@ -3032,7 +3044,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3060,13 +3072,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _objects_watch_all(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _objects_watch_all(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3080,8 +3092,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "resource-uri" => Some(("resourceUri", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3105,7 +3117,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.objects().watch_all(request, opt.value_of("bucket").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "versions" => { @@ -3136,7 +3148,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["projection", "versions", "prefix", "max-results", "page-token", "delimiter"].iter().map(|v|*v)); @@ -3150,7 +3162,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3348,14 +3360,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "storage1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "storage1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -3375,7 +3387,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -3415,7 +3427,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("bucket-access-controls", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Permanently deletes the ACL entry for the specified entity on the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/bucket-access-controls_delete", vec![ @@ -3437,7 +3449,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns the ACL entry for the specified entity on the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/bucket-access-controls_get", vec![ @@ -3465,7 +3477,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new ACL entry on the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/bucket-access-controls_insert", vec![ @@ -3493,7 +3505,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves ACL entries on the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/bucket-access-controls_list", vec![ @@ -3515,7 +3527,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an ACL entry on the specified bucket. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/bucket-access-controls_patch", vec![ @@ -3549,7 +3561,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an ACL entry on the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/bucket-access-controls_update", vec![ @@ -3586,7 +3598,7 @@ fn main() { ]), ("buckets", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Permanently deletes an empty bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/buckets_delete", vec![ @@ -3602,7 +3614,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns metadata for the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/buckets_get", vec![ @@ -3624,7 +3636,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/buckets_insert", vec![ @@ -3652,7 +3664,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of buckets for a given project."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/buckets_list", vec![ @@ -3674,7 +3686,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a bucket. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/buckets_patch", vec![ @@ -3702,7 +3714,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/buckets_update", vec![ @@ -3733,7 +3745,7 @@ fn main() { ]), ("channels", "methods: 'stop'", vec![ - ("stop", + ("stop", Some(r##"Stop watching resources through this channel"##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/channels_stop", vec![ @@ -3752,7 +3764,7 @@ fn main() { ]), ("default-object-access-controls", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Permanently deletes the default object ACL entry for the specified entity on the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/default-object-access-controls_delete", vec![ @@ -3774,7 +3786,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns the default object ACL entry for the specified entity on the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/default-object-access-controls_get", vec![ @@ -3802,7 +3814,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new default object ACL entry on the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/default-object-access-controls_insert", vec![ @@ -3830,7 +3842,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves default object ACL entries on the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/default-object-access-controls_list", vec![ @@ -3852,7 +3864,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a default object ACL entry on the specified bucket. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/default-object-access-controls_patch", vec![ @@ -3886,7 +3898,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a default object ACL entry on the specified bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/default-object-access-controls_update", vec![ @@ -3923,7 +3935,7 @@ fn main() { ]), ("object-access-controls", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Permanently deletes the ACL entry for the specified entity on the specified object."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/object-access-controls_delete", vec![ @@ -3951,7 +3963,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns the ACL entry for the specified entity on the specified object."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/object-access-controls_get", vec![ @@ -3985,7 +3997,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new ACL entry on the specified object."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/object-access-controls_insert", vec![ @@ -4019,7 +4031,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves ACL entries on the specified object."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/object-access-controls_list", vec![ @@ -4047,7 +4059,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an ACL entry on the specified object. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/object-access-controls_patch", vec![ @@ -4087,7 +4099,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an ACL entry on the specified object."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/object-access-controls_update", vec![ @@ -4130,7 +4142,7 @@ fn main() { ]), ("objects", "methods: 'compose', 'copy', 'delete', 'get', 'insert', 'list', 'patch', 'rewrite', 'update' and 'watch-all'", vec![ - ("compose", + ("compose", Some(r##"Concatenates a list of existing objects into a new object in the same bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/objects_compose", vec![ @@ -4164,7 +4176,7 @@ fn main() { Some(false), Some(false)), ]), - ("copy", + ("copy", Some(r##"Copies a source object to a destination object. Optionally overrides metadata."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/objects_copy", vec![ @@ -4210,7 +4222,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/objects_delete", vec![ @@ -4232,7 +4244,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves an object or its metadata."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/objects_get", vec![ @@ -4260,7 +4272,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Stores a new object and metadata."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/objects_insert", vec![ @@ -4294,7 +4306,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of objects matching the criteria."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/objects_list", vec![ @@ -4316,7 +4328,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates an object's metadata. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/objects_patch", vec![ @@ -4350,7 +4362,7 @@ fn main() { Some(false), Some(false)), ]), - ("rewrite", + ("rewrite", Some(r##"Rewrites a source object to a destination object. Optionally overrides metadata."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/objects_rewrite", vec![ @@ -4396,7 +4408,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates an object's metadata."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/objects_update", vec![ @@ -4430,7 +4442,7 @@ fn main() { Some(false), Some(false)), ]), - ("watch-all", + ("watch-all", Some(r##"Watch for changes on all objects in a bucket."##), "Details at http://byron.github.io/google-apis-rs/google_storage1_cli/objects_watch-all", vec![ @@ -4464,7 +4476,7 @@ fn main() { let mut app = App::new("storage1") .author("Sebastian Thiel ") - .version("0.3.2+20151007") + .version("0.3.3+20151229") .about("Lets you store and retrieve potentially-large, immutable data objects.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_storage1_cli") .arg(Arg::with_name("url") @@ -4488,7 +4500,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -4499,7 +4511,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/storage1/Cargo.toml b/gen/storage1/Cargo.toml index e6be405cd7..e0b76e042b 100644 --- a/gen/storage1/Cargo.toml +++ b/gen/storage1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-storage1" -version = "0.1.10+20151007" +version = "0.1.11+20151229" authors = ["Sebastian Thiel "] description = "A complete library to interact with storage (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/storage1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/storage1/LICENSE.md b/gen/storage1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/storage1/LICENSE.md +++ b/gen/storage1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/storage1/README.md b/gen/storage1/README.md index cbc91dd5f1..e4f914a09c 100644 --- a/gen/storage1/README.md +++ b/gen/storage1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-storage1` library allows access to all features of the *Google storage* service. -This documentation was generated from *storage* crate version *0.1.10+20151007*, where *20151007* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *storage* crate version *0.1.11+20151229*, where *20151229* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *storage* *v1* API can be found at the [official documentation site](https://developers.google.com/storage/docs/json_api/). diff --git a/gen/storage1/src/cmn.rs b/gen/storage1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/storage1/src/cmn.rs +++ b/gen/storage1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/storage1/src/lib.rs b/gen/storage1/src/lib.rs index c49c53dad4..5663fc16d9 100644 --- a/gen/storage1/src/lib.rs +++ b/gen/storage1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *storage* crate version *0.1.10+20151007*, where *20151007* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *storage* crate version *0.1.11+20151229*, where *20151229* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *storage* *v1* API can be found at the //! [official documentation site](https://developers.google.com/storage/docs/json_api/). diff --git a/gen/storage1/src/lib.rs.in b/gen/storage1/src/lib.rs.in index 31b3df7775..eba4ba62bf 100644 --- a/gen/storage1/src/lib.rs.in +++ b/gen/storage1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -161,7 +162,7 @@ impl<'a, C, A> Storage Storage { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -185,7 +186,7 @@ impl<'a, C, A> Storage } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -414,6 +415,9 @@ pub struct Object { pub time_created: Option, /// The content generation of this object. Used for object versioning. pub generation: Option, + /// Metadata of customer-supplied encryption key, if the object is encrypted by such a key. + #[serde(rename="customerEncryption")] + pub customer_encryption: Option, /// Number of underlying components that make up this object. Components are accumulated by compose operations. #[serde(rename="componentCount")] pub component_count: Option, @@ -427,9 +431,8 @@ pub struct Object { /// Cache-Control directive for the object data. #[serde(rename="cacheControl")] pub cache_control: Option, - /// Content-Encoding of the object data. - #[serde(rename="contentEncoding")] - pub content_encoding: Option, + /// Access controls on the object. + pub acl: Option>, /// The ID of the object. pub id: Option, /// Content-Length of the data in bytes. @@ -449,8 +452,9 @@ pub struct Object { pub md5_hash: Option, /// The name of the bucket containing this object. pub bucket: Option, - /// Access controls on the object. - pub acl: Option>, + /// Content-Encoding of the object data. + #[serde(rename="contentEncoding")] + pub content_encoding: Option, /// CRC32c checksum, as described in RFC 4960, Appendix B; encoded using base64 in big-endian byte order. For more information about using the CRC32c checksum, see Hashes and ETags: Best Practices. pub crc32c: Option, /// HTTP 1.1 Entity tag for the object. @@ -655,6 +659,24 @@ impl Resource for Bucket {} impl ResponseResult for Bucket {} +/// Metadata of customer-supplied encryption key, if the object is encrypted by such a key. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ObjectCustomerEncryption { + /// The encryption algorithm. + #[serde(rename="encryptionAlgorithm")] + pub encryption_algorithm: Option, + /// SHA256 hash value of the encryption key. + #[serde(rename="keySha256")] + pub key_sha256: Option, +} + +impl NestedType for ObjectCustomerEncryption {} +impl Part for ObjectCustomerEncryption {} + + /// An access-control entry. /// /// # Activities @@ -2018,7 +2040,7 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.insert", + dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -2036,7 +2058,7 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut let mut url = "https://www.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::DevstorageFullControl.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{bucket}", "bucket")].iter() { @@ -2060,14 +2082,14 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2111,7 +2133,7 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2121,10 +2143,10 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2156,7 +2178,7 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ObjectAccessControl) -> DefaultObjectAccessControlInsertCall<'a, C, A> { self._request = new_value; @@ -2166,7 +2188,7 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> DefaultObjectAccessControlInsertCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -2184,12 +2206,12 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2206,17 +2228,17 @@ impl<'a, C, A> DefaultObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DevstorageFullControl`. + /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DefaultObjectAccessControlInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DefaultObjectAccessControlInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2286,7 +2308,7 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.update", + dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -2305,7 +2327,7 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut let mut url = "https://www.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl/{entity}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::DevstorageFullControl.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{bucket}", "bucket"), ("{entity}", "entity")].iter() { @@ -2329,14 +2351,14 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2380,7 +2402,7 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2390,10 +2412,10 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2425,7 +2447,7 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ObjectAccessControl) -> DefaultObjectAccessControlUpdateCall<'a, C, A> { self._request = new_value; @@ -2435,7 +2457,7 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> DefaultObjectAccessControlUpdateCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -2445,7 +2467,7 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *entity* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn entity(mut self, new_value: &str) -> DefaultObjectAccessControlUpdateCall<'a, C, A> { self._entity = new_value.to_string(); @@ -2463,12 +2485,12 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2485,17 +2507,17 @@ impl<'a, C, A> DefaultObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DevstorageFullControl`. + /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DefaultObjectAccessControlUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DefaultObjectAccessControlUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2561,7 +2583,7 @@ impl<'a, C, A> DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.list", + dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -2585,7 +2607,7 @@ impl<'a, C, A> DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2645,7 +2667,7 @@ impl<'a, C, A> DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2655,10 +2677,10 @@ impl<'a, C, A> DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlListCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -2723,12 +2745,12 @@ impl<'a, C, A> DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DefaultObjectAccessControlListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DefaultObjectAccessControlListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2825,7 +2847,7 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.patch", + dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -2844,7 +2866,7 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< let mut url = "https://www.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl/{entity}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::DevstorageFullControl.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{bucket}", "bucket"), ("{entity}", "entity")].iter() { @@ -2868,14 +2890,14 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2919,7 +2941,7 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2929,10 +2951,10 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2964,7 +2986,7 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ObjectAccessControl) -> DefaultObjectAccessControlPatchCall<'a, C, A> { self._request = new_value; @@ -2974,7 +2996,7 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> DefaultObjectAccessControlPatchCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -2984,7 +3006,7 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< /// /// Sets the *entity* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn entity(mut self, new_value: &str) -> DefaultObjectAccessControlPatchCall<'a, C, A> { self._entity = new_value.to_string(); @@ -3002,12 +3024,12 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3024,17 +3046,17 @@ impl<'a, C, A> DefaultObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DevstorageFullControl`. + /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DefaultObjectAccessControlPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DefaultObjectAccessControlPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3097,7 +3119,7 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.delete", + dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -3115,7 +3137,7 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut let mut url = "https://www.googleapis.com/storage/v1/b/{bucket}/defaultObjectAcl/{entity}".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::DevstorageFullControl.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } for &(find_this, param_name) in [("{bucket}", "bucket"), ("{entity}", "entity")].iter() { @@ -3139,7 +3161,7 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3175,7 +3197,7 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3185,10 +3207,10 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3211,7 +3233,7 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> DefaultObjectAccessControlDeleteCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -3221,7 +3243,7 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut /// /// Sets the *entity* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn entity(mut self, new_value: &str) -> DefaultObjectAccessControlDeleteCall<'a, C, A> { self._entity = new_value.to_string(); @@ -3239,12 +3261,12 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3261,17 +3283,17 @@ impl<'a, C, A> DefaultObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::DevstorageFullControl`. + /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> DefaultObjectAccessControlDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DefaultObjectAccessControlDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3334,7 +3356,7 @@ impl<'a, C, A> DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.get", + dlg.begin(MethodInfo { id: "storage.defaultObjectAccessControls.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -3353,7 +3375,7 @@ impl<'a, C, A> DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3413,7 +3435,7 @@ impl<'a, C, A> DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3423,10 +3445,10 @@ impl<'a, C, A> DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlGetCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -3469,7 +3491,7 @@ impl<'a, C, A> DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlGetCall<'a, C, A> { self._entity = new_value.to_string(); @@ -3487,12 +3509,12 @@ impl<'a, C, A> DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut DefaultObjectAccessControlGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> DefaultObjectAccessControlGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> DefaultObjectAccessControlGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3589,7 +3611,7 @@ impl<'a, C, A> BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.bucketAccessControls.patch", + dlg.begin(MethodInfo { id: "storage.bucketAccessControls.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -3608,7 +3630,7 @@ impl<'a, C, A> BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3683,7 +3705,7 @@ impl<'a, C, A> BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3693,10 +3715,10 @@ impl<'a, C, A> BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut BucketAccessControlPatchCall<'a, C, A> { self._request = new_value; @@ -3738,7 +3760,7 @@ impl<'a, C, A> BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut BucketAccessControlPatchCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -3748,7 +3770,7 @@ impl<'a, C, A> BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut BucketAccessControlPatchCall<'a, C, A> { self._entity = new_value.to_string(); @@ -3766,12 +3788,12 @@ impl<'a, C, A> BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut BucketAccessControlPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BucketAccessControlPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketAccessControlPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3861,7 +3883,7 @@ impl<'a, C, A> BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.bucketAccessControls.delete", + dlg.begin(MethodInfo { id: "storage.bucketAccessControls.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -3879,7 +3901,7 @@ impl<'a, C, A> BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3939,7 +3961,7 @@ impl<'a, C, A> BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3949,10 +3971,10 @@ impl<'a, C, A> BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut BucketAccessControlDeleteCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -3985,7 +4007,7 @@ impl<'a, C, A> BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut BucketAccessControlDeleteCall<'a, C, A> { self._entity = new_value.to_string(); @@ -4003,12 +4025,12 @@ impl<'a, C, A> BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut BucketAccessControlDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BucketAccessControlDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketAccessControlDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4104,7 +4126,7 @@ impl<'a, C, A> BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.bucketAccessControls.insert", + dlg.begin(MethodInfo { id: "storage.bucketAccessControls.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -4122,7 +4144,7 @@ impl<'a, C, A> BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4197,7 +4219,7 @@ impl<'a, C, A> BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4207,10 +4229,10 @@ impl<'a, C, A> BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut BucketAccessControlInsertCall<'a, C, A> { self._request = new_value; @@ -4252,7 +4274,7 @@ impl<'a, C, A> BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut BucketAccessControlInsertCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -4270,12 +4292,12 @@ impl<'a, C, A> BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut BucketAccessControlInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BucketAccessControlInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketAccessControlInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4365,7 +4387,7 @@ impl<'a, C, A> BucketAccessControlGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.bucketAccessControls.get", + dlg.begin(MethodInfo { id: "storage.bucketAccessControls.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -4384,7 +4406,7 @@ impl<'a, C, A> BucketAccessControlGetCall<'a, C, A> where C: BorrowMut BucketAccessControlGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4444,7 +4466,7 @@ impl<'a, C, A> BucketAccessControlGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4454,10 +4476,10 @@ impl<'a, C, A> BucketAccessControlGetCall<'a, C, A> where C: BorrowMut BucketAccessControlGetCall<'a, C, A> where C: BorrowMut BucketAccessControlGetCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -4500,7 +4522,7 @@ impl<'a, C, A> BucketAccessControlGetCall<'a, C, A> where C: BorrowMut BucketAccessControlGetCall<'a, C, A> { self._entity = new_value.to_string(); @@ -4518,12 +4540,12 @@ impl<'a, C, A> BucketAccessControlGetCall<'a, C, A> where C: BorrowMut BucketAccessControlGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BucketAccessControlGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketAccessControlGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4620,7 +4642,7 @@ impl<'a, C, A> BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.bucketAccessControls.update", + dlg.begin(MethodInfo { id: "storage.bucketAccessControls.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -4639,7 +4661,7 @@ impl<'a, C, A> BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -4714,7 +4736,7 @@ impl<'a, C, A> BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4724,10 +4746,10 @@ impl<'a, C, A> BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut BucketAccessControlUpdateCall<'a, C, A> { self._request = new_value; @@ -4769,7 +4791,7 @@ impl<'a, C, A> BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut BucketAccessControlUpdateCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -4779,7 +4801,7 @@ impl<'a, C, A> BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut BucketAccessControlUpdateCall<'a, C, A> { self._entity = new_value.to_string(); @@ -4797,12 +4819,12 @@ impl<'a, C, A> BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut BucketAccessControlUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BucketAccessControlUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketAccessControlUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4891,7 +4913,7 @@ impl<'a, C, A> BucketAccessControlListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.bucketAccessControls.list", + dlg.begin(MethodInfo { id: "storage.bucketAccessControls.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -4909,7 +4931,7 @@ impl<'a, C, A> BucketAccessControlListCall<'a, C, A> where C: BorrowMut BucketAccessControlListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4969,7 +4991,7 @@ impl<'a, C, A> BucketAccessControlListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4979,10 +5001,10 @@ impl<'a, C, A> BucketAccessControlListCall<'a, C, A> where C: BorrowMut BucketAccessControlListCall<'a, C, A> where C: BorrowMut BucketAccessControlListCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -5033,12 +5055,12 @@ impl<'a, C, A> BucketAccessControlListCall<'a, C, A> where C: BorrowMut BucketAccessControlListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BucketAccessControlListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketAccessControlListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5133,7 +5155,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.channels.stop", + dlg.begin(MethodInfo { id: "storage.channels.stop", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in [].iter() { @@ -5152,14 +5174,14 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5203,7 +5225,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5213,10 +5235,10 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5238,7 +5260,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> ChannelStopCall<'a, C, A> { self._request = new_value; @@ -5256,12 +5278,12 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5278,17 +5300,17 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ChannelStopCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChannelStopCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5386,7 +5408,7 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objects.rewrite", + dlg.begin(MethodInfo { id: "storage.objects.rewrite", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((20 + self._additional_params.len())); params.push(("sourceBucket", self._source_bucket.to_string())); @@ -5470,14 +5492,14 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -5521,7 +5543,7 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5531,10 +5553,10 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5566,7 +5588,7 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Object) -> ObjectRewriteCall<'a, C, A> { self._request = new_value; @@ -5576,7 +5598,7 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *source bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn source_bucket(mut self, new_value: &str) -> ObjectRewriteCall<'a, C, A> { self._source_bucket = new_value.to_string(); @@ -5586,7 +5608,7 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *source object* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn source_object(mut self, new_value: &str) -> ObjectRewriteCall<'a, C, A> { self._source_object = new_value.to_string(); @@ -5596,7 +5618,7 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *destination bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn destination_bucket(mut self, new_value: &str) -> ObjectRewriteCall<'a, C, A> { self._destination_bucket = new_value.to_string(); @@ -5606,7 +5628,7 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *destination object* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn destination_object(mut self, new_value: &str) -> ObjectRewriteCall<'a, C, A> { self._destination_object = new_value.to_string(); @@ -5715,12 +5737,12 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5737,17 +5759,17 @@ impl<'a, C, A> ObjectRewriteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ObjectRewriteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectRewriteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5827,7 +5849,7 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objects.get", + dlg.begin(MethodInfo { id: "storage.objects.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -5904,7 +5926,7 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5940,7 +5962,7 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5950,10 +5972,10 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5986,7 +6008,7 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> ObjectGetCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -5996,7 +6018,7 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *object* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn object(mut self, new_value: &str) -> ObjectGetCall<'a, C, A> { self._object = new_value.to_string(); @@ -6056,12 +6078,12 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6078,17 +6100,17 @@ impl<'a, C, A> ObjectGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ObjectGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6177,7 +6199,7 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objects.update", + dlg.begin(MethodInfo { id: "storage.objects.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -6257,14 +6279,14 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6308,7 +6330,7 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6318,10 +6340,10 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6353,7 +6375,7 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Object) -> ObjectUpdateCall<'a, C, A> { self._request = new_value; @@ -6363,7 +6385,7 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> ObjectUpdateCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -6373,7 +6395,7 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *object* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn object(mut self, new_value: &str) -> ObjectUpdateCall<'a, C, A> { self._object = new_value.to_string(); @@ -6440,12 +6462,12 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6462,17 +6484,17 @@ impl<'a, C, A> ObjectUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ObjectUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6553,7 +6575,7 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objects.watchAll", + dlg.begin(MethodInfo { id: "storage.objects.watchAll", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -6613,14 +6635,14 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6664,7 +6686,7 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6674,10 +6696,10 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6709,7 +6731,7 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Channel) -> ObjectWatchAllCall<'a, C, A> { self._request = new_value; @@ -6719,7 +6741,7 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> ObjectWatchAllCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -6779,12 +6801,12 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -6801,17 +6823,17 @@ impl<'a, C, A> ObjectWatchAllCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ObjectWatchAllCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectWatchAllCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6903,7 +6925,7 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objects.insert", + dlg.begin(MethodInfo { id: "storage.objects.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -6959,13 +6981,13 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: params.push(("alt", "json".to_string())); } - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/storage/v1/b/{bucket}/o".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/storage/v1/b/{bucket}/o".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { @@ -6993,14 +7015,14 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7075,7 +7097,7 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7085,10 +7107,10 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7189,7 +7211,7 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Object) -> ObjectInsertCall<'a, C, A> { self._request = new_value; @@ -7199,7 +7221,7 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> ObjectInsertCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -7273,12 +7295,12 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7295,17 +7317,17 @@ impl<'a, C, A> ObjectInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ObjectInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7386,7 +7408,7 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objects.compose", + dlg.begin(MethodInfo { id: "storage.objects.compose", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("destinationBucket", self._destination_bucket.to_string())); @@ -7454,14 +7476,14 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7505,7 +7527,7 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7515,10 +7537,10 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7550,7 +7572,7 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: ComposeRequest) -> ObjectComposeCall<'a, C, A> { self._request = new_value; @@ -7560,7 +7582,7 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *destination bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn destination_bucket(mut self, new_value: &str) -> ObjectComposeCall<'a, C, A> { self._destination_bucket = new_value.to_string(); @@ -7570,7 +7592,7 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *destination object* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn destination_object(mut self, new_value: &str) -> ObjectComposeCall<'a, C, A> { self._destination_object = new_value.to_string(); @@ -7609,12 +7631,12 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7631,17 +7653,17 @@ impl<'a, C, A> ObjectComposeCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ObjectComposeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectComposeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7714,7 +7736,7 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objects.delete", + dlg.begin(MethodInfo { id: "storage.objects.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -7771,7 +7793,7 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7807,7 +7829,7 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7817,10 +7839,10 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7843,7 +7865,7 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> ObjectDeleteCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -7853,7 +7875,7 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *object* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn object(mut self, new_value: &str) -> ObjectDeleteCall<'a, C, A> { self._object = new_value.to_string(); @@ -7906,12 +7928,12 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7928,17 +7950,17 @@ impl<'a, C, A> ObjectDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ObjectDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8012,7 +8034,7 @@ impl<'a, C, A> ObjectListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objects.list", + dlg.begin(MethodInfo { id: "storage.objects.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -8072,7 +8094,7 @@ impl<'a, C, A> ObjectListCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8108,7 +8130,7 @@ impl<'a, C, A> ObjectListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8118,10 +8140,10 @@ impl<'a, C, A> ObjectListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8154,7 +8176,7 @@ impl<'a, C, A> ObjectListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> ObjectListCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -8214,12 +8236,12 @@ impl<'a, C, A> ObjectListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8236,17 +8258,17 @@ impl<'a, C, A> ObjectListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ObjectListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8345,7 +8367,7 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objects.copy", + dlg.begin(MethodInfo { id: "storage.objects.copy", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((17 + self._additional_params.len())); params.push(("sourceBucket", self._source_bucket.to_string())); @@ -8439,14 +8461,14 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8490,7 +8512,7 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8500,10 +8522,10 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8535,7 +8557,7 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Object) -> ObjectCopyCall<'a, C, A> { self._request = new_value; @@ -8545,7 +8567,7 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *source bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn source_bucket(mut self, new_value: &str) -> ObjectCopyCall<'a, C, A> { self._source_bucket = new_value.to_string(); @@ -8555,7 +8577,7 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *source object* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn source_object(mut self, new_value: &str) -> ObjectCopyCall<'a, C, A> { self._source_object = new_value.to_string(); @@ -8565,7 +8587,7 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *destination bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn destination_bucket(mut self, new_value: &str) -> ObjectCopyCall<'a, C, A> { self._destination_bucket = new_value.to_string(); @@ -8575,7 +8597,7 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *destination object* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn destination_object(mut self, new_value: &str) -> ObjectCopyCall<'a, C, A> { self._destination_object = new_value.to_string(); @@ -8670,12 +8692,12 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8692,17 +8714,17 @@ impl<'a, C, A> ObjectCopyCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ObjectCopyCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectCopyCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8786,7 +8808,7 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objects.patch", + dlg.begin(MethodInfo { id: "storage.objects.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -8850,14 +8872,14 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8901,7 +8923,7 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8911,10 +8933,10 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8946,7 +8968,7 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Object) -> ObjectPatchCall<'a, C, A> { self._request = new_value; @@ -8956,7 +8978,7 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> ObjectPatchCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -8966,7 +8988,7 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *object* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn object(mut self, new_value: &str) -> ObjectPatchCall<'a, C, A> { self._object = new_value.to_string(); @@ -9033,12 +9055,12 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9055,17 +9077,17 @@ impl<'a, C, A> ObjectPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ObjectPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9137,7 +9159,7 @@ impl<'a, C, A> ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objectAccessControls.insert", + dlg.begin(MethodInfo { id: "storage.objectAccessControls.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -9159,7 +9181,7 @@ impl<'a, C, A> ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9234,7 +9256,7 @@ impl<'a, C, A> ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9244,10 +9266,10 @@ impl<'a, C, A> ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut ObjectAccessControlInsertCall<'a, C, A> { self._request = new_value; @@ -9289,7 +9311,7 @@ impl<'a, C, A> ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut ObjectAccessControlInsertCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -9299,7 +9321,7 @@ impl<'a, C, A> ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut ObjectAccessControlInsertCall<'a, C, A> { self._object = new_value.to_string(); @@ -9324,12 +9346,12 @@ impl<'a, C, A> ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut ObjectAccessControlInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ObjectAccessControlInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectAccessControlInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9429,7 +9451,7 @@ impl<'a, C, A> ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objectAccessControls.patch", + dlg.begin(MethodInfo { id: "storage.objectAccessControls.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -9452,7 +9474,7 @@ impl<'a, C, A> ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9527,7 +9549,7 @@ impl<'a, C, A> ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9537,10 +9559,10 @@ impl<'a, C, A> ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut ObjectAccessControlPatchCall<'a, C, A> { self._request = new_value; @@ -9582,7 +9604,7 @@ impl<'a, C, A> ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut ObjectAccessControlPatchCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -9592,7 +9614,7 @@ impl<'a, C, A> ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut ObjectAccessControlPatchCall<'a, C, A> { self._object = new_value.to_string(); @@ -9602,7 +9624,7 @@ impl<'a, C, A> ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut ObjectAccessControlPatchCall<'a, C, A> { self._entity = new_value.to_string(); @@ -9627,12 +9649,12 @@ impl<'a, C, A> ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut ObjectAccessControlPatchCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ObjectAccessControlPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectAccessControlPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9724,7 +9746,7 @@ impl<'a, C, A> ObjectAccessControlListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objectAccessControls.list", + dlg.begin(MethodInfo { id: "storage.objectAccessControls.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -9746,7 +9768,7 @@ impl<'a, C, A> ObjectAccessControlListCall<'a, C, A> where C: BorrowMut ObjectAccessControlListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9806,7 +9828,7 @@ impl<'a, C, A> ObjectAccessControlListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9816,10 +9838,10 @@ impl<'a, C, A> ObjectAccessControlListCall<'a, C, A> where C: BorrowMut ObjectAccessControlListCall<'a, C, A> where C: BorrowMut ObjectAccessControlListCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -9862,7 +9884,7 @@ impl<'a, C, A> ObjectAccessControlListCall<'a, C, A> where C: BorrowMut ObjectAccessControlListCall<'a, C, A> { self._object = new_value.to_string(); @@ -9887,12 +9909,12 @@ impl<'a, C, A> ObjectAccessControlListCall<'a, C, A> where C: BorrowMut ObjectAccessControlListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ObjectAccessControlListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectAccessControlListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9985,7 +10007,7 @@ impl<'a, C, A> ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objectAccessControls.delete", + dlg.begin(MethodInfo { id: "storage.objectAccessControls.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -10007,7 +10029,7 @@ impl<'a, C, A> ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10067,7 +10089,7 @@ impl<'a, C, A> ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10077,10 +10099,10 @@ impl<'a, C, A> ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut ObjectAccessControlDeleteCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -10113,7 +10135,7 @@ impl<'a, C, A> ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut ObjectAccessControlDeleteCall<'a, C, A> { self._object = new_value.to_string(); @@ -10123,7 +10145,7 @@ impl<'a, C, A> ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut ObjectAccessControlDeleteCall<'a, C, A> { self._entity = new_value.to_string(); @@ -10148,12 +10170,12 @@ impl<'a, C, A> ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut ObjectAccessControlDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ObjectAccessControlDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectAccessControlDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10246,7 +10268,7 @@ impl<'a, C, A> ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objectAccessControls.get", + dlg.begin(MethodInfo { id: "storage.objectAccessControls.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -10269,7 +10291,7 @@ impl<'a, C, A> ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10329,7 +10351,7 @@ impl<'a, C, A> ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10339,10 +10361,10 @@ impl<'a, C, A> ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut ObjectAccessControlGetCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -10385,7 +10407,7 @@ impl<'a, C, A> ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut ObjectAccessControlGetCall<'a, C, A> { self._object = new_value.to_string(); @@ -10395,7 +10417,7 @@ impl<'a, C, A> ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut ObjectAccessControlGetCall<'a, C, A> { self._entity = new_value.to_string(); @@ -10420,12 +10442,12 @@ impl<'a, C, A> ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut ObjectAccessControlGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ObjectAccessControlGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectAccessControlGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10525,7 +10547,7 @@ impl<'a, C, A> ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.objectAccessControls.update", + dlg.begin(MethodInfo { id: "storage.objectAccessControls.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -10548,7 +10570,7 @@ impl<'a, C, A> ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10623,7 +10645,7 @@ impl<'a, C, A> ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10633,10 +10655,10 @@ impl<'a, C, A> ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut ObjectAccessControlUpdateCall<'a, C, A> { self._request = new_value; @@ -10678,7 +10700,7 @@ impl<'a, C, A> ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut ObjectAccessControlUpdateCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -10688,7 +10710,7 @@ impl<'a, C, A> ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut ObjectAccessControlUpdateCall<'a, C, A> { self._object = new_value.to_string(); @@ -10698,7 +10720,7 @@ impl<'a, C, A> ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut ObjectAccessControlUpdateCall<'a, C, A> { self._entity = new_value.to_string(); @@ -10723,12 +10745,12 @@ impl<'a, C, A> ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut ObjectAccessControlUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ObjectAccessControlUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ObjectAccessControlUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10834,7 +10856,7 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.buckets.update", + dlg.begin(MethodInfo { id: "storage.buckets.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -10891,14 +10913,14 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10942,7 +10964,7 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10952,10 +10974,10 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10987,7 +11009,7 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Bucket) -> BucketUpdateCall<'a, C, A> { self._request = new_value; @@ -10997,7 +11019,7 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> BucketUpdateCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -11050,12 +11072,12 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11072,17 +11094,17 @@ impl<'a, C, A> BucketUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BucketUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11150,7 +11172,7 @@ impl<'a, C, A> BucketGetCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.buckets.get", + dlg.begin(MethodInfo { id: "storage.buckets.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -11201,7 +11223,7 @@ impl<'a, C, A> BucketGetCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11237,7 +11259,7 @@ impl<'a, C, A> BucketGetCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11247,10 +11269,10 @@ impl<'a, C, A> BucketGetCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11283,7 +11305,7 @@ impl<'a, C, A> BucketGetCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> BucketGetCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -11322,12 +11344,12 @@ impl<'a, C, A> BucketGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11344,17 +11366,17 @@ impl<'a, C, A> BucketGetCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BucketGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11420,7 +11442,7 @@ impl<'a, C, A> BucketDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.buckets.delete", + dlg.begin(MethodInfo { id: "storage.buckets.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -11467,7 +11489,7 @@ impl<'a, C, A> BucketDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11503,7 +11525,7 @@ impl<'a, C, A> BucketDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11513,10 +11535,10 @@ impl<'a, C, A> BucketDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11539,7 +11561,7 @@ impl<'a, C, A> BucketDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> BucketDeleteCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -11571,12 +11593,12 @@ impl<'a, C, A> BucketDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11593,17 +11615,17 @@ impl<'a, C, A> BucketDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BucketDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11678,7 +11700,7 @@ impl<'a, C, A> BucketInsertCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.buckets.insert", + dlg.begin(MethodInfo { id: "storage.buckets.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -11708,14 +11730,14 @@ impl<'a, C, A> BucketInsertCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11759,7 +11781,7 @@ impl<'a, C, A> BucketInsertCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11769,10 +11791,10 @@ impl<'a, C, A> BucketInsertCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11804,7 +11826,7 @@ impl<'a, C, A> BucketInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Bucket) -> BucketInsertCall<'a, C, A> { self._request = new_value; @@ -11814,7 +11836,7 @@ impl<'a, C, A> BucketInsertCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> BucketInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -11853,12 +11875,12 @@ impl<'a, C, A> BucketInsertCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11875,17 +11897,17 @@ impl<'a, C, A> BucketInsertCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BucketInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11964,7 +11986,7 @@ impl<'a, C, A> BucketPatchCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.buckets.patch", + dlg.begin(MethodInfo { id: "storage.buckets.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("bucket", self._bucket.to_string())); @@ -12021,14 +12043,14 @@ impl<'a, C, A> BucketPatchCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12072,7 +12094,7 @@ impl<'a, C, A> BucketPatchCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12082,10 +12104,10 @@ impl<'a, C, A> BucketPatchCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12117,7 +12139,7 @@ impl<'a, C, A> BucketPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Bucket) -> BucketPatchCall<'a, C, A> { self._request = new_value; @@ -12127,7 +12149,7 @@ impl<'a, C, A> BucketPatchCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *bucket* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn bucket(mut self, new_value: &str) -> BucketPatchCall<'a, C, A> { self._bucket = new_value.to_string(); @@ -12180,12 +12202,12 @@ impl<'a, C, A> BucketPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12202,17 +12224,17 @@ impl<'a, C, A> BucketPatchCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BucketPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12282,7 +12304,7 @@ impl<'a, C, A> BucketListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storage.buckets.list", + dlg.begin(MethodInfo { id: "storage.buckets.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -12315,7 +12337,7 @@ impl<'a, C, A> BucketListCall<'a, C, A> where C: BorrowMut, A: oa self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12351,7 +12373,7 @@ impl<'a, C, A> BucketListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12361,10 +12383,10 @@ impl<'a, C, A> BucketListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12397,7 +12419,7 @@ impl<'a, C, A> BucketListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> BucketListCall<'a, C, A> { self._project = new_value.to_string(); @@ -12443,12 +12465,12 @@ impl<'a, C, A> BucketListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12465,17 +12487,17 @@ impl<'a, C, A> BucketListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BucketListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BucketListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/storagetransfer1-cli/Cargo.toml b/gen/storagetransfer1-cli/Cargo.toml index c9df939402..eb5e8a6664 100644 --- a/gen/storagetransfer1-cli/Cargo.toml +++ b/gen/storagetransfer1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-storagetransfer1-cli" -version = "0.3.2+20150811" +version = "0.3.3+20150811" authors = ["Sebastian Thiel "] description = "A complete library to interact with storagetransfer (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/storagetransfer1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/storagetransfer1-cli/LICENSE.md b/gen/storagetransfer1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/storagetransfer1-cli/LICENSE.md +++ b/gen/storagetransfer1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/storagetransfer1-cli/README.md b/gen/storagetransfer1-cli/README.md index 42b7e51427..3d5b4776a4 100644 --- a/gen/storagetransfer1-cli/README.md +++ b/gen/storagetransfer1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *storagetransfer* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/storagetransfer1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/storagetransfer1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/storagetransfer1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/storagetransfer1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/storagetransfer1-cli). # Usage -This documentation was generated from the *storagetransfer* API at revision *20150811*. The CLI is at version *0.3.2*. +This documentation was generated from the *storagetransfer* API at revision *20150811*. The CLI is at version *0.3.3*. ```bash storagetransfer1 [options] @@ -48,18 +48,18 @@ storagetransfer1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/storagetransfer1-cli/mkdocs.yml b/gen/storagetransfer1-cli/mkdocs.yml index e111f9f51c..68ff681c0c 100644 --- a/gen/storagetransfer1-cli/mkdocs.yml +++ b/gen/storagetransfer1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: storagetransfer v0.3.2+20150811 +site_name: storagetransfer v0.3.3+20150811 site_url: http://byron.github.io/google-apis-rs/google-storagetransfer1-cli site_description: Write integrating applications with bcore @@ -24,5 +24,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/storagetransfer1-cli/src/main.rs b/gen/storagetransfer1-cli/src/main.rs index 5397c03d6f..f5b17f5f21 100644 --- a/gen/storagetransfer1-cli/src/main.rs +++ b/gen/storagetransfer1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Storagetransfer>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _google_service_accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _google_service_accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.google_service_accounts().get(opt.value_of("project-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _methods_get_google_service_account(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _methods_get_google_service_account(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.methods().get_google_service_account(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "project-id" => { @@ -116,7 +116,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["project-id"].iter().map(|v|*v)); @@ -130,7 +130,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -153,13 +153,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _transfer_jobs_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _transfer_jobs_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -173,8 +173,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "transfer-spec.object-conditions.max-time-elapsed-since-last-modification" => Some(("transferSpec.objectConditions.maxTimeElapsedSinceLastModification", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "transfer-spec.object-conditions.include-prefixes" => Some(("transferSpec.objectConditions.includePrefixes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -218,7 +218,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TransferJob = json::value::from_value(object).unwrap(); let mut call = self.hub.transfer_jobs().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -231,7 +231,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -244,7 +244,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -267,10 +267,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _transfer_jobs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _transfer_jobs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.transfer_jobs().get(opt.value_of("job-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "project-id" => { @@ -286,7 +286,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["project-id"].iter().map(|v|*v)); @@ -300,7 +300,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -323,10 +323,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _transfer_jobs_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _transfer_jobs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.transfer_jobs().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -348,7 +348,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); @@ -362,7 +362,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -385,13 +385,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _transfer_jobs_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _transfer_jobs_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -405,8 +405,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "project-id" => Some(("projectId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "update-transfer-job-field-mask" => Some(("updateTransferJobFieldMask", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -452,7 +452,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UpdateTransferJobRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.transfer_jobs().patch(request, opt.value_of("job-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -465,7 +465,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -478,7 +478,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -501,10 +501,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _transfer_operations_cancel(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _transfer_operations_cancel(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.transfer_operations().cancel(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -517,7 +517,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -530,7 +530,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -553,10 +553,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _transfer_operations_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _transfer_operations_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.transfer_operations().delete(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -569,7 +569,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -582,7 +582,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -605,10 +605,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _transfer_operations_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _transfer_operations_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.transfer_operations().get(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -621,7 +621,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -634,7 +634,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -657,10 +657,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _transfer_operations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _transfer_operations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.transfer_operations().list(opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -682,7 +682,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["filter", "page-token", "page-size"].iter().map(|v|*v)); @@ -696,7 +696,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -719,13 +719,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _transfer_operations_pause(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _transfer_operations_pause(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -739,8 +739,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -754,7 +754,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PauseTransferOperationRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.transfer_operations().pause(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -767,7 +767,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -780,7 +780,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -803,13 +803,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _transfer_operations_resume(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _transfer_operations_resume(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -823,8 +823,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { _ => { let suggestion = FieldCursor::did_you_mean(key, &vec![]); @@ -838,7 +838,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ResumeTransferOperationRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.transfer_operations().resume(request, opt.value_of("name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -851,7 +851,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -864,7 +864,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -977,14 +977,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "storagetransfer1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "storagetransfer1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1004,7 +1004,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1047,7 +1047,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("google-service-accounts", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Returns the Google service account that is used by Storage Transfer Service to access buckets in the project where transfers run or in other projects. Each Google service account is associated with one Google Developers Console project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only be used by Storage Transfer Service."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/google-service-accounts_get", vec![ @@ -1072,7 +1072,7 @@ fn main() { ]), ("methods", "methods: 'get-google-service-account'", vec![ - ("get-google-service-account", + ("get-google-service-account", Some(r##"Returns the Google service account that is used by Storage Transfer Service to access buckets in the project where transfers run or in other projects. Each Google service account is associated with one Google Developers Console project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only be used by Storage Transfer Service."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/methods_get-google-service-account", vec![ @@ -1091,7 +1091,7 @@ fn main() { ]), ("transfer-jobs", "methods: 'create', 'get', 'list' and 'patch'", vec![ - ("create", + ("create", Some(r##"Creates a transfer job that runs periodically."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/transfer-jobs_create", vec![ @@ -1113,7 +1113,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets a transfer job."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/transfer-jobs_get", vec![ @@ -1135,7 +1135,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists transfer jobs."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/transfer-jobs_list", vec![ @@ -1151,7 +1151,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates a transfer job. Updating a job's transfer spec does not affect transfer operations that are running already. Updating the scheduling of a job is not allowed."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/transfer-jobs_patch", vec![ @@ -1182,7 +1182,7 @@ fn main() { ]), ("transfer-operations", "methods: 'cancel', 'delete', 'get', 'list', 'pause' and 'resume'", vec![ - ("cancel", + ("cancel", Some(r##"Cancels a transfer. Use the get method to check whether the cancellation succeeded or whether the operation completed despite cancellation."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/transfer-operations_cancel", vec![ @@ -1204,7 +1204,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"This method is not supported and the server returns `UNIMPLEMENTED`."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/transfer-operations_delete", vec![ @@ -1226,7 +1226,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/transfer-operations_get", vec![ @@ -1248,7 +1248,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"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 below allows API services to override the binding to use different resource name schemes, such as `users/*/operations`."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/transfer-operations_list", vec![ @@ -1270,7 +1270,7 @@ fn main() { Some(false), Some(false)), ]), - ("pause", + ("pause", Some(r##"Pauses a transfer operation."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/transfer-operations_pause", vec![ @@ -1298,7 +1298,7 @@ fn main() { Some(false), Some(false)), ]), - ("resume", + ("resume", Some(r##"Resumes a transfer operation that is paused."##), "Details at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli/transfer-operations_resume", vec![ @@ -1332,7 +1332,7 @@ fn main() { let mut app = App::new("storagetransfer1") .author("Sebastian Thiel ") - .version("0.3.2+20150811") + .version("0.3.3+20150811") .about("Transfers data from external data sources to a Google Cloud Storage bucket or between Google Cloud Storage buckets.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_storagetransfer1_cli") .arg(Arg::with_name("url") @@ -1356,7 +1356,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1367,7 +1367,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/storagetransfer1/Cargo.toml b/gen/storagetransfer1/Cargo.toml index 48728682ec..f559dc58d3 100644 --- a/gen/storagetransfer1/Cargo.toml +++ b/gen/storagetransfer1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-storagetransfer1" -version = "0.1.10+20150811" +version = "0.1.11+20150811" authors = ["Sebastian Thiel "] description = "A complete library to interact with storagetransfer (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/storagetransfer1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/storagetransfer1/LICENSE.md b/gen/storagetransfer1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/storagetransfer1/LICENSE.md +++ b/gen/storagetransfer1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/storagetransfer1/README.md b/gen/storagetransfer1/README.md index 5b58896aab..5719a3143d 100644 --- a/gen/storagetransfer1/README.md +++ b/gen/storagetransfer1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-storagetransfer1` library allows access to all features of the *Google storagetransfer* service. -This documentation was generated from *storagetransfer* crate version *0.1.10+20150811*, where *20150811* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *storagetransfer* crate version *0.1.11+20150811*, where *20150811* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *storagetransfer* *v1* API can be found at the [official documentation site](https://cloud.google.com/storage/transfer). diff --git a/gen/storagetransfer1/src/cmn.rs b/gen/storagetransfer1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/storagetransfer1/src/cmn.rs +++ b/gen/storagetransfer1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/storagetransfer1/src/lib.rs b/gen/storagetransfer1/src/lib.rs index 0628af50b2..16462ae48d 100644 --- a/gen/storagetransfer1/src/lib.rs +++ b/gen/storagetransfer1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *storagetransfer* crate version *0.1.10+20150811*, where *20150811* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *storagetransfer* crate version *0.1.11+20150811*, where *20150811* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *storagetransfer* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/storage/transfer). diff --git a/gen/storagetransfer1/src/lib.rs.in b/gen/storagetransfer1/src/lib.rs.in index ead939ea06..c7e0e42b38 100644 --- a/gen/storagetransfer1/src/lib.rs.in +++ b/gen/storagetransfer1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -129,7 +130,7 @@ impl<'a, C, A> Storagetransfer Storagetransfer { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -147,7 +148,7 @@ impl<'a, C, A> Storagetransfer } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1160,7 +1161,7 @@ impl<'a, C, A> TransferOperationPauseCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.pause", + dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.pause", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -1205,14 +1206,14 @@ impl<'a, C, A> TransferOperationPauseCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1256,7 +1257,7 @@ impl<'a, C, A> TransferOperationPauseCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1266,10 +1267,10 @@ impl<'a, C, A> TransferOperationPauseCall<'a, C, A> where C: BorrowMut TransferOperationPauseCall<'a, C, A> where C: BorrowMut TransferOperationPauseCall<'a, C, A> { self._request = new_value; @@ -1311,7 +1312,7 @@ impl<'a, C, A> TransferOperationPauseCall<'a, C, A> where C: BorrowMut TransferOperationPauseCall<'a, C, A> { self._name = new_value.to_string(); @@ -1329,12 +1330,12 @@ impl<'a, C, A> TransferOperationPauseCall<'a, C, A> where C: BorrowMut TransferOperationPauseCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TransferOperationPauseCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TransferOperationPauseCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1437,7 +1438,7 @@ impl<'a, C, A> TransferOperationResumeCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.resume", + dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.resume", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -1482,14 +1483,14 @@ impl<'a, C, A> TransferOperationResumeCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1533,7 +1534,7 @@ impl<'a, C, A> TransferOperationResumeCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1543,10 +1544,10 @@ impl<'a, C, A> TransferOperationResumeCall<'a, C, A> where C: BorrowMut TransferOperationResumeCall<'a, C, A> where C: BorrowMut TransferOperationResumeCall<'a, C, A> { self._request = new_value; @@ -1588,7 +1589,7 @@ impl<'a, C, A> TransferOperationResumeCall<'a, C, A> where C: BorrowMut TransferOperationResumeCall<'a, C, A> { self._name = new_value.to_string(); @@ -1606,12 +1607,12 @@ impl<'a, C, A> TransferOperationResumeCall<'a, C, A> where C: BorrowMut TransferOperationResumeCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TransferOperationResumeCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TransferOperationResumeCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1707,7 +1708,7 @@ impl<'a, C, A> TransferOperationGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.get", + dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -1752,7 +1753,7 @@ impl<'a, C, A> TransferOperationGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1788,7 +1789,7 @@ impl<'a, C, A> TransferOperationGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1798,10 +1799,10 @@ impl<'a, C, A> TransferOperationGetCall<'a, C, A> where C: BorrowMut TransferOperationGetCall<'a, C, A> where C: BorrowMut TransferOperationGetCall<'a, C, A> { self._name = new_value.to_string(); @@ -1852,12 +1853,12 @@ impl<'a, C, A> TransferOperationGetCall<'a, C, A> where C: BorrowMut TransferOperationGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TransferOperationGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TransferOperationGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1953,7 +1954,7 @@ impl<'a, C, A> TransferOperationDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.delete", + dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -1998,7 +1999,7 @@ impl<'a, C, A> TransferOperationDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2034,7 +2035,7 @@ impl<'a, C, A> TransferOperationDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2044,10 +2045,10 @@ impl<'a, C, A> TransferOperationDeleteCall<'a, C, A> where C: BorrowMut TransferOperationDeleteCall<'a, C, A> where C: BorrowMut TransferOperationDeleteCall<'a, C, A> { self._name = new_value.to_string(); @@ -2098,12 +2099,12 @@ impl<'a, C, A> TransferOperationDeleteCall<'a, C, A> where C: BorrowMut TransferOperationDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TransferOperationDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TransferOperationDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2205,7 +2206,7 @@ impl<'a, C, A> TransferOperationListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.list", + dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -2259,7 +2260,7 @@ impl<'a, C, A> TransferOperationListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2295,7 +2296,7 @@ impl<'a, C, A> TransferOperationListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2305,10 +2306,10 @@ impl<'a, C, A> TransferOperationListCall<'a, C, A> where C: BorrowMut TransferOperationListCall<'a, C, A> where C: BorrowMut TransferOperationListCall<'a, C, A> { self._name = new_value.to_string(); @@ -2380,12 +2381,12 @@ impl<'a, C, A> TransferOperationListCall<'a, C, A> where C: BorrowMut TransferOperationListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TransferOperationListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TransferOperationListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2481,7 +2482,7 @@ impl<'a, C, A> TransferOperationCancelCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.cancel", + dlg.begin(MethodInfo { id: "storagetransfer.transferOperations.cancel", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("name", self._name.to_string())); @@ -2526,7 +2527,7 @@ impl<'a, C, A> TransferOperationCancelCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2562,7 +2563,7 @@ impl<'a, C, A> TransferOperationCancelCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2572,10 +2573,10 @@ impl<'a, C, A> TransferOperationCancelCall<'a, C, A> where C: BorrowMut TransferOperationCancelCall<'a, C, A> where C: BorrowMut TransferOperationCancelCall<'a, C, A> { self._name = new_value.to_string(); @@ -2626,12 +2627,12 @@ impl<'a, C, A> TransferOperationCancelCall<'a, C, A> where C: BorrowMut TransferOperationCancelCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> TransferOperationCancelCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TransferOperationCancelCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2726,7 +2727,7 @@ impl<'a, C, A> GoogleServiceAccountGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.googleServiceAccounts.get", + dlg.begin(MethodInfo { id: "storagetransfer.googleServiceAccounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("projectId", self._project_id.to_string())); @@ -2768,7 +2769,7 @@ impl<'a, C, A> GoogleServiceAccountGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2804,7 +2805,7 @@ impl<'a, C, A> GoogleServiceAccountGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2814,10 +2815,10 @@ impl<'a, C, A> GoogleServiceAccountGetCall<'a, C, A> where C: BorrowMut GoogleServiceAccountGetCall<'a, C, A> where C: BorrowMut GoogleServiceAccountGetCall<'a, C, A> { self._project_id = new_value.to_string(); @@ -2868,12 +2869,12 @@ impl<'a, C, A> GoogleServiceAccountGetCall<'a, C, A> where C: BorrowMut GoogleServiceAccountGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> GoogleServiceAccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GoogleServiceAccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2973,7 +2974,7 @@ impl<'a, C, A> TransferJobListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.transferJobs.list", + dlg.begin(MethodInfo { id: "storagetransfer.transferJobs.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -3002,7 +3003,7 @@ impl<'a, C, A> TransferJobListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3038,7 +3039,7 @@ impl<'a, C, A> TransferJobListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3048,10 +3049,10 @@ impl<'a, C, A> TransferJobListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3113,12 +3114,12 @@ impl<'a, C, A> TransferJobListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3141,17 +3142,17 @@ impl<'a, C, A> TransferJobListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TransferJobListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TransferJobListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3221,7 +3222,7 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.transferJobs.patch", + dlg.begin(MethodInfo { id: "storagetransfer.transferJobs.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("jobName", self._job_name.to_string())); @@ -3266,14 +3267,14 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3317,7 +3318,7 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3327,10 +3328,10 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3362,7 +3363,7 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: UpdateTransferJobRequest) -> TransferJobPatchCall<'a, C, A> { self._request = new_value; @@ -3372,7 +3373,7 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, /// /// Sets the *job name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_name(mut self, new_value: &str) -> TransferJobPatchCall<'a, C, A> { self._job_name = new_value.to_string(); @@ -3390,12 +3391,12 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3418,17 +3419,17 @@ impl<'a, C, A> TransferJobPatchCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TransferJobPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TransferJobPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3496,7 +3497,7 @@ impl<'a, C, A> TransferJobCreateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.transferJobs.create", + dlg.begin(MethodInfo { id: "storagetransfer.transferJobs.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3516,14 +3517,14 @@ impl<'a, C, A> TransferJobCreateCall<'a, C, A> where C: BorrowMut self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3567,7 +3568,7 @@ impl<'a, C, A> TransferJobCreateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3577,10 +3578,10 @@ impl<'a, C, A> TransferJobCreateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3612,7 +3613,7 @@ impl<'a, C, A> TransferJobCreateCall<'a, C, A> where C: BorrowMut /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TransferJob) -> TransferJobCreateCall<'a, C, A> { self._request = new_value; @@ -3630,12 +3631,12 @@ impl<'a, C, A> TransferJobCreateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3658,17 +3659,17 @@ impl<'a, C, A> TransferJobCreateCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TransferJobCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TransferJobCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3733,7 +3734,7 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.transferJobs.get", + dlg.begin(MethodInfo { id: "storagetransfer.transferJobs.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("jobName", self._job_name.to_string())); @@ -3781,7 +3782,7 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3817,7 +3818,7 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3827,10 +3828,10 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3863,7 +3864,7 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *job name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_name(mut self, new_value: &str) -> TransferJobGetCall<'a, C, A> { self._job_name = new_value.to_string(); @@ -3888,12 +3889,12 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -3916,17 +3917,17 @@ impl<'a, C, A> TransferJobGetCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::CloudPlatform`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TransferJobGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TransferJobGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3989,7 +3990,7 @@ impl<'a, C, A> MethodGetGoogleServiceAccountCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "storagetransfer.getGoogleServiceAccount", + dlg.begin(MethodInfo { id: "storagetransfer.getGoogleServiceAccount", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if let Some(value) = self._project_id { @@ -4012,7 +4013,7 @@ impl<'a, C, A> MethodGetGoogleServiceAccountCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4048,7 +4049,7 @@ impl<'a, C, A> MethodGetGoogleServiceAccountCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4058,10 +4059,10 @@ impl<'a, C, A> MethodGetGoogleServiceAccountCall<'a, C, A> where C: BorrowMut MethodGetGoogleServiceAccountCall<'a, C, A> where C: BorrowMut MethodGetGoogleServiceAccountCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> MethodGetGoogleServiceAccountCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MethodGetGoogleServiceAccountCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/tagmanager1-cli/Cargo.toml b/gen/tagmanager1-cli/Cargo.toml index c30c711ecc..70b662d543 100644 --- a/gen/tagmanager1-cli/Cargo.toml +++ b/gen/tagmanager1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-tagmanager1-cli" -version = "0.3.2+20151008" +version = "0.3.3+20151112" authors = ["Sebastian Thiel "] description = "A complete library to interact with Tag Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tagmanager1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/tagmanager1-cli/LICENSE.md b/gen/tagmanager1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/tagmanager1-cli/LICENSE.md +++ b/gen/tagmanager1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/tagmanager1-cli/README.md b/gen/tagmanager1-cli/README.md index 6bdd555f37..0e0594258d 100644 --- a/gen/tagmanager1-cli/README.md +++ b/gen/tagmanager1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *Tag Manager* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/tagmanager1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/tagmanager1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/tagmanager1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/tagmanager1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/tagmanager1-cli). # Usage -This documentation was generated from the *Tag Manager* API at revision *20151008*. The CLI is at version *0.3.2*. +This documentation was generated from the *Tag Manager* API at revision *20151112*. The CLI is at version *0.3.3*. ```bash tagmanager1 [options] @@ -76,18 +76,18 @@ tagmanager1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/tagmanager1-cli/mkdocs.yml b/gen/tagmanager1-cli/mkdocs.yml index bef26d606e..e30286edcb 100644 --- a/gen/tagmanager1-cli/mkdocs.yml +++ b/gen/tagmanager1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Tag Manager v0.3.2+20151008 +site_name: Tag Manager v0.3.3+20151112 site_url: http://byron.github.io/google-apis-rs/google-tagmanager1-cli site_description: Write integrating applications with bcore @@ -55,5 +55,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/tagmanager1-cli/src/main.rs b/gen/tagmanager1-cli/src/main.rs index 5304660e40..42005e12e4 100644 --- a/gen/tagmanager1-cli/src/main.rs +++ b/gen/tagmanager1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::TagManager>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _accounts_containers_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _accounts_containers_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "time-zone-id" => Some(("timeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enabled-built-in-variable" => Some(("enabledBuiltInVariable", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -91,7 +91,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Container = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_create(request, opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -104,7 +104,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -117,7 +117,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -140,10 +140,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -156,7 +156,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -169,7 +169,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -184,13 +184,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_folders_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_folders_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -204,8 +204,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "folder-id" => Some(("folderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -224,7 +224,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Folder = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_folders_create(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -237,7 +237,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -250,7 +250,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -273,10 +273,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_folders_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_folders_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_folders_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("folder-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -289,7 +289,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -302,7 +302,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -317,10 +317,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_folders_entities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_folders_entities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_folders_entities_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("folder-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -333,7 +333,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -346,7 +346,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -369,10 +369,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_folders_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_folders_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_folders_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("folder-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -385,7 +385,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -398,7 +398,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -421,10 +421,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_folders_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_folders_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_folders_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -437,7 +437,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -450,7 +450,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -473,13 +473,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_folders_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_folders_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -493,8 +493,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "folder-id" => Some(("folderId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -513,7 +513,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Folder = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_folders_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("folder-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "fingerprint" => { @@ -529,7 +529,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["fingerprint"].iter().map(|v|*v)); @@ -543,7 +543,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -566,10 +566,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -582,7 +582,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -595,7 +595,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -618,10 +618,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -634,7 +634,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -647,7 +647,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -670,10 +670,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_move_folders_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_move_folders_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_move_folders_update(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("folder-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "variable-id" => { @@ -695,7 +695,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["trigger-id", "tag-id", "variable-id"].iter().map(|v|*v)); @@ -721,13 +721,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_tags_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_tags_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -741,8 +741,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "schedule-start-ms" => Some(("scheduleStartMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "schedule-end-ms" => Some(("scheduleEndMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -775,7 +775,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Tag = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_tags_create(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -788,7 +788,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -801,7 +801,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -824,10 +824,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_tags_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_tags_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_tags_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("tag-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -840,7 +840,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -853,7 +853,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -868,10 +868,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_tags_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_tags_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_tags_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("tag-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -884,7 +884,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -897,7 +897,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -920,10 +920,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_tags_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_tags_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_tags_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -936,7 +936,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -949,7 +949,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -972,13 +972,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_tags_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_tags_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -992,8 +992,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "schedule-start-ms" => Some(("scheduleStartMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "schedule-end-ms" => Some(("scheduleEndMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1026,7 +1026,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Tag = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_tags_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("tag-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "fingerprint" => { @@ -1042,7 +1042,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["fingerprint"].iter().map(|v|*v)); @@ -1056,7 +1056,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1079,13 +1079,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_triggers_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_triggers_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1099,8 +1099,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "video-percentage-list.type" => Some(("videoPercentageList.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "video-percentage-list.value" => Some(("videoPercentageList.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1148,7 +1148,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Trigger = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_triggers_create(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1161,7 +1161,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1174,7 +1174,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1197,10 +1197,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_triggers_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_triggers_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_triggers_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("trigger-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1213,7 +1213,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1226,7 +1226,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1241,10 +1241,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_triggers_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_triggers_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_triggers_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("trigger-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1257,7 +1257,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1270,7 +1270,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1293,10 +1293,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_triggers_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_triggers_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_triggers_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1309,7 +1309,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1322,7 +1322,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1345,13 +1345,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_triggers_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_triggers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1365,8 +1365,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "video-percentage-list.type" => Some(("videoPercentageList.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "video-percentage-list.value" => Some(("videoPercentageList.value", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1414,7 +1414,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Trigger = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_triggers_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("trigger-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "fingerprint" => { @@ -1430,7 +1430,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["fingerprint"].iter().map(|v|*v)); @@ -1444,7 +1444,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1467,13 +1467,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1487,8 +1487,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "time-zone-id" => Some(("timeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "enabled-built-in-variable" => Some(("enabledBuiltInVariable", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1513,7 +1513,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Container = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "fingerprint" => { @@ -1529,7 +1529,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["fingerprint"].iter().map(|v|*v)); @@ -1543,7 +1543,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1566,13 +1566,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_variables_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_variables_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1586,8 +1586,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "schedule-start-ms" => Some(("scheduleStartMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "schedule-end-ms" => Some(("scheduleEndMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1613,7 +1613,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Variable = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_variables_create(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1626,7 +1626,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1639,7 +1639,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1662,10 +1662,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_variables_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_variables_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_variables_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("variable-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1678,7 +1678,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1691,7 +1691,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1706,10 +1706,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_variables_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_variables_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_variables_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("variable-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1722,7 +1722,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1735,7 +1735,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1758,10 +1758,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_variables_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_variables_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_variables_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1774,7 +1774,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1787,7 +1787,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1810,13 +1810,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_variables_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_variables_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1830,8 +1830,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "schedule-start-ms" => Some(("scheduleStartMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "schedule-end-ms" => Some(("scheduleEndMs", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1857,7 +1857,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Variable = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_variables_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("variable-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "fingerprint" => { @@ -1873,7 +1873,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["fingerprint"].iter().map(|v|*v)); @@ -1887,7 +1887,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1910,13 +1910,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_versions_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_versions_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1930,8 +1930,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "notes" => Some(("notes", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "name" => Some(("name", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1948,7 +1948,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CreateContainerVersionRequestVersionOptions = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_versions_create(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1961,7 +1961,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1974,7 +1974,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1997,10 +1997,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_versions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_versions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_versions_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("container-version-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2013,7 +2013,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2026,7 +2026,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2041,10 +2041,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_versions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_versions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_versions_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("container-version-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2057,7 +2057,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2070,7 +2070,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2093,12 +2093,15 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_versions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_versions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_versions_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "include-deleted" => { + call = call.include_deleted(arg_from_str(value.unwrap_or("false"), err, "include-deleted", "boolean")); + }, "headers" => { call = call.headers(arg_from_str(value.unwrap_or("false"), err, "headers", "boolean")); }, @@ -2112,10 +2115,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["headers"].iter().map(|v|*v)); + v.extend(["headers", "include-deleted"].iter().map(|v|*v)); v } )); } } @@ -2126,7 +2129,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2149,10 +2152,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_versions_publish(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_versions_publish(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_versions_publish(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("container-version-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "fingerprint" => { @@ -2168,7 +2171,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["fingerprint"].iter().map(|v|*v)); @@ -2182,7 +2185,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2205,10 +2208,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_versions_restore(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_versions_restore(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_versions_restore(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("container-version-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2221,7 +2224,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2234,7 +2237,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2257,10 +2260,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_versions_undelete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_versions_undelete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().containers_versions_undelete(opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("container-version-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2273,7 +2276,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2286,7 +2289,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2309,13 +2312,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_containers_versions_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_containers_versions_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2329,8 +2332,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "container.time-zone-id" => Some(("container.timeZoneId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "container.enabled-built-in-variable" => Some(("container.enabledBuiltInVariable", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -2362,7 +2365,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ContainerVersion = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().containers_versions_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("container-id").unwrap_or(""), opt.value_of("container-version-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "fingerprint" => { @@ -2378,7 +2381,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["fingerprint"].iter().map(|v|*v)); @@ -2392,7 +2395,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2415,10 +2418,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().get(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2431,7 +2434,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2444,7 +2447,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2467,10 +2470,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2483,7 +2486,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2496,7 +2499,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2519,13 +2522,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_permissions_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_permissions_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2539,8 +2542,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "account-access.permission" => Some(("accountAccess.permission", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "email-address" => Some(("emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2558,7 +2561,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserAccess = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().permissions_create(request, opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2571,7 +2574,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2584,7 +2587,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2607,10 +2610,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_permissions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_permissions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().permissions_delete(opt.value_of("account-id").unwrap_or(""), opt.value_of("permission-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2623,7 +2626,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2636,7 +2639,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2651,10 +2654,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_permissions_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_permissions_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().permissions_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("permission-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2667,7 +2670,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2680,7 +2683,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2703,10 +2706,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_permissions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_permissions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.accounts().permissions_list(opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2719,7 +2722,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2732,7 +2735,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2755,13 +2758,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_permissions_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_permissions_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2775,8 +2778,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "account-access.permission" => Some(("accountAccess.permission", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "email-address" => Some(("emailAddress", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2794,7 +2797,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::UserAccess = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().permissions_update(request, opt.value_of("account-id").unwrap_or(""), opt.value_of("permission-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2807,7 +2810,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2820,7 +2823,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2843,13 +2846,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _accounts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _accounts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2863,8 +2866,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "share-data" => Some(("shareData", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "fingerprint" => Some(("fingerprint", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2882,7 +2885,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Account = json::value::from_value(object).unwrap(); let mut call = self.hub.accounts().update(request, opt.value_of("account-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "fingerprint" => { @@ -2898,7 +2901,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["fingerprint"].iter().map(|v|*v)); @@ -2912,7 +2915,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3094,14 +3097,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "tagmanager1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "tagmanager1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -3121,7 +3124,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -3160,7 +3163,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("accounts", "methods: 'containers-create', 'containers-delete', 'containers-folders-create', 'containers-folders-delete', 'containers-folders-entities-list', 'containers-folders-get', 'containers-folders-list', 'containers-folders-update', 'containers-get', 'containers-list', 'containers-move-folders-update', 'containers-tags-create', 'containers-tags-delete', 'containers-tags-get', 'containers-tags-list', 'containers-tags-update', 'containers-triggers-create', 'containers-triggers-delete', 'containers-triggers-get', 'containers-triggers-list', 'containers-triggers-update', 'containers-update', 'containers-variables-create', 'containers-variables-delete', 'containers-variables-get', 'containers-variables-list', 'containers-variables-update', 'containers-versions-create', 'containers-versions-delete', 'containers-versions-get', 'containers-versions-list', 'containers-versions-publish', 'containers-versions-restore', 'containers-versions-undelete', 'containers-versions-update', 'get', 'list', 'permissions-create', 'permissions-delete', 'permissions-get', 'permissions-list', 'permissions-update' and 'update'", vec![ - ("containers-create", + ("containers-create", Some(r##"Creates a Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-create", vec![ @@ -3188,7 +3191,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-delete", + ("containers-delete", Some(r##"Deletes a Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-delete", vec![ @@ -3210,7 +3213,7 @@ fn main() { Some(false), Some(true)), ]), - ("containers-folders-create", + ("containers-folders-create", Some(r##"Creates a GTM Folder."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-folders-create", vec![ @@ -3244,7 +3247,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-folders-delete", + ("containers-folders-delete", Some(r##"Deletes a GTM Folder."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-folders-delete", vec![ @@ -3272,7 +3275,7 @@ fn main() { Some(false), Some(true)), ]), - ("containers-folders-entities-list", + ("containers-folders-entities-list", Some(r##"List all entities in a GTM Folder."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-folders-entities-list", vec![ @@ -3306,7 +3309,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-folders-get", + ("containers-folders-get", Some(r##"Gets a GTM Folder."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-folders-get", vec![ @@ -3340,7 +3343,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-folders-list", + ("containers-folders-list", Some(r##"Lists all GTM Folders of a Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-folders-list", vec![ @@ -3368,7 +3371,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-folders-update", + ("containers-folders-update", Some(r##"Updates a GTM Folder."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-folders-update", vec![ @@ -3408,7 +3411,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-get", + ("containers-get", Some(r##"Gets a Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-get", vec![ @@ -3436,7 +3439,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-list", + ("containers-list", Some(r##"Lists all Containers that belongs to a GTM Account."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-list", vec![ @@ -3458,7 +3461,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-move-folders-update", + ("containers-move-folders-update", Some(r##"Moves entities to a GTM Folder."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-move-folders-update", vec![ @@ -3486,7 +3489,7 @@ fn main() { Some(false), Some(true)), ]), - ("containers-tags-create", + ("containers-tags-create", Some(r##"Creates a GTM Tag."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-tags-create", vec![ @@ -3520,7 +3523,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-tags-delete", + ("containers-tags-delete", Some(r##"Deletes a GTM Tag."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-tags-delete", vec![ @@ -3548,7 +3551,7 @@ fn main() { Some(false), Some(true)), ]), - ("containers-tags-get", + ("containers-tags-get", Some(r##"Gets a GTM Tag."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-tags-get", vec![ @@ -3582,7 +3585,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-tags-list", + ("containers-tags-list", Some(r##"Lists all GTM Tags of a Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-tags-list", vec![ @@ -3610,7 +3613,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-tags-update", + ("containers-tags-update", Some(r##"Updates a GTM Tag."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-tags-update", vec![ @@ -3650,7 +3653,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-triggers-create", + ("containers-triggers-create", Some(r##"Creates a GTM Trigger."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-triggers-create", vec![ @@ -3684,7 +3687,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-triggers-delete", + ("containers-triggers-delete", Some(r##"Deletes a GTM Trigger."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-triggers-delete", vec![ @@ -3712,7 +3715,7 @@ fn main() { Some(false), Some(true)), ]), - ("containers-triggers-get", + ("containers-triggers-get", Some(r##"Gets a GTM Trigger."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-triggers-get", vec![ @@ -3746,7 +3749,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-triggers-list", + ("containers-triggers-list", Some(r##"Lists all GTM Triggers of a Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-triggers-list", vec![ @@ -3774,7 +3777,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-triggers-update", + ("containers-triggers-update", Some(r##"Updates a GTM Trigger."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-triggers-update", vec![ @@ -3814,7 +3817,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-update", + ("containers-update", Some(r##"Updates a Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-update", vec![ @@ -3848,7 +3851,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-variables-create", + ("containers-variables-create", Some(r##"Creates a GTM Variable."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-variables-create", vec![ @@ -3882,7 +3885,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-variables-delete", + ("containers-variables-delete", Some(r##"Deletes a GTM Variable."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-variables-delete", vec![ @@ -3910,7 +3913,7 @@ fn main() { Some(false), Some(true)), ]), - ("containers-variables-get", + ("containers-variables-get", Some(r##"Gets a GTM Variable."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-variables-get", vec![ @@ -3944,7 +3947,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-variables-list", + ("containers-variables-list", Some(r##"Lists all GTM Variables of a Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-variables-list", vec![ @@ -3972,7 +3975,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-variables-update", + ("containers-variables-update", Some(r##"Updates a GTM Variable."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-variables-update", vec![ @@ -4012,7 +4015,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-versions-create", + ("containers-versions-create", Some(r##"Creates a Container Version."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-versions-create", vec![ @@ -4046,7 +4049,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-versions-delete", + ("containers-versions-delete", Some(r##"Deletes a Container Version."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-versions-delete", vec![ @@ -4074,7 +4077,7 @@ fn main() { Some(false), Some(true)), ]), - ("containers-versions-get", + ("containers-versions-get", Some(r##"Gets a Container Version."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-versions-get", vec![ @@ -4108,7 +4111,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-versions-list", + ("containers-versions-list", Some(r##"Lists all Container Versions of a GTM Container."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-versions-list", vec![ @@ -4136,7 +4139,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-versions-publish", + ("containers-versions-publish", Some(r##"Publishes a Container Version."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-versions-publish", vec![ @@ -4170,7 +4173,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-versions-restore", + ("containers-versions-restore", Some(r##"Restores a Container Version. This will overwrite the container's current configuration (including its variables, triggers and tags). The operation will not have any effect on the version that is being served (i.e. the published version)."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-versions-restore", vec![ @@ -4204,7 +4207,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-versions-undelete", + ("containers-versions-undelete", Some(r##"Undeletes a Container Version."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-versions-undelete", vec![ @@ -4238,7 +4241,7 @@ fn main() { Some(false), Some(false)), ]), - ("containers-versions-update", + ("containers-versions-update", Some(r##"Updates a Container Version."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_containers-versions-update", vec![ @@ -4278,7 +4281,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets a GTM Account."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_get", vec![ @@ -4300,7 +4303,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists all GTM Accounts that a user has access to."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_list", vec![ @@ -4316,7 +4319,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-create", + ("permissions-create", Some(r##"Creates a user's Account & Container Permissions."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_permissions-create", vec![ @@ -4344,7 +4347,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-delete", + ("permissions-delete", Some(r##"Removes a user from the account, revoking access to it and all of its containers."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_permissions-delete", vec![ @@ -4366,7 +4369,7 @@ fn main() { Some(false), Some(true)), ]), - ("permissions-get", + ("permissions-get", Some(r##"Gets a user's Account & Container Permissions."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_permissions-get", vec![ @@ -4394,7 +4397,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-list", + ("permissions-list", Some(r##"List all users that have access to the account along with Account and Container Permissions granted to each of them."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_permissions-list", vec![ @@ -4416,7 +4419,7 @@ fn main() { Some(false), Some(false)), ]), - ("permissions-update", + ("permissions-update", Some(r##"Updates a user's Account & Container Permissions."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_permissions-update", vec![ @@ -4450,7 +4453,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a GTM Account."##), "Details at http://byron.github.io/google-apis-rs/google_tagmanager1_cli/accounts_update", vec![ @@ -4484,7 +4487,7 @@ fn main() { let mut app = App::new("tagmanager1") .author("Sebastian Thiel ") - .version("0.3.2+20151008") + .version("0.3.3+20151112") .about("API for accessing Tag Manager accounts and containers.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_tagmanager1_cli") .arg(Arg::with_name("url") @@ -4508,7 +4511,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -4519,7 +4522,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/tagmanager1/Cargo.toml b/gen/tagmanager1/Cargo.toml index 25edacd1ec..5d8d19c1b8 100644 --- a/gen/tagmanager1/Cargo.toml +++ b/gen/tagmanager1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-tagmanager1" -version = "0.1.10+20151008" +version = "0.1.11+20151112" authors = ["Sebastian Thiel "] description = "A complete library to interact with Tag Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tagmanager1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/tagmanager1/LICENSE.md b/gen/tagmanager1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/tagmanager1/LICENSE.md +++ b/gen/tagmanager1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/tagmanager1/README.md b/gen/tagmanager1/README.md index ec2ad1107e..2e38cd6a08 100644 --- a/gen/tagmanager1/README.md +++ b/gen/tagmanager1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-tagmanager1` library allows access to all features of the *Google Tag Manager* service. -This documentation was generated from *Tag Manager* crate version *0.1.10+20151008*, where *20151008* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *Tag Manager* crate version *0.1.11+20151112*, where *20151112* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *Tag Manager* *v1* API can be found at the [official documentation site](https://developers.google.com/tag-manager/api/v1/). diff --git a/gen/tagmanager1/src/cmn.rs b/gen/tagmanager1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/tagmanager1/src/cmn.rs +++ b/gen/tagmanager1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/tagmanager1/src/lib.rs b/gen/tagmanager1/src/lib.rs index 90ad290572..ef9892b1d0 100644 --- a/gen/tagmanager1/src/lib.rs +++ b/gen/tagmanager1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Tag Manager* crate version *0.1.10+20151008*, where *20151008* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *Tag Manager* crate version *0.1.11+20151112*, where *20151112* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *Tag Manager* *v1* API can be found at the //! [official documentation site](https://developers.google.com/tag-manager/api/v1/). @@ -136,9 +136,9 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.accounts().containers_move_folders_update("accountId", "containerId", "folderId") -//! .add_variable_id("clita") -//! .add_trigger_id("diam") -//! .add_tag_id("justo") +//! .add_variable_id("diam") +//! .add_trigger_id("justo") +//! .add_tag_id("est") //! .doit(); //! //! match result { diff --git a/gen/tagmanager1/src/lib.rs.in b/gen/tagmanager1/src/lib.rs.in index b29b0610c9..2fd6e44bfa 100644 --- a/gen/tagmanager1/src/lib.rs.in +++ b/gen/tagmanager1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -153,7 +154,7 @@ impl<'a, C, A> TagManager TagManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -162,7 +163,7 @@ impl<'a, C, A> TagManager } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -1239,6 +1240,7 @@ impl<'a, C, A> AccountMethods<'a, C, A> { hub: self.hub, _account_id: account_id.to_string(), _container_id: container_id.to_string(), + _include_deleted: Default::default(), _headers: Default::default(), _delegate: Default::default(), _scopes: Default::default(), @@ -2058,7 +2060,7 @@ impl<'a, C, A> AccountContainerListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.list", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2100,7 +2102,7 @@ impl<'a, C, A> AccountContainerListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2136,7 +2138,7 @@ impl<'a, C, A> AccountContainerListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2146,10 +2148,10 @@ impl<'a, C, A> AccountContainerListCall<'a, C, A> where C: BorrowMut AccountContainerListCall<'a, C, A> where C: BorrowMut AccountContainerListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2200,12 +2202,12 @@ impl<'a, C, A> AccountContainerListCall<'a, C, A> where C: BorrowMut AccountContainerListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2294,7 +2296,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.permissions.list", + dlg.begin(MethodInfo { id: "tagmanager.accounts.permissions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2336,7 +2338,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2372,7 +2374,7 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2382,10 +2384,10 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2436,12 +2438,12 @@ impl<'a, C, A> AccountPermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2537,7 +2539,7 @@ impl<'a, C, A> AccountContainerCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.create", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2579,14 +2581,14 @@ impl<'a, C, A> AccountContainerCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2630,7 +2632,7 @@ impl<'a, C, A> AccountContainerCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2640,10 +2642,10 @@ impl<'a, C, A> AccountContainerCreateCall<'a, C, A> where C: BorrowMut AccountContainerCreateCall<'a, C, A> where C: BorrowMut AccountContainerCreateCall<'a, C, A> { self._request = new_value; @@ -2685,7 +2687,7 @@ impl<'a, C, A> AccountContainerCreateCall<'a, C, A> where C: BorrowMut AccountContainerCreateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2703,12 +2705,12 @@ impl<'a, C, A> AccountContainerCreateCall<'a, C, A> where C: BorrowMut AccountContainerCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2804,7 +2806,7 @@ impl<'a, C, A> AccountPermissionCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.permissions.create", + dlg.begin(MethodInfo { id: "tagmanager.accounts.permissions.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -2846,14 +2848,14 @@ impl<'a, C, A> AccountPermissionCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2897,7 +2899,7 @@ impl<'a, C, A> AccountPermissionCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2907,10 +2909,10 @@ impl<'a, C, A> AccountPermissionCreateCall<'a, C, A> where C: BorrowMut AccountPermissionCreateCall<'a, C, A> where C: BorrowMut AccountPermissionCreateCall<'a, C, A> { self._request = new_value; @@ -2952,7 +2954,7 @@ impl<'a, C, A> AccountPermissionCreateCall<'a, C, A> where C: BorrowMut AccountPermissionCreateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -2970,12 +2972,12 @@ impl<'a, C, A> AccountPermissionCreateCall<'a, C, A> where C: BorrowMut AccountPermissionCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3065,7 +3067,7 @@ impl<'a, C, A> AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.permissions.delete", + dlg.begin(MethodInfo { id: "tagmanager.accounts.permissions.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -3107,7 +3109,7 @@ impl<'a, C, A> AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3143,7 +3145,7 @@ impl<'a, C, A> AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3153,10 +3155,10 @@ impl<'a, C, A> AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut AccountPermissionDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -3189,7 +3191,7 @@ impl<'a, C, A> AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut AccountPermissionDeleteCall<'a, C, A> { self._permission_id = new_value.to_string(); @@ -3207,12 +3209,12 @@ impl<'a, C, A> AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut AccountPermissionDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3302,7 +3304,7 @@ impl<'a, C, A> AccountContainerGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.get", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -3345,7 +3347,7 @@ impl<'a, C, A> AccountContainerGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3381,7 +3383,7 @@ impl<'a, C, A> AccountContainerGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3391,10 +3393,10 @@ impl<'a, C, A> AccountContainerGetCall<'a, C, A> where C: BorrowMut AccountContainerGetCall<'a, C, A> where C: BorrowMut AccountContainerGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -3437,7 +3439,7 @@ impl<'a, C, A> AccountContainerGetCall<'a, C, A> where C: BorrowMut AccountContainerGetCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -3455,12 +3457,12 @@ impl<'a, C, A> AccountContainerGetCall<'a, C, A> where C: BorrowMut AccountContainerGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3522,6 +3524,7 @@ impl<'a, C, A> AccountContainerGetCall<'a, C, A> where C: BorrowMut hub: &'a TagManager, _account_id: String, _container_id: String, + _include_deleted: Option, _headers: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, @@ -3552,15 +3556,18 @@ impl<'a, C, A> AccountContainerVersionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.list", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); params.push(("containerId", self._container_id.to_string())); + if let Some(value) = self._include_deleted { + params.push(("includeDeleted", value.to_string())); + } if let Some(value) = self._headers { params.push(("headers", value.to_string())); } - for &field in ["alt", "accountId", "containerId", "headers"].iter() { + for &field in ["alt", "accountId", "containerId", "includeDeleted", "headers"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -3598,7 +3605,7 @@ impl<'a, C, A> AccountContainerVersionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3634,7 +3641,7 @@ impl<'a, C, A> AccountContainerVersionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3644,10 +3651,10 @@ impl<'a, C, A> AccountContainerVersionListCall<'a, C, A> where C: BorrowMut AccountContainerVersionListCall<'a, C, A> where C: BorrowMut AccountContainerVersionListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -3690,12 +3697,19 @@ impl<'a, C, A> AccountContainerVersionListCall<'a, C, A> where C: BorrowMut AccountContainerVersionListCall<'a, C, A> { self._container_id = new_value.to_string(); self } + /// Also retrieve deleted (archived) versions when true. + /// + /// Sets the *include deleted* query property to the given value. + pub fn include_deleted(mut self, new_value: bool) -> AccountContainerVersionListCall<'a, C, A> { + self._include_deleted = Some(new_value); + self + } /// Retrieve headers only when true. /// /// Sets the *headers* query property to the given value. @@ -3715,12 +3729,12 @@ impl<'a, C, A> AccountContainerVersionListCall<'a, C, A> where C: BorrowMut AccountContainerVersionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVersionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVersionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3788,7 +3802,7 @@ impl<'a, C, A> AccountContainerVersionListCall<'a, C, A> where C: BorrowMut AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.triggers.update", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.triggers.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -3867,14 +3881,14 @@ impl<'a, C, A> AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3918,7 +3932,7 @@ impl<'a, C, A> AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3928,10 +3942,10 @@ impl<'a, C, A> AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerUpdateCall<'a, C, A> { self._request = new_value; @@ -3973,7 +3987,7 @@ impl<'a, C, A> AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -3983,7 +3997,7 @@ impl<'a, C, A> AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerUpdateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -3993,7 +4007,7 @@ impl<'a, C, A> AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerUpdateCall<'a, C, A> { self._trigger_id = new_value.to_string(); @@ -4018,12 +4032,12 @@ impl<'a, C, A> AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerTriggerUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerTriggerUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4114,7 +4128,7 @@ impl<'a, C, A> AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.triggers.get", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.triggers.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -4158,7 +4172,7 @@ impl<'a, C, A> AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4194,7 +4208,7 @@ impl<'a, C, A> AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4204,10 +4218,10 @@ impl<'a, C, A> AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut AccountContainerTriggerGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -4250,7 +4264,7 @@ impl<'a, C, A> AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut AccountContainerTriggerGetCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -4260,7 +4274,7 @@ impl<'a, C, A> AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut AccountContainerTriggerGetCall<'a, C, A> { self._trigger_id = new_value.to_string(); @@ -4278,12 +4292,12 @@ impl<'a, C, A> AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut AccountContainerTriggerGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerTriggerGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerTriggerGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4373,7 +4387,7 @@ impl<'a, C, A> AccountContainerDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.delete", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -4415,7 +4429,7 @@ impl<'a, C, A> AccountContainerDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4451,7 +4465,7 @@ impl<'a, C, A> AccountContainerDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4461,10 +4475,10 @@ impl<'a, C, A> AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -4497,7 +4511,7 @@ impl<'a, C, A> AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -4515,12 +4529,12 @@ impl<'a, C, A> AccountContainerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4611,7 +4625,7 @@ impl<'a, C, A> AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.delete", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -4654,7 +4668,7 @@ impl<'a, C, A> AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4690,7 +4704,7 @@ impl<'a, C, A> AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4700,10 +4714,10 @@ impl<'a, C, A> AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut AccountContainerFolderDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -4736,7 +4750,7 @@ impl<'a, C, A> AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut AccountContainerFolderDeleteCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -4746,7 +4760,7 @@ impl<'a, C, A> AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut AccountContainerFolderDeleteCall<'a, C, A> { self._folder_id = new_value.to_string(); @@ -4764,12 +4778,12 @@ impl<'a, C, A> AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut AccountContainerFolderDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerFolderDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerFolderDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4860,7 +4874,7 @@ impl<'a, C, A> AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.tags.delete", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.tags.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -4903,7 +4917,7 @@ impl<'a, C, A> AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4939,7 +4953,7 @@ impl<'a, C, A> AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4949,10 +4963,10 @@ impl<'a, C, A> AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTagDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -4985,7 +4999,7 @@ impl<'a, C, A> AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTagDeleteCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -4995,7 +5009,7 @@ impl<'a, C, A> AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTagDeleteCall<'a, C, A> { self._tag_id = new_value.to_string(); @@ -5013,12 +5027,12 @@ impl<'a, C, A> AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTagDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerTagDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerTagDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5109,7 +5123,7 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.entities.list", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.entities.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5153,7 +5167,7 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5189,7 +5203,7 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5199,10 +5213,10 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5235,7 +5249,7 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountContainerFolderEntityListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5245,7 +5259,7 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut /// /// Sets the *container id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn container_id(mut self, new_value: &str) -> AccountContainerFolderEntityListCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -5255,7 +5269,7 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut /// /// Sets the *folder id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn folder_id(mut self, new_value: &str) -> AccountContainerFolderEntityListCall<'a, C, A> { self._folder_id = new_value.to_string(); @@ -5273,12 +5287,12 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5295,17 +5309,17 @@ impl<'a, C, A> AccountContainerFolderEntityListCall<'a, C, A> where C: BorrowMut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountContainerFolderEntityListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerFolderEntityListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5369,7 +5383,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.undelete", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.undelete", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5413,7 +5427,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5449,7 +5463,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5459,10 +5473,10 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5495,7 +5509,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountContainerVersionUndeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5505,7 +5519,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< /// /// Sets the *container id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn container_id(mut self, new_value: &str) -> AccountContainerVersionUndeleteCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -5515,7 +5529,7 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< /// /// Sets the *container version id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn container_version_id(mut self, new_value: &str) -> AccountContainerVersionUndeleteCall<'a, C, A> { self._container_version_id = new_value.to_string(); @@ -5533,12 +5547,12 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -5555,17 +5569,17 @@ impl<'a, C, A> AccountContainerVersionUndeleteCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::EditContainerversion`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountContainerVersionUndeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVersionUndeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5628,7 +5642,7 @@ impl<'a, C, A> AccountContainerTagListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.tags.list", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.tags.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5671,7 +5685,7 @@ impl<'a, C, A> AccountContainerTagListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5707,7 +5721,7 @@ impl<'a, C, A> AccountContainerTagListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5717,10 +5731,10 @@ impl<'a, C, A> AccountContainerTagListCall<'a, C, A> where C: BorrowMut AccountContainerTagListCall<'a, C, A> where C: BorrowMut AccountContainerTagListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -5763,7 +5777,7 @@ impl<'a, C, A> AccountContainerTagListCall<'a, C, A> where C: BorrowMut AccountContainerTagListCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -5781,12 +5795,12 @@ impl<'a, C, A> AccountContainerTagListCall<'a, C, A> where C: BorrowMut AccountContainerTagListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerTagListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerTagListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -5848,7 +5862,7 @@ impl<'a, C, A> AccountContainerTagListCall<'a, C, A> where C: BorrowMut AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.publish", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.publish", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -5926,7 +5940,7 @@ impl<'a, C, A> AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -5962,7 +5976,7 @@ impl<'a, C, A> AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -5972,10 +5986,10 @@ impl<'a, C, A> AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut AccountContainerVersionPublishCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6018,7 +6032,7 @@ impl<'a, C, A> AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut AccountContainerVersionPublishCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -6028,7 +6042,7 @@ impl<'a, C, A> AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut AccountContainerVersionPublishCall<'a, C, A> { self._container_version_id = new_value.to_string(); @@ -6053,12 +6067,12 @@ impl<'a, C, A> AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut AccountContainerVersionPublishCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVersionPublishCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVersionPublishCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6149,7 +6163,7 @@ impl<'a, C, A> AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.get", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6193,7 +6207,7 @@ impl<'a, C, A> AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6229,7 +6243,7 @@ impl<'a, C, A> AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6239,10 +6253,10 @@ impl<'a, C, A> AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut AccountContainerFolderGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6285,7 +6299,7 @@ impl<'a, C, A> AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut AccountContainerFolderGetCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -6295,7 +6309,7 @@ impl<'a, C, A> AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut AccountContainerFolderGetCall<'a, C, A> { self._folder_id = new_value.to_string(); @@ -6313,12 +6327,12 @@ impl<'a, C, A> AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut AccountContainerFolderGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerFolderGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerFolderGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6415,7 +6429,7 @@ impl<'a, C, A> AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.tags.create", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.tags.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6458,14 +6472,14 @@ impl<'a, C, A> AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -6509,7 +6523,7 @@ impl<'a, C, A> AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6519,10 +6533,10 @@ impl<'a, C, A> AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut AccountContainerTagCreateCall<'a, C, A> { self._request = new_value; @@ -6564,7 +6578,7 @@ impl<'a, C, A> AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut AccountContainerTagCreateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6574,7 +6588,7 @@ impl<'a, C, A> AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut AccountContainerTagCreateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -6592,12 +6606,12 @@ impl<'a, C, A> AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut AccountContainerTagCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerTagCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerTagCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6687,7 +6701,7 @@ impl<'a, C, A> AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.triggers.list", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.triggers.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6730,7 +6744,7 @@ impl<'a, C, A> AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -6766,7 +6780,7 @@ impl<'a, C, A> AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -6776,10 +6790,10 @@ impl<'a, C, A> AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut AccountContainerTriggerListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -6822,7 +6836,7 @@ impl<'a, C, A> AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut AccountContainerTriggerListCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -6840,12 +6854,12 @@ impl<'a, C, A> AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut AccountContainerTriggerListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerTriggerListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerTriggerListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -6936,7 +6950,7 @@ impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.delete", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -6979,7 +6993,7 @@ impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7015,7 +7029,7 @@ impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7025,10 +7039,10 @@ impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVersionDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7061,7 +7075,7 @@ impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVersionDeleteCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -7071,7 +7085,7 @@ impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVersionDeleteCall<'a, C, A> { self._container_version_id = new_value.to_string(); @@ -7089,12 +7103,12 @@ impl<'a, C, A> AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVersionDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVersionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVersionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7192,7 +7206,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.update", + dlg.begin(MethodInfo { id: "tagmanager.accounts.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -7237,14 +7251,14 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7288,7 +7302,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7298,10 +7312,10 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7333,7 +7347,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Account) -> AccountUpdateCall<'a, C, A> { self._request = new_value; @@ -7343,7 +7357,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7368,12 +7382,12 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -7390,17 +7404,17 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::ManageAccount`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7470,7 +7484,7 @@ impl<'a, C, A> AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.create", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -7513,14 +7527,14 @@ impl<'a, C, A> AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -7564,7 +7578,7 @@ impl<'a, C, A> AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7574,10 +7588,10 @@ impl<'a, C, A> AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut AccountContainerVersionCreateCall<'a, C, A> { self._request = new_value; @@ -7619,7 +7633,7 @@ impl<'a, C, A> AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut AccountContainerVersionCreateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7629,7 +7643,7 @@ impl<'a, C, A> AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut AccountContainerVersionCreateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -7647,12 +7661,12 @@ impl<'a, C, A> AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut AccountContainerVersionCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVersionCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVersionCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7742,7 +7756,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.permissions.get", + dlg.begin(MethodInfo { id: "tagmanager.accounts.permissions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -7785,7 +7799,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7821,7 +7835,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7831,10 +7845,10 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -7877,7 +7891,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> { self._permission_id = new_value.to_string(); @@ -7895,12 +7909,12 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7962,9 +7976,9 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.move_folders.update", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.move_folders.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8069,7 +8083,7 @@ impl<'a, C, A> AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8090,7 +8104,7 @@ impl<'a, C, A> AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8100,10 +8114,10 @@ impl<'a, C, A> AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8126,7 +8140,7 @@ impl<'a, C, A> AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountContainerMoveFolderUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8136,7 +8150,7 @@ impl<'a, C, A> AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *container id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn container_id(mut self, new_value: &str) -> AccountContainerMoveFolderUpdateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -8146,7 +8160,7 @@ impl<'a, C, A> AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut /// /// Sets the *folder id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn folder_id(mut self, new_value: &str) -> AccountContainerMoveFolderUpdateCall<'a, C, A> { self._folder_id = new_value.to_string(); @@ -8188,12 +8202,12 @@ impl<'a, C, A> AccountContainerMoveFolderUpdateCall<'a, C, A> where C: BorrowMut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -8268,7 +8282,7 @@ impl<'a, C, A> AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.restore", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.restore", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8312,7 +8326,7 @@ impl<'a, C, A> AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8348,7 +8362,7 @@ impl<'a, C, A> AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8358,10 +8372,10 @@ impl<'a, C, A> AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut AccountContainerVersionRestoreCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8404,7 +8418,7 @@ impl<'a, C, A> AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut AccountContainerVersionRestoreCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -8414,7 +8428,7 @@ impl<'a, C, A> AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut AccountContainerVersionRestoreCall<'a, C, A> { self._container_version_id = new_value.to_string(); @@ -8432,12 +8446,12 @@ impl<'a, C, A> AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut AccountContainerVersionRestoreCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVersionRestoreCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVersionRestoreCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8534,7 +8548,7 @@ impl<'a, C, A> AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.variables.create", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.variables.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8577,14 +8591,14 @@ impl<'a, C, A> AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8628,7 +8642,7 @@ impl<'a, C, A> AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8638,10 +8652,10 @@ impl<'a, C, A> AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut AccountContainerVariableCreateCall<'a, C, A> { self._request = new_value; @@ -8683,7 +8697,7 @@ impl<'a, C, A> AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut AccountContainerVariableCreateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8693,7 +8707,7 @@ impl<'a, C, A> AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut AccountContainerVariableCreateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -8711,12 +8725,12 @@ impl<'a, C, A> AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut AccountContainerVariableCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVariableCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVariableCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8806,7 +8820,7 @@ impl<'a, C, A> AccountContainerVariableListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.variables.list", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.variables.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -8849,7 +8863,7 @@ impl<'a, C, A> AccountContainerVariableListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8885,7 +8899,7 @@ impl<'a, C, A> AccountContainerVariableListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8895,10 +8909,10 @@ impl<'a, C, A> AccountContainerVariableListCall<'a, C, A> where C: BorrowMut AccountContainerVariableListCall<'a, C, A> where C: BorrowMut AccountContainerVariableListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -8941,7 +8955,7 @@ impl<'a, C, A> AccountContainerVariableListCall<'a, C, A> where C: BorrowMut AccountContainerVariableListCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -8959,12 +8973,12 @@ impl<'a, C, A> AccountContainerVariableListCall<'a, C, A> where C: BorrowMut AccountContainerVariableListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVariableListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVariableListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9055,7 +9069,7 @@ impl<'a, C, A> AccountContainerTagGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.tags.get", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.tags.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9099,7 +9113,7 @@ impl<'a, C, A> AccountContainerTagGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9135,7 +9149,7 @@ impl<'a, C, A> AccountContainerTagGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9145,10 +9159,10 @@ impl<'a, C, A> AccountContainerTagGetCall<'a, C, A> where C: BorrowMut AccountContainerTagGetCall<'a, C, A> where C: BorrowMut AccountContainerTagGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9191,7 +9205,7 @@ impl<'a, C, A> AccountContainerTagGetCall<'a, C, A> where C: BorrowMut AccountContainerTagGetCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -9201,7 +9215,7 @@ impl<'a, C, A> AccountContainerTagGetCall<'a, C, A> where C: BorrowMut AccountContainerTagGetCall<'a, C, A> { self._tag_id = new_value.to_string(); @@ -9219,12 +9233,12 @@ impl<'a, C, A> AccountContainerTagGetCall<'a, C, A> where C: BorrowMut AccountContainerTagGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerTagGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerTagGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9315,7 +9329,7 @@ impl<'a, C, A> AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.variables.get", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.variables.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9359,7 +9373,7 @@ impl<'a, C, A> AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9395,7 +9409,7 @@ impl<'a, C, A> AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9405,10 +9419,10 @@ impl<'a, C, A> AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut AccountContainerVariableGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9451,7 +9465,7 @@ impl<'a, C, A> AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut AccountContainerVariableGetCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -9461,7 +9475,7 @@ impl<'a, C, A> AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut AccountContainerVariableGetCall<'a, C, A> { self._variable_id = new_value.to_string(); @@ -9479,12 +9493,12 @@ impl<'a, C, A> AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut AccountContainerVariableGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVariableGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVariableGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9575,7 +9589,7 @@ impl<'a, C, A> AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.triggers.delete", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.triggers.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9618,7 +9632,7 @@ impl<'a, C, A> AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9654,7 +9668,7 @@ impl<'a, C, A> AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9664,10 +9678,10 @@ impl<'a, C, A> AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTriggerDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9700,7 +9714,7 @@ impl<'a, C, A> AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTriggerDeleteCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -9710,7 +9724,7 @@ impl<'a, C, A> AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTriggerDeleteCall<'a, C, A> { self._trigger_id = new_value.to_string(); @@ -9728,12 +9742,12 @@ impl<'a, C, A> AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut AccountContainerTriggerDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerTriggerDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerTriggerDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9830,7 +9844,7 @@ impl<'a, C, A> AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.triggers.create", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.triggers.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -9873,14 +9887,14 @@ impl<'a, C, A> AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9924,7 +9938,7 @@ impl<'a, C, A> AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9934,10 +9948,10 @@ impl<'a, C, A> AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerCreateCall<'a, C, A> { self._request = new_value; @@ -9979,7 +9993,7 @@ impl<'a, C, A> AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerCreateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -9989,7 +10003,7 @@ impl<'a, C, A> AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerCreateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -10007,12 +10021,12 @@ impl<'a, C, A> AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerTriggerCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerTriggerCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10080,7 +10094,7 @@ impl<'a, C, A> AccountContainerTriggerCreateCall<'a, C, A> where C: BorrowMut AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.update", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -10159,14 +10173,14 @@ impl<'a, C, A> AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10210,7 +10224,7 @@ impl<'a, C, A> AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10220,10 +10234,10 @@ impl<'a, C, A> AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut AccountContainerFolderUpdateCall<'a, C, A> { self._request = new_value; @@ -10265,7 +10279,7 @@ impl<'a, C, A> AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut AccountContainerFolderUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10275,7 +10289,7 @@ impl<'a, C, A> AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut AccountContainerFolderUpdateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -10285,7 +10299,7 @@ impl<'a, C, A> AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut AccountContainerFolderUpdateCall<'a, C, A> { self._folder_id = new_value.to_string(); @@ -10310,12 +10324,12 @@ impl<'a, C, A> AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut AccountContainerFolderUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerFolderUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerFolderUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10403,7 +10417,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.list", + dlg.begin(MethodInfo { id: "tagmanager.accounts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -10423,7 +10437,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10459,7 +10473,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10469,10 +10483,10 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10513,12 +10527,12 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10535,17 +10549,17 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10615,7 +10629,7 @@ impl<'a, C, A> AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.permissions.update", + dlg.begin(MethodInfo { id: "tagmanager.accounts.permissions.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -10658,14 +10672,14 @@ impl<'a, C, A> AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10709,7 +10723,7 @@ impl<'a, C, A> AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10719,10 +10733,10 @@ impl<'a, C, A> AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountPermissionUpdateCall<'a, C, A> { self._request = new_value; @@ -10764,7 +10778,7 @@ impl<'a, C, A> AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountPermissionUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -10774,7 +10788,7 @@ impl<'a, C, A> AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountPermissionUpdateCall<'a, C, A> { self._permission_id = new_value.to_string(); @@ -10792,12 +10806,12 @@ impl<'a, C, A> AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut AccountPermissionUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountPermissionUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountPermissionUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10888,7 +10902,7 @@ impl<'a, C, A> AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.variables.delete", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.variables.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -10931,7 +10945,7 @@ impl<'a, C, A> AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10967,7 +10981,7 @@ impl<'a, C, A> AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10977,10 +10991,10 @@ impl<'a, C, A> AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVariableDeleteCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -11013,7 +11027,7 @@ impl<'a, C, A> AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVariableDeleteCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -11023,7 +11037,7 @@ impl<'a, C, A> AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVariableDeleteCall<'a, C, A> { self._variable_id = new_value.to_string(); @@ -11041,12 +11055,12 @@ impl<'a, C, A> AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut AccountContainerVariableDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVariableDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVariableDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11135,7 +11149,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.get", + dlg.begin(MethodInfo { id: "tagmanager.accounts.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -11177,7 +11191,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11213,7 +11227,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11223,10 +11237,10 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11259,7 +11273,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *account id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn account_id(mut self, new_value: &str) -> AccountGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -11277,12 +11291,12 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11299,17 +11313,17 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> AccountGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11350,7 +11364,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.accounts().containers_update(req, "accountId", "containerId") -/// .fingerprint("aliquyam") +/// .fingerprint("sit") /// .doit(); /// # } /// ``` @@ -11381,7 +11395,7 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.update", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -11427,14 +11441,14 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11478,7 +11492,7 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11488,10 +11502,10 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> { self._request = new_value; @@ -11533,7 +11547,7 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -11543,7 +11557,7 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -11568,12 +11582,12 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11641,7 +11655,7 @@ impl<'a, C, A> AccountContainerUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.tags.update", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.tags.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -11720,14 +11734,14 @@ impl<'a, C, A> AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11771,7 +11785,7 @@ impl<'a, C, A> AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11781,10 +11795,10 @@ impl<'a, C, A> AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTagUpdateCall<'a, C, A> { self._request = new_value; @@ -11826,7 +11840,7 @@ impl<'a, C, A> AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTagUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -11836,7 +11850,7 @@ impl<'a, C, A> AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTagUpdateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -11846,7 +11860,7 @@ impl<'a, C, A> AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTagUpdateCall<'a, C, A> { self._tag_id = new_value.to_string(); @@ -11871,12 +11885,12 @@ impl<'a, C, A> AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut AccountContainerTagUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerTagUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerTagUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11973,7 +11987,7 @@ impl<'a, C, A> AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.create", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -12016,14 +12030,14 @@ impl<'a, C, A> AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12067,7 +12081,7 @@ impl<'a, C, A> AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12077,10 +12091,10 @@ impl<'a, C, A> AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut AccountContainerFolderCreateCall<'a, C, A> { self._request = new_value; @@ -12122,7 +12136,7 @@ impl<'a, C, A> AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut AccountContainerFolderCreateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12132,7 +12146,7 @@ impl<'a, C, A> AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut AccountContainerFolderCreateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -12150,12 +12164,12 @@ impl<'a, C, A> AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut AccountContainerFolderCreateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerFolderCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerFolderCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12245,7 +12259,7 @@ impl<'a, C, A> AccountContainerFolderListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.list", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.folders.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -12288,7 +12302,7 @@ impl<'a, C, A> AccountContainerFolderListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12324,7 +12338,7 @@ impl<'a, C, A> AccountContainerFolderListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12334,10 +12348,10 @@ impl<'a, C, A> AccountContainerFolderListCall<'a, C, A> where C: BorrowMut AccountContainerFolderListCall<'a, C, A> where C: BorrowMut AccountContainerFolderListCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12380,7 +12394,7 @@ impl<'a, C, A> AccountContainerFolderListCall<'a, C, A> where C: BorrowMut AccountContainerFolderListCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -12398,12 +12412,12 @@ impl<'a, C, A> AccountContainerFolderListCall<'a, C, A> where C: BorrowMut AccountContainerFolderListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerFolderListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerFolderListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12471,7 +12485,7 @@ impl<'a, C, A> AccountContainerFolderListCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.update", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -12550,14 +12564,14 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12601,7 +12615,7 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12611,10 +12625,10 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> { self._request = new_value; @@ -12656,7 +12670,7 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12666,7 +12680,7 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -12676,7 +12690,7 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> { self._container_version_id = new_value.to_string(); @@ -12701,12 +12715,12 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVersionUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVersionUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12774,7 +12788,7 @@ impl<'a, C, A> AccountContainerVersionUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.variables.update", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.variables.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -12853,14 +12867,14 @@ impl<'a, C, A> AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12904,7 +12918,7 @@ impl<'a, C, A> AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12914,10 +12928,10 @@ impl<'a, C, A> AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVariableUpdateCall<'a, C, A> { self._request = new_value; @@ -12959,7 +12973,7 @@ impl<'a, C, A> AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVariableUpdateCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -12969,7 +12983,7 @@ impl<'a, C, A> AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVariableUpdateCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -12979,7 +12993,7 @@ impl<'a, C, A> AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVariableUpdateCall<'a, C, A> { self._variable_id = new_value.to_string(); @@ -13004,12 +13018,12 @@ impl<'a, C, A> AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut AccountContainerVariableUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVariableUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVariableUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13100,7 +13114,7 @@ impl<'a, C, A> AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.get", + dlg.begin(MethodInfo { id: "tagmanager.accounts.containers.versions.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("accountId", self._account_id.to_string())); @@ -13144,7 +13158,7 @@ impl<'a, C, A> AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13180,7 +13194,7 @@ impl<'a, C, A> AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13190,10 +13204,10 @@ impl<'a, C, A> AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> { self._account_id = new_value.to_string(); @@ -13236,7 +13250,7 @@ impl<'a, C, A> AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> { self._container_id = new_value.to_string(); @@ -13246,7 +13260,7 @@ impl<'a, C, A> AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> { self._container_version_id = new_value.to_string(); @@ -13264,12 +13278,12 @@ impl<'a, C, A> AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut AccountContainerVersionGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> AccountContainerVersionGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> AccountContainerVersionGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/taskqueue1_beta2-cli/Cargo.toml b/gen/taskqueue1_beta2-cli/Cargo.toml index 6f17b4c8b2..a2e3727a33 100644 --- a/gen/taskqueue1_beta2-cli/Cargo.toml +++ b/gen/taskqueue1_beta2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-taskqueue1_beta2-cli" -version = "0.3.2+20141111" +version = "0.3.3+20141111" authors = ["Sebastian Thiel "] description = "A complete library to interact with taskqueue (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/taskqueue1_beta2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/taskqueue1_beta2-cli/LICENSE.md b/gen/taskqueue1_beta2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/taskqueue1_beta2-cli/LICENSE.md +++ b/gen/taskqueue1_beta2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/taskqueue1_beta2-cli/README.md b/gen/taskqueue1_beta2-cli/README.md index 0d6443df96..380947c301 100644 --- a/gen/taskqueue1_beta2-cli/README.md +++ b/gen/taskqueue1_beta2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *taskqueue* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/taskqueue1-beta2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/taskqueue1-beta2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/taskqueue1-beta2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/taskqueue1-beta2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/taskqueue1_beta2-cli). # Usage -This documentation was generated from the *taskqueue* API at revision *20141111*. The CLI is at version *0.3.2*. +This documentation was generated from the *taskqueue* API at revision *20141111*. The CLI is at version *0.3.3*. ```bash taskqueue1-beta2 [options] @@ -42,18 +42,18 @@ taskqueue1-beta2 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/taskqueue1_beta2-cli/mkdocs.yml b/gen/taskqueue1_beta2-cli/mkdocs.yml index 756a83c64f..5131e520e9 100644 --- a/gen/taskqueue1_beta2-cli/mkdocs.yml +++ b/gen/taskqueue1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: taskqueue v0.3.2+20141111 +site_name: taskqueue v0.3.3+20141111 site_url: http://byron.github.io/google-apis-rs/google-taskqueue1_beta2-cli site_description: Write integrating applications with bcore @@ -20,5 +20,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/taskqueue1_beta2-cli/src/main.rs b/gen/taskqueue1_beta2-cli/src/main.rs index abfef48354..58f685a7e3 100644 --- a/gen/taskqueue1_beta2-cli/src/main.rs +++ b/gen/taskqueue1_beta2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Taskqueue>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _taskqueues_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _taskqueues_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.taskqueues().get(opt.value_of("project").unwrap_or(""), opt.value_of("taskqueue").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "get-stats" => { @@ -64,7 +64,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["get-stats"].iter().map(|v|*v)); @@ -78,7 +78,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -101,10 +101,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasks().delete(opt.value_of("project").unwrap_or(""), opt.value_of("taskqueue").unwrap_or(""), opt.value_of("task").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -117,7 +117,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -130,7 +130,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -145,10 +145,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasks().get(opt.value_of("project").unwrap_or(""), opt.value_of("taskqueue").unwrap_or(""), opt.value_of("task").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -161,7 +161,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -174,7 +174,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -197,13 +197,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -217,8 +217,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "lease-timestamp" => Some(("leaseTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -240,7 +240,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Task = json::value::from_value(object).unwrap(); let mut call = self.hub.tasks().insert(request, opt.value_of("project").unwrap_or(""), opt.value_of("taskqueue").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -253,7 +253,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -266,7 +266,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -289,12 +289,12 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_lease(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_lease(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let num_tasks: i32 = arg_from_str(&opt.value_of("num-tasks").unwrap_or(""), err, "", "integer"); let lease_secs: i32 = arg_from_str(&opt.value_of("lease-secs").unwrap_or(""), err, "", "integer"); let mut call = self.hub.tasks().lease(opt.value_of("project").unwrap_or(""), opt.value_of("taskqueue").unwrap_or(""), num_tasks, lease_secs); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tag" => { @@ -313,7 +313,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["group-by-tag", "tag"].iter().map(|v|*v)); @@ -327,7 +327,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -350,10 +350,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasks().list(opt.value_of("project").unwrap_or(""), opt.value_of("taskqueue").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -366,7 +366,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -379,7 +379,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -402,13 +402,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -422,8 +422,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "lease-timestamp" => Some(("leaseTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -446,7 +446,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Task = json::value::from_value(object).unwrap(); let new_lease_seconds: i32 = arg_from_str(&opt.value_of("new-lease-seconds").unwrap_or(""), err, "", "integer"); let mut call = self.hub.tasks().patch(request, opt.value_of("project").unwrap_or(""), opt.value_of("taskqueue").unwrap_or(""), opt.value_of("task").unwrap_or(""), new_lease_seconds); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -459,7 +459,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -472,7 +472,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -495,13 +495,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -515,8 +515,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "lease-timestamp" => Some(("leaseTimestamp", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -539,7 +539,7 @@ impl<'n, 'a> Engine<'n, 'a> { let mut request: api::Task = json::value::from_value(object).unwrap(); let new_lease_seconds: i32 = arg_from_str(&opt.value_of("new-lease-seconds").unwrap_or(""), err, "", "integer"); let mut call = self.hub.tasks().update(request, opt.value_of("project").unwrap_or(""), opt.value_of("taskqueue").unwrap_or(""), opt.value_of("task").unwrap_or(""), new_lease_seconds); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -552,7 +552,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -565,7 +565,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -650,14 +650,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "taskqueue1-beta2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "taskqueue1-beta2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -677,7 +677,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -716,7 +716,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("taskqueues", "methods: 'get'", vec![ - ("get", + ("get", Some(r##"Get detailed information about a TaskQueue."##), "Details at http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli/taskqueues_get", vec![ @@ -747,7 +747,7 @@ fn main() { ]), ("tasks", "methods: 'delete', 'get', 'insert', 'lease', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Delete a task from a TaskQueue."##), "Details at http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli/tasks_delete", vec![ @@ -775,7 +775,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Get a particular task from a TaskQueue."##), "Details at http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli/tasks_get", vec![ @@ -809,7 +809,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Insert a new task in a TaskQueue"##), "Details at http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli/tasks_insert", vec![ @@ -843,7 +843,7 @@ fn main() { Some(false), Some(false)), ]), - ("lease", + ("lease", Some(r##"Lease 1 or more tasks from a TaskQueue."##), "Details at http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli/tasks_lease", vec![ @@ -883,7 +883,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"List Tasks in a TaskQueue"##), "Details at http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli/tasks_list", vec![ @@ -911,7 +911,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Update tasks that are leased out of a TaskQueue. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli/tasks_patch", vec![ @@ -957,7 +957,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update tasks that are leased out of a TaskQueue."##), "Details at http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli/tasks_update", vec![ @@ -1009,7 +1009,7 @@ fn main() { let mut app = App::new("taskqueue1-beta2") .author("Sebastian Thiel ") - .version("0.3.2+20141111") + .version("0.3.3+20141111") .about("Lets you access a Google App Engine Pull Task Queue over REST.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli") .arg(Arg::with_name("url") @@ -1033,7 +1033,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1044,7 +1044,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/taskqueue1_beta2/Cargo.toml b/gen/taskqueue1_beta2/Cargo.toml index 588d289fae..b971346973 100644 --- a/gen/taskqueue1_beta2/Cargo.toml +++ b/gen/taskqueue1_beta2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-taskqueue1_beta2" -version = "0.1.10+20141111" +version = "0.1.11+20141111" authors = ["Sebastian Thiel "] description = "A complete library to interact with taskqueue (protocol v1beta2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/taskqueue1_beta2" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/taskqueue1_beta2/LICENSE.md b/gen/taskqueue1_beta2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/taskqueue1_beta2/LICENSE.md +++ b/gen/taskqueue1_beta2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/taskqueue1_beta2/README.md b/gen/taskqueue1_beta2/README.md index ca7233eafa..da2c7cef5a 100644 --- a/gen/taskqueue1_beta2/README.md +++ b/gen/taskqueue1_beta2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-taskqueue1_beta2` library allows access to all features of the *Google taskqueue* service. -This documentation was generated from *taskqueue* crate version *0.1.10+20141111*, where *20141111* is the exact revision of the *taskqueue:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *taskqueue* crate version *0.1.11+20141111*, where *20141111* is the exact revision of the *taskqueue:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *taskqueue* *v1_beta2* API can be found at the [official documentation site](https://developers.google.com/appengine/docs/python/taskqueue/rest). diff --git a/gen/taskqueue1_beta2/src/cmn.rs b/gen/taskqueue1_beta2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/taskqueue1_beta2/src/cmn.rs +++ b/gen/taskqueue1_beta2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/taskqueue1_beta2/src/lib.rs b/gen/taskqueue1_beta2/src/lib.rs index 8890496dfa..613a8522a7 100644 --- a/gen/taskqueue1_beta2/src/lib.rs +++ b/gen/taskqueue1_beta2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *taskqueue* crate version *0.1.10+20141111*, where *20141111* is the exact revision of the *taskqueue:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *taskqueue* crate version *0.1.11+20141111*, where *20141111* is the exact revision of the *taskqueue:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *taskqueue* *v1_beta2* API can be found at the //! [official documentation site](https://developers.google.com/appengine/docs/python/taskqueue/rest). diff --git a/gen/taskqueue1_beta2/src/lib.rs.in b/gen/taskqueue1_beta2/src/lib.rs.in index df959a5e75..12c2b04048 100644 --- a/gen/taskqueue1_beta2/src/lib.rs.in +++ b/gen/taskqueue1_beta2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -132,7 +133,7 @@ impl<'a, C, A> Taskqueue Taskqueue { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -144,7 +145,7 @@ impl<'a, C, A> Taskqueue } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -642,7 +643,7 @@ impl<'a, C, A> TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "taskqueue.taskqueues.get", + dlg.begin(MethodInfo { id: "taskqueue.taskqueues.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -688,7 +689,7 @@ impl<'a, C, A> TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -724,7 +725,7 @@ impl<'a, C, A> TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -734,10 +735,10 @@ impl<'a, C, A> TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -770,7 +771,7 @@ impl<'a, C, A> TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TaskqueueGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -780,7 +781,7 @@ impl<'a, C, A> TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *taskqueue* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn taskqueue(mut self, new_value: &str) -> TaskqueueGetCall<'a, C, A> { self._taskqueue = new_value.to_string(); @@ -805,12 +806,12 @@ impl<'a, C, A> TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -827,17 +828,17 @@ impl<'a, C, A> TaskqueueGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskqueueGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskqueueGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -906,7 +907,7 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "taskqueue.tasks.lease", + dlg.begin(MethodInfo { id: "taskqueue.tasks.lease", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -957,7 +958,7 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -993,7 +994,7 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1003,10 +1004,10 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1039,7 +1040,7 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TaskLeaseCall<'a, C, A> { self._project = new_value.to_string(); @@ -1049,7 +1050,7 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *taskqueue* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn taskqueue(mut self, new_value: &str) -> TaskLeaseCall<'a, C, A> { self._taskqueue = new_value.to_string(); @@ -1059,7 +1060,7 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *num tasks* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn num_tasks(mut self, new_value: i32) -> TaskLeaseCall<'a, C, A> { self._num_tasks = new_value; @@ -1069,7 +1070,7 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *lease secs* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn lease_secs(mut self, new_value: i32) -> TaskLeaseCall<'a, C, A> { self._lease_secs = new_value; @@ -1101,12 +1102,12 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1123,17 +1124,17 @@ impl<'a, C, A> TaskLeaseCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskLeaseCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskLeaseCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1203,7 +1204,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "taskqueue.tasks.insert", + dlg.begin(MethodInfo { id: "taskqueue.tasks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1246,14 +1247,14 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1297,7 +1298,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1307,10 +1308,10 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1342,7 +1343,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Task) -> TaskInsertCall<'a, C, A> { self._request = new_value; @@ -1352,7 +1353,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TaskInsertCall<'a, C, A> { self._project = new_value.to_string(); @@ -1362,7 +1363,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *taskqueue* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn taskqueue(mut self, new_value: &str) -> TaskInsertCall<'a, C, A> { self._taskqueue = new_value.to_string(); @@ -1380,12 +1381,12 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1402,17 +1403,17 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1476,7 +1477,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "taskqueue.tasks.delete", + dlg.begin(MethodInfo { id: "taskqueue.tasks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1519,7 +1520,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1555,7 +1556,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1565,10 +1566,10 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1591,7 +1592,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TaskDeleteCall<'a, C, A> { self._project = new_value.to_string(); @@ -1601,7 +1602,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *taskqueue* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn taskqueue(mut self, new_value: &str) -> TaskDeleteCall<'a, C, A> { self._taskqueue = new_value.to_string(); @@ -1611,7 +1612,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *task* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task(mut self, new_value: &str) -> TaskDeleteCall<'a, C, A> { self._task = new_value.to_string(); @@ -1629,12 +1630,12 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1651,17 +1652,17 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1733,7 +1734,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "taskqueue.tasks.patch", + dlg.begin(MethodInfo { id: "taskqueue.tasks.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -1778,14 +1779,14 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1829,7 +1830,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1839,10 +1840,10 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1874,7 +1875,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Task) -> TaskPatchCall<'a, C, A> { self._request = new_value; @@ -1884,7 +1885,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TaskPatchCall<'a, C, A> { self._project = new_value.to_string(); @@ -1893,7 +1894,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *taskqueue* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn taskqueue(mut self, new_value: &str) -> TaskPatchCall<'a, C, A> { self._taskqueue = new_value.to_string(); @@ -1902,7 +1903,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *task* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task(mut self, new_value: &str) -> TaskPatchCall<'a, C, A> { self._task = new_value.to_string(); @@ -1912,7 +1913,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *new lease seconds* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn new_lease_seconds(mut self, new_value: i32) -> TaskPatchCall<'a, C, A> { self._new_lease_seconds = new_value; @@ -1930,12 +1931,12 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1952,17 +1953,17 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2025,7 +2026,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "taskqueue.tasks.list", + dlg.begin(MethodInfo { id: "taskqueue.tasks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2068,7 +2069,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2104,7 +2105,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2114,10 +2115,10 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2150,7 +2151,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TaskListCall<'a, C, A> { self._project = new_value.to_string(); @@ -2160,7 +2161,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *taskqueue* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn taskqueue(mut self, new_value: &str) -> TaskListCall<'a, C, A> { self._taskqueue = new_value.to_string(); @@ -2178,12 +2179,12 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2200,17 +2201,17 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2274,7 +2275,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "taskqueue.tasks.get", + dlg.begin(MethodInfo { id: "taskqueue.tasks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2318,7 +2319,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2354,7 +2355,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2364,10 +2365,10 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2400,7 +2401,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TaskGetCall<'a, C, A> { self._project = new_value.to_string(); @@ -2410,7 +2411,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *taskqueue* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn taskqueue(mut self, new_value: &str) -> TaskGetCall<'a, C, A> { self._taskqueue = new_value.to_string(); @@ -2420,7 +2421,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *task* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task(mut self, new_value: &str) -> TaskGetCall<'a, C, A> { self._task = new_value.to_string(); @@ -2438,12 +2439,12 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2460,17 +2461,17 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2542,7 +2543,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "taskqueue.tasks.update", + dlg.begin(MethodInfo { id: "taskqueue.tasks.update", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("project", self._project.to_string())); @@ -2587,14 +2588,14 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2638,7 +2639,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2648,10 +2649,10 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2683,7 +2684,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Task) -> TaskUpdateCall<'a, C, A> { self._request = new_value; @@ -2693,7 +2694,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *project* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project(mut self, new_value: &str) -> TaskUpdateCall<'a, C, A> { self._project = new_value.to_string(); @@ -2702,7 +2703,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *taskqueue* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn taskqueue(mut self, new_value: &str) -> TaskUpdateCall<'a, C, A> { self._taskqueue = new_value.to_string(); @@ -2711,7 +2712,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *task* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task(mut self, new_value: &str) -> TaskUpdateCall<'a, C, A> { self._task = new_value.to_string(); @@ -2721,7 +2722,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *new lease seconds* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn new_lease_seconds(mut self, new_value: i32) -> TaskUpdateCall<'a, C, A> { self._new_lease_seconds = new_value; @@ -2739,12 +2740,12 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2761,17 +2762,17 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/tasks1-cli/Cargo.toml b/gen/tasks1-cli/Cargo.toml index b1f309900b..1b0a82efcb 100644 --- a/gen/tasks1-cli/Cargo.toml +++ b/gen/tasks1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-tasks1-cli" -version = "0.3.2+20141121" +version = "0.3.3+20141121" authors = ["Sebastian Thiel "] description = "A complete library to interact with tasks (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tasks1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/tasks1-cli/LICENSE.md b/gen/tasks1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/tasks1-cli/LICENSE.md +++ b/gen/tasks1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/tasks1-cli/README.md b/gen/tasks1-cli/README.md index 128921d6a0..096e7522ff 100644 --- a/gen/tasks1-cli/README.md +++ b/gen/tasks1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *tasks* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/tasks1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/tasks1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/tasks1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/tasks1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/tasks1-cli). # Usage -This documentation was generated from the *tasks* API at revision *20141121*. The CLI is at version *0.3.2*. +This documentation was generated from the *tasks* API at revision *20141121*. The CLI is at version *0.3.3*. ```bash tasks1 [options] @@ -48,18 +48,18 @@ tasks1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/tasks1-cli/mkdocs.yml b/gen/tasks1-cli/mkdocs.yml index 86c795ab53..45c5e9af18 100644 --- a/gen/tasks1-cli/mkdocs.yml +++ b/gen/tasks1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: tasks v0.3.2+20141121 +site_name: tasks v0.3.3+20141121 site_url: http://byron.github.io/google-apis-rs/google-tasks1-cli site_description: Write integrating applications with bcore @@ -26,5 +26,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/tasks1-cli/src/main.rs b/gen/tasks1-cli/src/main.rs index a5995f62cb..0947c7b623 100644 --- a/gen/tasks1-cli/src/main.rs +++ b/gen/tasks1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::TasksHub>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _tasklists_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _tasklists_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasklists().delete(opt.value_of("tasklist").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -89,10 +89,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasklists_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasklists_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasklists().get(opt.value_of("tasklist").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -105,7 +105,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -118,7 +118,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -141,13 +141,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasklists_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasklists_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -161,8 +161,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -182,7 +182,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TaskList = json::value::from_value(object).unwrap(); let mut call = self.hub.tasklists().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -195,7 +195,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -208,7 +208,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -231,10 +231,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasklists_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasklists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasklists().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -253,7 +253,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "max-results"].iter().map(|v|*v)); @@ -267,7 +267,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -290,13 +290,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasklists_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasklists_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -310,8 +310,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -331,7 +331,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TaskList = json::value::from_value(object).unwrap(); let mut call = self.hub.tasklists().patch(request, opt.value_of("tasklist").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -344,7 +344,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -357,7 +357,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -380,13 +380,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasklists_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasklists_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -400,8 +400,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "title" => Some(("title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -421,7 +421,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::TaskList = json::value::from_value(object).unwrap(); let mut call = self.hub.tasklists().update(request, opt.value_of("tasklist").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -434,7 +434,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -447,7 +447,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -470,10 +470,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_clear(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_clear(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasks().clear(opt.value_of("tasklist").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -486,7 +486,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -499,7 +499,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -514,10 +514,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasks().delete(opt.value_of("tasklist").unwrap_or(""), opt.value_of("task").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -530,7 +530,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -543,7 +543,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -558,10 +558,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasks().get(opt.value_of("tasklist").unwrap_or(""), opt.value_of("task").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -574,7 +574,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -587,7 +587,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -610,13 +610,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -630,8 +630,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -659,7 +659,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Task = json::value::from_value(object).unwrap(); let mut call = self.hub.tasks().insert(request, opt.value_of("tasklist").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "previous" => { @@ -678,7 +678,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["parent", "previous"].iter().map(|v|*v)); @@ -692,7 +692,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -715,10 +715,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasks().list(opt.value_of("tasklist").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "updated-min" => { @@ -761,7 +761,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["due-max", "show-deleted", "updated-min", "completed-min", "max-results", "show-completed", "page-token", "completed-max", "show-hidden", "due-min"].iter().map(|v|*v)); @@ -775,7 +775,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -798,10 +798,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_move(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_move(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.tasks().move_(opt.value_of("tasklist").unwrap_or(""), opt.value_of("task").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "previous" => { @@ -820,7 +820,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["parent", "previous"].iter().map(|v|*v)); @@ -834,7 +834,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -857,13 +857,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_patch(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_patch(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -877,8 +877,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -906,7 +906,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Task = json::value::from_value(object).unwrap(); let mut call = self.hub.tasks().patch(request, opt.value_of("tasklist").unwrap_or(""), opt.value_of("task").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -919,7 +919,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -932,7 +932,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -955,13 +955,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _tasks_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _tasks_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -975,8 +975,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1004,7 +1004,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Task = json::value::from_value(object).unwrap(); let mut call = self.hub.tasks().update(request, opt.value_of("tasklist").unwrap_or(""), opt.value_of("task").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1017,7 +1017,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1030,7 +1030,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1133,14 +1133,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "tasks1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "tasks1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -1160,7 +1160,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -1199,7 +1199,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("tasklists", "methods: 'delete', 'get', 'insert', 'list', 'patch' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes the authenticated user's specified task list."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasklists_delete", vec![ @@ -1215,7 +1215,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns the authenticated user's specified task list."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasklists_get", vec![ @@ -1237,7 +1237,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new task list and adds it to the authenticated user's task lists."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasklists_insert", vec![ @@ -1259,7 +1259,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns all the authenticated user's task lists."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasklists_list", vec![ @@ -1275,7 +1275,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates the authenticated user's specified task list. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasklists_patch", vec![ @@ -1303,7 +1303,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates the authenticated user's specified task list."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasklists_update", vec![ @@ -1334,7 +1334,7 @@ fn main() { ]), ("tasks", "methods: 'clear', 'delete', 'get', 'insert', 'list', 'move', 'patch' and 'update'", vec![ - ("clear", + ("clear", Some(r##"Clears all completed tasks from the specified task list. The affected tasks will be marked as 'hidden' and no longer be returned by default when retrieving all tasks for a task list."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasks_clear", vec![ @@ -1350,7 +1350,7 @@ fn main() { Some(false), Some(true)), ]), - ("delete", + ("delete", Some(r##"Deletes the specified task from the task list."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasks_delete", vec![ @@ -1372,7 +1372,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Returns the specified task."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasks_get", vec![ @@ -1400,7 +1400,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new task on the specified task list."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasks_insert", vec![ @@ -1428,7 +1428,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns all tasks in the specified task list."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasks_list", vec![ @@ -1450,7 +1450,7 @@ fn main() { Some(false), Some(false)), ]), - ("move", + ("move", Some(r##"Moves the specified task to another position in the task list. This can include putting it as a child task under a new parent and/or move it to a different position among its sibling tasks."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasks_move", vec![ @@ -1478,7 +1478,7 @@ fn main() { Some(false), Some(false)), ]), - ("patch", + ("patch", Some(r##"Updates the specified task. This method supports patch semantics."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasks_patch", vec![ @@ -1512,7 +1512,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates the specified task."##), "Details at http://byron.github.io/google-apis-rs/google_tasks1_cli/tasks_update", vec![ @@ -1552,7 +1552,7 @@ fn main() { let mut app = App::new("tasks1") .author("Sebastian Thiel ") - .version("0.3.2+20141121") + .version("0.3.3+20141121") .about("Lets you manage your tasks and task lists.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_tasks1_cli") .arg(Arg::with_name("url") @@ -1576,7 +1576,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1587,7 +1587,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/tasks1/Cargo.toml b/gen/tasks1/Cargo.toml index fd9ed1d30c..4b6bec2fea 100644 --- a/gen/tasks1/Cargo.toml +++ b/gen/tasks1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-tasks1" -version = "0.1.10+20141121" +version = "0.1.11+20141121" authors = ["Sebastian Thiel "] description = "A complete library to interact with tasks (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/tasks1" diff --git a/gen/tasks1/LICENSE.md b/gen/tasks1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/tasks1/LICENSE.md +++ b/gen/tasks1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/tasks1/README.md b/gen/tasks1/README.md index 4c36cbdd68..a42a633d12 100644 --- a/gen/tasks1/README.md +++ b/gen/tasks1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-tasks1` library allows access to all features of the *Google tasks* service. -This documentation was generated from *tasks* crate version *0.1.10+20141121*, where *20141121* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *tasks* crate version *0.1.11+20141121*, where *20141121* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *tasks* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/tasks/firstapp). diff --git a/gen/tasks1/src/cmn.rs b/gen/tasks1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/tasks1/src/cmn.rs +++ b/gen/tasks1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/tasks1/src/lib.rs b/gen/tasks1/src/lib.rs index 753c16be7f..d780aa2cf4 100644 --- a/gen/tasks1/src/lib.rs +++ b/gen/tasks1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *tasks* crate version *0.1.10+20141121*, where *20141121* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *tasks* crate version *0.1.11+20141121*, where *20141121* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *tasks* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/tasks/firstapp). diff --git a/gen/tasks1/src/lib.rs.in b/gen/tasks1/src/lib.rs.in index 7c51b88dae..bbca099f10 100644 --- a/gen/tasks1/src/lib.rs.in +++ b/gen/tasks1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -140,7 +141,7 @@ impl<'a, C, A> TasksHub TasksHub { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -152,7 +153,7 @@ impl<'a, C, A> TasksHub } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -761,7 +762,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasks.list", + dlg.begin(MethodInfo { id: "tasks.tasks.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -833,7 +834,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -869,7 +870,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -879,10 +880,10 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -915,7 +916,7 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TaskListCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -1003,12 +1004,12 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1025,17 +1026,17 @@ impl<'a, C, A> TaskListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1105,7 +1106,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasks.update", + dlg.begin(MethodInfo { id: "tasks.tasks.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -1148,14 +1149,14 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1199,7 +1200,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1209,10 +1210,10 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1244,7 +1245,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Task) -> TaskUpdateCall<'a, C, A> { self._request = new_value; @@ -1254,7 +1255,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TaskUpdateCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -1264,7 +1265,7 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *task* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task(mut self, new_value: &str) -> TaskUpdateCall<'a, C, A> { self._task = new_value.to_string(); @@ -1282,12 +1283,12 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1304,17 +1305,17 @@ impl<'a, C, A> TaskUpdateCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1384,7 +1385,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasks.patch", + dlg.begin(MethodInfo { id: "tasks.tasks.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -1427,14 +1428,14 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1478,7 +1479,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1488,10 +1489,10 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1523,7 +1524,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Task) -> TaskPatchCall<'a, C, A> { self._request = new_value; @@ -1533,7 +1534,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TaskPatchCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -1543,7 +1544,7 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *task* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task(mut self, new_value: &str) -> TaskPatchCall<'a, C, A> { self._task = new_value.to_string(); @@ -1561,12 +1562,12 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1583,17 +1584,17 @@ impl<'a, C, A> TaskPatchCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1655,7 +1656,7 @@ impl<'a, C, A> TaskClearCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasks.clear", + dlg.begin(MethodInfo { id: "tasks.tasks.clear", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -1696,7 +1697,7 @@ impl<'a, C, A> TaskClearCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1732,7 +1733,7 @@ impl<'a, C, A> TaskClearCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1742,10 +1743,10 @@ impl<'a, C, A> TaskClearCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1768,7 +1769,7 @@ impl<'a, C, A> TaskClearCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TaskClearCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -1786,12 +1787,12 @@ impl<'a, C, A> TaskClearCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1808,17 +1809,17 @@ impl<'a, C, A> TaskClearCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskClearCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskClearCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1885,7 +1886,7 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasks.move", + dlg.begin(MethodInfo { id: "tasks.tasks.move", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -1934,7 +1935,7 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1970,7 +1971,7 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1980,10 +1981,10 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2016,7 +2017,7 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TaskMoveCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -2026,7 +2027,7 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut /// /// Sets the *task* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task(mut self, new_value: &str) -> TaskMoveCall<'a, C, A> { self._task = new_value.to_string(); @@ -2058,12 +2059,12 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2080,17 +2081,17 @@ impl<'a, C, A> TaskMoveCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskMoveCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskMoveCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2153,7 +2154,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasks.delete", + dlg.begin(MethodInfo { id: "tasks.tasks.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -2195,7 +2196,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2231,7 +2232,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2241,10 +2242,10 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2267,7 +2268,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TaskDeleteCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -2277,7 +2278,7 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *task* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task(mut self, new_value: &str) -> TaskDeleteCall<'a, C, A> { self._task = new_value.to_string(); @@ -2295,12 +2296,12 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2317,17 +2318,17 @@ impl<'a, C, A> TaskDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2390,7 +2391,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasks.get", + dlg.begin(MethodInfo { id: "tasks.tasks.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -2433,7 +2434,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2469,7 +2470,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2479,10 +2480,10 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2515,7 +2516,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TaskGetCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -2525,7 +2526,7 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *task* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn task(mut self, new_value: &str) -> TaskGetCall<'a, C, A> { self._task = new_value.to_string(); @@ -2543,12 +2544,12 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2565,17 +2566,17 @@ impl<'a, C, A> TaskGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2648,7 +2649,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasks.insert", + dlg.begin(MethodInfo { id: "tasks.tasks.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -2696,14 +2697,14 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2747,7 +2748,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2757,10 +2758,10 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2792,7 +2793,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Task) -> TaskInsertCall<'a, C, A> { self._request = new_value; @@ -2802,7 +2803,7 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TaskInsertCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -2834,12 +2835,12 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2856,17 +2857,17 @@ impl<'a, C, A> TaskInsertCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TaskInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TaskInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2931,7 +2932,7 @@ impl<'a, C, A> TasklistListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasklists.list", + dlg.begin(MethodInfo { id: "tasks.tasklists.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -2957,7 +2958,7 @@ impl<'a, C, A> TasklistListCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2993,7 +2994,7 @@ impl<'a, C, A> TasklistListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3003,10 +3004,10 @@ impl<'a, C, A> TasklistListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3061,12 +3062,12 @@ impl<'a, C, A> TasklistListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3083,17 +3084,17 @@ impl<'a, C, A> TasklistListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TasklistListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TasklistListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3162,7 +3163,7 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasklists.update", + dlg.begin(MethodInfo { id: "tasks.tasklists.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -3204,14 +3205,14 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3255,7 +3256,7 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3265,10 +3266,10 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3300,7 +3301,7 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TaskList) -> TasklistUpdateCall<'a, C, A> { self._request = new_value; @@ -3310,7 +3311,7 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TasklistUpdateCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -3328,12 +3329,12 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3350,17 +3351,17 @@ impl<'a, C, A> TasklistUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TasklistUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TasklistUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3422,7 +3423,7 @@ impl<'a, C, A> TasklistDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasklists.delete", + dlg.begin(MethodInfo { id: "tasks.tasklists.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -3463,7 +3464,7 @@ impl<'a, C, A> TasklistDeleteCall<'a, C, A> where C: BorrowMut, A params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3499,7 +3500,7 @@ impl<'a, C, A> TasklistDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3509,10 +3510,10 @@ impl<'a, C, A> TasklistDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3535,7 +3536,7 @@ impl<'a, C, A> TasklistDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TasklistDeleteCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -3553,12 +3554,12 @@ impl<'a, C, A> TasklistDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3575,17 +3576,17 @@ impl<'a, C, A> TasklistDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TasklistDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TasklistDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3654,7 +3655,7 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasklists.patch", + dlg.begin(MethodInfo { id: "tasks.tasklists.patch", http_method: hyper::method::Method::Patch }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -3696,14 +3697,14 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3747,7 +3748,7 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3757,10 +3758,10 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3792,7 +3793,7 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TaskList) -> TasklistPatchCall<'a, C, A> { self._request = new_value; @@ -3802,7 +3803,7 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TasklistPatchCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -3820,12 +3821,12 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3842,17 +3843,17 @@ impl<'a, C, A> TasklistPatchCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TasklistPatchCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TasklistPatchCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3920,7 +3921,7 @@ impl<'a, C, A> TasklistInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasklists.insert", + dlg.begin(MethodInfo { id: "tasks.tasklists.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -3940,14 +3941,14 @@ impl<'a, C, A> TasklistInsertCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3991,7 +3992,7 @@ impl<'a, C, A> TasklistInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4001,10 +4002,10 @@ impl<'a, C, A> TasklistInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4036,7 +4037,7 @@ impl<'a, C, A> TasklistInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: TaskList) -> TasklistInsertCall<'a, C, A> { self._request = new_value; @@ -4054,12 +4055,12 @@ impl<'a, C, A> TasklistInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4076,17 +4077,17 @@ impl<'a, C, A> TasklistInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TasklistInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TasklistInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -4148,7 +4149,7 @@ impl<'a, C, A> TasklistGetCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "tasks.tasklists.get", + dlg.begin(MethodInfo { id: "tasks.tasklists.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("tasklist", self._tasklist.to_string())); @@ -4190,7 +4191,7 @@ impl<'a, C, A> TasklistGetCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4226,7 +4227,7 @@ impl<'a, C, A> TasklistGetCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4236,10 +4237,10 @@ impl<'a, C, A> TasklistGetCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4272,7 +4273,7 @@ impl<'a, C, A> TasklistGetCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *tasklist* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn tasklist(mut self, new_value: &str) -> TasklistGetCall<'a, C, A> { self._tasklist = new_value.to_string(); @@ -4290,12 +4291,12 @@ impl<'a, C, A> TasklistGetCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4312,17 +4313,17 @@ impl<'a, C, A> TasklistGetCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> TasklistGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> TasklistGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/translate2-cli/Cargo.toml b/gen/translate2-cli/Cargo.toml index c9b8505fc4..b1dc3bc083 100644 --- a/gen/translate2-cli/Cargo.toml +++ b/gen/translate2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-translate2-cli" -version = "0.3.2+20141123" +version = "0.3.3+20141123" authors = ["Sebastian Thiel "] description = "A complete library to interact with translate (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/translate2-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/translate2-cli/LICENSE.md b/gen/translate2-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/translate2-cli/LICENSE.md +++ b/gen/translate2-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/translate2-cli/README.md b/gen/translate2-cli/README.md index 8bc7e4ff9e..6dd54fd527 100644 --- a/gen/translate2-cli/README.md +++ b/gen/translate2-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *translate* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/translate2.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/translate2.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/translate2.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/translate2.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/translate2-cli). # Usage -This documentation was generated from the *translate* API at revision *20141123*. The CLI is at version *0.3.2*. +This documentation was generated from the *translate* API at revision *20141123*. The CLI is at version *0.3.3*. ```bash translate2 [options] @@ -38,14 +38,14 @@ translate2 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/translate2-cli/mkdocs.yml b/gen/translate2-cli/mkdocs.yml index 1187ed6322..e3c9743ea2 100644 --- a/gen/translate2-cli/mkdocs.yml +++ b/gen/translate2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: translate v0.3.2+20141123 +site_name: translate v0.3.3+20141123 site_url: http://byron.github.io/google-apis-rs/google-translate2-cli site_description: Write integrating applications with bcore @@ -15,5 +15,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/translate2-cli/src/main.rs b/gen/translate2-cli/src/main.rs index cf7ac6484d..1051955de0 100644 --- a/gen/translate2-cli/src/main.rs +++ b/gen/translate2-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Translate>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _detections_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _detections_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.detections().list(&opt.values_of("q").unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.detections().list(&opt.values_of("q").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>()); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -94,10 +94,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _languages_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _languages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.languages().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "target" => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["target"].iter().map(|v|*v)); @@ -147,10 +147,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _translations_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _translations_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { - let mut call = self.hub.translations().list(&opt.values_of("q").unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>(), opt.value_of("target").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + let mut call = self.hub.translations().list(&opt.values_of("q").map(|i|i.collect()).unwrap_or(Vec::new()).iter().map(|&v| v.to_string()).collect::>(), opt.value_of("target").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "source" => { @@ -172,7 +172,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["source", "cid", "format"].iter().map(|v|*v)); @@ -261,14 +261,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "translate2-secret.json", + match cmn::application_secret_from_directory(&config_dir, "translate2-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -288,7 +288,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -327,7 +327,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("detections", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Detect the language of text."##), "Details at http://byron.github.io/google-apis-rs/google_translate2_cli/detections_list", vec![ @@ -352,7 +352,7 @@ fn main() { ]), ("languages", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"List the source/target languages supported by the API"##), "Details at http://byron.github.io/google-apis-rs/google_translate2_cli/languages_list", vec![ @@ -371,7 +371,7 @@ fn main() { ]), ("translations", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Returns text translations from one language to another."##), "Details at http://byron.github.io/google-apis-rs/google_translate2_cli/translations_list", vec![ @@ -405,7 +405,7 @@ fn main() { let mut app = App::new("translate2") .author("Sebastian Thiel ") - .version("0.3.2+20141123") + .version("0.3.3+20141123") .about("Lets you translate text from one language to another") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_translate2_cli") .arg(Arg::with_name("folder") @@ -424,7 +424,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -435,7 +435,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/translate2/Cargo.toml b/gen/translate2/Cargo.toml index ecbda0ef9b..199f436b0c 100644 --- a/gen/translate2/Cargo.toml +++ b/gen/translate2/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-translate2" -version = "0.1.10+20141123" +version = "0.1.11+20141123" authors = ["Sebastian Thiel "] description = "A complete library to interact with translate (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/translate2" diff --git a/gen/translate2/LICENSE.md b/gen/translate2/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/translate2/LICENSE.md +++ b/gen/translate2/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/translate2/README.md b/gen/translate2/README.md index 319c0a4fa0..05ca742fe4 100644 --- a/gen/translate2/README.md +++ b/gen/translate2/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-translate2` library allows access to all features of the *Google translate* service. -This documentation was generated from *translate* crate version *0.1.10+20141123*, where *20141123* is the exact revision of the *translate:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *translate* crate version *0.1.11+20141123*, where *20141123* is the exact revision of the *translate:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *translate* *v2* API can be found at the [official documentation site](https://developers.google.com/translate/v2/using_rest). diff --git a/gen/translate2/src/cmn.rs b/gen/translate2/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/translate2/src/cmn.rs +++ b/gen/translate2/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/translate2/src/lib.rs b/gen/translate2/src/lib.rs index 2367e497bc..3c06a481ed 100644 --- a/gen/translate2/src/lib.rs +++ b/gen/translate2/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *translate* crate version *0.1.10+20141123*, where *20141123* is the exact revision of the *translate:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *translate* crate version *0.1.11+20141123*, where *20141123* is the exact revision of the *translate:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *translate* *v2* API can be found at the //! [official documentation site](https://developers.google.com/translate/v2/using_rest). diff --git a/gen/translate2/src/lib.rs.in b/gen/translate2/src/lib.rs.in index d64d9335ba..4a52b1b9ed 100644 --- a/gen/translate2/src/lib.rs.in +++ b/gen/translate2/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -104,7 +105,7 @@ impl<'a, C, A> Translate Translate { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -119,7 +120,7 @@ impl<'a, C, A> Translate } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -495,7 +496,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "language.languages.list", + dlg.begin(MethodInfo { id: "language.languages.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if let Some(value) = self._target { @@ -527,7 +528,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -548,7 +549,7 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -558,10 +559,10 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -609,12 +610,12 @@ impl<'a, C, A> LanguageListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -686,7 +687,7 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "language.detections.list", + dlg.begin(MethodInfo { id: "language.detections.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if self._q.len() > 0 { @@ -722,7 +723,7 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut, A: } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -743,7 +744,7 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -753,10 +754,10 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -790,7 +791,7 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut, A: /// Append the given value to the *q* query property. /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn add_q(mut self, new_value: &str) -> DetectionListCall<'a, C, A> { self._q.push(new_value.to_string()); @@ -808,12 +809,12 @@ impl<'a, C, A> DetectionListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -892,7 +893,7 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "language.translations.list", + dlg.begin(MethodInfo { id: "language.translations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); if self._q.len() > 0 { @@ -942,7 +943,7 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut, } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -963,7 +964,7 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -973,10 +974,10 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1010,7 +1011,7 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut, /// Append the given value to the *q* query property. /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn add_q(mut self, new_value: &str) -> TranslationListCall<'a, C, A> { self._q.push(new_value.to_string()); @@ -1020,7 +1021,7 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *target* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn target(mut self, new_value: &str) -> TranslationListCall<'a, C, A> { self._target = new_value.to_string(); @@ -1060,12 +1061,12 @@ impl<'a, C, A> TranslationListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/urlshortener1-cli/Cargo.toml b/gen/urlshortener1-cli/Cargo.toml index b662bb19a9..0c2227c7d0 100644 --- a/gen/urlshortener1-cli/Cargo.toml +++ b/gen/urlshortener1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-urlshortener1-cli" -version = "0.3.2+20150519" +version = "0.3.3+20150519" authors = ["Sebastian Thiel "] description = "A complete library to interact with urlshortener (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/urlshortener1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/urlshortener1-cli/LICENSE.md b/gen/urlshortener1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/urlshortener1-cli/LICENSE.md +++ b/gen/urlshortener1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/urlshortener1-cli/README.md b/gen/urlshortener1-cli/README.md index 9d9f4bb80c..0a545c75c2 100644 --- a/gen/urlshortener1-cli/README.md +++ b/gen/urlshortener1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *urlshortener* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/urlshortener1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/urlshortener1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/urlshortener1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/urlshortener1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/urlshortener1-cli). # Usage -This documentation was generated from the *urlshortener* API at revision *20150519*. The CLI is at version *0.3.2*. +This documentation was generated from the *urlshortener* API at revision *20150519*. The CLI is at version *0.3.3*. ```bash urlshortener1 [options] @@ -36,18 +36,18 @@ urlshortener1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/urlshortener1-cli/mkdocs.yml b/gen/urlshortener1-cli/mkdocs.yml index f243ec9d64..2a7f019ab3 100644 --- a/gen/urlshortener1-cli/mkdocs.yml +++ b/gen/urlshortener1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: urlshortener v0.3.2+20150519 +site_name: urlshortener v0.3.3+20150519 site_url: http://byron.github.io/google-apis-rs/google-urlshortener1-cli site_description: Write integrating applications with bcore @@ -15,5 +15,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/urlshortener1-cli/src/main.rs b/gen/urlshortener1-cli/src/main.rs index 47328e782f..f766181162 100644 --- a/gen/urlshortener1-cli/src/main.rs +++ b/gen/urlshortener1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Urlshortener>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _url_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _url_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.url().get(opt.value_of("short-url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "projection" => { @@ -64,7 +64,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["projection"].iter().map(|v|*v)); @@ -78,7 +78,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -101,13 +101,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _url_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _url_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -121,8 +121,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status" => Some(("status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -151,7 +151,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Url = json::value::from_value(object).unwrap(); let mut call = self.hub.url().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -164,7 +164,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -177,7 +177,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -200,10 +200,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _url_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _url_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.url().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-token" => { @@ -222,7 +222,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["start-token", "projection"].iter().map(|v|*v)); @@ -236,7 +236,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -298,14 +298,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "urlshortener1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "urlshortener1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -325,7 +325,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -364,7 +364,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("url", "methods: 'get', 'insert' and 'list'", vec![ - ("get", + ("get", Some(r##"Expands a short URL or gets creation time and analytics."##), "Details at http://byron.github.io/google-apis-rs/google_urlshortener1_cli/url_get", vec![ @@ -386,7 +386,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Creates a new short URL."##), "Details at http://byron.github.io/google-apis-rs/google_urlshortener1_cli/url_insert", vec![ @@ -408,7 +408,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Retrieves a list of URLs shortened by a user."##), "Details at http://byron.github.io/google-apis-rs/google_urlshortener1_cli/url_list", vec![ @@ -430,7 +430,7 @@ fn main() { let mut app = App::new("urlshortener1") .author("Sebastian Thiel ") - .version("0.3.2+20150519") + .version("0.3.3+20150519") .about("Lets you create, inspect, and manage goo.gl short URLs") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_urlshortener1_cli") .arg(Arg::with_name("url") @@ -454,7 +454,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -465,7 +465,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/urlshortener1/Cargo.toml b/gen/urlshortener1/Cargo.toml index 5cdf0a2d9a..c77fc8e253 100644 --- a/gen/urlshortener1/Cargo.toml +++ b/gen/urlshortener1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-urlshortener1" -version = "0.1.10+20150519" +version = "0.1.11+20150519" authors = ["Sebastian Thiel "] description = "A complete library to interact with urlshortener (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/urlshortener1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/urlshortener1/LICENSE.md b/gen/urlshortener1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/urlshortener1/LICENSE.md +++ b/gen/urlshortener1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/urlshortener1/README.md b/gen/urlshortener1/README.md index 16b41cb22e..07c1974e7b 100644 --- a/gen/urlshortener1/README.md +++ b/gen/urlshortener1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-urlshortener1` library allows access to all features of the *Google urlshortener* service. -This documentation was generated from *urlshortener* crate version *0.1.10+20150519*, where *20150519* is the exact revision of the *urlshortener:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *urlshortener* crate version *0.1.11+20150519*, where *20150519* is the exact revision of the *urlshortener:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *urlshortener* *v1* API can be found at the [official documentation site](https://developers.google.com/url-shortener/v1/getting_started). diff --git a/gen/urlshortener1/src/cmn.rs b/gen/urlshortener1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/urlshortener1/src/cmn.rs +++ b/gen/urlshortener1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/urlshortener1/src/lib.rs b/gen/urlshortener1/src/lib.rs index 40d24bcc12..e6a9c168e1 100644 --- a/gen/urlshortener1/src/lib.rs +++ b/gen/urlshortener1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *urlshortener* crate version *0.1.10+20150519*, where *20150519* is the exact revision of the *urlshortener:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *urlshortener* crate version *0.1.11+20150519*, where *20150519* is the exact revision of the *urlshortener:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *urlshortener* *v1* API can be found at the //! [official documentation site](https://developers.google.com/url-shortener/v1/getting_started). diff --git a/gen/urlshortener1/src/lib.rs.in b/gen/urlshortener1/src/lib.rs.in index c079b4da38..b70f4b2aed 100644 --- a/gen/urlshortener1/src/lib.rs.in +++ b/gen/urlshortener1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -127,7 +128,7 @@ impl<'a, C, A> Urlshortener Urlshortener { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -136,7 +137,7 @@ impl<'a, C, A> Urlshortener } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -434,7 +435,7 @@ impl<'a, C, A> UrlInsertCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "urlshortener.url.insert", + dlg.begin(MethodInfo { id: "urlshortener.url.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -454,14 +455,14 @@ impl<'a, C, A> UrlInsertCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -505,7 +506,7 @@ impl<'a, C, A> UrlInsertCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -515,10 +516,10 @@ impl<'a, C, A> UrlInsertCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -550,7 +551,7 @@ impl<'a, C, A> UrlInsertCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Url) -> UrlInsertCall<'a, C, A> { self._request = new_value; @@ -568,12 +569,12 @@ impl<'a, C, A> UrlInsertCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -590,17 +591,17 @@ impl<'a, C, A> UrlInsertCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -664,7 +665,7 @@ impl<'a, C, A> UrlGetCall<'a, C, A> where C: BorrowMut, A: oauth2 Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "urlshortener.url.get", + dlg.begin(MethodInfo { id: "urlshortener.url.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("shortUrl", self._short_url.to_string())); @@ -688,7 +689,7 @@ impl<'a, C, A> UrlGetCall<'a, C, A> where C: BorrowMut, A: oauth2 self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -724,7 +725,7 @@ impl<'a, C, A> UrlGetCall<'a, C, A> where C: BorrowMut, A: oauth2 match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -734,10 +735,10 @@ impl<'a, C, A> UrlGetCall<'a, C, A> where C: BorrowMut, A: oauth2 if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -770,7 +771,7 @@ impl<'a, C, A> UrlGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *short url* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn short_url(mut self, new_value: &str) -> UrlGetCall<'a, C, A> { self._short_url = new_value.to_string(); @@ -795,12 +796,12 @@ impl<'a, C, A> UrlGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -817,17 +818,17 @@ impl<'a, C, A> UrlGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -892,7 +893,7 @@ impl<'a, C, A> UrlListCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "urlshortener.url.list", + dlg.begin(MethodInfo { id: "urlshortener.url.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._start_token { @@ -918,7 +919,7 @@ impl<'a, C, A> UrlListCall<'a, C, A> where C: BorrowMut, A: oauth self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -954,7 +955,7 @@ impl<'a, C, A> UrlListCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -964,10 +965,10 @@ impl<'a, C, A> UrlListCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1022,12 +1023,12 @@ impl<'a, C, A> UrlListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1044,17 +1045,17 @@ impl<'a, C, A> UrlListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/webfonts1-cli/Cargo.toml b/gen/webfonts1-cli/Cargo.toml index 1aa78faecc..3cb79fb358 100644 --- a/gen/webfonts1-cli/Cargo.toml +++ b/gen/webfonts1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-webfonts1-cli" -version = "0.3.2+20140210" +version = "0.3.3+20140210" authors = ["Sebastian Thiel "] description = "A complete library to interact with webfonts (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/webfonts1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/webfonts1-cli/LICENSE.md b/gen/webfonts1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/webfonts1-cli/LICENSE.md +++ b/gen/webfonts1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/webfonts1-cli/README.md b/gen/webfonts1-cli/README.md index 0d268d790a..f28bd6acfc 100644 --- a/gen/webfonts1-cli/README.md +++ b/gen/webfonts1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *webfonts* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/webfonts1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/webfonts1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/webfonts1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/webfonts1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/webfonts1-cli). # Usage -This documentation was generated from the *webfonts* API at revision *20140210*. The CLI is at version *0.3.2*. +This documentation was generated from the *webfonts* API at revision *20140210*. The CLI is at version *0.3.3*. ```bash webfonts1 [options] @@ -34,14 +34,14 @@ webfonts1 [options] Configuration: --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/webfonts1-cli/mkdocs.yml b/gen/webfonts1-cli/mkdocs.yml index 1d60f23976..997c0c8c57 100644 --- a/gen/webfonts1-cli/mkdocs.yml +++ b/gen/webfonts1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: webfonts v0.3.2+20140210 +site_name: webfonts v0.3.3+20140210 site_url: http://byron.github.io/google-apis-rs/google-webfonts1-cli site_description: Write integrating applications with bcore @@ -13,5 +13,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/webfonts1-cli/src/main.rs b/gen/webfonts1-cli/src/main.rs index b745fc9600..79b48da62c 100644 --- a/gen/webfonts1-cli/src/main.rs +++ b/gen/webfonts1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Webfonts>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _webfonts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _webfonts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.webfonts().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sort" => { @@ -64,7 +64,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort"].iter().map(|v|*v)); @@ -131,14 +131,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "webfonts1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "webfonts1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -158,7 +158,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -197,7 +197,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("webfonts", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves the list of fonts currently served by the Google Fonts Developer API"##), "Details at http://byron.github.io/google-apis-rs/google_webfonts1_cli/webfonts_list", vec![ @@ -219,7 +219,7 @@ fn main() { let mut app = App::new("webfonts1") .author("Sebastian Thiel ") - .version("0.3.2+20140210") + .version("0.3.3+20140210") .about("The Google Fonts Developer API.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_webfonts1_cli") .arg(Arg::with_name("folder") @@ -238,7 +238,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -249,7 +249,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/webfonts1/Cargo.toml b/gen/webfonts1/Cargo.toml index fd4fbe9003..cb77d894ef 100644 --- a/gen/webfonts1/Cargo.toml +++ b/gen/webfonts1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-webfonts1" -version = "0.1.10+20140210" +version = "0.1.11+20140210" authors = ["Sebastian Thiel "] description = "A complete library to interact with webfonts (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/webfonts1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/webfonts1/LICENSE.md b/gen/webfonts1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/webfonts1/LICENSE.md +++ b/gen/webfonts1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/webfonts1/README.md b/gen/webfonts1/README.md index 2783552705..b47ad030b7 100644 --- a/gen/webfonts1/README.md +++ b/gen/webfonts1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-webfonts1` library allows access to all features of the *Google webfonts* service. -This documentation was generated from *webfonts* crate version *0.1.10+20140210*, where *20140210* is the exact revision of the *webfonts:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *webfonts* crate version *0.1.11+20140210*, where *20140210* is the exact revision of the *webfonts:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *webfonts* *v1* API can be found at the [official documentation site](https://developers.google.com/fonts/docs/developer_api). diff --git a/gen/webfonts1/src/cmn.rs b/gen/webfonts1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/webfonts1/src/cmn.rs +++ b/gen/webfonts1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/webfonts1/src/lib.rs b/gen/webfonts1/src/lib.rs index e24a55ad38..8e97db3f23 100644 --- a/gen/webfonts1/src/lib.rs +++ b/gen/webfonts1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *webfonts* crate version *0.1.10+20140210*, where *20140210* is the exact revision of the *webfonts:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *webfonts* crate version *0.1.11+20140210*, where *20140210* is the exact revision of the *webfonts:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *webfonts* *v1* API can be found at the //! [official documentation site](https://developers.google.com/fonts/docs/developer_api). diff --git a/gen/webfonts1/src/lib.rs.in b/gen/webfonts1/src/lib.rs.in index 66885d317b..e7cc27169b 100644 --- a/gen/webfonts1/src/lib.rs.in +++ b/gen/webfonts1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -105,7 +106,7 @@ impl<'a, C, A> Webfonts Webfonts { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -114,7 +115,7 @@ impl<'a, C, A> Webfonts } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -299,7 +300,7 @@ impl<'a, C, A> WebfontListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webfonts.webfonts.list", + dlg.begin(MethodInfo { id: "webfonts.webfonts.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if let Some(value) = self._sort { @@ -331,7 +332,7 @@ impl<'a, C, A> WebfontListCall<'a, C, A> where C: BorrowMut, A: o } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -352,7 +353,7 @@ impl<'a, C, A> WebfontListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -362,10 +363,10 @@ impl<'a, C, A> WebfontListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -413,12 +414,12 @@ impl<'a, C, A> WebfontListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. diff --git a/gen/webmasters3-cli/Cargo.toml b/gen/webmasters3-cli/Cargo.toml index e605cdc86c..7d868ae1d9 100644 --- a/gen/webmasters3-cli/Cargo.toml +++ b/gen/webmasters3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-webmasters3-cli" -version = "0.3.2+20150804" +version = "0.3.3+20151229" authors = ["Sebastian Thiel "] description = "A complete library to interact with webmasters (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/webmasters3-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/webmasters3-cli/LICENSE.md b/gen/webmasters3-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/webmasters3-cli/LICENSE.md +++ b/gen/webmasters3-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/webmasters3-cli/README.md b/gen/webmasters3-cli/README.md index 3e39287dca..ade229cc3a 100644 --- a/gen/webmasters3-cli/README.md +++ b/gen/webmasters3-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *webmasters* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/webmasters3.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/webmasters3.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/webmasters3.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/webmasters3.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/webmasters3-cli). # Usage -This documentation was generated from the *webmasters* API at revision *20150804*. The CLI is at version *0.3.2*. +This documentation was generated from the *webmasters* API at revision *20151229*. The CLI is at version *0.3.3*. ```bash webmasters3 [options] @@ -50,18 +50,18 @@ webmasters3 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/webmasters3-cli/mkdocs.yml b/gen/webmasters3-cli/mkdocs.yml index f62f2608f6..83e1d3fbbe 100644 --- a/gen/webmasters3-cli/mkdocs.yml +++ b/gen/webmasters3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: webmasters v0.3.2+20150804 +site_name: webmasters v0.3.3+20151229 site_url: http://byron.github.io/google-apis-rs/google-webmasters3-cli site_description: Write integrating applications with bcore @@ -25,5 +25,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/webmasters3-cli/src/main.rs b/gen/webmasters3-cli/src/main.rs index 95e8675eb3..f475e44d4d 100644 --- a/gen/webmasters3-cli/src/main.rs +++ b/gen/webmasters3-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::Webmasters>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _searchanalytics_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _searchanalytics_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "start-date" => Some(("startDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "end-date" => Some(("endDate", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -86,7 +86,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::SearchAnalyticsQueryRequest = json::value::from_value(object).unwrap(); let mut call = self.hub.searchanalytics().query(request, opt.value_of("site-url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -99,7 +99,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -112,7 +112,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -135,10 +135,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sitemaps_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sitemaps_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sitemaps().delete(opt.value_of("site-url").unwrap_or(""), opt.value_of("feedpath").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -151,7 +151,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -164,7 +164,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -179,10 +179,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sitemaps_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sitemaps_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sitemaps().get(opt.value_of("site-url").unwrap_or(""), opt.value_of("feedpath").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -195,7 +195,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -208,7 +208,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -231,10 +231,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sitemaps_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sitemaps_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sitemaps().list(opt.value_of("site-url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sitemap-index" => { @@ -250,7 +250,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sitemap-index"].iter().map(|v|*v)); @@ -264,7 +264,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -287,10 +287,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sitemaps_submit(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sitemaps_submit(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sitemaps().submit(opt.value_of("site-url").unwrap_or(""), opt.value_of("feedpath").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -303,7 +303,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -316,7 +316,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -331,10 +331,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_add(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_add(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sites().add(opt.value_of("site-url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -347,7 +347,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -360,7 +360,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -375,10 +375,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sites().delete(opt.value_of("site-url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -391,7 +391,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -404,7 +404,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -419,10 +419,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sites().get(opt.value_of("site-url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -435,7 +435,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -448,7 +448,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -471,10 +471,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _sites_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.sites().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -487,7 +487,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -500,7 +500,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -523,10 +523,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _urlcrawlerrorscounts_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _urlcrawlerrorscounts_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.urlcrawlerrorscounts().query(opt.value_of("site-url").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "platform" => { @@ -548,7 +548,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["category", "platform", "latest-counts-only"].iter().map(|v|*v)); @@ -562,7 +562,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -585,10 +585,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _urlcrawlerrorssamples_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _urlcrawlerrorssamples_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.urlcrawlerrorssamples().get(opt.value_of("site-url").unwrap_or(""), opt.value_of("url").unwrap_or(""), opt.value_of("category").unwrap_or(""), opt.value_of("platform").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -601,7 +601,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -614,7 +614,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -637,10 +637,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _urlcrawlerrorssamples_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _urlcrawlerrorssamples_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.urlcrawlerrorssamples().list(opt.value_of("site-url").unwrap_or(""), opt.value_of("category").unwrap_or(""), opt.value_of("platform").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -653,7 +653,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -666,7 +666,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -689,10 +689,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _urlcrawlerrorssamples_mark_as_fixed(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _urlcrawlerrorssamples_mark_as_fixed(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.urlcrawlerrorssamples().mark_as_fixed(opt.value_of("site-url").unwrap_or(""), opt.value_of("url").unwrap_or(""), opt.value_of("category").unwrap_or(""), opt.value_of("platform").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -705,7 +705,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -718,7 +718,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -834,14 +834,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "webmasters3-secret.json", + match cmn::application_secret_from_directory(&config_dir, "webmasters3-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -861,7 +861,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -900,7 +900,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("searchanalytics", "methods: 'query'", vec![ - ("query", + ("query", Some(r##"Query your data with filters and parameters that you define. Returns zero or more rows grouped by the row keys that you define. You must define a date range of one or more days. When date is one of the group by values, any days without data are omitted from the result list. If you need to know which days have data, issue a broad date range query grouped by date for any metric, and see which day rows are returned."##), @@ -933,7 +933,7 @@ fn main() { ]), ("sitemaps", "methods: 'delete', 'get', 'list' and 'submit'", vec![ - ("delete", + ("delete", Some(r##"Deletes a sitemap from this site."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/sitemaps_delete", vec![ @@ -955,7 +955,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves information about a specific sitemap."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/sitemaps_get", vec![ @@ -983,7 +983,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists the sitemaps-entries submitted for this site, or included in the sitemap index file (if sitemapIndex is specified in the request)."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/sitemaps_list", vec![ @@ -1005,7 +1005,7 @@ fn main() { Some(false), Some(false)), ]), - ("submit", + ("submit", Some(r##"Submits a sitemap for a site."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/sitemaps_submit", vec![ @@ -1030,8 +1030,8 @@ fn main() { ]), ("sites", "methods: 'add', 'delete', 'get' and 'list'", vec![ - ("add", - Some(r##"Adds a site to the set of the user's sites in Webmaster Tools."##), + ("add", + Some(r##"Adds a site to the set of the user's sites in Search Console."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/sites_add", vec![ (Some(r##"site-url"##), @@ -1046,8 +1046,8 @@ fn main() { Some(false), Some(true)), ]), - ("delete", - Some(r##"Removes a site from the set of the user's Webmaster Tools sites."##), + ("delete", + Some(r##"Removes a site from the set of the user's Search Console sites."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/sites_delete", vec![ (Some(r##"site-url"##), @@ -1062,7 +1062,7 @@ fn main() { Some(false), Some(true)), ]), - ("get", + ("get", Some(r##"Retrieves information about specific site."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/sites_get", vec![ @@ -1084,8 +1084,8 @@ fn main() { Some(false), Some(false)), ]), - ("list", - Some(r##"Lists the user's Webmaster Tools sites."##), + ("list", + Some(r##"Lists the user's Search Console sites."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/sites_list", vec![ (Some(r##"v"##), @@ -1103,7 +1103,7 @@ fn main() { ]), ("urlcrawlerrorscounts", "methods: 'query'", vec![ - ("query", + ("query", Some(r##"Retrieves a time series of the number of URL crawl errors per error category and platform."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/urlcrawlerrorscounts_query", vec![ @@ -1128,7 +1128,7 @@ fn main() { ]), ("urlcrawlerrorssamples", "methods: 'get', 'list' and 'mark-as-fixed'", vec![ - ("get", + ("get", Some(r##"Retrieves details about crawl errors for a site's sample URL."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/urlcrawlerrorssamples_get", vec![ @@ -1168,7 +1168,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists a site's sample URLs for the specified crawl error category and platform."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/urlcrawlerrorssamples_list", vec![ @@ -1202,7 +1202,7 @@ fn main() { Some(false), Some(false)), ]), - ("mark-as-fixed", + ("mark-as-fixed", Some(r##"Marks the provided site's sample URL as fixed, and removes it from the samples list."##), "Details at http://byron.github.io/google-apis-rs/google_webmasters3_cli/urlcrawlerrorssamples_mark-as-fixed", vec![ @@ -1242,8 +1242,8 @@ fn main() { let mut app = App::new("webmasters3") .author("Sebastian Thiel ") - .version("0.3.2+20150804") - .about("Lets you view Google Webmaster Tools data for your verified sites.") + .version("0.3.3+20151229") + .about("Lets you view Google Search Console data for your verified sites.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_webmasters3_cli") .arg(Arg::with_name("url") .long("scope") @@ -1266,7 +1266,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1277,7 +1277,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/webmasters3/Cargo.toml b/gen/webmasters3/Cargo.toml index 46f59b7947..621f76b0d9 100644 --- a/gen/webmasters3/Cargo.toml +++ b/gen/webmasters3/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-webmasters3" -version = "0.1.10+20150804" +version = "0.1.11+20151229" authors = ["Sebastian Thiel "] description = "A complete library to interact with webmasters (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/webmasters3" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/webmasters3/LICENSE.md b/gen/webmasters3/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/webmasters3/LICENSE.md +++ b/gen/webmasters3/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/webmasters3/README.md b/gen/webmasters3/README.md index 03960c6c92..71d36e6972 100644 --- a/gen/webmasters3/README.md +++ b/gen/webmasters3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-webmasters3` library allows access to all features of the *Google webmasters* service. -This documentation was generated from *webmasters* crate version *0.1.10+20150804*, where *20150804* is the exact revision of the *webmasters:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *webmasters* crate version *0.1.11+20151229*, where *20151229* is the exact revision of the *webmasters:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *webmasters* *v3* API can be found at the [official documentation site](https://developers.google.com/webmaster-tools/). diff --git a/gen/webmasters3/src/cmn.rs b/gen/webmasters3/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/webmasters3/src/cmn.rs +++ b/gen/webmasters3/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/webmasters3/src/lib.rs b/gen/webmasters3/src/lib.rs index 74e13e27e7..bcfa717f5b 100644 --- a/gen/webmasters3/src/lib.rs +++ b/gen/webmasters3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *webmasters* crate version *0.1.10+20150804*, where *20150804* is the exact revision of the *webmasters:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *webmasters* crate version *0.1.11+20151229*, where *20151229* is the exact revision of the *webmasters:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *webmasters* *v3* API can be found at the //! [official documentation site](https://developers.google.com/webmaster-tools/). diff --git a/gen/webmasters3/src/lib.rs.in b/gen/webmasters3/src/lib.rs.in index abb90e62d4..6c4517b53b 100644 --- a/gen/webmasters3/src/lib.rs.in +++ b/gen/webmasters3/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -35,10 +36,10 @@ pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// View Webmaster Tools data for your verified sites + /// View Search Console data for your verified sites Readonly, - /// View and modify Webmaster Tools data for your verified sites + /// View and manage Search Console data for your verified sites Full, } @@ -130,7 +131,7 @@ impl<'a, C, A> Webmasters Webmasters { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -151,7 +152,7 @@ impl<'a, C, A> Webmasters } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -268,7 +269,7 @@ impl ResponseResult for WmxSitemap {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SitesListResponse { - /// Contains permission level information about a Webmaster Tools site. For more information, see Permissions in Webmaster Tools. + /// Contains permission level information about a Search Console site. For more information, see Permissions in Search Console. #[serde(rename="siteEntry")] pub site_entry: Option>, } @@ -425,7 +426,7 @@ pub struct UrlCrawlErrorCountsPerType { impl Part for UrlCrawlErrorCountsPerType {} -/// Contains permission level information about a Webmaster Tools site. For more information, see Permissions in Webmaster Tools. +/// Contains permission level information about a Search Console site. For more information, see Permissions in Search Console. /// /// # Activities /// @@ -691,7 +692,7 @@ impl<'a, C, A> SiteMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Adds a site to the set of the user's sites in Webmaster Tools. + /// Adds a site to the set of the user's sites in Search Console. /// /// # Arguments /// @@ -708,7 +709,7 @@ impl<'a, C, A> SiteMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Lists the user's Webmaster Tools sites. + /// Lists the user's Search Console sites. pub fn list(&self) -> SiteListCall<'a, C, A> { SiteListCall { hub: self.hub, @@ -720,7 +721,7 @@ impl<'a, C, A> SiteMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Removes a site from the set of the user's Webmaster Tools sites. + /// Removes a site from the set of the user's Search Console sites. /// /// # Arguments /// @@ -1030,7 +1031,7 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.sitemaps.delete", + dlg.begin(MethodInfo { id: "webmasters.sitemaps.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -1072,7 +1073,7 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1108,7 +1109,7 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1118,10 +1119,10 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1144,7 +1145,7 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *site url* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn site_url(mut self, new_value: &str) -> SitemapDeleteCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -1154,7 +1155,7 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *feedpath* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn feedpath(mut self, new_value: &str) -> SitemapDeleteCall<'a, C, A> { self._feedpath = new_value.to_string(); @@ -1172,12 +1173,12 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1194,17 +1195,17 @@ impl<'a, C, A> SitemapDeleteCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SitemapDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SitemapDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1267,7 +1268,7 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.sitemaps.submit", + dlg.begin(MethodInfo { id: "webmasters.sitemaps.submit", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -1309,7 +1310,7 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1345,7 +1346,7 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1355,10 +1356,10 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1381,7 +1382,7 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *site url* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn site_url(mut self, new_value: &str) -> SitemapSubmitCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -1391,7 +1392,7 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *feedpath* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn feedpath(mut self, new_value: &str) -> SitemapSubmitCall<'a, C, A> { self._feedpath = new_value.to_string(); @@ -1409,12 +1410,12 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1431,17 +1432,17 @@ impl<'a, C, A> SitemapSubmitCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SitemapSubmitCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SitemapSubmitCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1504,7 +1505,7 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.sitemaps.get", + dlg.begin(MethodInfo { id: "webmasters.sitemaps.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -1547,7 +1548,7 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1583,7 +1584,7 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1593,10 +1594,10 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1629,7 +1630,7 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *site url* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn site_url(mut self, new_value: &str) -> SitemapGetCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -1639,7 +1640,7 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *feedpath* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn feedpath(mut self, new_value: &str) -> SitemapGetCall<'a, C, A> { self._feedpath = new_value.to_string(); @@ -1657,12 +1658,12 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1679,17 +1680,17 @@ impl<'a, C, A> SitemapGetCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SitemapGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SitemapGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1753,7 +1754,7 @@ impl<'a, C, A> SitemapListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.sitemaps.list", + dlg.begin(MethodInfo { id: "webmasters.sitemaps.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -1798,7 +1799,7 @@ impl<'a, C, A> SitemapListCall<'a, C, A> where C: BorrowMut, A: o params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1834,7 +1835,7 @@ impl<'a, C, A> SitemapListCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1844,10 +1845,10 @@ impl<'a, C, A> SitemapListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1880,7 +1881,7 @@ impl<'a, C, A> SitemapListCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *site url* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn site_url(mut self, new_value: &str) -> SitemapListCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -1905,12 +1906,12 @@ impl<'a, C, A> SitemapListCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1927,17 +1928,17 @@ impl<'a, C, A> SitemapListCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SitemapListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SitemapListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1999,7 +2000,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.sites.get", + dlg.begin(MethodInfo { id: "webmasters.sites.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -2041,7 +2042,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2077,7 +2078,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2087,10 +2088,10 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2123,7 +2124,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *site url* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn site_url(mut self, new_value: &str) -> SiteGetCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -2141,12 +2142,12 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2163,17 +2164,17 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2181,7 +2182,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth } -/// Adds a site to the set of the user's sites in Webmaster Tools. +/// Adds a site to the set of the user's sites in Search Console. /// /// A builder for the *add* method supported by a *site* resource. /// It is not used directly, but through a `SiteMethods` instance. @@ -2235,7 +2236,7 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.sites.add", + dlg.begin(MethodInfo { id: "webmasters.sites.add", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -2276,7 +2277,7 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2312,7 +2313,7 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2322,10 +2323,10 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2348,7 +2349,7 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth /// /// Sets the *site url* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn site_url(mut self, new_value: &str) -> SiteAddCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -2366,12 +2367,12 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2388,17 +2389,17 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteAddCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteAddCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2406,7 +2407,7 @@ impl<'a, C, A> SiteAddCall<'a, C, A> where C: BorrowMut, A: oauth } -/// Lists the user's Webmaster Tools sites. +/// Lists the user's Search Console sites. /// /// A builder for the *list* method supported by a *site* resource. /// It is not used directly, but through a `SiteMethods` instance. @@ -2459,7 +2460,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.sites.list", + dlg.begin(MethodInfo { id: "webmasters.sites.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); for &field in ["alt"].iter() { @@ -2479,7 +2480,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2515,7 +2516,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2525,10 +2526,10 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2569,12 +2570,12 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2591,17 +2592,17 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2609,7 +2610,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut } -/// Removes a site from the set of the user's Webmaster Tools sites. +/// Removes a site from the set of the user's Search Console sites. /// /// A builder for the *delete* method supported by a *site* resource. /// It is not used directly, but through a `SiteMethods` instance. @@ -2663,7 +2664,7 @@ impl<'a, C, A> SiteDeleteCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.sites.delete", + dlg.begin(MethodInfo { id: "webmasters.sites.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -2704,7 +2705,7 @@ impl<'a, C, A> SiteDeleteCall<'a, C, A> where C: BorrowMut, A: oa params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2740,7 +2741,7 @@ impl<'a, C, A> SiteDeleteCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2750,10 +2751,10 @@ impl<'a, C, A> SiteDeleteCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2776,7 +2777,7 @@ impl<'a, C, A> SiteDeleteCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *site url* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn site_url(mut self, new_value: &str) -> SiteDeleteCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -2794,12 +2795,12 @@ impl<'a, C, A> SiteDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2816,17 +2817,17 @@ impl<'a, C, A> SiteDeleteCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SiteDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SiteDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2897,7 +2898,7 @@ impl<'a, C, A> SearchanalyticQueryCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.searchanalytics.query", + dlg.begin(MethodInfo { id: "webmasters.searchanalytics.query", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -2939,14 +2940,14 @@ impl<'a, C, A> SearchanalyticQueryCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2990,7 +2991,7 @@ impl<'a, C, A> SearchanalyticQueryCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3000,10 +3001,10 @@ impl<'a, C, A> SearchanalyticQueryCall<'a, C, A> where C: BorrowMut SearchanalyticQueryCall<'a, C, A> where C: BorrowMut SearchanalyticQueryCall<'a, C, A> { self._request = new_value; @@ -3045,7 +3046,7 @@ impl<'a, C, A> SearchanalyticQueryCall<'a, C, A> where C: BorrowMut SearchanalyticQueryCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -3063,12 +3064,12 @@ impl<'a, C, A> SearchanalyticQueryCall<'a, C, A> where C: BorrowMut SearchanalyticQueryCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SearchanalyticQueryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SearchanalyticQueryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3163,7 +3164,7 @@ impl<'a, C, A> UrlcrawlerrorscountQueryCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.urlcrawlerrorscounts.query", + dlg.begin(MethodInfo { id: "webmasters.urlcrawlerrorscounts.query", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -3214,7 +3215,7 @@ impl<'a, C, A> UrlcrawlerrorscountQueryCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3250,7 +3251,7 @@ impl<'a, C, A> UrlcrawlerrorscountQueryCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3260,10 +3261,10 @@ impl<'a, C, A> UrlcrawlerrorscountQueryCall<'a, C, A> where C: BorrowMut UrlcrawlerrorscountQueryCall<'a, C, A> where C: BorrowMut UrlcrawlerrorscountQueryCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -3335,12 +3336,12 @@ impl<'a, C, A> UrlcrawlerrorscountQueryCall<'a, C, A> where C: BorrowMut UrlcrawlerrorscountQueryCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UrlcrawlerrorscountQueryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlcrawlerrorscountQueryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3432,7 +3433,7 @@ impl<'a, C, A> UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.urlcrawlerrorssamples.get", + dlg.begin(MethodInfo { id: "webmasters.urlcrawlerrorssamples.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -3477,7 +3478,7 @@ impl<'a, C, A> UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3513,7 +3514,7 @@ impl<'a, C, A> UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3523,10 +3524,10 @@ impl<'a, C, A> UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleGetCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -3569,7 +3570,7 @@ impl<'a, C, A> UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleGetCall<'a, C, A> { self._url = new_value.to_string(); @@ -3579,7 +3580,7 @@ impl<'a, C, A> UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleGetCall<'a, C, A> { self._category = new_value.to_string(); @@ -3589,7 +3590,7 @@ impl<'a, C, A> UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleGetCall<'a, C, A> { self._platform = new_value.to_string(); @@ -3607,12 +3608,12 @@ impl<'a, C, A> UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleGetCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UrlcrawlerrorssampleGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlcrawlerrorssampleGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3703,7 +3704,7 @@ impl<'a, C, A> UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.urlcrawlerrorssamples.list", + dlg.begin(MethodInfo { id: "webmasters.urlcrawlerrorssamples.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -3747,7 +3748,7 @@ impl<'a, C, A> UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3783,7 +3784,7 @@ impl<'a, C, A> UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3793,10 +3794,10 @@ impl<'a, C, A> UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleListCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -3839,7 +3840,7 @@ impl<'a, C, A> UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleListCall<'a, C, A> { self._category = new_value.to_string(); @@ -3849,7 +3850,7 @@ impl<'a, C, A> UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleListCall<'a, C, A> { self._platform = new_value.to_string(); @@ -3867,12 +3868,12 @@ impl<'a, C, A> UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut UrlcrawlerrorssampleListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> UrlcrawlerrorssampleListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlcrawlerrorssampleListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3964,7 +3965,7 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "webmasters.urlcrawlerrorssamples.markAsFixed", + dlg.begin(MethodInfo { id: "webmasters.urlcrawlerrorssamples.markAsFixed", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("siteUrl", self._site_url.to_string())); @@ -4008,7 +4009,7 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -4044,7 +4045,7 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4054,10 +4055,10 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -4080,7 +4081,7 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< /// /// Sets the *site url* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn site_url(mut self, new_value: &str) -> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> { self._site_url = new_value.to_string(); @@ -4090,7 +4091,7 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< /// /// Sets the *url* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn url(mut self, new_value: &str) -> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> { self._url = new_value.to_string(); @@ -4100,7 +4101,7 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< /// /// Sets the *category* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn category(mut self, new_value: &str) -> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> { self._category = new_value.to_string(); @@ -4110,7 +4111,7 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< /// /// Sets the *platform* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn platform(mut self, new_value: &str) -> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> { self._platform = new_value.to_string(); @@ -4128,12 +4129,12 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -4150,17 +4151,17 @@ impl<'a, C, A> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where C: BorrowMut< } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> UrlcrawlerrorssampleMarkAsFixedCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/youtube3-cli/Cargo.toml b/gen/youtube3-cli/Cargo.toml index 7a88a35a86..ee762ddf83 100644 --- a/gen/youtube3-cli/Cargo.toml +++ b/gen/youtube3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtube3-cli" -version = "0.3.2+20151012" +version = "0.3.3+20160111" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtube3-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/youtube3-cli/LICENSE.md b/gen/youtube3-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/youtube3-cli/LICENSE.md +++ b/gen/youtube3-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/youtube3-cli/README.md b/gen/youtube3-cli/README.md index 660a62c314..5bc6b51e34 100644 --- a/gen/youtube3-cli/README.md +++ b/gen/youtube3-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *YouTube* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/youtube3.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/youtube3.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/youtube3.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/youtube3.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/youtube3-cli). # Usage -This documentation was generated from the *YouTube* API at revision *20151012*. The CLI is at version *0.3.2*. +This documentation was generated from the *YouTube* API at revision *20160111*. The CLI is at version *0.3.3*. ```bash youtube3 [options] @@ -58,6 +58,8 @@ youtube3 [options] mark-as-spam [-p ]... set-moderation-status [-p ]... update (-r )... [-p ]... [-o ] + fan-funding-events + list [-p ]... [-o ] guide-categories list [-p ]... [-o ] i18n-languages @@ -66,13 +68,23 @@ youtube3 [options] list [-p ]... [-o ] live-broadcasts bind [-p ]... [-o ] - bind-direct [-p ]... [-o ] control [-p ]... [-o ] delete [-p ]... insert (-r )... [-p ]... [-o ] list [-p ]... [-o ] transition [-p ]... [-o ] update (-r )... [-p ]... [-o ] + live-chat-bans + delete [-p ]... + insert (-r )... [-p ]... [-o ] + live-chat-messages + delete [-p ]... + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] + live-chat-moderators + delete [-p ]... + insert (-r )... [-p ]... [-o ] + list [-p ]... [-o ] live-streams delete [-p ]... insert (-r )... [-p ]... [-o ] @@ -90,6 +102,8 @@ youtube3 [options] update (-r )... [-p ]... [-o ] search list [-p ]... [-o ] + sponsors + list [-p ]... [-o ] subscriptions delete [-p ]... insert (-r )... [-p ]... [-o ] @@ -115,18 +129,18 @@ youtube3 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/youtube3-cli/mkdocs.yml b/gen/youtube3-cli/mkdocs.yml index 9061edd3a1..9c1ef8d7f9 100644 --- a/gen/youtube3-cli/mkdocs.yml +++ b/gen/youtube3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube v0.3.2+20151012 +site_name: YouTube v0.3.3+20160111 site_url: http://byron.github.io/google-apis-rs/google-youtube3-cli site_description: Write integrating applications with bcore @@ -32,17 +32,25 @@ pages: - ['comments_mark-as-spam.md', 'Comments', 'Mark As Spam'] - ['comments_set-moderation-status.md', 'Comments', 'Set Moderation Status'] - ['comments_update.md', 'Comments', 'Update'] +- ['fan-funding-events_list.md', 'Fan Funding Events', 'List'] - ['guide-categories_list.md', 'Guide Categories', 'List'] - ['i18n-languages_list.md', 'I18n Languages', 'List'] - ['i18n-regions_list.md', 'I18n Regions', 'List'] - ['live-broadcasts_bind.md', 'Live Broadcasts', 'Bind'] -- ['live-broadcasts_bind-direct.md', 'Live Broadcasts', 'Bind Direct'] - ['live-broadcasts_control.md', 'Live Broadcasts', 'Control'] - ['live-broadcasts_delete.md', 'Live Broadcasts', 'Delete'] - ['live-broadcasts_insert.md', 'Live Broadcasts', 'Insert'] - ['live-broadcasts_list.md', 'Live Broadcasts', 'List'] - ['live-broadcasts_transition.md', 'Live Broadcasts', 'Transition'] - ['live-broadcasts_update.md', 'Live Broadcasts', 'Update'] +- ['live-chat-bans_delete.md', 'Live Chat Bans', 'Delete'] +- ['live-chat-bans_insert.md', 'Live Chat Bans', 'Insert'] +- ['live-chat-messages_delete.md', 'Live Chat Messages', 'Delete'] +- ['live-chat-messages_insert.md', 'Live Chat Messages', 'Insert'] +- ['live-chat-messages_list.md', 'Live Chat Messages', 'List'] +- ['live-chat-moderators_delete.md', 'Live Chat Moderators', 'Delete'] +- ['live-chat-moderators_insert.md', 'Live Chat Moderators', 'Insert'] +- ['live-chat-moderators_list.md', 'Live Chat Moderators', 'List'] - ['live-streams_delete.md', 'Live Streams', 'Delete'] - ['live-streams_insert.md', 'Live Streams', 'Insert'] - ['live-streams_list.md', 'Live Streams', 'List'] @@ -56,6 +64,7 @@ pages: - ['playlists_list.md', 'Playlists', 'List'] - ['playlists_update.md', 'Playlists', 'Update'] - ['search_list.md', 'Search', 'List'] +- ['sponsors_list.md', 'Sponsors', 'List'] - ['subscriptions_delete.md', 'Subscriptions', 'Delete'] - ['subscriptions_insert.md', 'Subscriptions', 'Insert'] - ['subscriptions_list.md', 'Subscriptions', 'List'] @@ -74,5 +83,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/youtube3-cli/src/main.rs b/gen/youtube3-cli/src/main.rs index e81a78f96f..7d98151563 100644 --- a/gen/youtube3-cli/src/main.rs +++ b/gen/youtube3-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::YouTube>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _activities_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _activities_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "snippet.thumbnails.default.url" => Some(("snippet.thumbnails.default.url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.thumbnails.default.width" => Some(("snippet.thumbnails.default.width", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -163,7 +163,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Activity = json::value::from_value(object).unwrap(); let mut call = self.hub.activities().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -176,7 +176,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -189,7 +189,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -212,10 +212,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _activities_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _activities_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.activities().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "region-code" => { @@ -252,7 +252,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "published-before", "channel-id", "mine", "max-results", "region-code", "home", "published-after"].iter().map(|v|*v)); @@ -266,7 +266,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -289,10 +289,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _captions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _captions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.captions().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -311,7 +311,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner", "on-behalf-of"].iter().map(|v|*v)); @@ -325,7 +325,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -340,11 +340,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _captions_download(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _captions_download(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.captions().download(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "tlang" => { @@ -372,7 +372,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["tfmt", "on-behalf-of-content-owner", "on-behalf-of", "tlang"].iter().map(|v|*v)); @@ -386,7 +386,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -410,13 +410,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _captions_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _captions_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -430,8 +430,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "snippet.status" => Some(("snippet.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.audio-track-type" => Some(("snippet.audioTrackType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -461,7 +461,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Caption = json::value::from_value(object).unwrap(); let mut call = self.hub.captions().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sync" => { @@ -483,7 +483,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner", "on-behalf-of", "sync"].iter().map(|v|*v)); @@ -492,7 +492,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -500,7 +500,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -524,10 +524,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _captions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _captions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.captions().list(opt.value_of("part").unwrap_or(""), opt.value_of("video-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -549,7 +549,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner", "on-behalf-of", "id"].iter().map(|v|*v)); @@ -563,7 +563,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -586,13 +586,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _captions_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _captions_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -606,8 +606,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "snippet.status" => Some(("snippet.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.audio-track-type" => Some(("snippet.audioTrackType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -637,7 +637,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Caption = json::value::from_value(object).unwrap(); let mut call = self.hub.captions().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "sync" => { @@ -659,7 +659,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner", "on-behalf-of", "sync"].iter().map(|v|*v)); @@ -668,7 +668,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -676,7 +676,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -700,13 +700,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channel_banners_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channel_banners_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -720,8 +720,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "url" => Some(("url", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -738,7 +738,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ChannelBannerResource = json::value::from_value(object).unwrap(); let mut call = self.hub.channel_banners().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -754,7 +754,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -763,7 +763,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -771,7 +771,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -795,10 +795,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channel_sections_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channel_sections_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.channel_sections().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -814,7 +814,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -828,7 +828,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -843,13 +843,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channel_sections_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channel_sections_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -863,8 +863,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "targeting.languages" => Some(("targeting.languages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -893,7 +893,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ChannelSection = json::value::from_value(object).unwrap(); let mut call = self.hub.channel_sections().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner-channel" => { @@ -912,7 +912,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -926,7 +926,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -949,10 +949,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channel_sections_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channel_sections_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.channel_sections().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -980,7 +980,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner", "channel-id", "mine", "hl", "id"].iter().map(|v|*v)); @@ -994,7 +994,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1017,13 +1017,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channel_sections_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channel_sections_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1037,8 +1037,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "targeting.languages" => Some(("targeting.languages", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), @@ -1067,7 +1067,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::ChannelSection = json::value::from_value(object).unwrap(); let mut call = self.hub.channel_sections().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -1083,7 +1083,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -1097,7 +1097,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1120,10 +1120,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.channels().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -1166,7 +1166,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["managed-by-me", "on-behalf-of-content-owner", "for-username", "mine", "max-results", "category-id", "page-token", "my-subscribers", "hl", "id"].iter().map(|v|*v)); @@ -1180,7 +1180,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1203,13 +1203,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _channels_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _channels_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1223,8 +1223,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.privacy-status" => Some(("status.privacyStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.is-linked" => Some(("status.isLinked", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -1334,7 +1334,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Channel = json::value::from_value(object).unwrap(); let mut call = self.hub.channels().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -1350,7 +1350,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -1364,7 +1364,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1387,13 +1387,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comment_threads_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comment_threads_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1407,8 +1407,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "snippet.is-public" => Some(("snippet.isPublic", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "snippet.channel-id" => Some(("snippet.channelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1449,7 +1449,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CommentThread = json::value::from_value(object).unwrap(); let mut call = self.hub.comment_threads().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1462,7 +1462,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1475,7 +1475,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1498,10 +1498,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comment_threads_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comment_threads_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comment_threads().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "video-id" => { @@ -1544,7 +1544,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["max-results", "all-threads-related-to-channel-id", "channel-id", "video-id", "moderation-status", "id", "page-token", "search-terms", "text-format", "order"].iter().map(|v|*v)); @@ -1558,7 +1558,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1581,13 +1581,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comment_threads_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comment_threads_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1601,8 +1601,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "snippet.is-public" => Some(("snippet.isPublic", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "snippet.channel-id" => Some(("snippet.channelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1643,7 +1643,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::CommentThread = json::value::from_value(object).unwrap(); let mut call = self.hub.comment_threads().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1656,7 +1656,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1669,7 +1669,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1692,10 +1692,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1708,7 +1708,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1721,7 +1721,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1736,13 +1736,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -1756,8 +1756,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "snippet.author-channel-url" => Some(("snippet.authorChannelUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.viewer-rating" => Some(("snippet.viewerRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -1790,7 +1790,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Comment = json::value::from_value(object).unwrap(); let mut call = self.hub.comments().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1803,7 +1803,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1816,7 +1816,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1839,10 +1839,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "text-format" => { @@ -1870,7 +1870,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "text-format", "id", "max-results", "parent-id"].iter().map(|v|*v)); @@ -1884,7 +1884,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -1907,10 +1907,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_mark_as_spam(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_mark_as_spam(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().mark_as_spam(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -1923,7 +1923,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -1936,7 +1936,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1951,10 +1951,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_set_moderation_status(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_set_moderation_status(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.comments().set_moderation_status(opt.value_of("id").unwrap_or(""), opt.value_of("moderation-status").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "ban-author" => { @@ -1970,7 +1970,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["ban-author"].iter().map(|v|*v)); @@ -1984,7 +1984,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -1999,13 +1999,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _comments_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _comments_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2019,8 +2019,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "snippet.author-channel-url" => Some(("snippet.authorChannelUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.viewer-rating" => Some(("snippet.viewerRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2053,7 +2053,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Comment = json::value::from_value(object).unwrap(); let mut call = self.hub.comments().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -2066,7 +2066,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -2079,7 +2079,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2102,10 +2102,72 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _guide_categories_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _fan_funding_events_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.fan_funding_events().list(opt.value_of("part").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "hl" => { + call = call.hl(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "hl", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _guide_categories_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.guide_categories().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "region-code" => { @@ -2127,7 +2189,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["region-code", "id", "hl"].iter().map(|v|*v)); @@ -2141,7 +2203,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2164,10 +2226,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _i18n_languages_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _i18n_languages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.i18n_languages().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "hl" => { @@ -2183,7 +2245,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["hl"].iter().map(|v|*v)); @@ -2197,7 +2259,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2220,10 +2282,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _i18n_regions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _i18n_regions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.i18n_regions().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "hl" => { @@ -2239,7 +2301,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["hl"].iter().map(|v|*v)); @@ -2253,7 +2315,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2276,10 +2338,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_broadcasts_bind(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_broadcasts_bind(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.live_broadcasts().bind(opt.value_of("id").unwrap_or(""), opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "stream-id" => { @@ -2301,7 +2363,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner", "stream-id"].iter().map(|v|*v)); @@ -2315,7 +2377,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2338,72 +2400,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_broadcasts_bind_direct(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) - -> Result<(), DoitError> { - let mut call = self.hub.live_broadcasts().bind_direct(opt.value_of("id").unwrap_or(""), opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "stream-id" => { - call = call.stream_id(value.unwrap_or("")); - }, - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - _ => { - let mut found = false; - for param in &self.gp { - if key == *param { - found = true; - call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); - break; - } - } - if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), - {let mut v = Vec::new(); - v.extend(self.gp.iter().map(|v|*v)); - v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner", "stream-id"].iter().map(|v|*v)); - v } )); - } - } - } - } - let protocol = CallType::Standard; - if dry_run { - Ok(()) - } else { - assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { - call = call.add_scope(scope); - } - let mut ostream = match writer_from_opts(opt.value_of("out")) { - Ok(mut f) => f, - Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), - }; - match match protocol { - CallType::Standard => call.doit(), - _ => unreachable!() - } { - Err(api_err) => Err(DoitError::ApiError(api_err)), - Ok((mut response, output_schema)) => { - let mut value = json::value::to_value(&output_schema); - remove_json_null_values(&mut value); - json::to_writer_pretty(&mut ostream, &value).unwrap(); - ostream.flush().unwrap(); - Ok(()) - } - } - } - } - - fn _live_broadcasts_control(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_broadcasts_control(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.live_broadcasts().control(opt.value_of("id").unwrap_or(""), opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "walltime" => { @@ -2431,7 +2431,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner", "display-slate", "offset-time-ms", "walltime"].iter().map(|v|*v)); @@ -2445,7 +2445,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2468,10 +2468,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_broadcasts_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_broadcasts_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.live_broadcasts().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner-channel" => { @@ -2490,7 +2490,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -2504,7 +2504,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2519,13 +2519,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_broadcasts_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_broadcasts_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2539,8 +2539,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.recording-status" => Some(("status.recordingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.privacy-status" => Some(("status.privacyStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2554,6 +2554,7 @@ impl<'n, 'a> Engine<'n, 'a> { "content-details.enable-embed" => Some(("contentDetails.enableEmbed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "content-details.enable-closed-captions" => Some(("contentDetails.enableClosedCaptions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "content-details.start-with-slate" => Some(("contentDetails.startWithSlate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "content-details.closed-captions-type" => Some(("contentDetails.closedCaptionsType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.enable-content-encryption" => Some(("contentDetails.enableContentEncryption", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "content-details.record-from-start" => Some(("contentDetails.recordFromStart", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "content-details.enable-dvr" => Some(("contentDetails.enableDvr", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -2588,7 +2589,7 @@ impl<'n, 'a> Engine<'n, 'a> { "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["actual-end-time", "actual-start-time", "bound-stream-id", "broadcast-stream-delay-ms", "channel-id", "concurrent-viewers", "content-details", "default", "description", "embed-html", "enable-closed-captions", "enable-content-encryption", "enable-dvr", "enable-embed", "enable-low-latency", "enable-monitor-stream", "etag", "height", "high", "id", "is-default-broadcast", "kind", "life-cycle-status", "live-broadcast-priority", "live-chat-id", "maxres", "medium", "monitor-stream", "privacy-status", "published-at", "record-from-start", "recording-status", "scheduled-end-time", "scheduled-start-time", "snippet", "standard", "start-with-slate", "statistics", "status", "thumbnails", "title", "total-chat-count", "url", "width"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["actual-end-time", "actual-start-time", "bound-stream-id", "broadcast-stream-delay-ms", "channel-id", "closed-captions-type", "concurrent-viewers", "content-details", "default", "description", "embed-html", "enable-closed-captions", "enable-content-encryption", "enable-dvr", "enable-embed", "enable-low-latency", "enable-monitor-stream", "etag", "height", "high", "id", "is-default-broadcast", "kind", "life-cycle-status", "live-broadcast-priority", "live-chat-id", "maxres", "medium", "monitor-stream", "privacy-status", "published-at", "record-from-start", "recording-status", "scheduled-end-time", "scheduled-start-time", "snippet", "standard", "start-with-slate", "statistics", "status", "thumbnails", "title", "total-chat-count", "url", "width"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2599,7 +2600,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LiveBroadcast = json::value::from_value(object).unwrap(); let mut call = self.hub.live_broadcasts().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner-channel" => { @@ -2618,7 +2619,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -2632,7 +2633,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2655,10 +2656,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_broadcasts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_broadcasts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.live_broadcasts().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -2679,6 +2680,9 @@ impl<'n, 'a> Engine<'n, 'a> { "id" => { call = call.id(value.unwrap_or("")); }, + "broadcast-type" => { + call = call.broadcast_type(value.unwrap_or("")); + }, "broadcast-status" => { call = call.broadcast_status(value.unwrap_or("")); }, @@ -2692,10 +2696,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["broadcast-status", "on-behalf-of-content-owner", "on-behalf-of-content-owner-channel", "mine", "max-results", "page-token", "id"].iter().map(|v|*v)); + v.extend(["broadcast-status", "on-behalf-of-content-owner", "on-behalf-of-content-owner-channel", "mine", "max-results", "page-token", "broadcast-type", "id"].iter().map(|v|*v)); v } )); } } @@ -2706,7 +2710,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2729,10 +2733,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_broadcasts_transition(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_broadcasts_transition(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.live_broadcasts().transition(opt.value_of("broadcast-status").unwrap_or(""), opt.value_of("id").unwrap_or(""), opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner-channel" => { @@ -2751,7 +2755,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -2765,7 +2769,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2788,13 +2792,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_broadcasts_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_broadcasts_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2808,8 +2812,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.recording-status" => Some(("status.recordingStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.privacy-status" => Some(("status.privacyStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -2823,6 +2827,7 @@ impl<'n, 'a> Engine<'n, 'a> { "content-details.enable-embed" => Some(("contentDetails.enableEmbed", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "content-details.enable-closed-captions" => Some(("contentDetails.enableClosedCaptions", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "content-details.start-with-slate" => Some(("contentDetails.startWithSlate", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "content-details.closed-captions-type" => Some(("contentDetails.closedCaptionsType", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.enable-content-encryption" => Some(("contentDetails.enableContentEncryption", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "content-details.record-from-start" => Some(("contentDetails.recordFromStart", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), "content-details.enable-dvr" => Some(("contentDetails.enableDvr", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -2857,7 +2862,7 @@ impl<'n, 'a> Engine<'n, 'a> { "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["actual-end-time", "actual-start-time", "bound-stream-id", "broadcast-stream-delay-ms", "channel-id", "concurrent-viewers", "content-details", "default", "description", "embed-html", "enable-closed-captions", "enable-content-encryption", "enable-dvr", "enable-embed", "enable-low-latency", "enable-monitor-stream", "etag", "height", "high", "id", "is-default-broadcast", "kind", "life-cycle-status", "live-broadcast-priority", "live-chat-id", "maxres", "medium", "monitor-stream", "privacy-status", "published-at", "record-from-start", "recording-status", "scheduled-end-time", "scheduled-start-time", "snippet", "standard", "start-with-slate", "statistics", "status", "thumbnails", "title", "total-chat-count", "url", "width"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["actual-end-time", "actual-start-time", "bound-stream-id", "broadcast-stream-delay-ms", "channel-id", "closed-captions-type", "concurrent-viewers", "content-details", "default", "description", "embed-html", "enable-closed-captions", "enable-content-encryption", "enable-dvr", "enable-embed", "enable-low-latency", "enable-monitor-stream", "etag", "height", "high", "id", "is-default-broadcast", "kind", "life-cycle-status", "live-broadcast-priority", "live-chat-id", "maxres", "medium", "monitor-stream", "privacy-status", "published-at", "record-from-start", "recording-status", "scheduled-end-time", "scheduled-start-time", "snippet", "standard", "start-with-slate", "statistics", "status", "thumbnails", "title", "total-chat-count", "url", "width"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -2868,7 +2873,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LiveBroadcast = json::value::from_value(object).unwrap(); let mut call = self.hub.live_broadcasts().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner-channel" => { @@ -2887,7 +2892,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -2901,7 +2906,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -2924,10 +2929,558 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_streams_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_chat_bans_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.live_chat_bans().delete(opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _live_chat_bans_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "snippet.ban-duration-seconds" => Some(("snippet.banDurationSeconds", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.live-chat-id" => Some(("snippet.liveChatId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.banned-user-details.channel-id" => Some(("snippet.bannedUserDetails.channelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.banned-user-details.display-name" => Some(("snippet.bannedUserDetails.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.banned-user-details.profile-image-url" => Some(("snippet.bannedUserDetails.profileImageUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.banned-user-details.channel-url" => Some(("snippet.bannedUserDetails.channelUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.type" => Some(("snippet.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["ban-duration-seconds", "banned-user-details", "channel-id", "channel-url", "display-name", "etag", "id", "kind", "live-chat-id", "profile-image-url", "snippet", "type"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LiveChatBan = json::value::from_value(object).unwrap(); + let mut call = self.hub.live_chat_bans().insert(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _live_chat_messages_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.live_chat_messages().delete(opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _live_chat_messages_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "snippet.display-message" => Some(("snippet.displayMessage", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.fan-funding-event-details.currency" => Some(("snippet.fanFundingEventDetails.currency", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.fan-funding-event-details.amount-display-string" => Some(("snippet.fanFundingEventDetails.amountDisplayString", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.fan-funding-event-details.user-comment" => Some(("snippet.fanFundingEventDetails.userComment", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.fan-funding-event-details.amount-micros" => Some(("snippet.fanFundingEventDetails.amountMicros", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.has-display-content" => Some(("snippet.hasDisplayContent", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "snippet.published-at" => Some(("snippet.publishedAt", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.live-chat-id" => Some(("snippet.liveChatId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.author-channel-id" => Some(("snippet.authorChannelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.text-message-details.message-text" => Some(("snippet.textMessageDetails.messageText", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.type" => Some(("snippet.type", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author-details.display-name" => Some(("authorDetails.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author-details.is-chat-moderator" => Some(("authorDetails.isChatModerator", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "author-details.channel-id" => Some(("authorDetails.channelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author-details.is-chat-sponsor" => Some(("authorDetails.isChatSponsor", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "author-details.profile-image-url" => Some(("authorDetails.profileImageUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "author-details.is-chat-owner" => Some(("authorDetails.isChatOwner", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "author-details.is-verified" => Some(("authorDetails.isVerified", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), + "author-details.channel-url" => Some(("authorDetails.channelUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["amount-display-string", "amount-micros", "author-channel-id", "author-details", "channel-id", "channel-url", "currency", "display-message", "display-name", "etag", "fan-funding-event-details", "has-display-content", "id", "is-chat-moderator", "is-chat-owner", "is-chat-sponsor", "is-verified", "kind", "live-chat-id", "message-text", "profile-image-url", "published-at", "snippet", "text-message-details", "type", "user-comment"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LiveChatMessage = json::value::from_value(object).unwrap(); + let mut call = self.hub.live_chat_messages().insert(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _live_chat_messages_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.live_chat_messages().list(opt.value_of("live-chat-id").unwrap_or(""), opt.value_of("part").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "profile-image-size" => { + call = call.profile_image_size(arg_from_str(value.unwrap_or("-0"), err, "profile-image-size", "integer")); + }, + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "hl" => { + call = call.hl(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["profile-image-size", "hl", "max-results", "page-token"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _live_chat_moderators_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.live_chat_moderators().delete(opt.value_of("id").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok(mut response) => { + Ok(()) + } + } + } + } + + fn _live_chat_moderators_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + + let mut field_cursor = FieldCursor::default(); + let mut object = json::value::Value::Object(Default::default()); + + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let last_errc = err.issues.len(); + let (key, value) = parse_kv_arg(&*kvarg, err, false); + let mut temp_cursor = field_cursor.clone(); + if let Err(field_err) = temp_cursor.set(&*key) { + err.issues.push(field_err); + } + if value.is_none() { + field_cursor = temp_cursor.clone(); + if err.issues.len() > last_errc { + err.issues.remove(last_errc); + } + continue; + } + + let type_info: Option<(&'static str, JsonTypeInfo)> = + match &temp_cursor.to_string()[..] { + "snippet.live-chat-id" => Some(("snippet.liveChatId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.moderator-details.channel-id" => Some(("snippet.moderatorDetails.channelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.moderator-details.display-name" => Some(("snippet.moderatorDetails.displayName", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.moderator-details.profile-image-url" => Some(("snippet.moderatorDetails.profileImageUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "snippet.moderator-details.channel-url" => Some(("snippet.moderatorDetails.channelUrl", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + _ => { + let suggestion = FieldCursor::did_you_mean(key, &vec!["channel-id", "channel-url", "display-name", "etag", "id", "kind", "live-chat-id", "moderator-details", "profile-image-url", "snippet"]); + err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); + None + } + }; + if let Some((field_cursor_str, type_info)) = type_info { + FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor); + } + } + let mut request: api::LiveChatModerator = json::value::from_value(object).unwrap(); + let mut call = self.hub.live_chat_moderators().insert(request); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _live_chat_moderators_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.live_chat_moderators().list(opt.value_of("live-chat-id").unwrap_or(""), opt.value_of("part").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["page-token", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _live_streams_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.live_streams().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner-channel" => { @@ -2946,7 +3499,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -2960,7 +3513,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -2975,13 +3528,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_streams_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_streams_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -2995,8 +3548,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.stream-status" => Some(("status.streamStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.health-status.status" => Some(("status.healthStatus.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3028,7 +3581,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LiveStream = json::value::from_value(object).unwrap(); let mut call = self.hub.live_streams().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner-channel" => { @@ -3047,7 +3600,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -3061,7 +3614,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3084,10 +3637,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_streams_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_streams_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.live_streams().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3118,7 +3671,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner", "on-behalf-of-content-owner-channel", "mine", "max-results", "page-token", "id"].iter().map(|v|*v)); @@ -3132,7 +3685,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3155,13 +3708,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _live_streams_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _live_streams_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3175,8 +3728,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.stream-status" => Some(("status.streamStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.health-status.status" => Some(("status.healthStatus.status", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3208,7 +3761,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::LiveStream = json::value::from_value(object).unwrap(); let mut call = self.hub.live_streams().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner-channel" => { @@ -3227,7 +3780,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -3241,7 +3794,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3264,10 +3817,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _playlist_items_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _playlist_items_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.playlist_items().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3280,7 +3833,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3293,7 +3846,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3308,13 +3861,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _playlist_items_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _playlist_items_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3328,8 +3881,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.privacy-status" => Some(("status.privacyStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3377,7 +3930,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlaylistItem = json::value::from_value(object).unwrap(); let mut call = self.hub.playlist_items().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -3393,7 +3946,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -3407,7 +3960,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3430,10 +3983,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _playlist_items_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _playlist_items_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.playlist_items().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "video-id" => { @@ -3464,7 +4017,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner", "playlist-id", "video-id", "max-results", "page-token", "id"].iter().map(|v|*v)); @@ -3478,7 +4031,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3501,13 +4054,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _playlist_items_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _playlist_items_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3521,8 +4074,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.privacy-status" => Some(("status.privacyStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3570,7 +4123,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::PlaylistItem = json::value::from_value(object).unwrap(); let mut call = self.hub.playlist_items().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -3583,7 +4136,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -3596,7 +4149,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3619,10 +4172,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _playlists_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _playlists_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.playlists().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -3638,7 +4191,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -3652,7 +4205,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -3667,13 +4220,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _playlists_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _playlists_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3687,8 +4240,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.privacy-status" => Some(("status.privacyStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3732,7 +4285,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Playlist = json::value::from_value(object).unwrap(); let mut call = self.hub.playlists().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner-channel" => { @@ -3751,7 +4304,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -3765,7 +4318,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3788,10 +4341,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _playlists_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _playlists_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.playlists().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -3828,7 +4381,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner", "on-behalf-of-content-owner-channel", "channel-id", "mine", "max-results", "page-token", "hl", "id"].iter().map(|v|*v)); @@ -3842,7 +4395,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3865,13 +4418,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _playlists_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _playlists_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -3885,8 +4438,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.privacy-status" => Some(("status.privacyStatus", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -3930,7 +4483,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Playlist = json::value::from_value(object).unwrap(); let mut call = self.hub.playlists().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -3946,7 +4499,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -3960,7 +4513,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -3983,10 +4536,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _search_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _search_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.search().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "video-type" => { @@ -4089,7 +4642,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["location-radius", "channel-id", "video-syndicated", "event-type", "channel-type", "video-caption", "published-after", "on-behalf-of-content-owner", "video-category-id", "for-content-owner", "region-code", "location", "for-developer", "video-type", "type", "topic-id", "published-before", "video-dimension", "video-license", "max-results", "related-to-video-id", "video-definition", "page-token", "video-duration", "relevance-language", "for-mine", "q", "safe-search", "video-embeddable", "order"].iter().map(|v|*v)); @@ -4103,7 +4656,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4126,10 +4679,72 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _sponsors_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) + -> Result<(), DoitError> { + let mut call = self.hub.sponsors().list(opt.value_of("part").unwrap_or("")); + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + let (key, value) = parse_kv_arg(&*parg, err, false); + match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, + "max-results" => { + call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); + }, + "filter" => { + call = call.filter(value.unwrap_or("")); + }, + _ => { + let mut found = false; + for param in &self.gp { + if key == *param { + found = true; + call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")); + break; + } + } + if !found { + err.issues.push(CLIError::UnknownParameter(key.to_string(), + {let mut v = Vec::new(); + v.extend(self.gp.iter().map(|v|*v)); + v.extend(["filter", "page-token", "max-results"].iter().map(|v|*v)); + v } )); + } + } + } + } + let protocol = CallType::Standard; + if dry_run { + Ok(()) + } else { + assert!(err.issues.len() == 0); + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { + call = call.add_scope(scope); + } + let mut ostream = match writer_from_opts(opt.value_of("out")) { + Ok(mut f) => f, + Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)), + }; + match match protocol { + CallType::Standard => call.doit(), + _ => unreachable!() + } { + Err(api_err) => Err(DoitError::ApiError(api_err)), + Ok((mut response, output_schema)) => { + let mut value = json::value::to_value(&output_schema); + remove_json_null_values(&mut value); + json::to_writer_pretty(&mut ostream, &value).unwrap(); + ostream.flush().unwrap(); + Ok(()) + } + } + } + } + + fn _subscriptions_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subscriptions().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4142,7 +4757,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4155,7 +4770,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4170,13 +4785,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4190,8 +4805,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.new-item-count" => Some(("contentDetails.newItemCount", JsonTypeInfo { jtype: JsonType::Int, ctype: ComplexType::Pod })), @@ -4253,7 +4868,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Subscription = json::value::from_value(object).unwrap(); let mut call = self.hub.subscriptions().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -4266,7 +4881,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -4279,7 +4894,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4302,10 +4917,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _subscriptions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _subscriptions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.subscriptions().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -4348,7 +4963,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner", "on-behalf-of-content-owner-channel", "channel-id", "mine", "max-results", "id", "page-token", "my-subscribers", "for-channel-id", "order"].iter().map(|v|*v)); @@ -4362,7 +4977,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4385,10 +5000,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _thumbnails_set(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _thumbnails_set(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.thumbnails().set(opt.value_of("video-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -4404,7 +5019,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -4413,7 +5028,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -4421,7 +5036,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4445,10 +5060,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _video_abuse_report_reasons_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _video_abuse_report_reasons_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.video_abuse_report_reasons().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "hl" => { @@ -4464,7 +5079,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["hl"].iter().map(|v|*v)); @@ -4478,7 +5093,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4501,10 +5116,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _video_categories_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _video_categories_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.video_categories().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "region-code" => { @@ -4526,7 +5141,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["region-code", "id", "hl"].iter().map(|v|*v)); @@ -4540,7 +5155,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4563,10 +5178,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _videos_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _videos_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.videos().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -4582,7 +5197,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -4596,7 +5211,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -4611,10 +5226,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _videos_get_rating(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _videos_get_rating(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.videos().get_rating(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -4630,7 +5245,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -4644,7 +5259,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4667,13 +5282,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _videos_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _videos_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -4687,8 +5302,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.license" => Some(("status.license", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.embeddable" => Some(("status.embeddable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -4719,6 +5334,7 @@ impl<'n, 'a> Engine<'n, 'a> { "content-details.content-rating.bmukk-rating" => Some(("contentDetails.contentRating.bmukkRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.chfilm-rating" => Some(("contentDetails.contentRating.chfilmRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.resorteviolencia-rating" => Some(("contentDetails.contentRating.resorteviolenciaRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-details.content-rating.rte-rating" => Some(("contentDetails.contentRating.rteRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.csa-rating" => Some(("contentDetails.contentRating.csaRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.moctw-rating" => Some(("contentDetails.contentRating.moctwRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.anatel-rating" => Some(("contentDetails.contentRating.anatelRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4748,9 +5364,9 @@ impl<'n, 'a> Engine<'n, 'a> { "content-details.content-rating.medietilsynet-rating" => Some(("contentDetails.contentRating.medietilsynetRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.grfilm-rating" => Some(("contentDetails.contentRating.grfilmRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.ccc-rating" => Some(("contentDetails.contentRating.cccRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "content-details.content-rating.rte-rating" => Some(("contentDetails.contentRating.rteRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "content-details.content-rating.czfilm-rating" => Some(("contentDetails.contentRating.czfilmRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.lsf-rating" => Some(("contentDetails.contentRating.lsfRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-details.content-rating.czfilm-rating" => Some(("contentDetails.contentRating.czfilmRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-details.content-rating.ecbmct-rating" => Some(("contentDetails.contentRating.ecbmctRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.fmoc-rating" => Some(("contentDetails.contentRating.fmocRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.eirin-rating" => Some(("contentDetails.contentRating.eirinRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.cce-rating" => Some(("contentDetails.contentRating.cceRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -4789,11 +5405,12 @@ impl<'n, 'a> Engine<'n, 'a> { "suggestions.editor-suggestions" => Some(("suggestions.editorSuggestions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "suggestions.processing-warnings" => Some(("suggestions.processingWarnings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "suggestions.processing-hints" => Some(("suggestions.processingHints", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "live-streaming-details.concurrent-viewers" => Some(("liveStreamingDetails.concurrentViewers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "live-streaming-details.scheduled-start-time" => Some(("liveStreamingDetails.scheduledStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "live-streaming-details.scheduled-end-time" => Some(("liveStreamingDetails.scheduledEndTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "live-streaming-details.actual-start-time" => Some(("liveStreamingDetails.actualStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "live-streaming-details.actual-end-time" => Some(("liveStreamingDetails.actualEndTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "live-streaming-details.active-live-chat-id" => Some(("liveStreamingDetails.activeLiveChatId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "live-streaming-details.scheduled-start-time" => Some(("liveStreamingDetails.scheduledStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "live-streaming-details.concurrent-viewers" => Some(("liveStreamingDetails.concurrentViewers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "live-streaming-details.actual-start-time" => Some(("liveStreamingDetails.actualStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "live-streaming-details.scheduled-end-time" => Some(("liveStreamingDetails.scheduledEndTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "file-details.bitrate-bps" => Some(("fileDetails.bitrateBps", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "file-details.container" => Some(("fileDetails.container", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "file-details.recording-location.latitude" => Some(("fileDetails.recordingLocation.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -4851,7 +5468,7 @@ impl<'n, 'a> Engine<'n, 'a> { "recording-details.location.longitude" => Some(("recordingDetails.location.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["acb-rating", "access", "actual-end-time", "actual-start-time", "agcom-rating", "age-gating", "alcohol-content", "allowed", "altitude", "anatel-rating", "bbfc-rating", "bfvc-rating", "bitrate-bps", "blocked", "bmukk-rating", "caption", "category-id", "catv-rating", "catvfr-rating", "cbfc-rating", "ccc-rating", "cce-rating", "channel-id", "channel-title", "chfilm-rating", "chvrs-rating", "cicf-rating", "cna-rating", "cnc-rating", "comment-count", "concurrent-viewers", "container", "content-details", "content-rating", "country-restriction", "creation-time", "csa-rating", "cscf-rating", "czfilm-rating", "default", "default-audio-language", "default-language", "definition", "description", "dimension", "dislike-count", "djctq-rating", "djctq-rating-reasons", "duration", "duration-ms", "editor-suggestions", "editor-suggestions-availability", "eefilm-rating", "egfilm-rating", "eirin-rating", "embed-html", "embeddable", "etag", "exception", "failure-reason", "favorite-count", "fcbm-rating", "fco-rating", "file-details", "file-details-availability", "file-name", "file-size", "file-type", "fmoc-rating", "fpb-rating", "fsk-rating", "grfilm-rating", "height", "high", "icaa-rating", "id", "ifco-rating", "ilfilm-rating", "incaa-rating", "kfcb-rating", "kijkwijzer-rating", "kind", "kmrb-rating", "latitude", "license", "licensed-content", "like-count", "live-broadcast-content", "live-streaming-details", "localized", "location", "location-description", "longitude", "lsf-rating", "maxres", "mccaa-rating", "mccyp-rating", "mda-rating", "medietilsynet-rating", "medium", "meku-rating", "mibac-rating", "moc-rating", "moctw-rating", "monetization-details", "mpaa-rating", "mtrcb-rating", "nbc-rating", "nbcpl-rating", "nfrc-rating", "nfvcb-rating", "nkclv-rating", "oflc-rating", "parts-processed", "parts-total", "pefilm-rating", "player", "privacy-status", "processing-details", "processing-errors", "processing-failure-reason", "processing-hints", "processing-issues-availability", "processing-progress", "processing-status", "processing-warnings", "project-details", "public-stats-viewable", "publish-at", "published-at", "rcnof-rating", "recording-date", "recording-details", "recording-location", "region-restriction", "rejection-reason", "relevant-topic-ids", "resorteviolencia-rating", "restricted", "rtc-rating", "rte-rating", "russia-rating", "scheduled-end-time", "scheduled-start-time", "skfilm-rating", "smais-rating", "smsa-rating", "snippet", "standard", "statistics", "status", "suggestions", "tag-suggestions-availability", "tags", "thumbnails", "thumbnails-availability", "time-left-ms", "title", "topic-details", "topic-ids", "tvpg-rating", "upload-status", "url", "video-game-rating", "view-count", "width", "yt-rating"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["acb-rating", "access", "active-live-chat-id", "actual-end-time", "actual-start-time", "agcom-rating", "age-gating", "alcohol-content", "allowed", "altitude", "anatel-rating", "bbfc-rating", "bfvc-rating", "bitrate-bps", "blocked", "bmukk-rating", "caption", "category-id", "catv-rating", "catvfr-rating", "cbfc-rating", "ccc-rating", "cce-rating", "channel-id", "channel-title", "chfilm-rating", "chvrs-rating", "cicf-rating", "cna-rating", "cnc-rating", "comment-count", "concurrent-viewers", "container", "content-details", "content-rating", "country-restriction", "creation-time", "csa-rating", "cscf-rating", "czfilm-rating", "default", "default-audio-language", "default-language", "definition", "description", "dimension", "dislike-count", "djctq-rating", "djctq-rating-reasons", "duration", "duration-ms", "ecbmct-rating", "editor-suggestions", "editor-suggestions-availability", "eefilm-rating", "egfilm-rating", "eirin-rating", "embed-html", "embeddable", "etag", "exception", "failure-reason", "favorite-count", "fcbm-rating", "fco-rating", "file-details", "file-details-availability", "file-name", "file-size", "file-type", "fmoc-rating", "fpb-rating", "fsk-rating", "grfilm-rating", "height", "high", "icaa-rating", "id", "ifco-rating", "ilfilm-rating", "incaa-rating", "kfcb-rating", "kijkwijzer-rating", "kind", "kmrb-rating", "latitude", "license", "licensed-content", "like-count", "live-broadcast-content", "live-streaming-details", "localized", "location", "location-description", "longitude", "lsf-rating", "maxres", "mccaa-rating", "mccyp-rating", "mda-rating", "medietilsynet-rating", "medium", "meku-rating", "mibac-rating", "moc-rating", "moctw-rating", "monetization-details", "mpaa-rating", "mtrcb-rating", "nbc-rating", "nbcpl-rating", "nfrc-rating", "nfvcb-rating", "nkclv-rating", "oflc-rating", "parts-processed", "parts-total", "pefilm-rating", "player", "privacy-status", "processing-details", "processing-errors", "processing-failure-reason", "processing-hints", "processing-issues-availability", "processing-progress", "processing-status", "processing-warnings", "project-details", "public-stats-viewable", "publish-at", "published-at", "rcnof-rating", "recording-date", "recording-details", "recording-location", "region-restriction", "rejection-reason", "relevant-topic-ids", "resorteviolencia-rating", "restricted", "rtc-rating", "rte-rating", "russia-rating", "scheduled-end-time", "scheduled-start-time", "skfilm-rating", "smais-rating", "smsa-rating", "snippet", "standard", "statistics", "status", "suggestions", "tag-suggestions-availability", "tags", "thumbnails", "thumbnails-availability", "time-left-ms", "title", "topic-details", "topic-ids", "tvpg-rating", "upload-status", "url", "video-game-rating", "view-count", "width", "yt-rating"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -4862,7 +5479,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Video = json::value::from_value(object).unwrap(); let mut call = self.hub.videos().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "stabilize" => { @@ -4890,7 +5507,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner-channel", "on-behalf-of-content-owner", "auto-levels", "notify-subscribers", "stabilize"].iter().map(|v|*v)); @@ -4899,7 +5516,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -4907,7 +5524,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -4931,10 +5548,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _videos_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _videos_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.videos().list(opt.value_of("part").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "video-category-id" => { @@ -4977,7 +5594,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner", "region-code", "page-token", "locale", "chart", "max-results", "video-category-id", "hl", "my-rating", "id"].iter().map(|v|*v)); @@ -4991,7 +5608,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5014,10 +5631,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _videos_rate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _videos_rate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.videos().rate(opt.value_of("id").unwrap_or(""), opt.value_of("rating").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -5030,7 +5647,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -5043,7 +5660,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -5058,13 +5675,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _videos_report_abuse(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _videos_report_abuse(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5078,8 +5695,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "secondary-reason-id" => Some(("secondaryReasonId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "reason-id" => Some(("reasonId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5098,7 +5715,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::VideoAbuseReport = json::value::from_value(object).unwrap(); let mut call = self.hub.videos().report_abuse(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -5114,7 +5731,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -5128,7 +5745,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -5143,13 +5760,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _videos_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _videos_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5163,8 +5780,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "status.license" => Some(("status.license", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "status.embeddable" => Some(("status.embeddable", JsonTypeInfo { jtype: JsonType::Boolean, ctype: ComplexType::Pod })), @@ -5195,6 +5812,7 @@ impl<'n, 'a> Engine<'n, 'a> { "content-details.content-rating.bmukk-rating" => Some(("contentDetails.contentRating.bmukkRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.chfilm-rating" => Some(("contentDetails.contentRating.chfilmRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.resorteviolencia-rating" => Some(("contentDetails.contentRating.resorteviolenciaRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-details.content-rating.rte-rating" => Some(("contentDetails.contentRating.rteRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.csa-rating" => Some(("contentDetails.contentRating.csaRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.moctw-rating" => Some(("contentDetails.contentRating.moctwRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.anatel-rating" => Some(("contentDetails.contentRating.anatelRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5224,9 +5842,9 @@ impl<'n, 'a> Engine<'n, 'a> { "content-details.content-rating.medietilsynet-rating" => Some(("contentDetails.contentRating.medietilsynetRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.grfilm-rating" => Some(("contentDetails.contentRating.grfilmRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.ccc-rating" => Some(("contentDetails.contentRating.cccRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "content-details.content-rating.rte-rating" => Some(("contentDetails.contentRating.rteRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "content-details.content-rating.czfilm-rating" => Some(("contentDetails.contentRating.czfilmRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.lsf-rating" => Some(("contentDetails.contentRating.lsfRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-details.content-rating.czfilm-rating" => Some(("contentDetails.contentRating.czfilmRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "content-details.content-rating.ecbmct-rating" => Some(("contentDetails.contentRating.ecbmctRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.fmoc-rating" => Some(("contentDetails.contentRating.fmocRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.eirin-rating" => Some(("contentDetails.contentRating.eirinRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "content-details.content-rating.cce-rating" => Some(("contentDetails.contentRating.cceRating", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5265,11 +5883,12 @@ impl<'n, 'a> Engine<'n, 'a> { "suggestions.editor-suggestions" => Some(("suggestions.editorSuggestions", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "suggestions.processing-warnings" => Some(("suggestions.processingWarnings", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), "suggestions.processing-hints" => Some(("suggestions.processingHints", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })), - "live-streaming-details.concurrent-viewers" => Some(("liveStreamingDetails.concurrentViewers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "live-streaming-details.scheduled-start-time" => Some(("liveStreamingDetails.scheduledStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "live-streaming-details.scheduled-end-time" => Some(("liveStreamingDetails.scheduledEndTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), - "live-streaming-details.actual-start-time" => Some(("liveStreamingDetails.actualStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "live-streaming-details.actual-end-time" => Some(("liveStreamingDetails.actualEndTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "live-streaming-details.active-live-chat-id" => Some(("liveStreamingDetails.activeLiveChatId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "live-streaming-details.scheduled-start-time" => Some(("liveStreamingDetails.scheduledStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "live-streaming-details.concurrent-viewers" => Some(("liveStreamingDetails.concurrentViewers", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "live-streaming-details.actual-start-time" => Some(("liveStreamingDetails.actualStartTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), + "live-streaming-details.scheduled-end-time" => Some(("liveStreamingDetails.scheduledEndTime", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "file-details.bitrate-bps" => Some(("fileDetails.bitrateBps", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "file-details.container" => Some(("fileDetails.container", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "file-details.recording-location.latitude" => Some(("fileDetails.recordingLocation.latitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), @@ -5327,7 +5946,7 @@ impl<'n, 'a> Engine<'n, 'a> { "recording-details.location.longitude" => Some(("recordingDetails.location.longitude", JsonTypeInfo { jtype: JsonType::Float, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), _ => { - let suggestion = FieldCursor::did_you_mean(key, &vec!["acb-rating", "access", "actual-end-time", "actual-start-time", "agcom-rating", "age-gating", "alcohol-content", "allowed", "altitude", "anatel-rating", "bbfc-rating", "bfvc-rating", "bitrate-bps", "blocked", "bmukk-rating", "caption", "category-id", "catv-rating", "catvfr-rating", "cbfc-rating", "ccc-rating", "cce-rating", "channel-id", "channel-title", "chfilm-rating", "chvrs-rating", "cicf-rating", "cna-rating", "cnc-rating", "comment-count", "concurrent-viewers", "container", "content-details", "content-rating", "country-restriction", "creation-time", "csa-rating", "cscf-rating", "czfilm-rating", "default", "default-audio-language", "default-language", "definition", "description", "dimension", "dislike-count", "djctq-rating", "djctq-rating-reasons", "duration", "duration-ms", "editor-suggestions", "editor-suggestions-availability", "eefilm-rating", "egfilm-rating", "eirin-rating", "embed-html", "embeddable", "etag", "exception", "failure-reason", "favorite-count", "fcbm-rating", "fco-rating", "file-details", "file-details-availability", "file-name", "file-size", "file-type", "fmoc-rating", "fpb-rating", "fsk-rating", "grfilm-rating", "height", "high", "icaa-rating", "id", "ifco-rating", "ilfilm-rating", "incaa-rating", "kfcb-rating", "kijkwijzer-rating", "kind", "kmrb-rating", "latitude", "license", "licensed-content", "like-count", "live-broadcast-content", "live-streaming-details", "localized", "location", "location-description", "longitude", "lsf-rating", "maxres", "mccaa-rating", "mccyp-rating", "mda-rating", "medietilsynet-rating", "medium", "meku-rating", "mibac-rating", "moc-rating", "moctw-rating", "monetization-details", "mpaa-rating", "mtrcb-rating", "nbc-rating", "nbcpl-rating", "nfrc-rating", "nfvcb-rating", "nkclv-rating", "oflc-rating", "parts-processed", "parts-total", "pefilm-rating", "player", "privacy-status", "processing-details", "processing-errors", "processing-failure-reason", "processing-hints", "processing-issues-availability", "processing-progress", "processing-status", "processing-warnings", "project-details", "public-stats-viewable", "publish-at", "published-at", "rcnof-rating", "recording-date", "recording-details", "recording-location", "region-restriction", "rejection-reason", "relevant-topic-ids", "resorteviolencia-rating", "restricted", "rtc-rating", "rte-rating", "russia-rating", "scheduled-end-time", "scheduled-start-time", "skfilm-rating", "smais-rating", "smsa-rating", "snippet", "standard", "statistics", "status", "suggestions", "tag-suggestions-availability", "tags", "thumbnails", "thumbnails-availability", "time-left-ms", "title", "topic-details", "topic-ids", "tvpg-rating", "upload-status", "url", "video-game-rating", "view-count", "width", "yt-rating"]); + let suggestion = FieldCursor::did_you_mean(key, &vec!["acb-rating", "access", "active-live-chat-id", "actual-end-time", "actual-start-time", "agcom-rating", "age-gating", "alcohol-content", "allowed", "altitude", "anatel-rating", "bbfc-rating", "bfvc-rating", "bitrate-bps", "blocked", "bmukk-rating", "caption", "category-id", "catv-rating", "catvfr-rating", "cbfc-rating", "ccc-rating", "cce-rating", "channel-id", "channel-title", "chfilm-rating", "chvrs-rating", "cicf-rating", "cna-rating", "cnc-rating", "comment-count", "concurrent-viewers", "container", "content-details", "content-rating", "country-restriction", "creation-time", "csa-rating", "cscf-rating", "czfilm-rating", "default", "default-audio-language", "default-language", "definition", "description", "dimension", "dislike-count", "djctq-rating", "djctq-rating-reasons", "duration", "duration-ms", "ecbmct-rating", "editor-suggestions", "editor-suggestions-availability", "eefilm-rating", "egfilm-rating", "eirin-rating", "embed-html", "embeddable", "etag", "exception", "failure-reason", "favorite-count", "fcbm-rating", "fco-rating", "file-details", "file-details-availability", "file-name", "file-size", "file-type", "fmoc-rating", "fpb-rating", "fsk-rating", "grfilm-rating", "height", "high", "icaa-rating", "id", "ifco-rating", "ilfilm-rating", "incaa-rating", "kfcb-rating", "kijkwijzer-rating", "kind", "kmrb-rating", "latitude", "license", "licensed-content", "like-count", "live-broadcast-content", "live-streaming-details", "localized", "location", "location-description", "longitude", "lsf-rating", "maxres", "mccaa-rating", "mccyp-rating", "mda-rating", "medietilsynet-rating", "medium", "meku-rating", "mibac-rating", "moc-rating", "moctw-rating", "monetization-details", "mpaa-rating", "mtrcb-rating", "nbc-rating", "nbcpl-rating", "nfrc-rating", "nfvcb-rating", "nkclv-rating", "oflc-rating", "parts-processed", "parts-total", "pefilm-rating", "player", "privacy-status", "processing-details", "processing-errors", "processing-failure-reason", "processing-hints", "processing-issues-availability", "processing-progress", "processing-status", "processing-warnings", "project-details", "public-stats-viewable", "publish-at", "published-at", "rcnof-rating", "recording-date", "recording-details", "recording-location", "region-restriction", "rejection-reason", "relevant-topic-ids", "resorteviolencia-rating", "restricted", "rtc-rating", "rte-rating", "russia-rating", "scheduled-end-time", "scheduled-start-time", "skfilm-rating", "smais-rating", "smsa-rating", "snippet", "standard", "statistics", "status", "suggestions", "tag-suggestions-availability", "tags", "thumbnails", "thumbnails-availability", "time-left-ms", "title", "topic-details", "topic-ids", "tvpg-rating", "upload-status", "url", "video-game-rating", "view-count", "width", "yt-rating"]); err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string())))); None } @@ -5338,7 +5957,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Video = json::value::from_value(object).unwrap(); let mut call = self.hub.videos().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -5354,7 +5973,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -5368,7 +5987,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -5391,13 +6010,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _watermarks_set(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _watermarks_set(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -5411,8 +6030,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "target-channel-id" => Some(("targetChannelId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "position.corner-position" => Some(("position.cornerPosition", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -5434,7 +6053,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::InvideoBranding = json::value::from_value(object).unwrap(); let mut call = self.hub.watermarks().set(request, opt.value_of("channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -5450,7 +6069,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -5459,7 +6078,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } } - let vals = opt.values_of("mode").unwrap(); + let vals = opt.values_of("mode").unwrap().collect::>(); let protocol = calltype_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err); let mut input_file = input_file_from_opts(vals[1], err); let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err); @@ -5467,7 +6086,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -5483,10 +6102,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _watermarks_unset(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _watermarks_unset(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.watermarks().unset(opt.value_of("channel-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -5502,7 +6121,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -5516,7 +6135,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -5661,6 +6280,17 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, + ("fan-funding-events", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._fan_funding_events_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("fan-funding-events".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("guide-categories", Some(opt)) => { match opt.subcommand() { ("list", Some(opt)) => { @@ -5699,9 +6329,6 @@ impl<'n, 'a> Engine<'n, 'a> { ("bind", Some(opt)) => { call_result = self._live_broadcasts_bind(opt, dry_run, &mut err); }, - ("bind-direct", Some(opt)) => { - call_result = self._live_broadcasts_bind_direct(opt, dry_run, &mut err); - }, ("control", Some(opt)) => { call_result = self._live_broadcasts_control(opt, dry_run, &mut err); }, @@ -5726,6 +6353,54 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, + ("live-chat-bans", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._live_chat_bans_delete(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._live_chat_bans_insert(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("live-chat-bans".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("live-chat-messages", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._live_chat_messages_delete(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._live_chat_messages_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._live_chat_messages_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("live-chat-messages".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, + ("live-chat-moderators", Some(opt)) => { + match opt.subcommand() { + ("delete", Some(opt)) => { + call_result = self._live_chat_moderators_delete(opt, dry_run, &mut err); + }, + ("insert", Some(opt)) => { + call_result = self._live_chat_moderators_insert(opt, dry_run, &mut err); + }, + ("list", Some(opt)) => { + call_result = self._live_chat_moderators_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("live-chat-moderators".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("live-streams", Some(opt)) => { match opt.subcommand() { ("delete", Some(opt)) => { @@ -5797,6 +6472,17 @@ impl<'n, 'a> Engine<'n, 'a> { } } }, + ("sponsors", Some(opt)) => { + match opt.subcommand() { + ("list", Some(opt)) => { + call_result = self._sponsors_list(opt, dry_run, &mut err); + }, + _ => { + err.issues.push(CLIError::MissingMethodError("sponsors".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, ("subscriptions", Some(opt)) => { match opt.subcommand() { ("delete", Some(opt)) => { @@ -5907,14 +6593,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "youtube3-secret.json", + match cmn::application_secret_from_directory(&config_dir, "youtube3-secret.json", "{ \"installed\": { \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\", @@ -5948,7 +6634,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -5988,7 +6674,7 @@ fn main() { let upload_value_names = ["mode", "file"]; let arg_data = [ ("activities", "methods: 'insert' and 'list'", vec![ - ("insert", + ("insert", Some(r##"Posts a bulletin for a specific channel. (The user submitting the request must be authorized to act on the channel's behalf.) Note: Even though an activity resource can contain information about actions like a user rating a video or marking a video as a favorite, you need to use other API methods to generate those activity resources. For example, you would use the API's videos.rate() method to rate a video and the playlistItems.insert() method to mark a video as a favorite."##), @@ -6012,7 +6698,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of channel activity events that match the request criteria. For example, you can retrieve events associated with a particular channel, events associated with the user's subscriptions and Google+ friends, or the YouTube home page feed, which is customized for each user."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/activities_list", vec![ @@ -6039,7 +6725,7 @@ fn main() { ]), ("captions", "methods: 'delete', 'download', 'insert', 'list' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a specified caption track."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/captions_delete", vec![ @@ -6055,7 +6741,7 @@ fn main() { Some(false), Some(true)), ]), - ("download", + ("download", Some(r##"Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/captions_download", vec![ @@ -6077,7 +6763,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Uploads a caption track."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/captions_insert", vec![ @@ -6105,7 +6791,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of caption tracks that are associated with a specified video. Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/captions_list", vec![ @@ -6133,7 +6819,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/captions_update", vec![ @@ -6164,7 +6850,7 @@ fn main() { ]), ("channel-banners", "methods: 'insert'", vec![ - ("insert", + ("insert", Some(r##"Uploads a channel banner image to YouTube. This method represents the first two steps in a three-step process to update the banner image for a channel: - Call the channelBanners.insert method to upload the binary image data to YouTube. The image must have a 16:9 aspect ratio and be at least 2120x1192 pixels. @@ -6199,7 +6885,7 @@ fn main() { ]), ("channel-sections", "methods: 'delete', 'insert', 'list' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a channelSection."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/channel-sections_delete", vec![ @@ -6215,7 +6901,7 @@ fn main() { Some(false), Some(true)), ]), - ("insert", + ("insert", Some(r##"Adds a channelSection for the authenticated user's channel."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/channel-sections_insert", vec![ @@ -6237,7 +6923,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns channelSection resources that match the API request criteria."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/channel-sections_list", vec![ @@ -6261,7 +6947,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Update a channelSection."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/channel-sections_update", vec![ @@ -6286,7 +6972,7 @@ fn main() { ]), ("channels", "methods: 'list' and 'update'", vec![ - ("list", + ("list", Some(r##"Returns a collection of zero or more channel resources that match the request criteria."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/channels_list", vec![ @@ -6310,7 +6996,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a channel's metadata. Note that this method currently only supports updates to the channel resource's brandingSettings and invideoPromotion objects and their child properties."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/channels_update", vec![ @@ -6335,7 +7021,7 @@ fn main() { ]), ("comment-threads", "methods: 'insert', 'list' and 'update'", vec![ - ("insert", + ("insert", Some(r##"Creates a new top-level comment. To add a reply to an existing comment, use the comments.insert method instead."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/comment-threads_insert", vec![ @@ -6357,7 +7043,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of comment threads that match the API request parameters."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/comment-threads_list", vec![ @@ -6379,7 +7065,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Modifies the top-level comment in a comment thread."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/comment-threads_update", vec![ @@ -6404,7 +7090,7 @@ fn main() { ]), ("comments", "methods: 'delete', 'insert', 'list', 'mark-as-spam', 'set-moderation-status' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a comment."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/comments_delete", vec![ @@ -6420,7 +7106,7 @@ fn main() { Some(false), Some(true)), ]), - ("insert", + ("insert", Some(r##"Creates a reply to an existing comment. Note: To create a top-level comment, use the commentThreads.insert method."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/comments_insert", vec![ @@ -6442,7 +7128,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of comments that match the API request parameters."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/comments_list", vec![ @@ -6464,7 +7150,7 @@ fn main() { Some(false), Some(false)), ]), - ("mark-as-spam", + ("mark-as-spam", Some(r##"Expresses the caller's opinion that one or more comments should be flagged as spam."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/comments_mark-as-spam", vec![ @@ -6480,7 +7166,7 @@ fn main() { Some(false), Some(true)), ]), - ("set-moderation-status", + ("set-moderation-status", Some(r##"Sets the moderation status of one or more comments. The API request must be authorized by the owner of the channel or video associated with the comments."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/comments_set-moderation-status", vec![ @@ -6502,7 +7188,7 @@ fn main() { Some(false), Some(true)), ]), - ("update", + ("update", Some(r##"Modifies a comment."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/comments_update", vec![ @@ -6526,8 +7212,33 @@ fn main() { ]), ]), + ("fan-funding-events", "methods: 'list'", vec![ + ("list", + Some(r##"Lists fan funding events for a channel."##), + "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/fan-funding-events_list", + vec![ + (Some(r##"part"##), + None, + Some(r##"The part parameter specifies the fanFundingEvent resource parts that the API response will include. Supported values are id and snippet."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("guide-categories", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Returns a list of categories that can be associated with YouTube channels."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/guide-categories_list", vec![ @@ -6552,7 +7263,7 @@ fn main() { ]), ("i18n-languages", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Returns a list of application languages that the YouTube website supports."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/i18n-languages_list", vec![ @@ -6577,7 +7288,7 @@ fn main() { ]), ("i18n-regions", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Returns a list of content regions that the YouTube website supports."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/i18n-regions_list", vec![ @@ -6601,8 +7312,8 @@ fn main() { ]), ]), - ("live-broadcasts", "methods: 'bind', 'bind-direct', 'control', 'delete', 'insert', 'list', 'transition' and 'update'", vec![ - ("bind", + ("live-broadcasts", "methods: 'bind', 'control', 'delete', 'insert', 'list', 'transition' and 'update'", vec![ + ("bind", Some(r##"Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream, though a video stream may be bound to more than one broadcast."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-broadcasts_bind", vec![ @@ -6630,35 +7341,7 @@ fn main() { Some(false), Some(false)), ]), - ("bind-direct", - Some(r##"Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream, though a video stream may be bound to more than one broadcast."##), - "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-broadcasts_bind-direct", - vec![ - (Some(r##"id"##), - None, - Some(r##"The id parameter specifies the unique ID of the broadcast that is being bound to a video stream."##), - Some(true), - Some(false)), - - (Some(r##"part"##), - None, - Some(r##"The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status."##), - Some(true), - Some(false)), - - (Some(r##"v"##), - Some(r##"p"##), - Some(r##"Set various optional parameters, matching the key=value form"##), - Some(false), - Some(true)), - - (Some(r##"out"##), - Some(r##"o"##), - Some(r##"Specify the file into which to write the program's output"##), - Some(false), - Some(false)), - ]), - ("control", + ("control", Some(r##"Controls the settings for a slate that can be displayed in the broadcast stream."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-broadcasts_control", vec![ @@ -6686,7 +7369,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a broadcast."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-broadcasts_delete", vec![ @@ -6702,7 +7385,7 @@ fn main() { Some(false), Some(true)), ]), - ("insert", + ("insert", Some(r##"Creates a broadcast."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-broadcasts_insert", vec![ @@ -6724,7 +7407,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of YouTube broadcasts that match the API request parameters."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-broadcasts_list", vec![ @@ -6746,7 +7429,7 @@ fn main() { Some(false), Some(false)), ]), - ("transition", + ("transition", Some(r##"Changes the status of a YouTube live broadcast and initiates any processes associated with the new status. For example, when you transition a broadcast's status to testing, YouTube starts to transmit video to that broadcast's monitor stream. Before calling this method, you should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-broadcasts_transition", vec![ @@ -6780,7 +7463,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a broadcast. For example, you could modify the broadcast settings defined in the liveBroadcast resource's contentDetails object."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-broadcasts_update", vec![ @@ -6804,8 +7487,187 @@ fn main() { ]), ]), + ("live-chat-bans", "methods: 'delete' and 'insert'", vec![ + ("delete", + Some(r##"Removes a chat ban."##), + "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-chat-bans_delete", + vec![ + (Some(r##"id"##), + None, + Some(r##"The id parameter identifies the chat ban to remove. The value uniquely identifies both the ban and the chat."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("insert", + Some(r##"Adds a new ban to the chat."##), + "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-chat-bans_insert", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("live-chat-messages", "methods: 'delete', 'insert' and 'list'", vec![ + ("delete", + Some(r##"Deletes a chat message."##), + "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-chat-messages_delete", + vec![ + (Some(r##"id"##), + None, + Some(r##"The id parameter specifies the YouTube chat message ID of the resource that is being deleted."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("insert", + Some(r##"Adds a message to a live chat."##), + "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-chat-messages_insert", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists live chat messages for a specific chat."##), + "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-chat-messages_list", + vec![ + (Some(r##"live-chat-id"##), + None, + Some(r##"The liveChatId parameter specifies the ID of the chat whose messages will be returned."##), + Some(true), + Some(false)), + + (Some(r##"part"##), + None, + Some(r##"The part parameter specifies the liveChatComment resource parts that the API response will include. Supported values are id and snippet."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + + ("live-chat-moderators", "methods: 'delete', 'insert' and 'list'", vec![ + ("delete", + Some(r##"Removes a chat moderator."##), + "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-chat-moderators_delete", + vec![ + (Some(r##"id"##), + None, + Some(r##"The id parameter identifies the chat moderator to remove. The value uniquely identifies both the moderator and the chat."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + ]), + ("insert", + Some(r##"Adds a new moderator for the chat."##), + "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-chat-moderators_insert", + vec![ + (Some(r##"kv"##), + Some(r##"r"##), + Some(r##"Set various fields of the request structure, matching the key=value form"##), + Some(true), + Some(true)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ("list", + Some(r##"Lists moderators for a live chat."##), + "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-chat-moderators_list", + vec![ + (Some(r##"live-chat-id"##), + None, + Some(r##"The liveChatId parameter specifies the YouTube live chat for which the API should return moderators."##), + Some(true), + Some(false)), + + (Some(r##"part"##), + None, + Some(r##"The part parameter specifies the liveChatModerator resource parts that the API response will include. Supported values are id and snippet."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("live-streams", "methods: 'delete', 'insert', 'list' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a video stream."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-streams_delete", vec![ @@ -6821,7 +7683,7 @@ fn main() { Some(false), Some(true)), ]), - ("insert", + ("insert", Some(r##"Creates a video stream. The stream enables you to send your video to YouTube, which can then broadcast the video to your audience."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-streams_insert", vec![ @@ -6843,7 +7705,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of video streams that match the API request parameters."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-streams_list", vec![ @@ -6865,7 +7727,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Updates a video stream. If the properties that you want to change cannot be updated, then you need to create a new stream with the proper settings."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/live-streams_update", vec![ @@ -6890,7 +7752,7 @@ fn main() { ]), ("playlist-items", "methods: 'delete', 'insert', 'list' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a playlist item."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/playlist-items_delete", vec![ @@ -6906,7 +7768,7 @@ fn main() { Some(false), Some(true)), ]), - ("insert", + ("insert", Some(r##"Adds a resource to a playlist."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/playlist-items_insert", vec![ @@ -6928,7 +7790,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/playlist-items_list", vec![ @@ -6952,7 +7814,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Modifies a playlist item. For example, you could update the item's position in the playlist."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/playlist-items_update", vec![ @@ -6977,7 +7839,7 @@ fn main() { ]), ("playlists", "methods: 'delete', 'insert', 'list' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a playlist."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/playlists_delete", vec![ @@ -6993,7 +7855,7 @@ fn main() { Some(false), Some(true)), ]), - ("insert", + ("insert", Some(r##"Creates a playlist."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/playlists_insert", vec![ @@ -7015,7 +7877,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a collection of playlists that match the API request parameters. For example, you can retrieve all playlists that the authenticated user owns, or you can retrieve one or more playlists by their unique IDs."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/playlists_list", vec![ @@ -7039,7 +7901,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Modifies a playlist. For example, you could change a playlist's title, description, or privacy status."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/playlists_update", vec![ @@ -7064,7 +7926,7 @@ fn main() { ]), ("search", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching video, channel, and playlist resources, but you can also configure queries to only retrieve a specific type of resource."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/search_list", vec![ @@ -7088,8 +7950,33 @@ fn main() { ]), ]), + ("sponsors", "methods: 'list'", vec![ + ("list", + Some(r##"Lists sponsors for a channel."##), + "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/sponsors_list", + vec![ + (Some(r##"part"##), + None, + Some(r##"The part parameter specifies the sponsor resource parts that the API response will include. Supported values are id and snippet."##), + Some(true), + Some(false)), + + (Some(r##"v"##), + Some(r##"p"##), + Some(r##"Set various optional parameters, matching the key=value form"##), + Some(false), + Some(true)), + + (Some(r##"out"##), + Some(r##"o"##), + Some(r##"Specify the file into which to write the program's output"##), + Some(false), + Some(false)), + ]), + ]), + ("subscriptions", "methods: 'delete', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Deletes a subscription."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/subscriptions_delete", vec![ @@ -7105,7 +7992,7 @@ fn main() { Some(false), Some(true)), ]), - ("insert", + ("insert", Some(r##"Adds a subscription for the authenticated user's channel."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/subscriptions_insert", vec![ @@ -7127,7 +8014,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns subscription resources that match the API request criteria."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/subscriptions_list", vec![ @@ -7154,7 +8041,7 @@ fn main() { ]), ("thumbnails", "methods: 'set'", vec![ - ("set", + ("set", Some(r##"Uploads a custom video thumbnail to YouTube and sets it for a video."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/thumbnails_set", vec![ @@ -7185,7 +8072,7 @@ fn main() { ]), ("video-abuse-report-reasons", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Returns a list of abuse reasons that can be used for reporting abusive videos."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/video-abuse-report-reasons_list", vec![ @@ -7210,7 +8097,7 @@ fn main() { ]), ("video-categories", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Returns a list of categories that can be associated with YouTube videos."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/video-categories_list", vec![ @@ -7235,7 +8122,7 @@ fn main() { ]), ("videos", "methods: 'delete', 'get-rating', 'insert', 'list', 'rate', 'report-abuse' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a YouTube video."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/videos_delete", vec![ @@ -7251,7 +8138,7 @@ fn main() { Some(false), Some(true)), ]), - ("get-rating", + ("get-rating", Some(r##"Retrieves the ratings that the authorized user gave to a list of specified videos."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/videos_get-rating", vec![ @@ -7273,7 +8160,7 @@ fn main() { Some(false), Some(false)), ]), - ("insert", + ("insert", Some(r##"Uploads a video to YouTube and optionally sets the video's metadata."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/videos_insert", vec![ @@ -7301,7 +8188,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a list of videos that match the API request parameters."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/videos_list", vec![ @@ -7325,7 +8212,7 @@ fn main() { Some(false), Some(false)), ]), - ("rate", + ("rate", Some(r##"Add a like or dislike rating to a video or remove a rating from a video."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/videos_rate", vec![ @@ -7347,7 +8234,7 @@ fn main() { Some(false), Some(true)), ]), - ("report-abuse", + ("report-abuse", Some(r##"Report abuse for a video."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/videos_report-abuse", vec![ @@ -7363,7 +8250,7 @@ fn main() { Some(false), Some(true)), ]), - ("update", + ("update", Some(r##"Updates a video's metadata."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/videos_update", vec![ @@ -7388,7 +8275,7 @@ fn main() { ]), ("watermarks", "methods: 'set' and 'unset'", vec![ - ("set", + ("set", Some(r##"Uploads a watermark image to YouTube and sets it for a channel."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/watermarks_set", vec![ @@ -7416,7 +8303,7 @@ fn main() { Some(false), Some(true)), ]), - ("unset", + ("unset", Some(r##"Deletes a channel's watermark image."##), "Details at http://byron.github.io/google-apis-rs/google_youtube3_cli/watermarks_unset", vec![ @@ -7438,7 +8325,7 @@ fn main() { let mut app = App::new("youtube3") .author("Sebastian Thiel ") - .version("0.3.2+20151012") + .version("0.3.3+20160111") .about("Programmatic access to YouTube features.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_youtube3_cli") .arg(Arg::with_name("url") @@ -7462,7 +8349,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -7473,7 +8360,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/youtube3/LICENSE.md b/gen/youtube3/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/youtube3/LICENSE.md +++ b/gen/youtube3/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/youtube3/README.md b/gen/youtube3/README.md index 781564e20a..4af18d2ae8 100644 --- a/gen/youtube3/README.md +++ b/gen/youtube3/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-youtube3` library allows access to all features of the *Google YouTube* service. -This documentation was generated from *YouTube* crate version *0.1.10+20151012*, where *20151012* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *YouTube* crate version *0.1.11+20160111*, where *20160111* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *YouTube* *v3* API can be found at the [official documentation site](https://developers.google.com/youtube/v3). @@ -27,6 +27,8 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [*insert*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CommentThreadInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CommentThreadListCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CommentThreadUpdateCall.html) * [comments](http://byron.github.io/google-apis-rs/google_youtube3/struct.Comment.html) * [*delete*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CommentDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CommentInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CommentListCall.html), [*mark as spam*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CommentMarkAsSpamCall.html), [*set moderation status*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CommentSetModerationStatuCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CommentUpdateCall.html) +* [fan funding events](http://byron.github.io/google-apis-rs/google_youtube3/struct.FanFundingEvent.html) + * [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.FanFundingEventListCall.html) * [guide categories](http://byron.github.io/google-apis-rs/google_youtube3/struct.GuideCategory.html) * [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.GuideCategoryListCall.html) * [i18n languages](http://byron.github.io/google-apis-rs/google_youtube3/struct.I18nLanguage.html) @@ -34,7 +36,13 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [i18n regions](http://byron.github.io/google-apis-rs/google_youtube3/struct.I18nRegion.html) * [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.I18nRegionListCall.html) * [live broadcasts](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcast.html) - * [*bind*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastBindCall.html), [*bind_direct*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastBindDirectCall.html), [*control*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastControlCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastListCall.html), [*transition*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastTransitionCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastUpdateCall.html) + * [*bind*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastBindCall.html), [*control*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastControlCall.html), [*delete*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastListCall.html), [*transition*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastTransitionCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveBroadcastUpdateCall.html) +* [live chat bans](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatBan.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatBanDeleteCall.html) and [*insert*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatBanInsertCall.html) +* [live chat messages](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatMessage.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatMessageDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatMessageInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatMessageListCall.html) +* [live chat moderators](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatModerator.html) + * [*delete*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatModeratorDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatModeratorInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveChatModeratorListCall.html) * [live streams](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveStream.html) * [*delete*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveStreamDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveStreamInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveStreamListCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_youtube3/struct.LiveStreamUpdateCall.html) * [playlist items](http://byron.github.io/google-apis-rs/google_youtube3/struct.PlaylistItem.html) @@ -43,6 +51,8 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g * [*delete*](http://byron.github.io/google-apis-rs/google_youtube3/struct.PlaylistDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_youtube3/struct.PlaylistInsertCall.html), [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.PlaylistListCall.html) and [*update*](http://byron.github.io/google-apis-rs/google_youtube3/struct.PlaylistUpdateCall.html) * search * [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.SearchListCall.html) +* [sponsors](http://byron.github.io/google-apis-rs/google_youtube3/struct.Sponsor.html) + * [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.SponsorListCall.html) * [subscriptions](http://byron.github.io/google-apis-rs/google_youtube3/struct.Subscription.html) * [*delete*](http://byron.github.io/google-apis-rs/google_youtube3/struct.SubscriptionDeleteCall.html), [*insert*](http://byron.github.io/google-apis-rs/google_youtube3/struct.SubscriptionInsertCall.html) and [*list*](http://byron.github.io/google-apis-rs/google_youtube3/struct.SubscriptionListCall.html) * [thumbnails](http://byron.github.io/google-apis-rs/google_youtube3/struct.Thumbnail.html) @@ -59,12 +69,12 @@ Handle the following *Resources* with ease from the central [hub](http://byron.g Upload supported by ... -* [*set watermarks*](http://byron.github.io/google-apis-rs/google_youtube3/struct.WatermarkSetCall.html) -* [*insert channel banners*](http://byron.github.io/google-apis-rs/google_youtube3/struct.ChannelBannerInsertCall.html) * [*set thumbnails*](http://byron.github.io/google-apis-rs/google_youtube3/struct.ThumbnailSetCall.html) * [*insert captions*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CaptionInsertCall.html) -* [*update captions*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CaptionUpdateCall.html) * [*insert videos*](http://byron.github.io/google-apis-rs/google_youtube3/struct.VideoInsertCall.html) +* [*set watermarks*](http://byron.github.io/google-apis-rs/google_youtube3/struct.WatermarkSetCall.html) +* [*insert channel banners*](http://byron.github.io/google-apis-rs/google_youtube3/struct.ChannelBannerInsertCall.html) +* [*update captions*](http://byron.github.io/google-apis-rs/google_youtube3/struct.CaptionUpdateCall.html) Download supported by ... @@ -104,14 +114,13 @@ let r = hub.resource().activity(...).doit() Or specifically ... ```ignore -let r = hub.live_broadcasts().control(...).doit() -let r = hub.live_broadcasts().insert(...).doit() -let r = hub.live_broadcasts().bind_direct(...).doit() -let r = hub.live_broadcasts().list(...).doit() -let r = hub.live_broadcasts().transition(...).doit() -let r = hub.live_broadcasts().update(...).doit() -let r = hub.live_broadcasts().delete(...).doit() -let r = hub.live_broadcasts().bind(...).doit() +let r = hub.videos().rate(...).doit() +let r = hub.videos().report_abuse(...).doit() +let r = hub.videos().get_rating(...).doit() +let r = hub.videos().list(...).doit() +let r = hub.videos().insert(...).doit() +let r = hub.videos().update(...).doit() +let r = hub.videos().delete(...).doit() ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -156,14 +165,17 @@ let mut hub = YouTube::new(hyper::Client::new(), 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 ! -let result = hub.live_broadcasts().list("part") - .page_token("sit") - .on_behalf_of_content_owner_channel("Stet") - .on_behalf_of_content_owner("sed") - .mine(false) - .max_results(83) - .id("kasd") - .broadcast_status("accusam") +let result = hub.videos().list("part") + .video_category_id("sit") + .region_code("Stet") + .page_token("sed") + .on_behalf_of_content_owner("et") + .my_rating("dolores") + .max_results(38) + .locale("accusam") + .id("takimata") + .hl("justo") + .chart("amet.") .doit(); match result { diff --git a/gen/youtube3/cargo.toml b/gen/youtube3/cargo.toml index c88f9c4a60..237c5dc67d 100644 --- a/gen/youtube3/cargo.toml +++ b/gen/youtube3/cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtube3" -version = "0.1.10+20151012" +version = "0.1.11+20160111" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtube3" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/youtube3/src/cmn.rs b/gen/youtube3/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/youtube3/src/cmn.rs +++ b/gen/youtube3/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/youtube3/src/lib.rs b/gen/youtube3/src/lib.rs index dd11498bbf..38e490c441 100644 --- a/gen/youtube3/src/lib.rs +++ b/gen/youtube3/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *YouTube* crate version *0.1.10+20151012*, where *20151012* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *YouTube* crate version *0.1.11+20160111*, where *20160111* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *YouTube* *v3* API can be found at the //! [official documentation site](https://developers.google.com/youtube/v3). @@ -25,6 +25,8 @@ //! * [*insert*](struct.CommentThreadInsertCall.html), [*list*](struct.CommentThreadListCall.html) and [*update*](struct.CommentThreadUpdateCall.html) //! * [comments](struct.Comment.html) //! * [*delete*](struct.CommentDeleteCall.html), [*insert*](struct.CommentInsertCall.html), [*list*](struct.CommentListCall.html), [*mark as spam*](struct.CommentMarkAsSpamCall.html), [*set moderation status*](struct.CommentSetModerationStatuCall.html) and [*update*](struct.CommentUpdateCall.html) +//! * [fan funding events](struct.FanFundingEvent.html) +//! * [*list*](struct.FanFundingEventListCall.html) //! * [guide categories](struct.GuideCategory.html) //! * [*list*](struct.GuideCategoryListCall.html) //! * [i18n languages](struct.I18nLanguage.html) @@ -32,7 +34,13 @@ //! * [i18n regions](struct.I18nRegion.html) //! * [*list*](struct.I18nRegionListCall.html) //! * [live broadcasts](struct.LiveBroadcast.html) -//! * [*bind*](struct.LiveBroadcastBindCall.html), [*bind_direct*](struct.LiveBroadcastBindDirectCall.html), [*control*](struct.LiveBroadcastControlCall.html), [*delete*](struct.LiveBroadcastDeleteCall.html), [*insert*](struct.LiveBroadcastInsertCall.html), [*list*](struct.LiveBroadcastListCall.html), [*transition*](struct.LiveBroadcastTransitionCall.html) and [*update*](struct.LiveBroadcastUpdateCall.html) +//! * [*bind*](struct.LiveBroadcastBindCall.html), [*control*](struct.LiveBroadcastControlCall.html), [*delete*](struct.LiveBroadcastDeleteCall.html), [*insert*](struct.LiveBroadcastInsertCall.html), [*list*](struct.LiveBroadcastListCall.html), [*transition*](struct.LiveBroadcastTransitionCall.html) and [*update*](struct.LiveBroadcastUpdateCall.html) +//! * [live chat bans](struct.LiveChatBan.html) +//! * [*delete*](struct.LiveChatBanDeleteCall.html) and [*insert*](struct.LiveChatBanInsertCall.html) +//! * [live chat messages](struct.LiveChatMessage.html) +//! * [*delete*](struct.LiveChatMessageDeleteCall.html), [*insert*](struct.LiveChatMessageInsertCall.html) and [*list*](struct.LiveChatMessageListCall.html) +//! * [live chat moderators](struct.LiveChatModerator.html) +//! * [*delete*](struct.LiveChatModeratorDeleteCall.html), [*insert*](struct.LiveChatModeratorInsertCall.html) and [*list*](struct.LiveChatModeratorListCall.html) //! * [live streams](struct.LiveStream.html) //! * [*delete*](struct.LiveStreamDeleteCall.html), [*insert*](struct.LiveStreamInsertCall.html), [*list*](struct.LiveStreamListCall.html) and [*update*](struct.LiveStreamUpdateCall.html) //! * [playlist items](struct.PlaylistItem.html) @@ -41,6 +49,8 @@ //! * [*delete*](struct.PlaylistDeleteCall.html), [*insert*](struct.PlaylistInsertCall.html), [*list*](struct.PlaylistListCall.html) and [*update*](struct.PlaylistUpdateCall.html) //! * search //! * [*list*](struct.SearchListCall.html) +//! * [sponsors](struct.Sponsor.html) +//! * [*list*](struct.SponsorListCall.html) //! * [subscriptions](struct.Subscription.html) //! * [*delete*](struct.SubscriptionDeleteCall.html), [*insert*](struct.SubscriptionInsertCall.html) and [*list*](struct.SubscriptionListCall.html) //! * [thumbnails](struct.Thumbnail.html) @@ -57,12 +67,12 @@ //! //! Upload supported by ... //! -//! * [*set watermarks*](struct.WatermarkSetCall.html) -//! * [*insert channel banners*](struct.ChannelBannerInsertCall.html) //! * [*set thumbnails*](struct.ThumbnailSetCall.html) //! * [*insert captions*](struct.CaptionInsertCall.html) -//! * [*update captions*](struct.CaptionUpdateCall.html) //! * [*insert videos*](struct.VideoInsertCall.html) +//! * [*set watermarks*](struct.WatermarkSetCall.html) +//! * [*insert channel banners*](struct.ChannelBannerInsertCall.html) +//! * [*update captions*](struct.CaptionUpdateCall.html) //! //! Download supported by ... //! @@ -104,14 +114,13 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.live_broadcasts().control(...).doit() -//! let r = hub.live_broadcasts().insert(...).doit() -//! let r = hub.live_broadcasts().bind_direct(...).doit() -//! let r = hub.live_broadcasts().list(...).doit() -//! let r = hub.live_broadcasts().transition(...).doit() -//! let r = hub.live_broadcasts().update(...).doit() -//! let r = hub.live_broadcasts().delete(...).doit() -//! let r = hub.live_broadcasts().bind(...).doit() +//! let r = hub.videos().rate(...).doit() +//! let r = hub.videos().report_abuse(...).doit() +//! let r = hub.videos().get_rating(...).doit() +//! let r = hub.videos().list(...).doit() +//! let r = hub.videos().insert(...).doit() +//! let r = hub.videos().update(...).doit() +//! let r = hub.videos().delete(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -157,14 +166,17 @@ //! // 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 ! -//! let result = hub.live_broadcasts().list("part") -//! .page_token("Lorem") -//! .on_behalf_of_content_owner_channel("dolor") -//! .on_behalf_of_content_owner("vero") -//! .mine(false) -//! .max_results(93) -//! .id("dolores") -//! .broadcast_status("consetetur") +//! let result = hub.videos().list("part") +//! .video_category_id("sit") +//! .region_code("amet") +//! .page_token("eirmod") +//! .on_behalf_of_content_owner("sanctus") +//! .my_rating("Lorem") +//! .max_results(100) +//! .locale("diam") +//! .id("eirmod") +//! .hl("sadipscing") +//! .chart("Lorem") //! .doit(); //! //! match result { diff --git a/gen/youtube3/src/lib.rs.in b/gen/youtube3/src/lib.rs.in index 1a39d2d9c7..727ab2f20b 100644 --- a/gen/youtube3/src/lib.rs.in +++ b/gen/youtube3/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -110,14 +111,17 @@ impl Default for Scope { /// // 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 ! -/// let result = hub.live_broadcasts().list("part") -/// .page_token("justo") -/// .on_behalf_of_content_owner_channel("amet.") -/// .on_behalf_of_content_owner("erat") -/// .mine(true) -/// .max_results(92) -/// .id("nonumy") -/// .broadcast_status("dolores") +/// let result = hub.videos().list("part") +/// .video_category_id("labore") +/// .region_code("sea") +/// .page_token("nonumy") +/// .on_behalf_of_content_owner("dolores") +/// .my_rating("gubergren") +/// .max_results(6) +/// .locale("aliquyam") +/// .id("ea") +/// .hl("no") +/// .chart("justo") /// .doit(); /// /// match result { @@ -153,7 +157,7 @@ impl<'a, C, A> YouTube YouTube { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -178,6 +182,9 @@ impl<'a, C, A> YouTube pub fn comments(&'a self) -> CommentMethods<'a, C, A> { CommentMethods { hub: &self } } + pub fn fan_funding_events(&'a self) -> FanFundingEventMethods<'a, C, A> { + FanFundingEventMethods { hub: &self } + } pub fn guide_categories(&'a self) -> GuideCategoryMethods<'a, C, A> { GuideCategoryMethods { hub: &self } } @@ -190,6 +197,15 @@ impl<'a, C, A> YouTube pub fn live_broadcasts(&'a self) -> LiveBroadcastMethods<'a, C, A> { LiveBroadcastMethods { hub: &self } } + pub fn live_chat_bans(&'a self) -> LiveChatBanMethods<'a, C, A> { + LiveChatBanMethods { hub: &self } + } + pub fn live_chat_messages(&'a self) -> LiveChatMessageMethods<'a, C, A> { + LiveChatMessageMethods { hub: &self } + } + pub fn live_chat_moderators(&'a self) -> LiveChatModeratorMethods<'a, C, A> { + LiveChatModeratorMethods { hub: &self } + } pub fn live_streams(&'a self) -> LiveStreamMethods<'a, C, A> { LiveStreamMethods { hub: &self } } @@ -202,6 +218,9 @@ impl<'a, C, A> YouTube pub fn search(&'a self) -> SearchMethods<'a, C, A> { SearchMethods { hub: &self } } + pub fn sponsors(&'a self) -> SponsorMethods<'a, C, A> { + SponsorMethods { hub: &self } + } pub fn subscriptions(&'a self) -> SubscriptionMethods<'a, C, A> { SubscriptionMethods { hub: &self } } @@ -222,7 +241,7 @@ impl<'a, C, A> YouTube } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -295,6 +314,49 @@ impl ToParts for SubscriptionListResponse { } } +/// Describes original video file properties, including technical details about audio and video streams, but also metadata information like content length, digitization time, or geotagging information. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct VideoFileDetails { + /// The uploaded video file's combined (video and audio) bitrate in bits per second. + #[serde(rename="bitrateBps")] + pub bitrate_bps: Option, + /// The uploaded video file's container format. + pub container: Option, + /// Geographic coordinates that identify the place where the uploaded video was recorded. Coordinates are defined using WGS 84. + #[serde(rename="recordingLocation")] + pub recording_location: Option, + /// The uploaded file's type as detected by YouTube's video processing engine. Currently, YouTube only processes video files, but this field is present whether a video file or another type of file was uploaded. + #[serde(rename="fileType")] + pub file_type: Option, + /// The date and time when the uploaded video file was created. The value is specified in ISO 8601 format. Currently, the following ISO 8601 formats are supported: + /// - Date only: YYYY-MM-DD + /// - Naive time: YYYY-MM-DDTHH:MM:SS + /// - Time with timezone: YYYY-MM-DDTHH:MM:SS+HH:MM + #[serde(rename="creationTime")] + pub creation_time: Option, + /// The length of the uploaded video in milliseconds. + #[serde(rename="durationMs")] + pub duration_ms: Option, + /// The uploaded file's name. This field is present whether a video file or another type of file was uploaded. + #[serde(rename="fileName")] + pub file_name: Option, + /// The uploaded file's size in bytes. This field is present whether a video file or another type of file was uploaded. + #[serde(rename="fileSize")] + pub file_size: Option, + /// A list of video streams contained in the uploaded video file. Each item in the list contains detailed metadata about a video stream. + #[serde(rename="videoStreams")] + pub video_streams: Option>, + /// A list of audio streams contained in the uploaded video file. Each item in the list contains detailed metadata about an audio stream. + #[serde(rename="audioStreams")] + pub audio_streams: Option>, +} + +impl Part for VideoFileDetails {} + + /// Basic details about a playlist, including title, description and thumbnails. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -379,6 +441,26 @@ pub struct ThumbnailSetResponse { impl ResponseResult for ThumbnailSetResponse {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SponsorSnippet { + /// Details about the sponsor. + #[serde(rename="sponsorDetails")] + pub sponsor_details: Option, + /// The id of the channel being sponsored. + #[serde(rename="channelId")] + pub channel_id: Option, + /// The date and time when the user became a sponsor. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. + #[serde(rename="sponsorSince")] + pub sponsor_since: Option, +} + +impl Part for SponsorSnippet {} + + /// Branding properties for the channel view. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -606,65 +688,58 @@ impl ToParts for I18nRegionListResponse { } } -/// There is no detailed description. +/// A fanFundingEvent resource represents a fan funding event on a YouTube channel. Fan funding events occur when a user gives one-time monetary support to the channel owner. /// /// # Activities /// /// This type is used in activities, which are methods you may call on this type or where this type is involved in. /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// -/// * [list live streams](struct.LiveStreamListCall.html) (response) +/// * [list fan funding events](struct.FanFundingEventListCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LiveStreamListResponse { - /// Serialized EventId of the request which produced this response. - #[serde(rename="eventId")] - pub event_id: Option, - /// The token that can be used as the value of the pageToken parameter to retrieve the next page in the result set. - #[serde(rename="nextPageToken")] - pub next_page_token: Option, - /// Identifies what kind of resource this is. Value: the fixed string "youtube#liveStreamListResponse". +pub struct FanFundingEvent { + /// The snippet object contains basic details about the fan funding event. + pub snippet: Option, + /// Identifies what kind of resource this is. Value: the fixed string "youtube#fanFundingEvent". pub kind: Option, - /// The visitorId identifies the visitor. - #[serde(rename="visitorId")] - pub visitor_id: Option, - /// A list of live streams that match the request criteria. - pub items: Option>, - /// no description provided - #[serde(rename="tokenPagination")] - pub token_pagination: Option, /// Etag of this resource. pub etag: Option, - /// The token that can be used as the value of the pageToken parameter to retrieve the previous page in the result set. - #[serde(rename="prevPageToken")] - pub prev_page_token: Option, - /// no description provided - #[serde(rename="pageInfo")] - pub page_info: Option, + /// The ID that YouTube assigns to uniquely identify the fan funding event. + pub id: Option, } -impl ResponseResult for LiveStreamListResponse {} +impl Resource for FanFundingEvent {} -impl ToParts for LiveStreamListResponse { +impl ToParts for FanFundingEvent { /// Return a comma separated list of members that are currently set, i.e. for which `self.member.is_some()`. /// The produced string is suitable for use as a parts list that indicates the parts you are sending, and/or /// the parts you want to see in the server response. fn to_parts(&self) -> String { let mut r = String::new(); - if self.event_id.is_some() { r = r + "eventId,"; } - if self.next_page_token.is_some() { r = r + "nextPageToken,"; } + if self.snippet.is_some() { r = r + "snippet,"; } if self.kind.is_some() { r = r + "kind,"; } - if self.visitor_id.is_some() { r = r + "visitorId,"; } - if self.items.is_some() { r = r + "items,"; } - if self.token_pagination.is_some() { r = r + "tokenPagination,"; } if self.etag.is_some() { r = r + "etag,"; } - if self.prev_page_token.is_some() { r = r + "prevPageToken,"; } - if self.page_info.is_some() { r = r + "pageInfo,"; } + if self.id.is_some() { r = r + "id,"; } r.pop(); r } } +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveChatTextMessageDetails { + /// The user's message. + #[serde(rename="messageText")] + pub message_text: Option, +} + +impl Part for LiveChatTextMessageDetails {} + + /// There is no detailed description. /// /// # Activities @@ -820,6 +895,20 @@ impl ToParts for PlaylistItem { } } +/// Freebase topic information related to the channel. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChannelTopicDetails { + /// A list of Freebase topic IDs associated with the channel. You can retrieve information about each topic using the Freebase Topic API. + #[serde(rename="topicIds")] + pub topic_ids: Option>, +} + +impl Part for ChannelTopicDetails {} + + /// A i18nRegion resource identifies a region where YouTube is available. /// /// # Activities @@ -1015,6 +1104,52 @@ pub struct SubscriptionContentDetails { impl Part for SubscriptionContentDetails {} +/// A liveChatMessage resource represents a chat message in a YouTube Live Chat. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [delete live chat messages](struct.LiveChatMessageDeleteCall.html) (none) +/// * [list live chat messages](struct.LiveChatMessageListCall.html) (none) +/// * [insert live chat messages](struct.LiveChatMessageInsertCall.html) (request|response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveChatMessage { + /// The snippet object contains basic details about the message. + pub snippet: Option, + /// Identifies what kind of resource this is. Value: the fixed string "youtube#liveChatMessage". + pub kind: Option, + /// Etag of this resource. + pub etag: Option, + /// The authorDetails object contains basic details about the user that posted this message. + #[serde(rename="authorDetails")] + pub author_details: Option, + /// The ID that YouTube assigns to uniquely identify the message. + pub id: Option, +} + +impl RequestValue for LiveChatMessage {} +impl Resource for LiveChatMessage {} +impl ResponseResult for LiveChatMessage {} + +impl ToParts for LiveChatMessage { + /// Return a comma separated list of members that are currently set, i.e. for which `self.member.is_some()`. + /// The produced string is suitable for use as a parts list that indicates the parts you are sending, and/or + /// the parts you want to see in the server response. + fn to_parts(&self) -> String { + let mut r = String::new(); + if self.snippet.is_some() { r = r + "snippet,"; } + if self.kind.is_some() { r = r + "kind,"; } + if self.etag.is_some() { r = r + "etag,"; } + if self.author_details.is_some() { r = r + "authorDetails,"; } + if self.id.is_some() { r = r + "id,"; } + r.pop(); + r + } +} + /// There is no detailed description. /// /// # Activities @@ -1162,6 +1297,69 @@ pub struct CaptionSnippet { impl Part for CaptionSnippet {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list live chat messages](struct.LiveChatMessageListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveChatMessageListResponse { + /// Serialized EventId of the request which produced this response. + #[serde(rename="eventId")] + pub event_id: Option, + /// The token that can be used as the value of the pageToken parameter to retrieve the next page in the result set. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "youtube#liveChatMessageListResponse". + pub kind: Option, + /// The visitorId identifies the visitor. + #[serde(rename="visitorId")] + pub visitor_id: Option, + /// A list of live chat messages. + pub items: Option>, + /// no description provided + #[serde(rename="tokenPagination")] + pub token_pagination: Option, + /// Etag of this resource. + pub etag: Option, + /// The amount of time the client should wait before polling again. + #[serde(rename="pollingIntervalMillis")] + pub polling_interval_millis: Option, + /// no description provided + #[serde(rename="pageInfo")] + pub page_info: Option, + /// The date and time when the underlying stream went offline. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. + #[serde(rename="offlineAt")] + pub offline_at: Option, +} + +impl ResponseResult for LiveChatMessageListResponse {} + +impl ToParts for LiveChatMessageListResponse { + /// Return a comma separated list of members that are currently set, i.e. for which `self.member.is_some()`. + /// The produced string is suitable for use as a parts list that indicates the parts you are sending, and/or + /// the parts you want to see in the server response. + fn to_parts(&self) -> String { + let mut r = String::new(); + if self.event_id.is_some() { r = r + "eventId,"; } + if self.next_page_token.is_some() { r = r + "nextPageToken,"; } + if self.kind.is_some() { r = r + "kind,"; } + if self.visitor_id.is_some() { r = r + "visitorId,"; } + if self.items.is_some() { r = r + "items,"; } + if self.token_pagination.is_some() { r = r + "tokenPagination,"; } + if self.etag.is_some() { r = r + "etag,"; } + if self.polling_interval_millis.is_some() { r = r + "pollingIntervalMillis,"; } + if self.page_info.is_some() { r = r + "pageInfo,"; } + if self.offline_at.is_some() { r = r + "offlineAt,"; } + r.pop(); + r + } +} + /// Basic details about an i18n region, such as region code and human-readable name. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1177,24 +1375,29 @@ pub struct I18nRegionSnippet { impl Part for I18nRegionSnippet {} -/// Information about a new playlist item. +/// Details about a social network post. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ActivityContentDetailsPlaylistItem { - /// The resourceId object contains information about the resource that was added to the playlist. +pub struct ActivityContentDetailsSocial { + /// The resourceId object encapsulates information that identifies the resource associated with a social network post. #[serde(rename="resourceId")] pub resource_id: Option, - /// The value that YouTube uses to uniquely identify the playlist. - #[serde(rename="playlistId")] - pub playlist_id: Option, - /// ID of the item within the playlist. - #[serde(rename="playlistItemId")] - pub playlist_item_id: Option, + /// An image of the post's author. + #[serde(rename="imageUrl")] + pub image_url: Option, + /// The name of the social network. + #[serde(rename="type")] + pub type_: Option, + /// The URL of the social network post. + #[serde(rename="referenceUrl")] + pub reference_url: Option, + /// The author of the social network post. + pub author: Option, } -impl Part for ActivityContentDetailsPlaylistItem {} +impl Part for ActivityContentDetailsSocial {} /// Information about a resource that received a comment. @@ -1269,6 +1472,41 @@ pub struct VideoSnippet { impl Part for VideoSnippet {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveChatMessageSnippet { + /// Contains a string that can be displayed to the user. If this field is not present the message is silent, at the moment only messages of type TOMBSTONE and CHAT_ENDED_EVENT are silent. + #[serde(rename="displayMessage")] + pub display_message: Option, + /// Details about the funding event, this is only set if the type is 'fanFundingEvent'. + #[serde(rename="fanFundingEventDetails")] + pub fan_funding_event_details: Option, + /// Whether the message has display content that should be displayed to users. + #[serde(rename="hasDisplayContent")] + pub has_display_content: Option, + /// The date and time when the message was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. + #[serde(rename="publishedAt")] + pub published_at: Option, + /// no description provided + #[serde(rename="liveChatId")] + pub live_chat_id: Option, + /// The ID of the user that authored this message, this field is not always filled. textMessageEvent - the user that wrote the message fanFundingEvent - the user that funded the broadcast newSponsorEvent - the user that just became a sponsor + #[serde(rename="authorChannelId")] + pub author_channel_id: Option, + /// Details about the text message, this is only set if the type is 'textMessageEvent'. + #[serde(rename="textMessageDetails")] + pub text_message_details: Option, + /// The type of message, this will always be present, it determines the contents of the message as well as which fields will be present. + #[serde(rename="type")] + pub type_: Option, +} + +impl Part for LiveChatMessageSnippet {} + + /// Detailed settings of a stream. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1310,6 +1548,29 @@ pub struct GuideCategory { impl Part for GuideCategory {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ChannelProfileDetails { + /// The YouTube channel ID. + #[serde(rename="channelId")] + pub channel_id: Option, + /// The channel's display name. + #[serde(rename="displayName")] + pub display_name: Option, + /// The channel's URL. + #[serde(rename="channelUrl")] + pub channel_url: Option, + /// The channels's avatar URL. + #[serde(rename="profileImageUrl")] + pub profile_image_url: Option, +} + +impl Part for ChannelProfileDetails {} + + /// There is no detailed description. /// /// # Activities @@ -1353,22 +1614,18 @@ impl ToParts for I18nLanguageListResponse { } } -/// There is no detailed description. +/// Information about a channel that a user subscribed to. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LocalizedProperty { - /// no description provided - pub default: Option, - /// The language of the default property. - #[serde(rename="defaultLanguage")] - pub default_language: Option, - /// no description provided - pub localized: Option>, +pub struct ActivityContentDetailsSubscription { + /// The resourceId object contains information that identifies the resource that the user subscribed to. + #[serde(rename="resourceId")] + pub resource_id: Option, } -impl Part for LocalizedProperty {} +impl Part for ActivityContentDetailsSubscription {} /// Information about a video stream. @@ -1613,6 +1870,47 @@ impl ToParts for VideoCategoryListResponse { } } +/// A liveChatBan resource represents a ban for a YouTube live chat. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert live chat bans](struct.LiveChatBanInsertCall.html) (request|response) +/// * [delete live chat bans](struct.LiveChatBanDeleteCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveChatBan { + /// The snippet object contains basic details about the ban. + pub snippet: Option, + /// Identifies what kind of resource this is. Value: the fixed string "youtube#liveChatBan". + pub kind: Option, + /// Etag of this resource. + pub etag: Option, + /// The ID that YouTube assigns to uniquely identify the ban. + pub id: Option, +} + +impl RequestValue for LiveChatBan {} +impl Resource for LiveChatBan {} +impl ResponseResult for LiveChatBan {} + +impl ToParts for LiveChatBan { + /// Return a comma separated list of members that are currently set, i.e. for which `self.member.is_some()`. + /// The produced string is suitable for use as a parts list that indicates the parts you are sending, and/or + /// the parts you want to see in the server response. + fn to_parts(&self) -> String { + let mut r = String::new(); + if self.snippet.is_some() { r = r + "snippet,"; } + if self.kind.is_some() { r = r + "kind,"; } + if self.etag.is_some() { r = r + "etag,"; } + if self.id.is_some() { r = r + "id,"; } + r.pop(); + r + } +} + /// Video processing progress and completion time estimate. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -1914,6 +2212,28 @@ impl ToParts for ChannelSection { } } +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveChatFanFundingEventDetails { + /// The currency in which the fund was made. + pub currency: Option, + /// A rendered string that displays the fund amount and currency to the user. + #[serde(rename="amountDisplayString")] + pub amount_display_string: Option, + /// The amount of the fund. + #[serde(rename="amountMicros")] + pub amount_micros: Option, + /// The comment added by the user to this fan funding event. + #[serde(rename="userComment")] + pub user_comment: Option, +} + +impl Part for LiveChatFanFundingEventDetails {} + + /// There is no detailed description. /// /// # Activities @@ -2033,7 +2353,7 @@ pub struct LiveStreamStatus { impl Part for LiveStreamStatus {} -/// Ratings schemes. The country-specific ratings are mostly for movies and shows. NEXT_ID: 66 +/// Ratings schemes. The country-specific ratings are mostly for movies and shows. NEXT_ID: 67 /// /// This type is not used in any activity, and only used as *part* of another schema. /// @@ -2099,9 +2419,9 @@ pub struct ContentRating { /// The video's Consejo de Calificación Cinematográfica (Chile) rating. #[serde(rename="cccRating")] pub ccc_rating: Option, - /// The video's rating from Ireland's Raidió Teilifís Éireann. - #[serde(rename="rteRating")] - pub rte_rating: Option, + /// The video's rating from Indonesia's Lembaga Sensor Film. + #[serde(rename="lsfRating")] + pub lsf_rating: Option, /// This property has been deprecated. Use the contentDetails.contentRating.cncRating instead. #[serde(rename="fmocRating")] pub fmoc_rating: Option, @@ -2114,6 +2434,9 @@ pub struct ContentRating { /// The video's rating from the Nacionãlais Kino centrs (National Film Centre of Latvia). #[serde(rename="nkclvRating")] pub nkclv_rating: Option, + /// Rating system in Turkey - Evaluation and Classification Board of the Ministry of Culture and Tourism + #[serde(rename="ecbmctRating")] + pub ecbmct_rating: Option, /// The video's rating from South Africa's Film and Publication Board. #[serde(rename="fpbRating")] pub fpb_rating: Option, @@ -2201,9 +2524,9 @@ pub struct ContentRating { /// The video's rating in the Czech Republic. #[serde(rename="czfilmRating")] pub czfilm_rating: Option, - /// The video's rating from Indonesia's Lembaga Sensor Film. - #[serde(rename="lsfRating")] - pub lsf_rating: Option, + /// The video's rating from Ireland's Raidió Teilifís Éireann. + #[serde(rename="rteRating")] + pub rte_rating: Option, /// The video's National Film Registry of the Russian Federation (MKRF - Russia) rating. #[serde(rename="russiaRating")] pub russia_rating: Option, @@ -2239,63 +2562,21 @@ pub struct ContentRating { impl Part for ContentRating {} -/// Basic details about a comment, such as its author and text. +/// ChannelSection targeting setting. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CommentSnippet { - /// Link to the author's YouTube channel, if any. - #[serde(rename="authorChannelUrl")] - pub author_channel_url: Option, - /// The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel. - #[serde(rename="channelId")] - pub channel_id: Option, - /// The ID of the video the comment refers to, if any. - #[serde(rename="videoId")] - pub video_id: Option, - /// The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. - #[serde(rename="publishedAt")] - pub published_at: Option, - /// The total number of likes this comment has received. - #[serde(rename="likeCount")] - pub like_count: Option, - /// Whether the current viewer can rate this comment. - #[serde(rename="canRate")] - pub can_rate: Option, - /// The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. - #[serde(rename="updatedAt")] - pub updated_at: Option, - /// The URL for the avatar of the user who posted the comment. - #[serde(rename="authorProfileImageUrl")] - pub author_profile_image_url: Option, - /// Link to the author's Google+ profile, if any. - #[serde(rename="authorGoogleplusProfileUrl")] - pub author_googleplus_profile_url: Option, - /// The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc. - #[serde(rename="textDisplay")] - pub text_display: Option, - /// The name of the user who posted the comment. - #[serde(rename="authorDisplayName")] - pub author_display_name: Option, - /// The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future. - #[serde(rename="viewerRating")] - pub viewer_rating: Option, - /// The comment's moderation status. Will not be set if the comments were requested through the id filter. - #[serde(rename="moderationStatus")] - pub moderation_status: Option, - /// The id of the author's YouTube channel, if any. - #[serde(rename="authorChannelId")] - pub author_channel_id: Option, - /// The unique id of the parent comment, only set for replies. - #[serde(rename="parentId")] - pub parent_id: Option, - /// The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author. - #[serde(rename="textOriginal")] - pub text_original: Option, +pub struct ChannelSectionTargeting { + /// The language the channel section is targeting. + pub languages: Option>, + /// The region the channel section is targeting. + pub regions: Option>, + /// The country the channel section is targeting. + pub countries: Option>, } -impl Part for CommentSnippet {} +impl Part for ChannelSectionTargeting {} /// Branding properties for images associated with the channel. @@ -2955,29 +3236,24 @@ impl ToParts for LiveStream { } } -/// Details about a social network post. +/// Information about a new playlist item. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ActivityContentDetailsSocial { - /// The resourceId object encapsulates information that identifies the resource associated with a social network post. +pub struct ActivityContentDetailsPlaylistItem { + /// The resourceId object contains information about the resource that was added to the playlist. #[serde(rename="resourceId")] pub resource_id: Option, - /// An image of the post's author. - #[serde(rename="imageUrl")] - pub image_url: Option, - /// The name of the social network. - #[serde(rename="type")] - pub type_: Option, - /// The URL of the social network post. - #[serde(rename="referenceUrl")] - pub reference_url: Option, - /// The author of the social network post. - pub author: Option, + /// The value that YouTube uses to uniquely identify the playlist. + #[serde(rename="playlistId")] + pub playlist_id: Option, + /// ID of the item within the playlist. + #[serde(rename="playlistItemId")] + pub playlist_item_id: Option, } -impl Part for ActivityContentDetailsSocial {} +impl Part for ActivityContentDetailsPlaylistItem {} /// Basic details about an activity, including title, description, thumbnails, activity type and group. @@ -3012,21 +3288,63 @@ pub struct ActivitySnippet { impl Part for ActivitySnippet {} -/// ChannelSection targeting setting. +/// Basic details about a comment, such as its author and text. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ChannelSectionTargeting { - /// The language the channel section is targeting. - pub languages: Option>, - /// The region the channel section is targeting. - pub regions: Option>, - /// The country the channel section is targeting. - pub countries: Option>, +pub struct CommentSnippet { + /// Link to the author's YouTube channel, if any. + #[serde(rename="authorChannelUrl")] + pub author_channel_url: Option, + /// The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel. + #[serde(rename="channelId")] + pub channel_id: Option, + /// The ID of the video the comment refers to, if any. + #[serde(rename="videoId")] + pub video_id: Option, + /// The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. + #[serde(rename="publishedAt")] + pub published_at: Option, + /// The total number of likes this comment has received. + #[serde(rename="likeCount")] + pub like_count: Option, + /// Whether the current viewer can rate this comment. + #[serde(rename="canRate")] + pub can_rate: Option, + /// The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. + #[serde(rename="updatedAt")] + pub updated_at: Option, + /// The URL for the avatar of the user who posted the comment. + #[serde(rename="authorProfileImageUrl")] + pub author_profile_image_url: Option, + /// Link to the author's Google+ profile, if any. + #[serde(rename="authorGoogleplusProfileUrl")] + pub author_googleplus_profile_url: Option, + /// The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc. + #[serde(rename="textDisplay")] + pub text_display: Option, + /// The name of the user who posted the comment. + #[serde(rename="authorDisplayName")] + pub author_display_name: Option, + /// The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future. + #[serde(rename="viewerRating")] + pub viewer_rating: Option, + /// The comment's moderation status. Will not be set if the comments were requested through the id filter. + #[serde(rename="moderationStatus")] + pub moderation_status: Option, + /// The id of the author's YouTube channel, if any. + #[serde(rename="authorChannelId")] + pub author_channel_id: Option, + /// The unique id of the parent comment, only set for replies. + #[serde(rename="parentId")] + pub parent_id: Option, + /// The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author. + #[serde(rename="textOriginal")] + pub text_original: Option, } -impl Part for ChannelSectionTargeting {} +impl Part for CommentSnippet {} /// Statistics about the video, such as the number of times the video was viewed or liked. @@ -3055,6 +3373,41 @@ pub struct VideoStatistics { impl Part for VideoStatistics {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveChatMessageAuthorDetails { + /// The channel's display name. + #[serde(rename="displayName")] + pub display_name: Option, + /// Whether the author is a moderator of the live chat. + #[serde(rename="isChatModerator")] + pub is_chat_moderator: Option, + /// The YouTube channel ID. + #[serde(rename="channelId")] + pub channel_id: Option, + /// Whether the author is a sponsor of the live chat. + #[serde(rename="isChatSponsor")] + pub is_chat_sponsor: Option, + /// The channels's avatar URL. + #[serde(rename="profileImageUrl")] + pub profile_image_url: Option, + /// Whether the author is the owner of the live chat. + #[serde(rename="isChatOwner")] + pub is_chat_owner: Option, + /// The channel's URL. + #[serde(rename="channelUrl")] + pub channel_url: Option, + /// Whether the author's identity has been verified by YouTube. + #[serde(rename="isVerified")] + pub is_verified: Option, +} + +impl Part for LiveChatMessageAuthorDetails {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -3207,18 +3560,86 @@ impl ToParts for CommentListResponse { } } -/// Information about the playlist item's privacy status. +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list live streams](struct.LiveStreamListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveStreamListResponse { + /// Serialized EventId of the request which produced this response. + #[serde(rename="eventId")] + pub event_id: Option, + /// The token that can be used as the value of the pageToken parameter to retrieve the next page in the result set. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "youtube#liveStreamListResponse". + pub kind: Option, + /// The visitorId identifies the visitor. + #[serde(rename="visitorId")] + pub visitor_id: Option, + /// A list of live streams that match the request criteria. + pub items: Option>, + /// no description provided + #[serde(rename="tokenPagination")] + pub token_pagination: Option, + /// Etag of this resource. + pub etag: Option, + /// The token that can be used as the value of the pageToken parameter to retrieve the previous page in the result set. + #[serde(rename="prevPageToken")] + pub prev_page_token: Option, + /// no description provided + #[serde(rename="pageInfo")] + pub page_info: Option, +} + +impl ResponseResult for LiveStreamListResponse {} + +impl ToParts for LiveStreamListResponse { + /// Return a comma separated list of members that are currently set, i.e. for which `self.member.is_some()`. + /// The produced string is suitable for use as a parts list that indicates the parts you are sending, and/or + /// the parts you want to see in the server response. + fn to_parts(&self) -> String { + let mut r = String::new(); + if self.event_id.is_some() { r = r + "eventId,"; } + if self.next_page_token.is_some() { r = r + "nextPageToken,"; } + if self.kind.is_some() { r = r + "kind,"; } + if self.visitor_id.is_some() { r = r + "visitorId,"; } + if self.items.is_some() { r = r + "items,"; } + if self.token_pagination.is_some() { r = r + "tokenPagination,"; } + if self.etag.is_some() { r = r + "etag,"; } + if self.prev_page_token.is_some() { r = r + "prevPageToken,"; } + if self.page_info.is_some() { r = r + "pageInfo,"; } + r.pop(); + r + } +} + +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PlaylistItemStatus { - /// This resource's privacy status. - #[serde(rename="privacyStatus")] - pub privacy_status: Option, +pub struct LiveChatBanSnippet { + /// The duration of a ban, only filled if the ban has type TEMPORARY. + #[serde(rename="banDurationSeconds")] + pub ban_duration_seconds: Option, + /// The chat this ban is pertinent to. + #[serde(rename="liveChatId")] + pub live_chat_id: Option, + /// no description provided + #[serde(rename="bannedUserDetails")] + pub banned_user_details: Option, + /// The type of ban. + #[serde(rename="type")] + pub type_: Option, } -impl Part for PlaylistItemStatus {} +impl Part for LiveChatBanSnippet {} /// There is no detailed description. @@ -3398,6 +3819,23 @@ pub struct ActivityContentDetailsRecommendation { impl Part for ActivityContentDetailsRecommendation {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveChatModeratorSnippet { + /// The ID of the live chat this moderator can act on. + #[serde(rename="liveChatId")] + pub live_chat_id: Option, + /// Details about the moderator. + #[serde(rename="moderatorDetails")] + pub moderator_details: Option, +} + +impl Part for LiveChatModeratorSnippet {} + + /// Details about the content of an activity: the video that was shared, the channel that was subscribed to, etc. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -3644,9 +4082,6 @@ pub struct Video { /// The projectDetails object contains information about the project specific video metadata. #[serde(rename="projectDetails")] pub project_details: Option, - /// The conversionPings object encapsulates information about url pings that need to be respected by the App in different video contexts. - #[serde(rename="conversionPings")] - pub conversion_pings: Option, /// The processingProgress object encapsulates information about YouTube's progress in processing the uploaded video file. The properties in the object identify the current processing status and an estimate of the time remaining until YouTube finishes processing the video. This part also indicates whether different types of data or content, such as file details or thumbnail images, are available for the video. /// /// The processingProgress object is designed to be polled so that the video uploaded can track the progress that YouTube has made in processing the uploaded video file. This data can only be retrieved by the video owner. @@ -3686,7 +4121,6 @@ impl ToParts for Video { if self.kind.is_some() { r = r + "kind,"; } if self.statistics.is_some() { r = r + "statistics,"; } if self.project_details.is_some() { r = r + "projectDetails,"; } - if self.conversion_pings.is_some() { r = r + "conversionPings,"; } if self.processing_details.is_some() { r = r + "processingDetails,"; } if self.etag.is_some() { r = r + "etag,"; } if self.content_details.is_some() { r = r + "contentDetails,"; } @@ -3795,47 +4229,18 @@ pub struct PromotedItemId { impl Part for PromotedItemId {} -/// Describes original video file properties, including technical details about audio and video streams, but also metadata information like content length, digitization time, or geotagging information. +/// Information about the playlist item's privacy status. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VideoFileDetails { - /// The uploaded video file's combined (video and audio) bitrate in bits per second. - #[serde(rename="bitrateBps")] - pub bitrate_bps: Option, - /// The uploaded video file's container format. - pub container: Option, - /// Geographic coordinates that identify the place where the uploaded video was recorded. Coordinates are defined using WGS 84. - #[serde(rename="recordingLocation")] - pub recording_location: Option, - /// The uploaded file's type as detected by YouTube's video processing engine. Currently, YouTube only processes video files, but this field is present whether a video file or another type of file was uploaded. - #[serde(rename="fileType")] - pub file_type: Option, - /// The date and time when the uploaded video file was created. The value is specified in ISO 8601 format. Currently, the following ISO 8601 formats are supported: - /// - Date only: YYYY-MM-DD - /// - Naive time: YYYY-MM-DDTHH:MM:SS - /// - Time with timezone: YYYY-MM-DDTHH:MM:SS+HH:MM - #[serde(rename="creationTime")] - pub creation_time: Option, - /// The length of the uploaded video in milliseconds. - #[serde(rename="durationMs")] - pub duration_ms: Option, - /// The uploaded file's name. This field is present whether a video file or another type of file was uploaded. - #[serde(rename="fileName")] - pub file_name: Option, - /// The uploaded file's size in bytes. This field is present whether a video file or another type of file was uploaded. - #[serde(rename="fileSize")] - pub file_size: Option, - /// A list of video streams contained in the uploaded video file. Each item in the list contains detailed metadata about a video stream. - #[serde(rename="videoStreams")] - pub video_streams: Option>, - /// A list of audio streams contained in the uploaded video file. Each item in the list contains detailed metadata about an audio stream. - #[serde(rename="audioStreams")] - pub audio_streams: Option>, +pub struct PlaylistItemStatus { + /// This resource's privacy status. + #[serde(rename="privacyStatus")] + pub privacy_status: Option, } -impl Part for VideoFileDetails {} +impl Part for PlaylistItemStatus {} /// Describes the spatial position of a visual widget inside a video. It is a union of various position types, out of which only will be set one. @@ -3855,6 +4260,61 @@ pub struct InvideoPosition { impl Part for InvideoPosition {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list sponsors](struct.SponsorListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct SponsorListResponse { + /// Serialized EventId of the request which produced this response. + #[serde(rename="eventId")] + pub event_id: Option, + /// The token that can be used as the value of the pageToken parameter to retrieve the next page in the result set. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "youtube#sponsorListResponse". + pub kind: Option, + /// The visitorId identifies the visitor. + #[serde(rename="visitorId")] + pub visitor_id: Option, + /// A list of sponsors that match the request criteria. + pub items: Option>, + /// no description provided + #[serde(rename="tokenPagination")] + pub token_pagination: Option, + /// Etag of this resource. + pub etag: Option, + /// no description provided + #[serde(rename="pageInfo")] + pub page_info: Option, +} + +impl ResponseResult for SponsorListResponse {} + +impl ToParts for SponsorListResponse { + /// Return a comma separated list of members that are currently set, i.e. for which `self.member.is_some()`. + /// The produced string is suitable for use as a parts list that indicates the parts you are sending, and/or + /// the parts you want to see in the server response. + fn to_parts(&self) -> String { + let mut r = String::new(); + if self.event_id.is_some() { r = r + "eventId,"; } + if self.next_page_token.is_some() { r = r + "nextPageToken,"; } + if self.kind.is_some() { r = r + "kind,"; } + if self.visitor_id.is_some() { r = r + "visitorId,"; } + if self.items.is_some() { r = r + "items,"; } + if self.token_pagination.is_some() { r = r + "tokenPagination,"; } + if self.etag.is_some() { r = r + "etag,"; } + if self.page_info.is_some() { r = r + "pageInfo,"; } + r.pop(); + r + } +} + /// Project specific details about the content of a YouTube Video. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -3916,20 +4376,79 @@ pub struct VideoLocalization { impl Part for VideoLocalization {} -/// Information about a channel that a user subscribed to. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ActivityContentDetailsSubscription { - /// The resourceId object contains information that identifies the resource that the user subscribed to. - #[serde(rename="resourceId")] - pub resource_id: Option, +pub struct LocalizedProperty { + /// no description provided + pub default: Option, + /// The language of the default property. + #[serde(rename="defaultLanguage")] + pub default_language: Option, + /// no description provided + pub localized: Option>, } -impl Part for ActivityContentDetailsSubscription {} +impl Part for LocalizedProperty {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list fan funding events](struct.FanFundingEventListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FanFundingEventListResponse { + /// Serialized EventId of the request which produced this response. + #[serde(rename="eventId")] + pub event_id: Option, + /// The token that can be used as the value of the pageToken parameter to retrieve the next page in the result set. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "youtube#fanFundingEventListResponse". + pub kind: Option, + /// The visitorId identifies the visitor. + #[serde(rename="visitorId")] + pub visitor_id: Option, + /// A list of fan funding events that match the request criteria. + pub items: Option>, + /// no description provided + #[serde(rename="tokenPagination")] + pub token_pagination: Option, + /// Etag of this resource. + pub etag: Option, + /// no description provided + #[serde(rename="pageInfo")] + pub page_info: Option, +} + +impl ResponseResult for FanFundingEventListResponse {} + +impl ToParts for FanFundingEventListResponse { + /// Return a comma separated list of members that are currently set, i.e. for which `self.member.is_some()`. + /// The produced string is suitable for use as a parts list that indicates the parts you are sending, and/or + /// the parts you want to see in the server response. + fn to_parts(&self) -> String { + let mut r = String::new(); + if self.event_id.is_some() { r = r + "eventId,"; } + if self.next_page_token.is_some() { r = r + "nextPageToken,"; } + if self.kind.is_some() { r = r + "kind,"; } + if self.visitor_id.is_some() { r = r + "visitorId,"; } + if self.items.is_some() { r = r + "items,"; } + if self.token_pagination.is_some() { r = r + "tokenPagination,"; } + if self.etag.is_some() { r = r + "etag,"; } + if self.page_info.is_some() { r = r + "pageInfo,"; } + r.pop(); + r + } +} + /// A liveBroadcast resource represents an event that will be streamed, via live video, on YouTube. /// /// # Activities @@ -3939,7 +4458,6 @@ impl Part for ActivityContentDetailsSubscription {} /// /// * [control live broadcasts](struct.LiveBroadcastControlCall.html) (response) /// * [insert live broadcasts](struct.LiveBroadcastInsertCall.html) (request|response) -/// * [bind_direct live broadcasts](struct.LiveBroadcastBindDirectCall.html) (response) /// * [list live broadcasts](struct.LiveBroadcastListCall.html) (none) /// * [transition live broadcasts](struct.LiveBroadcastTransitionCall.html) (response) /// * [update live broadcasts](struct.LiveBroadcastUpdateCall.html) (request|response) @@ -4146,19 +4664,43 @@ pub struct PlaylistPlayer { impl Part for PlaylistPlayer {} -/// Freebase topic information related to the channel. +/// A sponsor resource represents a sponsor for a YouTube channel. A sponsor provides recurring monetary support to a creator and receives special benefits. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list sponsors](struct.SponsorListCall.html) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ChannelTopicDetails { - /// A list of Freebase topic IDs associated with the channel. You can retrieve information about each topic using the Freebase Topic API. - #[serde(rename="topicIds")] - pub topic_ids: Option>, +pub struct Sponsor { + /// The snippet object contains basic details about the sponsor. + pub snippet: Option, + /// Identifies what kind of resource this is. Value: the fixed string "youtube#sponsor". + pub kind: Option, + /// Etag of this resource. + pub etag: Option, + /// The ID that YouTube assigns to uniquely identify the sponsor. + pub id: Option, } -impl Part for ChannelTopicDetails {} +impl Resource for Sponsor {} +impl ToParts for Sponsor { + /// Return a comma separated list of members that are currently set, i.e. for which `self.member.is_some()`. + /// The produced string is suitable for use as a parts list that indicates the parts you are sending, and/or + /// the parts you want to see in the server response. + fn to_parts(&self) -> String { + let mut r = String::new(); + if self.snippet.is_some() { r = r + "snippet,"; } + if self.kind.is_some() { r = r + "kind,"; } + if self.etag.is_some() { r = r + "etag,"; } + if self.id.is_some() { r = r + "id,"; } + r.pop(); + r + } +} /// Recording information associated with the video. /// @@ -4230,27 +4772,89 @@ pub struct MonitorStreamInfo { impl Part for MonitorStreamInfo {} +/// There is no detailed description. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [list live chat moderators](struct.LiveChatModeratorListCall.html) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveChatModeratorListResponse { + /// Serialized EventId of the request which produced this response. + #[serde(rename="eventId")] + pub event_id: Option, + /// The token that can be used as the value of the pageToken parameter to retrieve the next page in the result set. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// Identifies what kind of resource this is. Value: the fixed string "youtube#liveChatModeratorListResponse". + pub kind: Option, + /// The visitorId identifies the visitor. + #[serde(rename="visitorId")] + pub visitor_id: Option, + /// A list of moderators that match the request criteria. + pub items: Option>, + /// no description provided + #[serde(rename="tokenPagination")] + pub token_pagination: Option, + /// Etag of this resource. + pub etag: Option, + /// The token that can be used as the value of the pageToken parameter to retrieve the previous page in the result set. + #[serde(rename="prevPageToken")] + pub prev_page_token: Option, + /// no description provided + #[serde(rename="pageInfo")] + pub page_info: Option, +} + +impl ResponseResult for LiveChatModeratorListResponse {} + +impl ToParts for LiveChatModeratorListResponse { + /// Return a comma separated list of members that are currently set, i.e. for which `self.member.is_some()`. + /// The produced string is suitable for use as a parts list that indicates the parts you are sending, and/or + /// the parts you want to see in the server response. + fn to_parts(&self) -> String { + let mut r = String::new(); + if self.event_id.is_some() { r = r + "eventId,"; } + if self.next_page_token.is_some() { r = r + "nextPageToken,"; } + if self.kind.is_some() { r = r + "kind,"; } + if self.visitor_id.is_some() { r = r + "visitorId,"; } + if self.items.is_some() { r = r + "items,"; } + if self.token_pagination.is_some() { r = r + "tokenPagination,"; } + if self.etag.is_some() { r = r + "etag,"; } + if self.prev_page_token.is_some() { r = r + "prevPageToken,"; } + if self.page_info.is_some() { r = r + "pageInfo,"; } + r.pop(); + r + } +} + /// Details about the live streaming metadata. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct VideoLiveStreamingDetails { - /// The number of viewers currently watching the broadcast. The property and its value will be present if the broadcast has current viewers and the broadcast owner has not hidden the viewcount for the video. Note that YouTube stops tracking the number of concurrent viewers for a broadcast when the broadcast ends. So, this property would not identify the number of viewers watching an archived video of a live broadcast that already ended. - #[serde(rename="concurrentViewers")] - pub concurrent_viewers: Option, /// The time that the broadcast is scheduled to begin. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. #[serde(rename="scheduledStartTime")] pub scheduled_start_time: Option, - /// The time that the broadcast is scheduled to end. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. If the value is empty or the property is not present, then the broadcast is scheduled to continue indefinitely. - #[serde(rename="scheduledEndTime")] - pub scheduled_end_time: Option, - /// The time that the broadcast actually started. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. This value will not be available until the broadcast begins. - #[serde(rename="actualStartTime")] - pub actual_start_time: Option, /// The time that the broadcast actually ended. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. This value will not be available until the broadcast is over. #[serde(rename="actualEndTime")] pub actual_end_time: Option, + /// The number of viewers currently watching the broadcast. The property and its value will be present if the broadcast has current viewers and the broadcast owner has not hidden the viewcount for the video. Note that YouTube stops tracking the number of concurrent viewers for a broadcast when the broadcast ends. So, this property would not identify the number of viewers watching an archived video of a live broadcast that already ended. + #[serde(rename="concurrentViewers")] + pub concurrent_viewers: Option, + /// The ID of the currently active live chat attached to this video. This field is filled only if the video is a currently live broadcast that has live chat. Once the broadcast transitions to complete this field will be removed and the live chat closed down. For persistent broadcasts that live chat id will no longer be tied to this video but rather to the new video being displayed at the persistent page. + #[serde(rename="activeLiveChatId")] + pub active_live_chat_id: Option, + /// The time that the broadcast actually started. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. This value will not be available until the broadcast begins. + #[serde(rename="actualStartTime")] + pub actual_start_time: Option, + /// The time that the broadcast is scheduled to end. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. If the value is empty or the property is not present, then the broadcast is scheduled to continue indefinitely. + #[serde(rename="scheduledEndTime")] + pub scheduled_end_time: Option, } impl Part for VideoLiveStreamingDetails {} @@ -4463,19 +5067,6 @@ pub struct PlaylistLocalization { impl Part for PlaylistLocalization {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VideoConversionPings { - /// Pings that the app shall fire for a video (authenticated by biscotti cookie). Each ping has a context, in which the app must fire the ping, and a url identifying the ping. - pub pings: Option>, -} - -impl Part for VideoConversionPings {} - - /// An i18nLanguage resource identifies a UI language currently supported by YouTube. /// /// # Activities @@ -4590,21 +5181,24 @@ impl Part for CommentThreadSnippet {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct LiveBroadcastContentDetails { - /// no description provided + /// Indicates whether this broadcast has low latency enabled. #[serde(rename="enableLowLatency")] pub enable_low_latency: Option, + /// The monitorStream object contains information about the monitor stream, which the broadcaster can use to review the event content before the broadcast stream is shown publicly. + #[serde(rename="monitorStream")] + pub monitor_stream: Option, /// This value uniquely identifies the live stream bound to the broadcast. #[serde(rename="boundStreamId")] pub bound_stream_id: Option, /// This setting indicates whether the broadcast video can be played in an embedded player. If you choose to archive the video (using the enableArchive property), this setting will also apply to the archived video. #[serde(rename="enableEmbed")] pub enable_embed: Option, - /// This setting indicates whether closed captioning is enabled for this broadcast. The ingestion URL of the closed captions is returned through the liveStreams API. + /// This setting indicates whether HTTP POST closed captioning is enabled for this broadcast. The ingestion URL of the closed captions is returned through the liveStreams API. This is mutually exclusive with using the closed_captions_type property, and is equivalent to setting closed_captions_type to CLOSED_CAPTIONS_HTTP_POST. #[serde(rename="enableClosedCaptions")] pub enable_closed_captions: Option, - /// The monitorStream object contains information about the monitor stream, which the broadcaster can use to review the event content before the broadcast stream is shown publicly. - #[serde(rename="monitorStream")] - pub monitor_stream: Option, + /// no description provided + #[serde(rename="closedCaptionsType")] + pub closed_captions_type: Option, /// This setting indicates whether YouTube should enable content encryption for the broadcast. #[serde(rename="enableContentEncryption")] pub enable_content_encryption: Option, @@ -4630,22 +5224,6 @@ pub struct LiveBroadcastContentDetails { impl Part for LiveBroadcastContentDetails {} -/// There is no detailed description. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct VideoConversionPing { - /// Defines the context of the ping. - pub context: Option, - /// The url (without the schema) that the app shall send the ping to. It's at caller's descretion to decide which schema to use (http vs https) Example of a returned url: //googleads.g.doubleclick.net/pagead/ viewthroughconversion/962985656/?data=path%3DtHe_path%3Btype%3D like%3Butuid%3DGISQtTNGYqaYl4sKxoVvKA%3Bytvid%3DUrIaJUvIQDg&labe=default The caller must append biscotti authentication (ms param in case of mobile, for example) to this ping. - #[serde(rename="conversionUrl")] - pub conversion_url: Option, -} - -impl Part for VideoConversionPing {} - - /// Basic details about a video category, such as its localized title. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -4723,6 +5301,48 @@ impl ToParts for SearchListResponse { } } +/// A liveChatModerator resource represents a moderator for a YouTube live chat. A chat moderator has the ability to ban/unban users from a chat, remove message, etc. +/// +/// # Activities +/// +/// This type is used in activities, which are methods you may call on this type or where this type is involved in. +/// The list links the activity name, along with information about where it is used (one of *request* and *response*). +/// +/// * [insert live chat moderators](struct.LiveChatModeratorInsertCall.html) (request|response) +/// * [list live chat moderators](struct.LiveChatModeratorListCall.html) (none) +/// * [delete live chat moderators](struct.LiveChatModeratorDeleteCall.html) (none) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct LiveChatModerator { + /// The snippet object contains basic details about the moderator. + pub snippet: Option, + /// Identifies what kind of resource this is. Value: the fixed string "youtube#liveChatModerator". + pub kind: Option, + /// Etag of this resource. + pub etag: Option, + /// The ID that YouTube assigns to uniquely identify the moderator. + pub id: Option, +} + +impl RequestValue for LiveChatModerator {} +impl Resource for LiveChatModerator {} +impl ResponseResult for LiveChatModerator {} + +impl ToParts for LiveChatModerator { + /// Return a comma separated list of members that are currently set, i.e. for which `self.member.is_some()`. + /// The produced string is suitable for use as a parts list that indicates the parts you are sending, and/or + /// the parts you want to see in the server response. + fn to_parts(&self) -> String { + let mut r = String::new(); + if self.snippet.is_some() { r = r + "snippet,"; } + if self.kind.is_some() { r = r + "kind,"; } + if self.etag.is_some() { r = r + "etag,"; } + if self.id.is_some() { r = r + "id,"; } + r.pop(); + r + } +} + /// Specifies suggestions on how to improve video content, including encoding hints, tag suggestions, and editor suggestions. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -4794,6 +5414,37 @@ pub struct LiveBroadcastTopicSnippet { impl Part for LiveBroadcastTopicSnippet {} +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct FanFundingEventSnippet { + /// The text contents of the comment left by the user. + #[serde(rename="commentText")] + pub comment_text: Option, + /// The date and time when the funding occurred. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. + #[serde(rename="createdAt")] + pub created_at: Option, + /// The currency in which the fund was made. ISO 4217. + pub currency: Option, + /// A rendered string that displays the fund amount and currency (e.g., "$1.00"). The string is rendered for the given language. + #[serde(rename="displayString")] + pub display_string: Option, + /// Channel id where the funding event occurred. + #[serde(rename="channelId")] + pub channel_id: Option, + /// Details about the supporter. Only filled if the event was made public by the user. + #[serde(rename="supporterDetails")] + pub supporter_details: Option, + /// The amount of funding in micros of fund_currency. e.g., 1 is represented + #[serde(rename="amountMicros")] + pub amount_micros: Option, +} + +impl Part for FanFundingEventSnippet {} + + /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. @@ -4817,128 +5468,6 @@ impl Part for LiveBroadcastTopic {} // MethodBuilders ### // ################# -/// A builder providing access to all methods supported on *i18nLanguage* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `list(...)` -/// // to build up your call. -/// let rb = hub.i18n_languages(); -/// # } -/// ``` -pub struct I18nLanguageMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for I18nLanguageMethods<'a, C, A> {} - -impl<'a, C, A> I18nLanguageMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Returns a list of application languages that the YouTube website supports. - /// - /// # Arguments - /// - /// * `part` - The part parameter specifies the i18nLanguage resource properties that the API response will include. Set the parameter value to snippet. - pub fn list(&self, part: &str) -> I18nLanguageListCall<'a, C, A> { - I18nLanguageListCall { - hub: self.hub, - _part: part.to_string(), - _hl: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *channelBanner* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `insert(...)` -/// // to build up your call. -/// let rb = hub.channel_banners(); -/// # } -/// ``` -pub struct ChannelBannerMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for ChannelBannerMethods<'a, C, A> {} - -impl<'a, C, A> ChannelBannerMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Uploads a channel banner image to YouTube. This method represents the first two steps in a three-step process to update the banner image for a channel: - /// - /// - Call the channelBanners.insert method to upload the binary image data to YouTube. The image must have a 16:9 aspect ratio and be at least 2120x1192 pixels. - /// - Extract the url property's value from the response that the API returns for step 1. - /// - Call the channels.update method to update the channel's branding settings. Set the brandingSettings.image.bannerExternalUrl property's value to the URL obtained in step 2. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn insert(&self, request: ChannelBannerResource) -> ChannelBannerInsertCall<'a, C, A> { - ChannelBannerInsertCall { - hub: self.hub, - _request: request, - _on_behalf_of_content_owner: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - /// A builder providing access to all methods supported on *channelSection* resources. /// It is not used directly, but through the `YouTube` hub. /// @@ -5062,67 +5591,6 @@ impl<'a, C, A> ChannelSectionMethods<'a, C, A> { -/// A builder providing access to all methods supported on *guideCategory* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `list(...)` -/// // to build up your call. -/// let rb = hub.guide_categories(); -/// # } -/// ``` -pub struct GuideCategoryMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for GuideCategoryMethods<'a, C, A> {} - -impl<'a, C, A> GuideCategoryMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Returns a list of categories that can be associated with YouTube channels. - /// - /// # Arguments - /// - /// * `part` - The part parameter specifies the guideCategory resource properties that the API response will include. Set the parameter value to snippet. - pub fn list(&self, part: &str) -> GuideCategoryListCall<'a, C, A> { - GuideCategoryListCall { - hub: self.hub, - _part: part.to_string(), - _region_code: Default::default(), - _id: Default::default(), - _hl: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - /// A builder providing access to all methods supported on *playlist* resources. /// It is not used directly, but through the `YouTube` hub. /// @@ -5249,65 +5717,6 @@ impl<'a, C, A> PlaylistMethods<'a, C, A> { -/// A builder providing access to all methods supported on *thumbnail* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `set(...)` -/// // to build up your call. -/// let rb = hub.thumbnails(); -/// # } -/// ``` -pub struct ThumbnailMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for ThumbnailMethods<'a, C, A> {} - -impl<'a, C, A> ThumbnailMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Uploads a custom video thumbnail to YouTube and sets it for a video. - /// - /// # Arguments - /// - /// * `videoId` - The videoId parameter specifies a YouTube video ID for which the custom video thumbnail is being provided. - pub fn set(&self, video_id: &str) -> ThumbnailSetCall<'a, C, A> { - ThumbnailSetCall { - hub: self.hub, - _video_id: video_id.to_string(), - _on_behalf_of_content_owner: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - /// A builder providing access to all methods supported on *video* resources. /// It is not used directly, but through the `YouTube` hub. /// @@ -5494,7 +5903,7 @@ impl<'a, C, A> VideoMethods<'a, C, A> { -/// A builder providing access to all methods supported on *subscription* resources. +/// A builder providing access to all methods supported on *activity* resources. /// It is not used directly, but through the `YouTube` hub. /// /// # Example @@ -5517,329 +5926,59 @@ impl<'a, C, A> VideoMethods<'a, C, A> { /// ::default(), None); /// let mut hub = YouTube::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `insert(...)` and `list(...)` +/// // like `insert(...)` and `list(...)` /// // to build up your call. -/// let rb = hub.subscriptions(); +/// let rb = hub.activities(); /// # } /// ``` -pub struct SubscriptionMethods<'a, C, A> +pub struct ActivityMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a YouTube, } -impl<'a, C, A> MethodsBuilder for SubscriptionMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for ActivityMethods<'a, C, A> {} -impl<'a, C, A> SubscriptionMethods<'a, C, A> { +impl<'a, C, A> ActivityMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Adds a subscription for the authenticated user's channel. + /// Returns a list of channel activity events that match the request criteria. For example, you can retrieve events associated with a particular channel, events associated with the user's subscriptions and Google+ friends, or the YouTube home page feed, which is customized for each user. /// /// # Arguments /// - /// * `request` - No description provided. - pub fn insert(&self, request: Subscription) -> SubscriptionInsertCall<'a, C, A> { - let parts = request.to_parts(); - SubscriptionInsertCall { - hub: self.hub, - _request: request, - _part: parts, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns subscription resources that match the API request criteria. - /// - /// # Arguments - /// - /// * `part` - The part parameter specifies a comma-separated list of one or more subscription resource properties that the API response will include. - /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a subscription resource, the snippet property contains other properties, such as a display title for the subscription. If you set part=snippet, the API response will also contain all of those nested properties. - pub fn list(&self, part: &str) -> SubscriptionListCall<'a, C, A> { - SubscriptionListCall { + /// * `part` - The part parameter specifies a comma-separated list of one or more activity resource properties that the API response will include. + /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in an activity resource, the snippet property contains other properties that identify the type of activity, a display title for the activity, and so forth. If you set part=snippet, the API response will also contain all of those nested properties. + pub fn list(&self, part: &str) -> ActivityListCall<'a, C, A> { + ActivityListCall { hub: self.hub, _part: part.to_string(), - _page_token: Default::default(), - _order: Default::default(), - _on_behalf_of_content_owner_channel: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _my_subscribers: Default::default(), - _mine: Default::default(), - _max_results: Default::default(), - _id: Default::default(), - _for_channel_id: Default::default(), - _channel_id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a subscription. - /// - /// # Arguments - /// - /// * `id` - The id parameter specifies the YouTube subscription ID for the resource that is being deleted. In a subscription resource, the id property specifies the YouTube subscription ID. - pub fn delete(&self, id: &str) -> SubscriptionDeleteCall<'a, C, A> { - SubscriptionDeleteCall { - hub: self.hub, - _id: id.to_string(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *search* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `list(...)` -/// // to build up your call. -/// let rb = hub.search(); -/// # } -/// ``` -pub struct SearchMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for SearchMethods<'a, C, A> {} - -impl<'a, C, A> SearchMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching video, channel, and playlist resources, but you can also configure queries to only retrieve a specific type of resource. - /// - /// # Arguments - /// - /// * `part` - The part parameter specifies a comma-separated list of one or more search resource properties that the API response will include. Set the parameter value to snippet. - pub fn list(&self, part: &str) -> SearchListCall<'a, C, A> { - SearchListCall { - hub: self.hub, - _part: part.to_string(), - _video_type: Default::default(), - _video_syndicated: Default::default(), - _video_license: Default::default(), - _video_embeddable: Default::default(), - _video_duration: Default::default(), - _video_dimension: Default::default(), - _video_definition: Default::default(), - _video_category_id: Default::default(), - _video_caption: Default::default(), - _type_: Default::default(), - _topic_id: Default::default(), - _safe_search: Default::default(), - _relevance_language: Default::default(), - _related_to_video_id: Default::default(), _region_code: Default::default(), - _q: Default::default(), _published_before: Default::default(), _published_after: Default::default(), _page_token: Default::default(), - _order: Default::default(), - _on_behalf_of_content_owner: Default::default(), + _mine: Default::default(), _max_results: Default::default(), - _location_radius: Default::default(), - _location: Default::default(), - _for_mine: Default::default(), - _for_developer: Default::default(), - _for_content_owner: Default::default(), - _event_type: Default::default(), - _channel_type: Default::default(), + _home: Default::default(), _channel_id: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } -} - - - -/// A builder providing access to all methods supported on *i18nRegion* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `list(...)` -/// // to build up your call. -/// let rb = hub.i18n_regions(); -/// # } -/// ``` -pub struct I18nRegionMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for I18nRegionMethods<'a, C, A> {} - -impl<'a, C, A> I18nRegionMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns a list of content regions that the YouTube website supports. + /// Posts a bulletin for a specific channel. (The user submitting the request must be authorized to act on the channel's behalf.) /// - /// # Arguments - /// - /// * `part` - The part parameter specifies the i18nRegion resource properties that the API response will include. Set the parameter value to snippet. - pub fn list(&self, part: &str) -> I18nRegionListCall<'a, C, A> { - I18nRegionListCall { - hub: self.hub, - _part: part.to_string(), - _hl: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *commentThread* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `insert(...)`, `list(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.comment_threads(); -/// # } -/// ``` -pub struct CommentThreadMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for CommentThreadMethods<'a, C, A> {} - -impl<'a, C, A> CommentThreadMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Returns a list of comment threads that match the API request parameters. - /// - /// # Arguments - /// - /// * `part` - The part parameter specifies a comma-separated list of one or more commentThread resource properties that the API response will include. - pub fn list(&self, part: &str) -> CommentThreadListCall<'a, C, A> { - CommentThreadListCall { - hub: self.hub, - _part: part.to_string(), - _video_id: Default::default(), - _text_format: Default::default(), - _search_terms: Default::default(), - _page_token: Default::default(), - _order: Default::default(), - _moderation_status: Default::default(), - _max_results: Default::default(), - _id: Default::default(), - _channel_id: Default::default(), - _all_threads_related_to_channel_id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Modifies the top-level comment in a comment thread. + /// Note: Even though an activity resource can contain information about actions like a user rating a video or marking a video as a favorite, you need to use other API methods to generate those activity resources. For example, you would use the API's videos.rate() method to rate a video and the playlistItems.insert() method to mark a video as a favorite. /// /// # Arguments /// /// * `request` - No description provided. - pub fn update(&self, request: CommentThread) -> CommentThreadUpdateCall<'a, C, A> { + pub fn insert(&self, request: Activity) -> ActivityInsertCall<'a, C, A> { let parts = request.to_parts(); - CommentThreadUpdateCall { - hub: self.hub, - _request: request, - _part: parts, - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a new top-level comment. To add a reply to an existing comment, use the comments.insert method instead. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn insert(&self, request: CommentThread) -> CommentThreadInsertCall<'a, C, A> { - let parts = request.to_parts(); - CommentThreadInsertCall { + ActivityInsertCall { hub: self.hub, _request: request, _part: parts, @@ -5977,6 +6116,645 @@ impl<'a, C, A> LiveStreamMethods<'a, C, A> { +/// A builder providing access to all methods supported on *channel* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.channels(); +/// # } +/// ``` +pub struct ChannelMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for ChannelMethods<'a, C, A> {} + +impl<'a, C, A> ChannelMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Updates a channel's metadata. Note that this method currently only supports updates to the channel resource's brandingSettings and invideoPromotion objects and their child properties. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn update(&self, request: Channel) -> ChannelUpdateCall<'a, C, A> { + let parts = request.to_parts(); + ChannelUpdateCall { + hub: self.hub, + _request: request, + _part: parts, + _on_behalf_of_content_owner: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns a collection of zero or more channel resources that match the request criteria. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies a comma-separated list of one or more channel resource properties that the API response will include. + /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a channel resource, the contentDetails property contains other properties, such as the uploads properties. As such, if you set part=contentDetails, the API response will also contain all of those nested properties. + pub fn list(&self, part: &str) -> ChannelListCall<'a, C, A> { + ChannelListCall { + hub: self.hub, + _part: part.to_string(), + _page_token: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _my_subscribers: Default::default(), + _mine: Default::default(), + _max_results: Default::default(), + _managed_by_me: Default::default(), + _id: Default::default(), + _hl: Default::default(), + _for_username: Default::default(), + _category_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *watermark* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `set(...)` and `unset(...)` +/// // to build up your call. +/// let rb = hub.watermarks(); +/// # } +/// ``` +pub struct WatermarkMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for WatermarkMethods<'a, C, A> {} + +impl<'a, C, A> WatermarkMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Uploads a watermark image to YouTube and sets it for a channel. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `channelId` - The channelId parameter specifies the YouTube channel ID for which the watermark is being provided. + pub fn set(&self, request: InvideoBranding, channel_id: &str) -> WatermarkSetCall<'a, C, A> { + WatermarkSetCall { + hub: self.hub, + _request: request, + _channel_id: channel_id.to_string(), + _on_behalf_of_content_owner: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a channel's watermark image. + /// + /// # Arguments + /// + /// * `channelId` - The channelId parameter specifies the YouTube channel ID for which the watermark is being unset. + pub fn unset(&self, channel_id: &str) -> WatermarkUnsetCall<'a, C, A> { + WatermarkUnsetCall { + hub: self.hub, + _channel_id: channel_id.to_string(), + _on_behalf_of_content_owner: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *liveChatModerator* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.live_chat_moderators(); +/// # } +/// ``` +pub struct LiveChatModeratorMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for LiveChatModeratorMethods<'a, C, A> {} + +impl<'a, C, A> LiveChatModeratorMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Adds a new moderator for the chat. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn insert(&self, request: LiveChatModerator) -> LiveChatModeratorInsertCall<'a, C, A> { + let parts = request.to_parts(); + LiveChatModeratorInsertCall { + hub: self.hub, + _request: request, + _part: parts, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Lists moderators for a live chat. + /// + /// # Arguments + /// + /// * `liveChatId` - The liveChatId parameter specifies the YouTube live chat for which the API should return moderators. + /// * `part` - The part parameter specifies the liveChatModerator resource parts that the API response will include. Supported values are id and snippet. + pub fn list(&self, live_chat_id: &str, part: &str) -> LiveChatModeratorListCall<'a, C, A> { + LiveChatModeratorListCall { + hub: self.hub, + _live_chat_id: live_chat_id.to_string(), + _part: part.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Removes a chat moderator. + /// + /// # Arguments + /// + /// * `id` - The id parameter identifies the chat moderator to remove. The value uniquely identifies both the moderator and the chat. + pub fn delete(&self, id: &str) -> LiveChatModeratorDeleteCall<'a, C, A> { + LiveChatModeratorDeleteCall { + hub: self.hub, + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *caption* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `download(...)`, `insert(...)`, `list(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.captions(); +/// # } +/// ``` +pub struct CaptionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for CaptionMethods<'a, C, A> {} + +impl<'a, C, A> CaptionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Deletes a specified caption track. + /// + /// # Arguments + /// + /// * `id` - The id parameter identifies the caption track that is being deleted. The value is a caption track ID as identified by the id property in a caption resource. + pub fn delete(&self, id: &str) -> CaptionDeleteCall<'a, C, A> { + CaptionDeleteCall { + hub: self.hub, + _id: id.to_string(), + _on_behalf_of_content_owner: Default::default(), + _on_behalf_of: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Uploads a caption track. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn insert(&self, request: Caption) -> CaptionInsertCall<'a, C, A> { + let parts = request.to_parts(); + CaptionInsertCall { + hub: self.hub, + _request: request, + _part: parts, + _sync: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _on_behalf_of: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns a list of caption tracks that are associated with a specified video. Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies a comma-separated list of one or more caption resource parts that the API response will include. The part names that you can include in the parameter value are id and snippet. + /// * `videoId` - The videoId parameter specifies the YouTube video ID of the video for which the API should return caption tracks. + pub fn list(&self, part: &str, video_id: &str) -> CaptionListCall<'a, C, A> { + CaptionListCall { + hub: self.hub, + _part: part.to_string(), + _video_id: video_id.to_string(), + _on_behalf_of_content_owner: Default::default(), + _on_behalf_of: Default::default(), + _id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter. + /// + /// # Arguments + /// + /// * `id` - The id parameter identifies the caption track that is being retrieved. The value is a caption track ID as identified by the id property in a caption resource. + pub fn download(&self, id: &str) -> CaptionDownloadCall<'a, C, A> { + CaptionDownloadCall { + hub: self.hub, + _id: id.to_string(), + _tlang: Default::default(), + _tfmt: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _on_behalf_of: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn update(&self, request: Caption) -> CaptionUpdateCall<'a, C, A> { + let parts = request.to_parts(); + CaptionUpdateCall { + hub: self.hub, + _request: request, + _part: parts, + _sync: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _on_behalf_of: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *i18nLanguage* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.i18n_languages(); +/// # } +/// ``` +pub struct I18nLanguageMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for I18nLanguageMethods<'a, C, A> {} + +impl<'a, C, A> I18nLanguageMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Returns a list of application languages that the YouTube website supports. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies the i18nLanguage resource properties that the API response will include. Set the parameter value to snippet. + pub fn list(&self, part: &str) -> I18nLanguageListCall<'a, C, A> { + I18nLanguageListCall { + hub: self.hub, + _part: part.to_string(), + _hl: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *guideCategory* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.guide_categories(); +/// # } +/// ``` +pub struct GuideCategoryMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for GuideCategoryMethods<'a, C, A> {} + +impl<'a, C, A> GuideCategoryMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Returns a list of categories that can be associated with YouTube channels. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies the guideCategory resource properties that the API response will include. Set the parameter value to snippet. + pub fn list(&self, part: &str) -> GuideCategoryListCall<'a, C, A> { + GuideCategoryListCall { + hub: self.hub, + _part: part.to_string(), + _region_code: Default::default(), + _id: Default::default(), + _hl: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *commentThread* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `insert(...)`, `list(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.comment_threads(); +/// # } +/// ``` +pub struct CommentThreadMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for CommentThreadMethods<'a, C, A> {} + +impl<'a, C, A> CommentThreadMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Returns a list of comment threads that match the API request parameters. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies a comma-separated list of one or more commentThread resource properties that the API response will include. + pub fn list(&self, part: &str) -> CommentThreadListCall<'a, C, A> { + CommentThreadListCall { + hub: self.hub, + _part: part.to_string(), + _video_id: Default::default(), + _text_format: Default::default(), + _search_terms: Default::default(), + _page_token: Default::default(), + _order: Default::default(), + _moderation_status: Default::default(), + _max_results: Default::default(), + _id: Default::default(), + _channel_id: Default::default(), + _all_threads_related_to_channel_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Modifies the top-level comment in a comment thread. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn update(&self, request: CommentThread) -> CommentThreadUpdateCall<'a, C, A> { + let parts = request.to_parts(); + CommentThreadUpdateCall { + hub: self.hub, + _request: request, + _part: parts, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a new top-level comment. To add a reply to an existing comment, use the comments.insert method instead. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn insert(&self, request: CommentThread) -> CommentThreadInsertCall<'a, C, A> { + let parts = request.to_parts(); + CommentThreadInsertCall { + hub: self.hub, + _request: request, + _part: parts, + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + /// A builder providing access to all methods supported on *comment* resources. /// It is not used directly, but through the `YouTube` hub. /// @@ -6132,154 +6910,6 @@ impl<'a, C, A> CommentMethods<'a, C, A> { -/// A builder providing access to all methods supported on *channel* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `list(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.channels(); -/// # } -/// ``` -pub struct ChannelMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for ChannelMethods<'a, C, A> {} - -impl<'a, C, A> ChannelMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Updates a channel's metadata. Note that this method currently only supports updates to the channel resource's brandingSettings and invideoPromotion objects and their child properties. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn update(&self, request: Channel) -> ChannelUpdateCall<'a, C, A> { - let parts = request.to_parts(); - ChannelUpdateCall { - hub: self.hub, - _request: request, - _part: parts, - _on_behalf_of_content_owner: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns a collection of zero or more channel resources that match the request criteria. - /// - /// # Arguments - /// - /// * `part` - The part parameter specifies a comma-separated list of one or more channel resource properties that the API response will include. - /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a channel resource, the contentDetails property contains other properties, such as the uploads properties. As such, if you set part=contentDetails, the API response will also contain all of those nested properties. - pub fn list(&self, part: &str) -> ChannelListCall<'a, C, A> { - ChannelListCall { - hub: self.hub, - _part: part.to_string(), - _page_token: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _my_subscribers: Default::default(), - _mine: Default::default(), - _max_results: Default::default(), - _managed_by_me: Default::default(), - _id: Default::default(), - _hl: Default::default(), - _for_username: Default::default(), - _category_id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *videoAbuseReportReason* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `list(...)` -/// // to build up your call. -/// let rb = hub.video_abuse_report_reasons(); -/// # } -/// ``` -pub struct VideoAbuseReportReasonMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for VideoAbuseReportReasonMethods<'a, C, A> {} - -impl<'a, C, A> VideoAbuseReportReasonMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Returns a list of abuse reasons that can be used for reporting abusive videos. - /// - /// # Arguments - /// - /// * `part` - The part parameter specifies the videoCategory resource parts that the API response will include. Supported values are id and snippet. - pub fn list(&self, part: &str) -> VideoAbuseReportReasonListCall<'a, C, A> { - VideoAbuseReportReasonListCall { - hub: self.hub, - _part: part.to_string(), - _hl: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - /// A builder providing access to all methods supported on *playlistItem* resources. /// It is not used directly, but through the `YouTube` hub. /// @@ -6401,7 +7031,7 @@ impl<'a, C, A> PlaylistItemMethods<'a, C, A> { -/// A builder providing access to all methods supported on *watermark* resources. +/// A builder providing access to all methods supported on *liveChatMessage* resources. /// It is not used directly, but through the `YouTube` hub. /// /// # Example @@ -6424,206 +7054,38 @@ impl<'a, C, A> PlaylistItemMethods<'a, C, A> { /// ::default(), None); /// let mut hub = YouTube::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `set(...)` and `unset(...)` +/// // like `delete(...)`, `insert(...)` and `list(...)` /// // to build up your call. -/// let rb = hub.watermarks(); +/// let rb = hub.live_chat_messages(); /// # } /// ``` -pub struct WatermarkMethods<'a, C, A> +pub struct LiveChatMessageMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a YouTube, } -impl<'a, C, A> MethodsBuilder for WatermarkMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for LiveChatMessageMethods<'a, C, A> {} -impl<'a, C, A> WatermarkMethods<'a, C, A> { +impl<'a, C, A> LiveChatMessageMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Uploads a watermark image to YouTube and sets it for a channel. + /// Lists live chat messages for a specific chat. /// /// # Arguments /// - /// * `request` - No description provided. - /// * `channelId` - The channelId parameter specifies the YouTube channel ID for which the watermark is being provided. - pub fn set(&self, request: InvideoBranding, channel_id: &str) -> WatermarkSetCall<'a, C, A> { - WatermarkSetCall { - hub: self.hub, - _request: request, - _channel_id: channel_id.to_string(), - _on_behalf_of_content_owner: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a channel's watermark image. - /// - /// # Arguments - /// - /// * `channelId` - The channelId parameter specifies the YouTube channel ID for which the watermark is being unset. - pub fn unset(&self, channel_id: &str) -> WatermarkUnsetCall<'a, C, A> { - WatermarkUnsetCall { - hub: self.hub, - _channel_id: channel_id.to_string(), - _on_behalf_of_content_owner: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *liveBroadcast* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `bind(...)`, `bind_direct(...)`, `control(...)`, `delete(...)`, `insert(...)`, `list(...)`, `transition(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.live_broadcasts(); -/// # } -/// ``` -pub struct LiveBroadcastMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for LiveBroadcastMethods<'a, C, A> {} - -impl<'a, C, A> LiveBroadcastMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Controls the settings for a slate that can be displayed in the broadcast stream. - /// - /// # Arguments - /// - /// * `id` - The id parameter specifies the YouTube live broadcast ID that uniquely identifies the broadcast in which the slate is being updated. - /// * `part` - The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. - pub fn control(&self, id: &str, part: &str) -> LiveBroadcastControlCall<'a, C, A> { - LiveBroadcastControlCall { - hub: self.hub, - _id: id.to_string(), - _part: part.to_string(), - _walltime: Default::default(), - _on_behalf_of_content_owner_channel: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _offset_time_ms: Default::default(), - _display_slate: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream, though a video stream may be bound to more than one broadcast. - /// - /// # Arguments - /// - /// * `id` - The id parameter specifies the unique ID of the broadcast that is being bound to a video stream. - /// * `part` - The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. - pub fn bind_direct(&self, id: &str, part: &str) -> LiveBroadcastBindDirectCall<'a, C, A> { - LiveBroadcastBindDirectCall { - hub: self.hub, - _id: id.to_string(), - _part: part.to_string(), - _stream_id: Default::default(), - _on_behalf_of_content_owner_channel: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a broadcast. For example, you could modify the broadcast settings defined in the liveBroadcast resource's contentDetails object. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn update(&self, request: LiveBroadcast) -> LiveBroadcastUpdateCall<'a, C, A> { - let parts = request.to_parts(); - LiveBroadcastUpdateCall { - hub: self.hub, - _request: request, - _part: parts, - _on_behalf_of_content_owner_channel: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Creates a broadcast. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn insert(&self, request: LiveBroadcast) -> LiveBroadcastInsertCall<'a, C, A> { - let parts = request.to_parts(); - LiveBroadcastInsertCall { - hub: self.hub, - _request: request, - _part: parts, - _on_behalf_of_content_owner_channel: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns a list of YouTube broadcasts that match the API request parameters. - /// - /// # Arguments - /// - /// * `part` - The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. - pub fn list(&self, part: &str) -> LiveBroadcastListCall<'a, C, A> { - LiveBroadcastListCall { + /// * `liveChatId` - The liveChatId parameter specifies the ID of the chat whose messages will be returned. + /// * `part` - The part parameter specifies the liveChatComment resource parts that the API response will include. Supported values are id and snippet. + pub fn list(&self, live_chat_id: &str, part: &str) -> LiveChatMessageListCall<'a, C, A> { + LiveChatMessageListCall { hub: self.hub, + _live_chat_id: live_chat_id.to_string(), _part: part.to_string(), + _profile_image_size: Default::default(), _page_token: Default::default(), - _on_behalf_of_content_owner_channel: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _mine: Default::default(), _max_results: Default::default(), - _id: Default::default(), - _broadcast_status: Default::default(), + _hl: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -6632,17 +7094,15 @@ impl<'a, C, A> LiveBroadcastMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Deletes a broadcast. + /// Deletes a chat message. /// /// # Arguments /// - /// * `id` - The id parameter specifies the YouTube live broadcast ID for the resource that is being deleted. - pub fn delete(&self, id: &str) -> LiveBroadcastDeleteCall<'a, C, A> { - LiveBroadcastDeleteCall { + /// * `id` - The id parameter specifies the YouTube chat message ID of the resource that is being deleted. + pub fn delete(&self, id: &str) -> LiveChatMessageDeleteCall<'a, C, A> { + LiveChatMessageDeleteCall { hub: self.hub, _id: id.to_string(), - _on_behalf_of_content_owner_channel: Default::default(), - _on_behalf_of_content_owner: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -6651,190 +7111,17 @@ impl<'a, C, A> LiveBroadcastMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Changes the status of a YouTube live broadcast and initiates any processes associated with the new status. For example, when you transition a broadcast's status to testing, YouTube starts to transmit video to that broadcast's monitor stream. Before calling this method, you should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active. - /// - /// # Arguments - /// - /// * `broadcastStatus` - The broadcastStatus parameter identifies the state to which the broadcast is changing. Note that to transition a broadcast to either the testing or live state, the status.streamStatus must be active for the stream that the broadcast is bound to. - /// * `id` - The id parameter specifies the unique ID of the broadcast that is transitioning to another status. - /// * `part` - The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. - pub fn transition(&self, broadcast_status: &str, id: &str, part: &str) -> LiveBroadcastTransitionCall<'a, C, A> { - LiveBroadcastTransitionCall { - hub: self.hub, - _broadcast_status: broadcast_status.to_string(), - _id: id.to_string(), - _part: part.to_string(), - _on_behalf_of_content_owner_channel: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream, though a video stream may be bound to more than one broadcast. - /// - /// # Arguments - /// - /// * `id` - The id parameter specifies the unique ID of the broadcast that is being bound to a video stream. - /// * `part` - The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. - pub fn bind(&self, id: &str, part: &str) -> LiveBroadcastBindCall<'a, C, A> { - LiveBroadcastBindCall { - hub: self.hub, - _id: id.to_string(), - _part: part.to_string(), - _stream_id: Default::default(), - _on_behalf_of_content_owner_channel: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } -} - - - -/// A builder providing access to all methods supported on *caption* resources. -/// It is not used directly, but through the `YouTube` hub. -/// -/// # Example -/// -/// Instantiate a resource builder -/// -/// ```test_harness,no_run -/// extern crate hyper; -/// extern crate yup_oauth2 as oauth2; -/// extern crate google_youtube3 as youtube3; -/// -/// # #[test] fn egal() { -/// use std::default::Default; -/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// use youtube3::YouTube; -/// -/// let secret: ApplicationSecret = Default::default(); -/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// hyper::Client::new(), -/// ::default(), None); -/// let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `delete(...)`, `download(...)`, `insert(...)`, `list(...)` and `update(...)` -/// // to build up your call. -/// let rb = hub.captions(); -/// # } -/// ``` -pub struct CaptionMethods<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, -} - -impl<'a, C, A> MethodsBuilder for CaptionMethods<'a, C, A> {} - -impl<'a, C, A> CaptionMethods<'a, C, A> { - - /// Create a builder to help you perform the following task: - /// - /// Uploads a caption track. + /// Adds a message to a live chat. /// /// # Arguments /// /// * `request` - No description provided. - pub fn insert(&self, request: Caption) -> CaptionInsertCall<'a, C, A> { + pub fn insert(&self, request: LiveChatMessage) -> LiveChatMessageInsertCall<'a, C, A> { let parts = request.to_parts(); - CaptionInsertCall { + LiveChatMessageInsertCall { hub: self.hub, _request: request, _part: parts, - _sync: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _on_behalf_of: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Returns a list of caption tracks that are associated with a specified video. Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track. - /// - /// # Arguments - /// - /// * `part` - The part parameter specifies a comma-separated list of one or more caption resource parts that the API response will include. The part names that you can include in the parameter value are id and snippet. - /// * `videoId` - The videoId parameter specifies the YouTube video ID of the video for which the API should return caption tracks. - pub fn list(&self, part: &str, video_id: &str) -> CaptionListCall<'a, C, A> { - CaptionListCall { - hub: self.hub, - _part: part.to_string(), - _video_id: video_id.to_string(), - _on_behalf_of_content_owner: Default::default(), - _on_behalf_of: Default::default(), - _id: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter. - /// - /// # Arguments - /// - /// * `id` - The id parameter identifies the caption track that is being retrieved. The value is a caption track ID as identified by the id property in a caption resource. - pub fn download(&self, id: &str) -> CaptionDownloadCall<'a, C, A> { - CaptionDownloadCall { - hub: self.hub, - _id: id.to_string(), - _tlang: Default::default(), - _tfmt: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _on_behalf_of: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Deletes a specified caption track. - /// - /// # Arguments - /// - /// * `id` - The id parameter identifies the caption track that is being deleted. The value is a caption track ID as identified by the id property in a caption resource. - pub fn delete(&self, id: &str) -> CaptionDeleteCall<'a, C, A> { - CaptionDeleteCall { - hub: self.hub, - _id: id.to_string(), - _on_behalf_of_content_owner: Default::default(), - _on_behalf_of: Default::default(), - _delegate: Default::default(), - _scopes: Default::default(), - _additional_params: Default::default(), - } - } - - /// Create a builder to help you perform the following task: - /// - /// Updates a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both. - /// - /// # Arguments - /// - /// * `request` - No description provided. - pub fn update(&self, request: Caption) -> CaptionUpdateCall<'a, C, A> { - let parts = request.to_parts(); - CaptionUpdateCall { - hub: self.hub, - _request: request, - _part: parts, - _sync: Default::default(), - _on_behalf_of_content_owner: Default::default(), - _on_behalf_of: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -6905,7 +7192,7 @@ impl<'a, C, A> VideoCategoryMethods<'a, C, A> { -/// A builder providing access to all methods supported on *activity* resources. +/// A builder providing access to all methods supported on *i18nRegion* resources. /// It is not used directly, but through the `YouTube` hub. /// /// # Example @@ -6928,41 +7215,93 @@ impl<'a, C, A> VideoCategoryMethods<'a, C, A> { /// ::default(), None); /// let mut hub = YouTube::new(hyper::Client::new(), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `insert(...)` and `list(...)` +/// // like `list(...)` /// // to build up your call. -/// let rb = hub.activities(); +/// let rb = hub.i18n_regions(); /// # } /// ``` -pub struct ActivityMethods<'a, C, A> +pub struct I18nRegionMethods<'a, C, A> where C: 'a, A: 'a { hub: &'a YouTube, } -impl<'a, C, A> MethodsBuilder for ActivityMethods<'a, C, A> {} +impl<'a, C, A> MethodsBuilder for I18nRegionMethods<'a, C, A> {} -impl<'a, C, A> ActivityMethods<'a, C, A> { +impl<'a, C, A> I18nRegionMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Returns a list of channel activity events that match the request criteria. For example, you can retrieve events associated with a particular channel, events associated with the user's subscriptions and Google+ friends, or the YouTube home page feed, which is customized for each user. + /// Returns a list of content regions that the YouTube website supports. /// /// # Arguments /// - /// * `part` - The part parameter specifies a comma-separated list of one or more activity resource properties that the API response will include. - /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in an activity resource, the snippet property contains other properties that identify the type of activity, a display title for the activity, and so forth. If you set part=snippet, the API response will also contain all of those nested properties. - pub fn list(&self, part: &str) -> ActivityListCall<'a, C, A> { - ActivityListCall { + /// * `part` - The part parameter specifies the i18nRegion resource properties that the API response will include. Set the parameter value to snippet. + pub fn list(&self, part: &str) -> I18nRegionListCall<'a, C, A> { + I18nRegionListCall { hub: self.hub, _part: part.to_string(), - _region_code: Default::default(), - _published_before: Default::default(), - _published_after: Default::default(), - _page_token: Default::default(), - _mine: Default::default(), - _max_results: Default::default(), - _home: Default::default(), - _channel_id: Default::default(), + _hl: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *subscription* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)`, `insert(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.subscriptions(); +/// # } +/// ``` +pub struct SubscriptionMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for SubscriptionMethods<'a, C, A> {} + +impl<'a, C, A> SubscriptionMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Adds a subscription for the authenticated user's channel. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn insert(&self, request: Subscription) -> SubscriptionInsertCall<'a, C, A> { + let parts = request.to_parts(); + SubscriptionInsertCall { + hub: self.hub, + _request: request, + _part: parts, _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -6971,16 +7310,100 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// - /// Posts a bulletin for a specific channel. (The user submitting the request must be authorized to act on the channel's behalf.) + /// Deletes a subscription. /// - /// Note: Even though an activity resource can contain information about actions like a user rating a video or marking a video as a favorite, you need to use other API methods to generate those activity resources. For example, you would use the API's videos.rate() method to rate a video and the playlistItems.insert() method to mark a video as a favorite. + /// # Arguments + /// + /// * `id` - The id parameter specifies the YouTube subscription ID for the resource that is being deleted. In a subscription resource, the id property specifies the YouTube subscription ID. + pub fn delete(&self, id: &str) -> SubscriptionDeleteCall<'a, C, A> { + SubscriptionDeleteCall { + hub: self.hub, + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns subscription resources that match the API request criteria. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies a comma-separated list of one or more subscription resource properties that the API response will include. + /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a subscription resource, the snippet property contains other properties, such as a display title for the subscription. If you set part=snippet, the API response will also contain all of those nested properties. + pub fn list(&self, part: &str) -> SubscriptionListCall<'a, C, A> { + SubscriptionListCall { + hub: self.hub, + _part: part.to_string(), + _page_token: Default::default(), + _order: Default::default(), + _on_behalf_of_content_owner_channel: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _my_subscribers: Default::default(), + _mine: Default::default(), + _max_results: Default::default(), + _id: Default::default(), + _for_channel_id: Default::default(), + _channel_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *liveChatBan* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `delete(...)` and `insert(...)` +/// // to build up your call. +/// let rb = hub.live_chat_bans(); +/// # } +/// ``` +pub struct LiveChatBanMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for LiveChatBanMethods<'a, C, A> {} + +impl<'a, C, A> LiveChatBanMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Adds a new ban to the chat. /// /// # Arguments /// /// * `request` - No description provided. - pub fn insert(&self, request: Activity) -> ActivityInsertCall<'a, C, A> { + pub fn insert(&self, request: LiveChatBan) -> LiveChatBanInsertCall<'a, C, A> { let parts = request.to_parts(); - ActivityInsertCall { + LiveChatBanInsertCall { hub: self.hub, _request: request, _part: parts, @@ -6989,6 +7412,610 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { _additional_params: Default::default(), } } + + /// Create a builder to help you perform the following task: + /// + /// Removes a chat ban. + /// + /// # Arguments + /// + /// * `id` - The id parameter identifies the chat ban to remove. The value uniquely identifies both the ban and the chat. + pub fn delete(&self, id: &str) -> LiveChatBanDeleteCall<'a, C, A> { + LiveChatBanDeleteCall { + hub: self.hub, + _id: id.to_string(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *sponsor* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.sponsors(); +/// # } +/// ``` +pub struct SponsorMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for SponsorMethods<'a, C, A> {} + +impl<'a, C, A> SponsorMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists sponsors for a channel. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies the sponsor resource parts that the API response will include. Supported values are id and snippet. + pub fn list(&self, part: &str) -> SponsorListCall<'a, C, A> { + SponsorListCall { + hub: self.hub, + _part: part.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _filter: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *videoAbuseReportReason* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.video_abuse_report_reasons(); +/// # } +/// ``` +pub struct VideoAbuseReportReasonMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for VideoAbuseReportReasonMethods<'a, C, A> {} + +impl<'a, C, A> VideoAbuseReportReasonMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Returns a list of abuse reasons that can be used for reporting abusive videos. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies the videoCategory resource parts that the API response will include. Supported values are id and snippet. + pub fn list(&self, part: &str) -> VideoAbuseReportReasonListCall<'a, C, A> { + VideoAbuseReportReasonListCall { + hub: self.hub, + _part: part.to_string(), + _hl: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *liveBroadcast* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `bind(...)`, `control(...)`, `delete(...)`, `insert(...)`, `list(...)`, `transition(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.live_broadcasts(); +/// # } +/// ``` +pub struct LiveBroadcastMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for LiveBroadcastMethods<'a, C, A> {} + +impl<'a, C, A> LiveBroadcastMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Controls the settings for a slate that can be displayed in the broadcast stream. + /// + /// # Arguments + /// + /// * `id` - The id parameter specifies the YouTube live broadcast ID that uniquely identifies the broadcast in which the slate is being updated. + /// * `part` - The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. + pub fn control(&self, id: &str, part: &str) -> LiveBroadcastControlCall<'a, C, A> { + LiveBroadcastControlCall { + hub: self.hub, + _id: id.to_string(), + _part: part.to_string(), + _walltime: Default::default(), + _on_behalf_of_content_owner_channel: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _offset_time_ms: Default::default(), + _display_slate: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates a broadcast. For example, you could modify the broadcast settings defined in the liveBroadcast resource's contentDetails object. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn update(&self, request: LiveBroadcast) -> LiveBroadcastUpdateCall<'a, C, A> { + let parts = request.to_parts(); + LiveBroadcastUpdateCall { + hub: self.hub, + _request: request, + _part: parts, + _on_behalf_of_content_owner_channel: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream, though a video stream may be bound to more than one broadcast. + /// + /// # Arguments + /// + /// * `id` - The id parameter specifies the unique ID of the broadcast that is being bound to a video stream. + /// * `part` - The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. + pub fn bind(&self, id: &str, part: &str) -> LiveBroadcastBindCall<'a, C, A> { + LiveBroadcastBindCall { + hub: self.hub, + _id: id.to_string(), + _part: part.to_string(), + _stream_id: Default::default(), + _on_behalf_of_content_owner_channel: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Creates a broadcast. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn insert(&self, request: LiveBroadcast) -> LiveBroadcastInsertCall<'a, C, A> { + let parts = request.to_parts(); + LiveBroadcastInsertCall { + hub: self.hub, + _request: request, + _part: parts, + _on_behalf_of_content_owner_channel: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a broadcast. + /// + /// # Arguments + /// + /// * `id` - The id parameter specifies the YouTube live broadcast ID for the resource that is being deleted. + pub fn delete(&self, id: &str) -> LiveBroadcastDeleteCall<'a, C, A> { + LiveBroadcastDeleteCall { + hub: self.hub, + _id: id.to_string(), + _on_behalf_of_content_owner_channel: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Returns a list of YouTube broadcasts that match the API request parameters. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. + pub fn list(&self, part: &str) -> LiveBroadcastListCall<'a, C, A> { + LiveBroadcastListCall { + hub: self.hub, + _part: part.to_string(), + _page_token: Default::default(), + _on_behalf_of_content_owner_channel: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _mine: Default::default(), + _max_results: Default::default(), + _id: Default::default(), + _broadcast_type: Default::default(), + _broadcast_status: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Changes the status of a YouTube live broadcast and initiates any processes associated with the new status. For example, when you transition a broadcast's status to testing, YouTube starts to transmit video to that broadcast's monitor stream. Before calling this method, you should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active. + /// + /// # Arguments + /// + /// * `broadcastStatus` - The broadcastStatus parameter identifies the state to which the broadcast is changing. Note that to transition a broadcast to either the testing or live state, the status.streamStatus must be active for the stream that the broadcast is bound to. + /// * `id` - The id parameter specifies the unique ID of the broadcast that is transitioning to another status. + /// * `part` - The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. + pub fn transition(&self, broadcast_status: &str, id: &str, part: &str) -> LiveBroadcastTransitionCall<'a, C, A> { + LiveBroadcastTransitionCall { + hub: self.hub, + _broadcast_status: broadcast_status.to_string(), + _id: id.to_string(), + _part: part.to_string(), + _on_behalf_of_content_owner_channel: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *channelBanner* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `insert(...)` +/// // to build up your call. +/// let rb = hub.channel_banners(); +/// # } +/// ``` +pub struct ChannelBannerMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for ChannelBannerMethods<'a, C, A> {} + +impl<'a, C, A> ChannelBannerMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Uploads a channel banner image to YouTube. This method represents the first two steps in a three-step process to update the banner image for a channel: + /// + /// - Call the channelBanners.insert method to upload the binary image data to YouTube. The image must have a 16:9 aspect ratio and be at least 2120x1192 pixels. + /// - Extract the url property's value from the response that the API returns for step 1. + /// - Call the channels.update method to update the channel's branding settings. Set the brandingSettings.image.bannerExternalUrl property's value to the URL obtained in step 2. + /// + /// # Arguments + /// + /// * `request` - No description provided. + pub fn insert(&self, request: ChannelBannerResource) -> ChannelBannerInsertCall<'a, C, A> { + ChannelBannerInsertCall { + hub: self.hub, + _request: request, + _on_behalf_of_content_owner: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *search* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.search(); +/// # } +/// ``` +pub struct SearchMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for SearchMethods<'a, C, A> {} + +impl<'a, C, A> SearchMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching video, channel, and playlist resources, but you can also configure queries to only retrieve a specific type of resource. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies a comma-separated list of one or more search resource properties that the API response will include. Set the parameter value to snippet. + pub fn list(&self, part: &str) -> SearchListCall<'a, C, A> { + SearchListCall { + hub: self.hub, + _part: part.to_string(), + _video_type: Default::default(), + _video_syndicated: Default::default(), + _video_license: Default::default(), + _video_embeddable: Default::default(), + _video_duration: Default::default(), + _video_dimension: Default::default(), + _video_definition: Default::default(), + _video_category_id: Default::default(), + _video_caption: Default::default(), + _type_: Default::default(), + _topic_id: Default::default(), + _safe_search: Default::default(), + _relevance_language: Default::default(), + _related_to_video_id: Default::default(), + _region_code: Default::default(), + _q: Default::default(), + _published_before: Default::default(), + _published_after: Default::default(), + _page_token: Default::default(), + _order: Default::default(), + _on_behalf_of_content_owner: Default::default(), + _max_results: Default::default(), + _location_radius: Default::default(), + _location: Default::default(), + _for_mine: Default::default(), + _for_developer: Default::default(), + _for_content_owner: Default::default(), + _event_type: Default::default(), + _channel_type: Default::default(), + _channel_id: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *thumbnail* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `set(...)` +/// // to build up your call. +/// let rb = hub.thumbnails(); +/// # } +/// ``` +pub struct ThumbnailMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for ThumbnailMethods<'a, C, A> {} + +impl<'a, C, A> ThumbnailMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Uploads a custom video thumbnail to YouTube and sets it for a video. + /// + /// # Arguments + /// + /// * `videoId` - The videoId parameter specifies a YouTube video ID for which the custom video thumbnail is being provided. + pub fn set(&self, video_id: &str) -> ThumbnailSetCall<'a, C, A> { + ThumbnailSetCall { + hub: self.hub, + _video_id: video_id.to_string(), + _on_behalf_of_content_owner: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *fanFundingEvent* resources. +/// It is not used directly, but through the `YouTube` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate yup_oauth2 as oauth2; +/// extern crate google_youtube3 as youtube3; +/// +/// # #[test] fn egal() { +/// use std::default::Default; +/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// use youtube3::YouTube; +/// +/// let secret: ApplicationSecret = Default::default(); +/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// hyper::Client::new(), +/// ::default(), None); +/// let mut hub = YouTube::new(hyper::Client::new(), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `list(...)` +/// // to build up your call. +/// let rb = hub.fan_funding_events(); +/// # } +/// ``` +pub struct FanFundingEventMethods<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, +} + +impl<'a, C, A> MethodsBuilder for FanFundingEventMethods<'a, C, A> {} + +impl<'a, C, A> FanFundingEventMethods<'a, C, A> { + + /// Create a builder to help you perform the following task: + /// + /// Lists fan funding events for a channel. + /// + /// # Arguments + /// + /// * `part` - The part parameter specifies the fanFundingEvent resource parts that the API response will include. Supported values are id and snippet. + pub fn list(&self, part: &str) -> FanFundingEventListCall<'a, C, A> { + FanFundingEventListCall { + hub: self.hub, + _part: part.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _hl: Default::default(), + _delegate: Default::default(), + _scopes: Default::default(), + _additional_params: Default::default(), + } + } } @@ -6999,599 +8026,6 @@ impl<'a, C, A> ActivityMethods<'a, C, A> { // CallBuilders ### // ################# -/// Returns a list of application languages that the YouTube website supports. -/// -/// A builder for the *list* method supported by a *i18nLanguage* resource. -/// It is not used directly, but through a `I18nLanguageMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.i18n_languages().list("part") -/// .hl("sadipscing") -/// .doit(); -/// # } -/// ``` -pub struct I18nLanguageListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _hl: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for I18nLanguageListCall<'a, C, A> {} - -impl<'a, C, A> I18nLanguageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, I18nLanguageListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.i18nLanguages.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._hl { - params.push(("hl", value.to_string())); - } - for &field in ["alt", "part", "hl"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/i18nLanguages".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies the i18nLanguage resource properties that the API response will include. Set the parameter value to snippet. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn part(mut self, new_value: &str) -> I18nLanguageListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The hl parameter specifies the language that should be used for text values in the API response. - /// - /// Sets the *hl* query property to the given value. - pub fn hl(mut self, new_value: &str) -> I18nLanguageListCall<'a, C, A> { - self._hl = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> I18nLanguageListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> I18nLanguageListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> I18nLanguageListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Uploads a channel banner image to YouTube. This method represents the first two steps in a three-step process to update the banner image for a channel: -/// -/// - Call the channelBanners.insert method to upload the binary image data to YouTube. The image must have a 16:9 aspect ratio and be at least 2120x1192 pixels. -/// - Extract the url property's value from the response that the API returns for step 1. -/// - Call the channels.update method to update the channel's branding settings. Set the brandingSettings.image.bannerExternalUrl property's value to the URL obtained in step 2. -/// -/// A builder for the *insert* method supported by a *channelBanner* resource. -/// It is not used directly, but through a `ChannelBannerMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::ChannelBannerResource; -/// use std::fs; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = ChannelBannerResource::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `upload(...)`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.channel_banners().insert(req) -/// .on_behalf_of_content_owner("aliquyam") -/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); -/// # } -/// ``` -pub struct ChannelBannerInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: ChannelBannerResource, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ChannelBannerInsertCall<'a, C, A> {} - -impl<'a, C, A> ChannelBannerInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, ChannelBannerResource)> - where RS: ReadSeek { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.channelBanners.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let (mut url, upload_type) = - if protocol == "simple" { - ("https://www.googleapis.com/upload/youtube/v3/channelBanners/insert".to_string(), "multipart") - } else if protocol == "resumable" { - ("https://www.googleapis.com/resumable/upload/youtube/v3/channelBanners/insert".to_string(), "resumable") - } else { - unreachable!() - }; - params.push(("uploadType", upload_type.to_string())); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - let mut should_ask_dlg_for_url = false; - let mut upload_url_from_server; - let mut upload_url: Option = None; - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { - should_ask_dlg_for_url = false; - upload_url_from_server = false; - let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); - hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { - res.status = hyper::status::StatusCode::Ok; - res.headers.set(Location(upload_url.as_ref().unwrap().clone())); - Ok(res) - }) - } else { - let mut mp_reader: MultiPartReader = Default::default(); - let (mut body_reader, content_type) = match protocol { - "simple" => { - mp_reader.reserve_exact(2); - let size = reader.seek(io::SeekFrom::End(0)).unwrap(); - reader.seek(io::SeekFrom::Start(0)).unwrap(); - if size > 6291456 { - return Err(Error::UploadSizeLimitExceeded(size, 6291456)) - } - mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) - .add_part(&mut reader, size, reader_mime_type.clone()); - let mime_type = mp_reader.mime_type(); - (&mut mp_reader as &mut io::Read, ContentType(mime_type)) - }, - _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), - }; - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(content_type) - .body(&mut body_reader); - upload_url_from_server = true; - if protocol == "resumable" { - req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); - } - - dlg.pre_request(); - req.send() - } - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - if protocol == "resumable" { - let size = reader.seek(io::SeekFrom::End(0)).unwrap(); - reader.seek(io::SeekFrom::Start(0)).unwrap(); - if size > 6291456 { - return Err(Error::UploadSizeLimitExceeded(size, 6291456)) - } - let mut client = &mut *self.hub.client.borrow_mut(); - let upload_result = { - let url_str = &res.headers.get::().expect("Location header is part of protocol").0; - if upload_url_from_server { - dlg.store_upload_url(Some(url_str)); - } - - cmn::ResumableUploadHelper { - client: &mut client.borrow_mut(), - delegate: dlg, - start_at: if upload_url_from_server { Some(0) } else { None }, - auth: &mut *self.hub.auth.borrow_mut(), - user_agent: &self.hub._user_agent, - auth_header: auth_header.clone(), - url: url_str, - reader: &mut reader, - media_type: reader_mime_type.clone(), - content_length: size - }.upload() - }; - match upload_result { - None => { - dlg.finished(false); - return Err(Error::Cancelled) - } - Some(Err(err)) => { - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Some(Ok(upload_result)) => { - res = upload_result; - if !res.status.is_success() { - dlg.store_upload_url(None); - dlg.finished(false); - return Err(Error::Failure(res)) - } - } - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - /// Upload media all at once. - /// If the upload fails for whichever reason, all progress is lost. - /// - /// * *max size*: 6MB - /// * *multipart*: yes - /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, ChannelBannerResource)> - where RS: ReadSeek { - self.doit(stream, mime_type, "simple") - } - /// Upload media in a resumable fashion. - /// Even if the upload fails or is interrupted, it can be resumed for a - /// certain amount of time as the server maintains state temporarily. - /// - /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL - /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate - /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using - /// `cancel_chunk_upload(...)`. - /// - /// * *max size*: 6MB - /// * *multipart*: yes - /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, ChannelBannerResource)> - where RS: ReadSeek { - self.doit(resumeable_stream, mime_type, "resumable") - } - - /// - /// Sets the *request* property to the given value. - /// - /// 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: ChannelBannerResource) -> ChannelBannerInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> ChannelBannerInsertCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ChannelBannerInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ChannelBannerInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ChannelBannerInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - /// Returns channelSection resources that match the API request criteria. /// /// A builder for the *list* method supported by a *channelSection* resource. @@ -7606,12 +8040,12 @@ impl<'a, C, A> ChannelBannerInsertCall<'a, C, A> where C: BorrowMut ChannelBannerInsertCall<'a, C, A> where C: BorrowMut ChannelSectionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.channelSections.list", + dlg.begin(MethodInfo { id: "youtube.channelSections.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); params.push(("part", self._part.to_string())); @@ -7709,7 +8143,7 @@ impl<'a, C, A> ChannelSectionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -7745,7 +8179,7 @@ impl<'a, C, A> ChannelSectionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -7755,10 +8189,10 @@ impl<'a, C, A> ChannelSectionListCall<'a, C, A> where C: BorrowMut ChannelSectionListCall<'a, C, A> where C: BorrowMut ChannelSectionListCall<'a, C, A> where C: BorrowMut ChannelSectionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ChannelSectionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChannelSectionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -7907,11 +8341,11 @@ impl<'a, C, A> ChannelSectionListCall<'a, C, A> where C: BorrowMut ChannelSectionListCall<'a, C, A> where C: BorrowMut ChannelSectionInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.channelSections.insert", + dlg.begin(MethodInfo { id: "youtube.channelSections.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._part.len() == 0 { @@ -8006,14 +8440,14 @@ impl<'a, C, A> ChannelSectionInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8057,7 +8491,7 @@ impl<'a, C, A> ChannelSectionInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8067,10 +8501,10 @@ impl<'a, C, A> ChannelSectionInsertCall<'a, C, A> where C: BorrowMut ChannelSectionInsertCall<'a, C, A> where C: BorrowMut ChannelSectionInsertCall<'a, C, A> where C: BorrowMut ChannelSectionInsertCall<'a, C, A> where C: BorrowMut ChannelSectionInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ChannelSectionInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChannelSectionInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8232,7 +8666,7 @@ impl<'a, C, A> ChannelSectionInsertCall<'a, C, A> where C: BorrowMut ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.channelSections.delete", + dlg.begin(MethodInfo { id: "youtube.channelSections.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -8284,7 +8718,7 @@ impl<'a, C, A> ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -8320,7 +8754,7 @@ impl<'a, C, A> ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8330,10 +8764,10 @@ impl<'a, C, A> ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut ChannelSectionDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -8383,12 +8817,12 @@ impl<'a, C, A> ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ChannelSectionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChannelSectionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -8436,11 +8870,11 @@ impl<'a, C, A> ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.channelSections.update", + dlg.begin(MethodInfo { id: "youtube.channelSections.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if self._part.len() == 0 { @@ -8530,14 +8964,14 @@ impl<'a, C, A> ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -8581,7 +9015,7 @@ impl<'a, C, A> ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -8591,10 +9025,10 @@ impl<'a, C, A> ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> ChannelSectionUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a list of categories that can be associated with YouTube channels. -/// -/// A builder for the *list* method supported by a *guideCategory* resource. -/// It is not used directly, but through a `GuideCategoryMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.guide_categories().list("part") -/// .region_code("sea") -/// .id("Lorem") -/// .hl("eos") -/// .doit(); -/// # } -/// ``` -pub struct GuideCategoryListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _region_code: Option, - _id: Option, - _hl: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for GuideCategoryListCall<'a, C, A> {} - -impl<'a, C, A> GuideCategoryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, GuideCategoryListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.guideCategories.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._region_code { - params.push(("regionCode", value.to_string())); - } - if let Some(value) = self._id { - params.push(("id", value.to_string())); - } - if let Some(value) = self._hl { - params.push(("hl", value.to_string())); - } - for &field in ["alt", "part", "regionCode", "id", "hl"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/guideCategories".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies the guideCategory resource properties that the API response will include. Set the parameter value to snippet. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn part(mut self, new_value: &str) -> GuideCategoryListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The regionCode parameter instructs the API to return the list of guide categories available in the specified country. The parameter value is an ISO 3166-1 alpha-2 country code. - /// - /// Sets the *region code* query property to the given value. - pub fn region_code(mut self, new_value: &str) -> GuideCategoryListCall<'a, C, A> { - self._region_code = Some(new_value.to_string()); - self - } - /// The id parameter specifies a comma-separated list of the YouTube channel category ID(s) for the resource(s) that are being retrieved. In a guideCategory resource, the id property specifies the YouTube channel category ID. - /// - /// Sets the *id* query property to the given value. - pub fn id(mut self, new_value: &str) -> GuideCategoryListCall<'a, C, A> { - self._id = Some(new_value.to_string()); - self - } - /// The hl parameter specifies the language that will be used for text values in the API response. - /// - /// Sets the *hl* query property to the given value. - pub fn hl(mut self, new_value: &str) -> GuideCategoryListCall<'a, C, A> { - self._hl = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> GuideCategoryListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> GuideCategoryListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> GuideCategoryListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ChannelSectionUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9002,8 +9185,8 @@ impl<'a, C, A> GuideCategoryListCall<'a, C, A> where C: BorrowMut /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.playlists().insert(req) -/// .on_behalf_of_content_owner_channel("erat") -/// .on_behalf_of_content_owner("sadipscing") +/// .on_behalf_of_content_owner_channel("eos") +/// .on_behalf_of_content_owner("erat") /// .doit(); /// # } /// ``` @@ -9034,7 +9217,7 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.playlists.insert", + dlg.begin(MethodInfo { id: "youtube.playlists.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._part.len() == 0 { @@ -9064,14 +9247,14 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9115,7 +9298,7 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9125,10 +9308,10 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9160,7 +9343,7 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Playlist) -> PlaylistInsertCall<'a, C, A> { self._request = new_value; @@ -9170,10 +9353,10 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *part* query property to the given value. /// - /// Even though the *parts* list is automatically derived from *Resource* passed in + /// Even though the *parts* list is automatically derived from *Resource* passed in /// during instantiation and indicates which values you are passing, the response would contain the very same parts. /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify + /// like statistics that are generated server side. Therefore you should use this method to specify /// the parts you provide in addition to the ones you want in the response. pub fn part(mut self, new_value: &str) -> PlaylistInsertCall<'a, C, A> { self._part = new_value.to_string(); @@ -9211,12 +9394,12 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9233,17 +9416,17 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlaylistInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlaylistInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9278,14 +9461,14 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.playlists().list("part") -/// .page_token("eirmod") -/// .on_behalf_of_content_owner_channel("elitr") -/// .on_behalf_of_content_owner("amet") +/// .page_token("dolor") +/// .on_behalf_of_content_owner_channel("eirmod") +/// .on_behalf_of_content_owner("elitr") /// .mine(false) -/// .max_results(65) -/// .id("eirmod") -/// .hl("dolore") -/// .channel_id("invidunt") +/// .max_results(41) +/// .id("labore") +/// .hl("eirmod") +/// .channel_id("dolore") /// .doit(); /// # } /// ``` @@ -9321,7 +9504,7 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.playlists.list", + dlg.begin(MethodInfo { id: "youtube.playlists.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("part", self._part.to_string())); @@ -9366,7 +9549,7 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9402,7 +9585,7 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9412,10 +9595,10 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9450,7 +9633,7 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *part* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn part(mut self, new_value: &str) -> PlaylistListCall<'a, C, A> { self._part = new_value.to_string(); @@ -9530,12 +9713,12 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9552,17 +9735,17 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlaylistListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlaylistListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9597,7 +9780,7 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.playlists().delete("id") -/// .on_behalf_of_content_owner("accusam") +/// .on_behalf_of_content_owner("aliquyam") /// .doit(); /// # } /// ``` @@ -9626,7 +9809,7 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.playlists.delete", + dlg.begin(MethodInfo { id: "youtube.playlists.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -9649,7 +9832,7 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -9685,7 +9868,7 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9695,10 +9878,10 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9721,7 +9904,7 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> PlaylistDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -9748,12 +9931,12 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -9770,17 +9953,17 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlaylistDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlaylistDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -9821,7 +10004,7 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.playlists().update(req) -/// .on_behalf_of_content_owner("Lorem") +/// .on_behalf_of_content_owner("accusam") /// .doit(); /// # } /// ``` @@ -9851,7 +10034,7 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.playlists.update", + dlg.begin(MethodInfo { id: "youtube.playlists.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if self._part.len() == 0 { @@ -9878,14 +10061,14 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -9929,7 +10112,7 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9939,10 +10122,10 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -9974,7 +10157,7 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Playlist) -> PlaylistUpdateCall<'a, C, A> { self._request = new_value; @@ -9986,10 +10169,10 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *part* query property to the given value. /// - /// Even though the *parts* list is automatically derived from *Resource* passed in + /// Even though the *parts* list is automatically derived from *Resource* passed in /// during instantiation and indicates which values you are passing, the response would contain the very same parts. /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify + /// like statistics that are generated server side. Therefore you should use this method to specify /// the parts you provide in addition to the ones you want in the response. pub fn part(mut self, new_value: &str) -> PlaylistUpdateCall<'a, C, A> { self._part = new_value.to_string(); @@ -10016,12 +10199,12 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10038,355 +10221,17 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> PlaylistUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Uploads a custom video thumbnail to YouTube and sets it for a video. -/// -/// A builder for the *set* method supported by a *thumbnail* resource. -/// It is not used directly, but through a `ThumbnailMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use std::fs; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), auth); -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `upload(...)`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.thumbnails().set("videoId") -/// .on_behalf_of_content_owner("et") -/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); -/// # } -/// ``` -pub struct ThumbnailSetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _video_id: String, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ThumbnailSetCall<'a, C, A> {} - -impl<'a, C, A> ThumbnailSetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, ThumbnailSetResponse)> - where RS: ReadSeek { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.thumbnails.set", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("videoId", self._video_id.to_string())); - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "videoId", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let (mut url, upload_type) = - if protocol == "simple" { - ("https://www.googleapis.com/upload/youtube/v3/thumbnails/set".to_string(), "multipart") - } else if protocol == "resumable" { - ("https://www.googleapis.com/resumable/upload/youtube/v3/thumbnails/set".to_string(), "resumable") - } else { - unreachable!() - }; - params.push(("uploadType", upload_type.to_string())); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - let mut should_ask_dlg_for_url = false; - let mut upload_url_from_server; - let mut upload_url: Option = None; - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { - should_ask_dlg_for_url = false; - upload_url_from_server = false; - let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); - hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { - res.status = hyper::status::StatusCode::Ok; - res.headers.set(Location(upload_url.as_ref().unwrap().clone())); - Ok(res) - }) - } else { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - if protocol == "simple" { - let size = reader.seek(io::SeekFrom::End(0)).unwrap(); - reader.seek(io::SeekFrom::Start(0)).unwrap(); - if size > 2097152 { - return Err(Error::UploadSizeLimitExceeded(size, 2097152)) - } - req = req.header(ContentType(reader_mime_type.clone())) - .header(ContentLength(size)) - .body(&mut reader); - } - upload_url_from_server = true; - if protocol == "resumable" { - req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); - } - - dlg.pre_request(); - req.send() - } - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - if protocol == "resumable" { - let size = reader.seek(io::SeekFrom::End(0)).unwrap(); - reader.seek(io::SeekFrom::Start(0)).unwrap(); - if size > 2097152 { - return Err(Error::UploadSizeLimitExceeded(size, 2097152)) - } - let mut client = &mut *self.hub.client.borrow_mut(); - let upload_result = { - let url_str = &res.headers.get::().expect("Location header is part of protocol").0; - if upload_url_from_server { - dlg.store_upload_url(Some(url_str)); - } - - cmn::ResumableUploadHelper { - client: &mut client.borrow_mut(), - delegate: dlg, - start_at: if upload_url_from_server { Some(0) } else { None }, - auth: &mut *self.hub.auth.borrow_mut(), - user_agent: &self.hub._user_agent, - auth_header: auth_header.clone(), - url: url_str, - reader: &mut reader, - media_type: reader_mime_type.clone(), - content_length: size - }.upload() - }; - match upload_result { - None => { - dlg.finished(false); - return Err(Error::Cancelled) - } - Some(Err(err)) => { - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Some(Ok(upload_result)) => { - res = upload_result; - if !res.status.is_success() { - dlg.store_upload_url(None); - dlg.finished(false); - return Err(Error::Failure(res)) - } - } - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - /// Upload media all at once. - /// If the upload fails for whichever reason, all progress is lost. - /// - /// * *max size*: 2MB - /// * *multipart*: yes - /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, ThumbnailSetResponse)> - where RS: ReadSeek { - self.doit(stream, mime_type, "simple") - } - /// Upload media in a resumable fashion. - /// Even if the upload fails or is interrupted, it can be resumed for a - /// certain amount of time as the server maintains state temporarily. - /// - /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL - /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate - /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using - /// `cancel_chunk_upload(...)`. - /// - /// * *max size*: 2MB - /// * *multipart*: yes - /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, ThumbnailSetResponse)> - where RS: ReadSeek { - self.doit(resumeable_stream, mime_type, "resumable") - } - - /// The videoId parameter specifies a YouTube video ID for which the custom video thumbnail is being provided. - /// - /// Sets the *video id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn video_id(mut self, new_value: &str) -> ThumbnailSetCall<'a, C, A> { - self._video_id = new_value.to_string(); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> ThumbnailSetCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ThumbnailSetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ThumbnailSetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ThumbnailSetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> PlaylistUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10427,7 +10272,7 @@ impl<'a, C, A> ThumbnailSetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.videos().report_abuse(req) -/// .on_behalf_of_content_owner("duo") +/// .on_behalf_of_content_owner("Lorem") /// .doit(); /// # } /// ``` @@ -10456,7 +10301,7 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.videos.reportAbuse", + dlg.begin(MethodInfo { id: "youtube.videos.reportAbuse", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); if let Some(value) = self._on_behalf_of_content_owner { @@ -10478,14 +10323,14 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -10529,7 +10374,7 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10539,10 +10384,10 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10564,7 +10409,7 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: VideoAbuseReport) -> VideoReportAbuseCall<'a, C, A> { self._request = new_value; @@ -10591,12 +10436,12 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10613,17 +10458,17 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VideoReportAbuseCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VideoReportAbuseCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -10658,16 +10503,16 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.videos().list("part") -/// .video_category_id("eirmod") -/// .region_code("sanctus") +/// .video_category_id("et") +/// .region_code("duo") /// .page_token("et") -/// .on_behalf_of_content_owner("amet") -/// .my_rating("et") -/// .max_results(56) -/// .locale("ut") -/// .id("ea") -/// .hl("sed") -/// .chart("dolor") +/// .on_behalf_of_content_owner("eirmod") +/// .my_rating("sanctus") +/// .max_results(79) +/// .locale("amet") +/// .id("et") +/// .hl("consetetur") +/// .chart("ut") /// .doit(); /// # } /// ``` @@ -10705,7 +10550,7 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.videos.list", + dlg.begin(MethodInfo { id: "youtube.videos.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("part", self._part.to_string())); @@ -10756,7 +10601,7 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -10792,7 +10637,7 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10802,10 +10647,10 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -10840,7 +10685,7 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *part* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn part(mut self, new_value: &str) -> VideoListCall<'a, C, A> { self._part = new_value.to_string(); @@ -10936,12 +10781,12 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -10958,17 +10803,17 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VideoListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VideoListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11031,7 +10876,7 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.videos.rate", + dlg.begin(MethodInfo { id: "youtube.videos.rate", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -11052,7 +10897,7 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11088,7 +10933,7 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11098,10 +10943,10 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11124,7 +10969,7 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> VideoRateCall<'a, C, A> { self._id = new_value.to_string(); @@ -11134,7 +10979,7 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *rating* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn rating(mut self, new_value: &str) -> VideoRateCall<'a, C, A> { self._rating = new_value.to_string(); @@ -11152,12 +10997,12 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11174,17 +11019,17 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VideoRateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VideoRateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11219,7 +11064,7 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.videos().get_rating("id") -/// .on_behalf_of_content_owner("consetetur") +/// .on_behalf_of_content_owner("dolor") /// .doit(); /// # } /// ``` @@ -11248,7 +11093,7 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.videos.getRating", + dlg.begin(MethodInfo { id: "youtube.videos.getRating", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -11272,7 +11117,7 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11308,7 +11153,7 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11318,10 +11163,10 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11354,7 +11199,7 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> VideoGetRatingCall<'a, C, A> { self._id = new_value.to_string(); @@ -11381,12 +11226,12 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11403,17 +11248,17 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VideoGetRatingCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VideoGetRatingCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11448,7 +11293,7 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.videos().delete("id") -/// .on_behalf_of_content_owner("voluptua.") +/// .on_behalf_of_content_owner("et") /// .doit(); /// # } /// ``` @@ -11477,7 +11322,7 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.videos.delete", + dlg.begin(MethodInfo { id: "youtube.videos.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -11500,7 +11345,7 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -11536,7 +11381,7 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11546,10 +11391,10 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11572,7 +11417,7 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> VideoDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -11599,12 +11444,12 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11621,17 +11466,17 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VideoDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VideoDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11672,7 +11517,7 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.videos().update(req) -/// .on_behalf_of_content_owner("Lorem") +/// .on_behalf_of_content_owner("consetetur") /// .doit(); /// # } /// ``` @@ -11702,7 +11547,7 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.videos.update", + dlg.begin(MethodInfo { id: "youtube.videos.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if self._part.len() == 0 { @@ -11729,14 +11574,14 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -11780,7 +11625,7 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11790,10 +11635,10 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -11825,7 +11670,7 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Video) -> VideoUpdateCall<'a, C, A> { self._request = new_value; @@ -11839,10 +11684,10 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *part* query property to the given value. /// - /// Even though the *parts* list is automatically derived from *Resource* passed in + /// Even though the *parts* list is automatically derived from *Resource* passed in /// during instantiation and indicates which values you are passing, the response would contain the very same parts. /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify + /// like statistics that are generated server side. Therefore you should use this method to specify /// the parts you provide in addition to the ones you want in the response. pub fn part(mut self, new_value: &str) -> VideoUpdateCall<'a, C, A> { self._part = new_value.to_string(); @@ -11869,12 +11714,12 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -11891,17 +11736,17 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VideoUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VideoUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -11943,9 +11788,9 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `upload_resumable(...)`. /// // Values shown here are possibly random and not representative ! /// let result = hub.videos().insert(req) -/// .stabilize(true) -/// .on_behalf_of_content_owner_channel("justo") -/// .on_behalf_of_content_owner("sit") +/// .stabilize(false) +/// .on_behalf_of_content_owner_channel("voluptua.") +/// .on_behalf_of_content_owner("Lorem") /// .notify_subscribers(true) /// .auto_levels(true) /// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); @@ -11982,7 +11827,7 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.videos.insert", + dlg.begin(MethodInfo { id: "youtube.videos.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); if self._part.len() == 0 { @@ -12016,27 +11861,27 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o params.push(("alt", "json".to_string())); - let (mut url, upload_type) = + let (mut url, upload_type) = if protocol == "simple" { ("https://www.googleapis.com/upload/youtube/v3/videos".to_string(), "multipart") } else if protocol == "resumable" { ("https://www.googleapis.com/resumable/upload/youtube/v3/videos".to_string(), "resumable") - } else { - unreachable!() + } else { + unreachable!() }; params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12113,7 +11958,7 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12123,10 +11968,10 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12229,7 +12074,7 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Video) -> VideoInsertCall<'a, C, A> { self._request = new_value; @@ -12241,10 +12086,10 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *part* query property to the given value. /// - /// Even though the *parts* list is automatically derived from *Resource* passed in + /// Even though the *parts* list is automatically derived from *Resource* passed in /// during instantiation and indicates which values you are passing, the response would contain the very same parts. /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify + /// like statistics that are generated server side. Therefore you should use this method to specify /// the parts you provide in addition to the ones you want in the response. pub fn part(mut self, new_value: &str) -> VideoInsertCall<'a, C, A> { self._part = new_value.to_string(); @@ -12303,12 +12148,12 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12325,17 +12170,10290 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VideoInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> VideoInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of channel activity events that match the request criteria. For example, you can retrieve events associated with a particular channel, events associated with the user's subscriptions and Google+ friends, or the YouTube home page feed, which is customized for each user. +/// +/// A builder for the *list* method supported by a *activity* resource. +/// It is not used directly, but through a `ActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.activities().list("part") +/// .region_code("vero") +/// .published_before("diam") +/// .published_after("rebum.") +/// .page_token("consetetur") +/// .mine(true) +/// .max_results(25) +/// .home(false) +/// .channel_id("invidunt") +/// .doit(); +/// # } +/// ``` +pub struct ActivityListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _region_code: Option, + _published_before: Option, + _published_after: Option, + _page_token: Option, + _mine: Option, + _max_results: Option, + _home: Option, + _channel_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ActivityListCall<'a, C, A> {} + +impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ActivityListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.activities.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._region_code { + params.push(("regionCode", value.to_string())); + } + if let Some(value) = self._published_before { + params.push(("publishedBefore", value.to_string())); + } + if let Some(value) = self._published_after { + params.push(("publishedAfter", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._mine { + params.push(("mine", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._home { + params.push(("home", value.to_string())); + } + if let Some(value) = self._channel_id { + params.push(("channelId", value.to_string())); + } + for &field in ["alt", "part", "regionCode", "publishedBefore", "publishedAfter", "pageToken", "mine", "maxResults", "home", "channelId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/activities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies a comma-separated list of one or more activity resource properties that the API response will include. + /// + /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in an activity resource, the snippet property contains other properties that identify the type of activity, a display title for the activity, and so forth. If you set part=snippet, the API response will also contain all of those nested properties. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn part(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The regionCode parameter instructs the API to return results for the specified country. The parameter value is an ISO 3166-1 alpha-2 country code. YouTube uses this value when the authorized user's previous activity on YouTube does not provide enough information to generate the activity feed. + /// + /// Sets the *region code* query property to the given value. + pub fn region_code(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { + self._region_code = Some(new_value.to_string()); + self + } + /// The publishedBefore parameter specifies the date and time before which an activity must have occurred for that activity to be included in the API response. If the parameter value specifies a day, but not a time, then any activities that occurred that day will be excluded from the result set. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. + /// + /// Sets the *published before* query property to the given value. + pub fn published_before(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { + self._published_before = Some(new_value.to_string()); + self + } + /// The publishedAfter parameter specifies the earliest date and time that an activity could have occurred for that activity to be included in the API response. If the parameter value specifies a day, but not a time, then any activities that occurred that day will be included in the result set. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. + /// + /// Sets the *published after* query property to the given value. + pub fn published_after(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { + self._published_after = Some(new_value.to_string()); + self + } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Set this parameter's value to true to retrieve a feed of the authenticated user's activities. + /// + /// Sets the *mine* query property to the given value. + pub fn mine(mut self, new_value: bool) -> ActivityListCall<'a, C, A> { + self._mine = Some(new_value); + self + } + /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> ActivityListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Set this parameter's value to true to retrieve the activity feed that displays on the YouTube home page for the currently authenticated user. + /// + /// Sets the *home* query property to the given value. + pub fn home(mut self, new_value: bool) -> ActivityListCall<'a, C, A> { + self._home = Some(new_value); + self + } + /// The channelId parameter specifies a unique YouTube channel ID. The API will then return a list of that channel's activities. + /// + /// Sets the *channel id* query property to the given value. + pub fn channel_id(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { + self._channel_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ActivityListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ActivityListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ActivityListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Posts a bulletin for a specific channel. (The user submitting the request must be authorized to act on the channel's behalf.) +/// +/// Note: Even though an activity resource can contain information about actions like a user rating a video or marking a video as a favorite, you need to use other API methods to generate those activity resources. For example, you would use the API's videos.rate() method to rate a video and the playlistItems.insert() method to mark a video as a favorite. +/// +/// A builder for the *insert* method supported by a *activity* resource. +/// It is not used directly, but through a `ActivityMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::Activity; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = Activity::default(); +/// +/// // 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 ! +/// let result = hub.activities().insert(req) +/// .doit(); +/// # } +/// ``` +pub struct ActivityInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: Activity, + _part: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ActivityInsertCall<'a, C, A> {} + +impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Activity)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.activities.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + for &field in ["alt", "part"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/activities".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Activity) -> ActivityInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> ActivityInsertCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ActivityInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ActivityInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ActivityInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a video stream. If the properties that you want to change cannot be updated, then you need to create a new stream with the proper settings. +/// +/// A builder for the *update* method supported by a *liveStream* resource. +/// It is not used directly, but through a `LiveStreamMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// * *cdn* +/// * *status* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// +/// The default scope will be `Scope::Full`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::LiveStream; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = LiveStream::default(); +/// req.status = Default::default(); // is LiveStreamStatus +/// req.snippet = Default::default(); // is LiveStreamSnippet +/// req.cdn = Default::default(); // is CdnSettings +/// req.id = Some("consetetur".to_string()); +/// +/// // 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 ! +/// let result = hub.live_streams().update(req) +/// .on_behalf_of_content_owner_channel("dolore") +/// .on_behalf_of_content_owner("duo") +/// .doit(); +/// # } +/// ``` +pub struct LiveStreamUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: LiveStream, + _part: String, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveStreamUpdateCall<'a, C, A> {} + +impl<'a, C, A> LiveStreamUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveStream)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveStreams.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["alt", "part", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *cdn* + /// * *status* + pub fn request(mut self, new_value: LiveStream) -> LiveStreamUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. + /// + /// The part properties that you can include in the parameter value are id, snippet, cdn, and status. + /// + /// Note that this method will override the existing values for all of the mutable properties that are contained in any parts that the parameter value specifies. If the request body does not specify a value for a mutable property, the existing value for that property will be removed. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *cdn* + /// * *status* + pub fn part(mut self, new_value: &str) -> LiveStreamUpdateCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveStreamUpdateCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveStreamUpdateCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveStreamUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveStreamUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveStreamUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a video stream. +/// +/// A builder for the *delete* method supported by a *liveStream* resource. +/// It is not used directly, but through a `LiveStreamMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_streams().delete("id") +/// .on_behalf_of_content_owner_channel("Lorem") +/// .on_behalf_of_content_owner("et") +/// .doit(); +/// # } +/// ``` +pub struct LiveStreamDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveStreamDeleteCall<'a, C, A> {} + +impl<'a, C, A> LiveStreamDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveStreams.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["id", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter specifies the YouTube live stream ID for the resource that is being deleted. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LiveStreamDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveStreamDeleteCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveStreamDeleteCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveStreamDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveStreamDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveStreamDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of video streams that match the API request parameters. +/// +/// A builder for the *list* method supported by a *liveStream* resource. +/// It is not used directly, but through a `LiveStreamMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// * *cdn* +/// * *status* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// * *https://www.googleapis.com/auth/youtube.readonly* +/// +/// The default scope will be `Scope::Readonly`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_streams().list("part") +/// .page_token("consetetur") +/// .on_behalf_of_content_owner_channel("takimata") +/// .on_behalf_of_content_owner("nonumy") +/// .mine(true) +/// .max_results(94) +/// .id("takimata") +/// .doit(); +/// # } +/// ``` +pub struct LiveStreamListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _page_token: Option, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _mine: Option, + _max_results: Option, + _id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveStreamListCall<'a, C, A> {} + +impl<'a, C, A> LiveStreamListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveStreamListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveStreams.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + if let Some(value) = self._mine { + params.push(("mine", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._id { + params.push(("id", value.to_string())); + } + for &field in ["alt", "part", "pageToken", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner", "mine", "maxResults", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies a comma-separated list of one or more liveStream resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, cdn, and status. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *cdn* + /// * *status* + pub fn part(mut self, new_value: &str) -> LiveStreamListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> LiveStreamListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveStreamListCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveStreamListCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The mine parameter can be used to instruct the API to only return streams owned by the authenticated user. Set the parameter value to true to only retrieve your own streams. + /// + /// Sets the *mine* query property to the given value. + pub fn mine(mut self, new_value: bool) -> LiveStreamListCall<'a, C, A> { + self._mine = Some(new_value); + self + } + /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> LiveStreamListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The id parameter specifies a comma-separated list of YouTube stream IDs that identify the streams being retrieved. In a liveStream resource, the id property specifies the stream's ID. + /// + /// Sets the *id* query property to the given value. + pub fn id(mut self, new_value: &str) -> LiveStreamListCall<'a, C, A> { + self._id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveStreamListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveStreamListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveStreamListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a video stream. The stream enables you to send your video to YouTube, which can then broadcast the video to your audience. +/// +/// A builder for the *insert* method supported by a *liveStream* resource. +/// It is not used directly, but through a `LiveStreamMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// * *cdn* +/// * *status* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// +/// The default scope will be `Scope::Full`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::LiveStream; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = LiveStream::default(); +/// req.status = Default::default(); // is LiveStreamStatus +/// req.snippet = Default::default(); // is LiveStreamSnippet +/// req.cdn = Default::default(); // is CdnSettings +/// req.id = Some("At".to_string()); +/// +/// // 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 ! +/// let result = hub.live_streams().insert(req) +/// .on_behalf_of_content_owner_channel("labore") +/// .on_behalf_of_content_owner("invidunt") +/// .doit(); +/// # } +/// ``` +pub struct LiveStreamInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: LiveStream, + _part: String, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveStreamInsertCall<'a, C, A> {} + +impl<'a, C, A> LiveStreamInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveStream)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveStreams.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["alt", "part", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *cdn* + /// * *status* + pub fn request(mut self, new_value: LiveStream) -> LiveStreamInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. + /// + /// The part properties that you can include in the parameter value are id, snippet, cdn, and status. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *cdn* + /// * *status* + pub fn part(mut self, new_value: &str) -> LiveStreamInsertCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveStreamInsertCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveStreamInsertCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveStreamInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveStreamInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveStreamInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a channel's metadata. Note that this method currently only supports updates to the channel resource's brandingSettings and invideoPromotion objects and their child properties. +/// +/// A builder for the *update* method supported by a *channel* resource. +/// It is not used directly, but through a `ChannelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::Channel; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = Channel::default(); +/// +/// // 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 ! +/// let result = hub.channels().update(req) +/// .on_behalf_of_content_owner("ea") +/// .doit(); +/// # } +/// ``` +pub struct ChannelUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: Channel, + _part: String, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChannelUpdateCall<'a, C, A> {} + +impl<'a, C, A> ChannelUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Channel)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.channels.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["alt", "part", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/channels".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Channel) -> ChannelUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. + /// + /// The API currently only allows the parameter value to be set to either brandingSettings or invideoPromotion. (You cannot update both of those parts with a single request.) + /// + /// Note that this method overrides the existing values for all of the mutable properties that are contained in any parts that the parameter value specifies. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> ChannelUpdateCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The onBehalfOfContentOwner parameter indicates that the authenticated user is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with needs to be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> ChannelUpdateCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChannelUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChannelUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChannelUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a collection of zero or more channel resources that match the request criteria. +/// +/// A builder for the *list* method supported by a *channel* resource. +/// It is not used directly, but through a `ChannelMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.channels().list("part") +/// .page_token("rebum.") +/// .on_behalf_of_content_owner("dolore") +/// .my_subscribers(true) +/// .mine(true) +/// .max_results(19) +/// .managed_by_me(false) +/// .id("eirmod") +/// .hl("consetetur") +/// .for_username("labore") +/// .category_id("sed") +/// .doit(); +/// # } +/// ``` +pub struct ChannelListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _page_token: Option, + _on_behalf_of_content_owner: Option, + _my_subscribers: Option, + _mine: Option, + _max_results: Option, + _managed_by_me: Option, + _id: Option, + _hl: Option, + _for_username: Option, + _category_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChannelListCall<'a, C, A> {} + +impl<'a, C, A> ChannelListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, ChannelListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.channels.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + if let Some(value) = self._my_subscribers { + params.push(("mySubscribers", value.to_string())); + } + if let Some(value) = self._mine { + params.push(("mine", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._managed_by_me { + params.push(("managedByMe", value.to_string())); + } + if let Some(value) = self._id { + params.push(("id", value.to_string())); + } + if let Some(value) = self._hl { + params.push(("hl", value.to_string())); + } + if let Some(value) = self._for_username { + params.push(("forUsername", value.to_string())); + } + if let Some(value) = self._category_id { + params.push(("categoryId", value.to_string())); + } + for &field in ["alt", "part", "pageToken", "onBehalfOfContentOwner", "mySubscribers", "mine", "maxResults", "managedByMe", "id", "hl", "forUsername", "categoryId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/channels".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies a comma-separated list of one or more channel resource properties that the API response will include. + /// + /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a channel resource, the contentDetails property contains other properties, such as the uploads properties. As such, if you set part=contentDetails, the API response will also contain all of those nested properties. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn part(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// Use the subscriptions.list method and its mySubscribers parameter to retrieve a list of subscribers to the authenticated user's channel. + /// + /// Sets the *my subscribers* query property to the given value. + pub fn my_subscribers(mut self, new_value: bool) -> ChannelListCall<'a, C, A> { + self._my_subscribers = Some(new_value); + self + } + /// Set this parameter's value to true to instruct the API to only return channels owned by the authenticated user. + /// + /// Sets the *mine* query property to the given value. + pub fn mine(mut self, new_value: bool) -> ChannelListCall<'a, C, A> { + self._mine = Some(new_value); + self + } + /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> ChannelListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// Set this parameter's value to true to instruct the API to only return channels managed by the content owner that the onBehalfOfContentOwner parameter specifies. The user must be authenticated as a CMS account linked to the specified content owner and onBehalfOfContentOwner must be provided. + /// + /// Sets the *managed by me* query property to the given value. + pub fn managed_by_me(mut self, new_value: bool) -> ChannelListCall<'a, C, A> { + self._managed_by_me = Some(new_value); + self + } + /// The id parameter specifies a comma-separated list of the YouTube channel ID(s) for the resource(s) that are being retrieved. In a channel resource, the id property specifies the channel's YouTube channel ID. + /// + /// Sets the *id* query property to the given value. + pub fn id(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { + self._id = Some(new_value.to_string()); + self + } + /// The hl parameter should be used for filter out the properties that are not in the given language. Used for the brandingSettings part. + /// + /// Sets the *hl* query property to the given value. + pub fn hl(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { + self._hl = Some(new_value.to_string()); + self + } + /// The forUsername parameter specifies a YouTube username, thereby requesting the channel associated with that username. + /// + /// Sets the *for username* query property to the given value. + pub fn for_username(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { + self._for_username = Some(new_value.to_string()); + self + } + /// The categoryId parameter specifies a YouTube guide category, thereby requesting YouTube channels associated with that category. + /// + /// Sets the *category id* query property to the given value. + pub fn category_id(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { + self._category_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChannelListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChannelListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChannelListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Uploads a watermark image to YouTube and sets it for a channel. +/// +/// A builder for the *set* method supported by a *watermark* resource. +/// It is not used directly, but through a `WatermarkMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::InvideoBranding; +/// use std::fs; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = InvideoBranding::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.watermarks().set(req, "channelId") +/// .on_behalf_of_content_owner("gubergren") +/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct WatermarkSetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: InvideoBranding, + _channel_id: String, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for WatermarkSetCall<'a, C, A> {} + +impl<'a, C, A> WatermarkSetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result + where RS: ReadSeek { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.watermarks.set", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("channelId", self._channel_id.to_string())); + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["channelId", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let (mut url, upload_type) = + if protocol == "simple" { + ("https://www.googleapis.com/upload/youtube/v3/watermarks/set".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://www.googleapis.com/resumable/upload/youtube/v3/watermarks/set".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut mp_reader: MultiPartReader = Default::default(); + let (mut body_reader, content_type) = match protocol { + "simple" => { + mp_reader.reserve_exact(2); + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 10485760 { + return Err(Error::UploadSizeLimitExceeded(size, 10485760)) + } + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) + .add_part(&mut reader, size, reader_mime_type.clone()); + let mime_type = mp_reader.mime_type(); + (&mut mp_reader as &mut io::Read, ContentType(mime_type)) + }, + _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), + }; + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(content_type) + .body(&mut body_reader); + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 10485760 { + return Err(Error::UploadSizeLimitExceeded(size, 10485760)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 10MB + /// * *multipart*: yes + /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 10MB + /// * *multipart*: yes + /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// + /// Sets the *request* property to the given value. + /// + /// 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: InvideoBranding) -> WatermarkSetCall<'a, C, A> { + self._request = new_value; + self + } + /// The channelId parameter specifies the YouTube channel ID for which the watermark is being provided. + /// + /// Sets the *channel id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn channel_id(mut self, new_value: &str) -> WatermarkSetCall<'a, C, A> { + self._channel_id = new_value.to_string(); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> WatermarkSetCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> WatermarkSetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> WatermarkSetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> WatermarkSetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a channel's watermark image. +/// +/// A builder for the *unset* method supported by a *watermark* resource. +/// It is not used directly, but through a `WatermarkMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.watermarks().unset("channelId") +/// .on_behalf_of_content_owner("eos") +/// .doit(); +/// # } +/// ``` +pub struct WatermarkUnsetCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _channel_id: String, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for WatermarkUnsetCall<'a, C, A> {} + +impl<'a, C, A> WatermarkUnsetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.watermarks.unset", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); + params.push(("channelId", self._channel_id.to_string())); + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["channelId", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/watermarks/unset".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The channelId parameter specifies the YouTube channel ID for which the watermark is being unset. + /// + /// Sets the *channel id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn channel_id(mut self, new_value: &str) -> WatermarkUnsetCall<'a, C, A> { + self._channel_id = new_value.to_string(); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> WatermarkUnsetCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> WatermarkUnsetCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> WatermarkUnsetCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> WatermarkUnsetCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Adds a new moderator for the chat. +/// +/// A builder for the *insert* method supported by a *liveChatModerator* resource. +/// It is not used directly, but through a `LiveChatModeratorMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::LiveChatModerator; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = LiveChatModerator::default(); +/// +/// // 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 ! +/// let result = hub.live_chat_moderators().insert(req) +/// .doit(); +/// # } +/// ``` +pub struct LiveChatModeratorInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: LiveChatModerator, + _part: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveChatModeratorInsertCall<'a, C, A> {} + +impl<'a, C, A> LiveChatModeratorInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveChatModerator)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveChatModerators.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + for &field in ["alt", "part"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveChat/moderators".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: LiveChatModerator) -> LiveChatModeratorInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response returns. Set the parameter value to snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> LiveChatModeratorInsertCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveChatModeratorInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveChatModeratorInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveChatModeratorInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists moderators for a live chat. +/// +/// A builder for the *list* method supported by a *liveChatModerator* resource. +/// It is not used directly, but through a `LiveChatModeratorMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// * *https://www.googleapis.com/auth/youtube.readonly* +/// +/// The default scope will be `Scope::Readonly`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_chat_moderators().list("liveChatId", "part") +/// .page_token("labore") +/// .max_results(47) +/// .doit(); +/// # } +/// ``` +pub struct LiveChatModeratorListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _live_chat_id: String, + _part: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveChatModeratorListCall<'a, C, A> {} + +impl<'a, C, A> LiveChatModeratorListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveChatModeratorListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveChatModerators.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("liveChatId", self._live_chat_id.to_string())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "liveChatId", "part", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveChat/moderators".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The liveChatId parameter specifies the YouTube live chat for which the API should return moderators. + /// + /// Sets the *live chat id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn live_chat_id(mut self, new_value: &str) -> LiveChatModeratorListCall<'a, C, A> { + self._live_chat_id = new_value.to_string(); + self + } + /// The part parameter specifies the liveChatModerator resource parts that the API response will include. Supported values are id and snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + pub fn part(mut self, new_value: &str) -> LiveChatModeratorListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> LiveChatModeratorListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> LiveChatModeratorListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveChatModeratorListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveChatModeratorListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveChatModeratorListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Removes a chat moderator. +/// +/// A builder for the *delete* method supported by a *liveChatModerator* resource. +/// It is not used directly, but through a `LiveChatModeratorMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_chat_moderators().delete("id") +/// .doit(); +/// # } +/// ``` +pub struct LiveChatModeratorDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveChatModeratorDeleteCall<'a, C, A> {} + +impl<'a, C, A> LiveChatModeratorDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveChatModerators.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + for &field in ["id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/liveChat/moderators".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter identifies the chat moderator to remove. The value uniquely identifies both the moderator and the chat. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LiveChatModeratorDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveChatModeratorDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveChatModeratorDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveChatModeratorDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a specified caption track. +/// +/// A builder for the *delete* method supported by a *caption* resource. +/// It is not used directly, but through a `CaptionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.captions().delete("id") +/// .on_behalf_of_content_owner("sit") +/// .on_behalf_of("diam") +/// .doit(); +/// # } +/// ``` +pub struct CaptionDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _on_behalf_of_content_owner: Option, + _on_behalf_of: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CaptionDeleteCall<'a, C, A> {} + +impl<'a, C, A> CaptionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.captions.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + if let Some(value) = self._on_behalf_of { + params.push(("onBehalfOf", value.to_string())); + } + for &field in ["id", "onBehalfOfContentOwner", "onBehalfOf"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/captions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter identifies the caption track that is being deleted. The value is a caption track ID as identified by the id property in a caption resource. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CaptionDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> CaptionDeleteCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// ID of the Google+ Page for the channel that the request is be on behalf of + /// + /// Sets the *on behalf of* query property to the given value. + pub fn on_behalf_of(mut self, new_value: &str) -> CaptionDeleteCall<'a, C, A> { + self._on_behalf_of = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CaptionDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CaptionDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CaptionDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Uploads a caption track. +/// +/// A builder for the *insert* method supported by a *caption* resource. +/// It is not used directly, but through a `CaptionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::Caption; +/// use std::fs; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = Caption::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload_resumable(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.captions().insert(req) +/// .sync(true) +/// .on_behalf_of_content_owner("justo") +/// .on_behalf_of("est") +/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct CaptionInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: Caption, + _part: String, + _sync: Option, + _on_behalf_of_content_owner: Option, + _on_behalf_of: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CaptionInsertCall<'a, C, A> {} + +impl<'a, C, A> CaptionInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, Caption)> + where RS: ReadSeek { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.captions.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + if let Some(value) = self._sync { + params.push(("sync", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + if let Some(value) = self._on_behalf_of { + params.push(("onBehalfOf", value.to_string())); + } + for &field in ["alt", "part", "sync", "onBehalfOfContentOwner", "onBehalfOf"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let (mut url, upload_type) = + if protocol == "simple" { + ("https://www.googleapis.com/upload/youtube/v3/captions".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://www.googleapis.com/resumable/upload/youtube/v3/captions".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut mp_reader: MultiPartReader = Default::default(); + let (mut body_reader, content_type) = match protocol { + "simple" => { + mp_reader.reserve_exact(2); + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 104857600 { + return Err(Error::UploadSizeLimitExceeded(size, 104857600)) + } + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) + .add_part(&mut reader, size, reader_mime_type.clone()); + let mime_type = mp_reader.mime_type(); + (&mut mp_reader as &mut io::Read, ContentType(mime_type)) + }, + _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), + }; + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(content_type) + .body(&mut body_reader); + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 104857600 { + return Err(Error::UploadSizeLimitExceeded(size, 104857600)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 100MB + /// * *multipart*: yes + /// * *valid mime types*: '*/*', 'application/octet-stream' and 'text/xml' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Caption)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 100MB + /// * *multipart*: yes + /// * *valid mime types*: '*/*', 'application/octet-stream' and 'text/xml' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Caption)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Caption) -> CaptionInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter specifies the caption resource parts that the API response will include. Set the parameter value to snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> CaptionInsertCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The sync parameter indicates whether YouTube should automatically synchronize the caption file with the audio track of the video. If you set the value to true, YouTube will disregard any time codes that are in the uploaded caption file and generate new time codes for the captions. + /// + /// You should set the sync parameter to true if you are uploading a transcript, which has no time codes, or if you suspect the time codes in your file are incorrect and want YouTube to try to fix them. + /// + /// Sets the *sync* query property to the given value. + pub fn sync(mut self, new_value: bool) -> CaptionInsertCall<'a, C, A> { + self._sync = Some(new_value); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> CaptionInsertCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// ID of the Google+ Page for the channel that the request is be on behalf of + /// + /// Sets the *on behalf of* query property to the given value. + pub fn on_behalf_of(mut self, new_value: &str) -> CaptionInsertCall<'a, C, A> { + self._on_behalf_of = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CaptionInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CaptionInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CaptionInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of caption tracks that are associated with a specified video. Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track. +/// +/// A builder for the *list* method supported by a *caption* resource. +/// It is not used directly, but through a `CaptionMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// * *https://www.googleapis.com/auth/youtubepartner* +/// +/// The default scope will be `Scope::ForceSsl`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.captions().list("part", "videoId") +/// .on_behalf_of_content_owner("clita") +/// .on_behalf_of("diam") +/// .id("justo") +/// .doit(); +/// # } +/// ``` +pub struct CaptionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _video_id: String, + _on_behalf_of_content_owner: Option, + _on_behalf_of: Option, + _id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CaptionListCall<'a, C, A> {} + +impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CaptionListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.captions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + params.push(("videoId", self._video_id.to_string())); + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + if let Some(value) = self._on_behalf_of { + params.push(("onBehalfOf", value.to_string())); + } + if let Some(value) = self._id { + params.push(("id", value.to_string())); + } + for &field in ["alt", "part", "videoId", "onBehalfOfContentOwner", "onBehalfOf", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/captions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies a comma-separated list of one or more caption resource parts that the API response will include. The part names that you can include in the parameter value are id and snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + pub fn part(mut self, new_value: &str) -> CaptionListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The videoId parameter specifies the YouTube video ID of the video for which the API should return caption tracks. + /// + /// Sets the *video id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn video_id(mut self, new_value: &str) -> CaptionListCall<'a, C, A> { + self._video_id = new_value.to_string(); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> CaptionListCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// ID of the Google+ Page for the channel that the request is on behalf of. + /// + /// Sets the *on behalf of* query property to the given value. + pub fn on_behalf_of(mut self, new_value: &str) -> CaptionListCall<'a, C, A> { + self._on_behalf_of = Some(new_value.to_string()); + self + } + /// The id parameter specifies a comma-separated list of IDs that identify the caption resources that should be retrieved. Each ID must identify a caption track associated with the specified video. + /// + /// Sets the *id* query property to the given value. + pub fn id(mut self, new_value: &str) -> CaptionListCall<'a, C, A> { + self._id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CaptionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CaptionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CaptionListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter. +/// +/// This method supports **media download**. To enable it, adjust the builder like this: +/// `.param("alt", "media")`. +/// +/// A builder for the *download* method supported by a *caption* resource. +/// It is not used directly, but through a `CaptionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.captions().download("id") +/// .tlang("clita") +/// .tfmt("invidunt") +/// .on_behalf_of_content_owner("ut") +/// .on_behalf_of("dolores") +/// .doit(); +/// # } +/// ``` +pub struct CaptionDownloadCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _tlang: Option, + _tfmt: Option, + _on_behalf_of_content_owner: Option, + _on_behalf_of: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CaptionDownloadCall<'a, C, A> {} + +impl<'a, C, A> CaptionDownloadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.captions.download", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + if let Some(value) = self._tlang { + params.push(("tlang", value.to_string())); + } + if let Some(value) = self._tfmt { + params.push(("tfmt", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + if let Some(value) = self._on_behalf_of { + params.push(("onBehalfOf", value.to_string())); + } + for &field in ["id", "tlang", "tfmt", "onBehalfOfContentOwner", "onBehalfOf"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/captions/{id}".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{id}", "id")].iter() { + let mut replace_with: Option<&str> = None; + for &(name, ref value) in params.iter() { + if name == param_name { + replace_with = Some(value); + break; + } + } + url = url.replace(find_this, replace_with.expect("to find substitution value in params")); + } + { + let mut indices_for_removal: Vec = Vec::with_capacity(1); + for param_name in ["id"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter identifies the caption track that is being retrieved. The value is a caption track ID as identified by the id property in a caption resource. + /// + /// Sets the *id* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CaptionDownloadCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The tlang parameter specifies that the API response should return a translation of the specified caption track. The parameter value is an ISO 639-1 two-letter language code that identifies the desired caption language. The translation is generated by using machine translation, such as Google Translate. + /// + /// Sets the *tlang* query property to the given value. + pub fn tlang(mut self, new_value: &str) -> CaptionDownloadCall<'a, C, A> { + self._tlang = Some(new_value.to_string()); + self + } + /// The tfmt parameter specifies that the caption track should be returned in a specific format. If the parameter is not included in the request, the track is returned in its original format. + /// + /// Sets the *tfmt* query property to the given value. + pub fn tfmt(mut self, new_value: &str) -> CaptionDownloadCall<'a, C, A> { + self._tfmt = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> CaptionDownloadCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// ID of the Google+ Page for the channel that the request is be on behalf of + /// + /// Sets the *on behalf of* query property to the given value. + pub fn on_behalf_of(mut self, new_value: &str) -> CaptionDownloadCall<'a, C, A> { + self._on_behalf_of = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CaptionDownloadCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CaptionDownloadCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CaptionDownloadCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both. +/// +/// A builder for the *update* method supported by a *caption* resource. +/// It is not used directly, but through a `CaptionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::Caption; +/// use std::fs; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = Caption::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload_resumable(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.captions().update(req) +/// .sync(true) +/// .on_behalf_of_content_owner("voluptua.") +/// .on_behalf_of("duo") +/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct CaptionUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: Caption, + _part: String, + _sync: Option, + _on_behalf_of_content_owner: Option, + _on_behalf_of: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CaptionUpdateCall<'a, C, A> {} + +impl<'a, C, A> CaptionUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, Caption)> + where RS: ReadSeek { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.captions.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + if let Some(value) = self._sync { + params.push(("sync", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + if let Some(value) = self._on_behalf_of { + params.push(("onBehalfOf", value.to_string())); + } + for &field in ["alt", "part", "sync", "onBehalfOfContentOwner", "onBehalfOf"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let (mut url, upload_type) = + if protocol == "simple" { + ("https://www.googleapis.com/upload/youtube/v3/captions".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://www.googleapis.com/resumable/upload/youtube/v3/captions".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut mp_reader: MultiPartReader = Default::default(); + let (mut body_reader, content_type) = match protocol { + "simple" => { + mp_reader.reserve_exact(2); + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 104857600 { + return Err(Error::UploadSizeLimitExceeded(size, 104857600)) + } + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) + .add_part(&mut reader, size, reader_mime_type.clone()); + let mime_type = mp_reader.mime_type(); + (&mut mp_reader as &mut io::Read, ContentType(mime_type)) + }, + _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), + }; + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(content_type) + .body(&mut body_reader); + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 104857600 { + return Err(Error::UploadSizeLimitExceeded(size, 104857600)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 100MB + /// * *multipart*: yes + /// * *valid mime types*: '*/*', 'application/octet-stream' and 'text/xml' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Caption)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 100MB + /// * *multipart*: yes + /// * *valid mime types*: '*/*', 'application/octet-stream' and 'text/xml' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Caption)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Caption) -> CaptionUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. Set the property value to snippet if you are updating the track's draft status. Otherwise, set the property value to id. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> CaptionUpdateCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// Note: The API server only processes the parameter value if the request contains an updated caption file. + /// + /// The sync parameter indicates whether YouTube should automatically synchronize the caption file with the audio track of the video. If you set the value to true, YouTube will automatically synchronize the caption track with the audio track. + /// + /// Sets the *sync* query property to the given value. + pub fn sync(mut self, new_value: bool) -> CaptionUpdateCall<'a, C, A> { + self._sync = Some(new_value); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> CaptionUpdateCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// ID of the Google+ Page for the channel that the request is be on behalf of + /// + /// Sets the *on behalf of* query property to the given value. + pub fn on_behalf_of(mut self, new_value: &str) -> CaptionUpdateCall<'a, C, A> { + self._on_behalf_of = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CaptionUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CaptionUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CaptionUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of application languages that the YouTube website supports. +/// +/// A builder for the *list* method supported by a *i18nLanguage* resource. +/// It is not used directly, but through a `I18nLanguageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.i18n_languages().list("part") +/// .hl("aliquyam") +/// .doit(); +/// # } +/// ``` +pub struct I18nLanguageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _hl: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for I18nLanguageListCall<'a, C, A> {} + +impl<'a, C, A> I18nLanguageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, I18nLanguageListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.i18nLanguages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._hl { + params.push(("hl", value.to_string())); + } + for &field in ["alt", "part", "hl"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/i18nLanguages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies the i18nLanguage resource properties that the API response will include. Set the parameter value to snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn part(mut self, new_value: &str) -> I18nLanguageListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The hl parameter specifies the language that should be used for text values in the API response. + /// + /// Sets the *hl* query property to the given value. + pub fn hl(mut self, new_value: &str) -> I18nLanguageListCall<'a, C, A> { + self._hl = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> I18nLanguageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> I18nLanguageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> I18nLanguageListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of categories that can be associated with YouTube channels. +/// +/// A builder for the *list* method supported by a *guideCategory* resource. +/// It is not used directly, but through a `GuideCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.guide_categories().list("part") +/// .region_code("ea") +/// .id("et") +/// .hl("dolor") +/// .doit(); +/// # } +/// ``` +pub struct GuideCategoryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _region_code: Option, + _id: Option, + _hl: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for GuideCategoryListCall<'a, C, A> {} + +impl<'a, C, A> GuideCategoryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, GuideCategoryListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.guideCategories.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._region_code { + params.push(("regionCode", value.to_string())); + } + if let Some(value) = self._id { + params.push(("id", value.to_string())); + } + if let Some(value) = self._hl { + params.push(("hl", value.to_string())); + } + for &field in ["alt", "part", "regionCode", "id", "hl"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/guideCategories".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies the guideCategory resource properties that the API response will include. Set the parameter value to snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn part(mut self, new_value: &str) -> GuideCategoryListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The regionCode parameter instructs the API to return the list of guide categories available in the specified country. The parameter value is an ISO 3166-1 alpha-2 country code. + /// + /// Sets the *region code* query property to the given value. + pub fn region_code(mut self, new_value: &str) -> GuideCategoryListCall<'a, C, A> { + self._region_code = Some(new_value.to_string()); + self + } + /// The id parameter specifies a comma-separated list of the YouTube channel category ID(s) for the resource(s) that are being retrieved. In a guideCategory resource, the id property specifies the YouTube channel category ID. + /// + /// Sets the *id* query property to the given value. + pub fn id(mut self, new_value: &str) -> GuideCategoryListCall<'a, C, A> { + self._id = Some(new_value.to_string()); + self + } + /// The hl parameter specifies the language that will be used for text values in the API response. + /// + /// Sets the *hl* query property to the given value. + pub fn hl(mut self, new_value: &str) -> GuideCategoryListCall<'a, C, A> { + self._hl = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> GuideCategoryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> GuideCategoryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> GuideCategoryListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of comment threads that match the API request parameters. +/// +/// A builder for the *list* method supported by a *commentThread* resource. +/// It is not used directly, but through a `CommentThreadMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.comment_threads().list("part") +/// .video_id("kasd") +/// .text_format("invidunt") +/// .search_terms("rebum.") +/// .page_token("Lorem") +/// .order("clita") +/// .moderation_status("invidunt") +/// .max_results(11) +/// .id("At") +/// .channel_id("consetetur") +/// .all_threads_related_to_channel_id("et") +/// .doit(); +/// # } +/// ``` +pub struct CommentThreadListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _video_id: Option, + _text_format: Option, + _search_terms: Option, + _page_token: Option, + _order: Option, + _moderation_status: Option, + _max_results: Option, + _id: Option, + _channel_id: Option, + _all_threads_related_to_channel_id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentThreadListCall<'a, C, A> {} + +impl<'a, C, A> CommentThreadListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CommentThreadListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.commentThreads.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._video_id { + params.push(("videoId", value.to_string())); + } + if let Some(value) = self._text_format { + params.push(("textFormat", value.to_string())); + } + if let Some(value) = self._search_terms { + params.push(("searchTerms", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._order { + params.push(("order", value.to_string())); + } + if let Some(value) = self._moderation_status { + params.push(("moderationStatus", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._id { + params.push(("id", value.to_string())); + } + if let Some(value) = self._channel_id { + params.push(("channelId", value.to_string())); + } + if let Some(value) = self._all_threads_related_to_channel_id { + params.push(("allThreadsRelatedToChannelId", value.to_string())); + } + for &field in ["alt", "part", "videoId", "textFormat", "searchTerms", "pageToken", "order", "moderationStatus", "maxResults", "id", "channelId", "allThreadsRelatedToChannelId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/commentThreads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies a comma-separated list of one or more commentThread resource properties that the API response will include. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn part(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The videoId parameter instructs the API to return comment threads associated with the specified video ID. + /// + /// Sets the *video id* query property to the given value. + pub fn video_id(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { + self._video_id = Some(new_value.to_string()); + self + } + /// Set this parameter's value to html or plainText to instruct the API to return the comments left by users in html formatted or in plain text. + /// + /// Sets the *text format* query property to the given value. + pub fn text_format(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { + self._text_format = Some(new_value.to_string()); + self + } + /// The searchTerms parameter instructs the API to limit the API response to only contain comments that contain the specified search terms. + /// + /// Note: This parameter is not supported for use in conjunction with the id parameter. + /// + /// Sets the *search terms* query property to the given value. + pub fn search_terms(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { + self._search_terms = Some(new_value.to_string()); + self + } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identifies the next page of the result that can be retrieved. + /// + /// Note: This parameter is not supported for use in conjunction with the id parameter. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The order parameter specifies the order in which the API response should list comment threads. Valid values are: + /// - time - Comment threads are ordered by time. This is the default behavior. + /// - relevance - Comment threads are ordered by relevance.Note: This parameter is not supported for use in conjunction with the id parameter. + /// + /// Sets the *order* query property to the given value. + pub fn order(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { + self._order = Some(new_value.to_string()); + self + } + /// Set this parameter to limit the returned comment threads to a particular moderation state. + /// + /// Note: This parameter is not supported for use in conjunction with the id parameter. + /// + /// Sets the *moderation status* query property to the given value. + pub fn moderation_status(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { + self._moderation_status = Some(new_value.to_string()); + self + } + /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. + /// + /// Note: This parameter is not supported for use in conjunction with the id parameter. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> CommentThreadListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The id parameter specifies a comma-separated list of comment thread IDs for the resources that should be retrieved. + /// + /// Sets the *id* query property to the given value. + pub fn id(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { + self._id = Some(new_value.to_string()); + self + } + /// The channelId parameter instructs the API to return comment threads containing comments about the specified channel. (The response will not include comments left on videos that the channel uploaded.) + /// + /// Sets the *channel id* query property to the given value. + pub fn channel_id(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { + self._channel_id = Some(new_value.to_string()); + self + } + /// The allThreadsRelatedToChannelId parameter instructs the API to return all comment threads associated with the specified channel. The response can include comments about the channel or about the channel's videos. + /// + /// Sets the *all threads related to channel id* query property to the given value. + pub fn all_threads_related_to_channel_id(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { + self._all_threads_related_to_channel_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentThreadListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentThreadListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentThreadListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Modifies the top-level comment in a comment thread. +/// +/// A builder for the *update* method supported by a *commentThread* resource. +/// It is not used directly, but through a `CommentThreadMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::CommentThread; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = CommentThread::default(); +/// +/// // 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 ! +/// let result = hub.comment_threads().update(req) +/// .doit(); +/// # } +/// ``` +pub struct CommentThreadUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: CommentThread, + _part: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentThreadUpdateCall<'a, C, A> {} + +impl<'a, C, A> CommentThreadUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CommentThread)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.commentThreads.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + for &field in ["alt", "part"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/commentThreads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CommentThread) -> CommentThreadUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter specifies a comma-separated list of commentThread resource properties that the API response will include. You must at least include the snippet part in the parameter value since that part contains all of the properties that the API request can update. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> CommentThreadUpdateCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentThreadUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentThreadUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentThreadUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a new top-level comment. To add a reply to an existing comment, use the comments.insert method instead. +/// +/// A builder for the *insert* method supported by a *commentThread* resource. +/// It is not used directly, but through a `CommentThreadMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::CommentThread; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = CommentThread::default(); +/// +/// // 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 ! +/// let result = hub.comment_threads().insert(req) +/// .doit(); +/// # } +/// ``` +pub struct CommentThreadInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: CommentThread, + _part: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentThreadInsertCall<'a, C, A> {} + +impl<'a, C, A> CommentThreadInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CommentThread)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.commentThreads.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + for &field in ["alt", "part"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/commentThreads".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: CommentThread) -> CommentThreadInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter identifies the properties that the API response will include. Set the parameter value to snippet. The snippet part has a quota cost of 2 units. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> CommentThreadInsertCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentThreadInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentThreadInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentThreadInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a reply to an existing comment. Note: To create a top-level comment, use the commentThreads.insert method. +/// +/// A builder for the *insert* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::Comment; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = Comment::default(); +/// +/// // 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 ! +/// let result = hub.comments().insert(req) +/// .doit(); +/// # } +/// ``` +pub struct CommentInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: Comment, + _part: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentInsertCall<'a, C, A> {} + +impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Comment)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.comments.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + for &field in ["alt", "part"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/comments".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Comment) -> CommentInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter identifies the properties that the API response will include. Set the parameter value to snippet. The snippet part has a quota cost of 2 units. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> CommentInsertCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Sets the moderation status of one or more comments. The API request must be authorized by the owner of the channel or video associated with the comments. +/// +/// A builder for the *setModerationStatus* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.comments().set_moderation_status("id", "moderationStatus") +/// .ban_author(true) +/// .doit(); +/// # } +/// ``` +pub struct CommentSetModerationStatuCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _moderation_status: String, + _ban_author: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentSetModerationStatuCall<'a, C, A> {} + +impl<'a, C, A> CommentSetModerationStatuCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.comments.setModerationStatus", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + params.push(("moderationStatus", self._moderation_status.to_string())); + if let Some(value) = self._ban_author { + params.push(("banAuthor", value.to_string())); + } + for &field in ["id", "moderationStatus", "banAuthor"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/comments/setModerationStatus".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter specifies a comma-separated list of IDs that identify the comments for which you are updating the moderation status. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CommentSetModerationStatuCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// Identifies the new moderation status of the specified comments. + /// + /// Sets the *moderation status* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn moderation_status(mut self, new_value: &str) -> CommentSetModerationStatuCall<'a, C, A> { + self._moderation_status = new_value.to_string(); + self + } + /// The banAuthor parameter lets you indicate that you want to automatically reject any additional comments written by the comment's author. Set the parameter value to true to ban the author. + /// + /// Note: This parameter is only valid if the moderationStatus parameter is also set to rejected. + /// + /// Sets the *ban author* query property to the given value. + pub fn ban_author(mut self, new_value: bool) -> CommentSetModerationStatuCall<'a, C, A> { + self._ban_author = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentSetModerationStatuCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentSetModerationStatuCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentSetModerationStatuCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a comment. +/// +/// A builder for the *delete* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.comments().delete("id") +/// .doit(); +/// # } +/// ``` +pub struct CommentDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentDeleteCall<'a, C, A> {} + +impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.comments.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + for &field in ["id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/comments".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter specifies the comment ID for the resource that is being deleted. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CommentDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of comments that match the API request parameters. +/// +/// A builder for the *list* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.comments().list("part") +/// .text_format("rebum.") +/// .parent_id("Lorem") +/// .page_token("Lorem") +/// .max_results(59) +/// .id("ut") +/// .doit(); +/// # } +/// ``` +pub struct CommentListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _text_format: Option, + _parent_id: Option, + _page_token: Option, + _max_results: Option, + _id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentListCall<'a, C, A> {} + +impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, CommentListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.comments.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._text_format { + params.push(("textFormat", value.to_string())); + } + if let Some(value) = self._parent_id { + params.push(("parentId", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._id { + params.push(("id", value.to_string())); + } + for &field in ["alt", "part", "textFormat", "parentId", "pageToken", "maxResults", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/comments".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies a comma-separated list of one or more comment resource properties that the API response will include. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn part(mut self, new_value: &str) -> CommentListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// This parameter indicates whether the API should return comments formatted as HTML or as plain text. + /// + /// Sets the *text format* query property to the given value. + pub fn text_format(mut self, new_value: &str) -> CommentListCall<'a, C, A> { + self._text_format = Some(new_value.to_string()); + self + } + /// The parentId parameter specifies the ID of the comment for which replies should be retrieved. + /// + /// Note: YouTube currently supports replies only for top-level comments. However, replies to replies may be supported in the future. + /// + /// Sets the *parent id* query property to the given value. + pub fn parent_id(mut self, new_value: &str) -> CommentListCall<'a, C, A> { + self._parent_id = Some(new_value.to_string()); + self + } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identifies the next page of the result that can be retrieved. + /// + /// Note: This parameter is not supported for use in conjunction with the id parameter. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> CommentListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. + /// + /// Note: This parameter is not supported for use in conjunction with the id parameter. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> CommentListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The id parameter specifies a comma-separated list of comment IDs for the resources that are being retrieved. In a comment resource, the id property specifies the comment's ID. + /// + /// Sets the *id* query property to the given value. + pub fn id(mut self, new_value: &str) -> CommentListCall<'a, C, A> { + self._id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Modifies a comment. +/// +/// A builder for the *update* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::Comment; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = Comment::default(); +/// +/// // 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 ! +/// let result = hub.comments().update(req) +/// .doit(); +/// # } +/// ``` +pub struct CommentUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: Comment, + _part: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentUpdateCall<'a, C, A> {} + +impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, Comment)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.comments.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + for &field in ["alt", "part"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/comments".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: Comment) -> CommentUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter identifies the properties that the API response will include. You must at least include the snippet part in the parameter value since that part contains all of the properties that the API request can update. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> CommentUpdateCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Expresses the caller's opinion that one or more comments should be flagged as spam. +/// +/// A builder for the *markAsSpam* method supported by a *comment* resource. +/// It is not used directly, but through a `CommentMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.comments().mark_as_spam("id") +/// .doit(); +/// # } +/// ``` +pub struct CommentMarkAsSpamCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for CommentMarkAsSpamCall<'a, C, A> {} + +impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.comments.markAsSpam", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + for &field in ["id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/comments/markAsSpam".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter specifies a comma-separated list of IDs of comments that the caller believes should be classified as spam. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> CommentMarkAsSpamCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> CommentMarkAsSpamCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> CommentMarkAsSpamCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::ForceSsl`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> CommentMarkAsSpamCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Adds a resource to a playlist. +/// +/// A builder for the *insert* method supported by a *playlistItem* resource. +/// It is not used directly, but through a `PlaylistItemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::PlaylistItem; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = PlaylistItem::default(); +/// +/// // 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 ! +/// let result = hub.playlist_items().insert(req) +/// .on_behalf_of_content_owner("amet.") +/// .doit(); +/// # } +/// ``` +pub struct PlaylistItemInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: PlaylistItem, + _part: String, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlaylistItemInsertCall<'a, C, A> {} + +impl<'a, C, A> PlaylistItemInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlaylistItem)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.playlistItems.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["alt", "part", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: PlaylistItem) -> PlaylistItemInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> PlaylistItemInsertCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> PlaylistItemInsertCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlaylistItemInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlaylistItemInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlaylistItemInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a playlist item. +/// +/// A builder for the *delete* method supported by a *playlistItem* resource. +/// It is not used directly, but through a `PlaylistItemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.playlist_items().delete("id") +/// .doit(); +/// # } +/// ``` +pub struct PlaylistItemDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlaylistItemDeleteCall<'a, C, A> {} + +impl<'a, C, A> PlaylistItemDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.playlistItems.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + for &field in ["id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter specifies the YouTube playlist item ID for the playlist item that is being deleted. In a playlistItem resource, the id property specifies the playlist item's ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> PlaylistItemDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlaylistItemDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlaylistItemDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlaylistItemDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs. +/// +/// A builder for the *list* method supported by a *playlistItem* resource. +/// It is not used directly, but through a `PlaylistItemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.playlist_items().list("part") +/// .video_id("dolor") +/// .playlist_id("sea") +/// .page_token("ut") +/// .on_behalf_of_content_owner("eirmod") +/// .max_results(93) +/// .id("voluptua.") +/// .doit(); +/// # } +/// ``` +pub struct PlaylistItemListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _video_id: Option, + _playlist_id: Option, + _page_token: Option, + _on_behalf_of_content_owner: Option, + _max_results: Option, + _id: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlaylistItemListCall<'a, C, A> {} + +impl<'a, C, A> PlaylistItemListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlaylistItemListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.playlistItems.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._video_id { + params.push(("videoId", value.to_string())); + } + if let Some(value) = self._playlist_id { + params.push(("playlistId", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._id { + params.push(("id", value.to_string())); + } + for &field in ["alt", "part", "videoId", "playlistId", "pageToken", "onBehalfOfContentOwner", "maxResults", "id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies a comma-separated list of one or more playlistItem resource properties that the API response will include. + /// + /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a playlistItem resource, the snippet property contains numerous fields, including the title, description, position, and resourceId properties. As such, if you set part=snippet, the API response will contain all of those properties. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn part(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The videoId parameter specifies that the request should return only the playlist items that contain the specified video. + /// + /// Sets the *video id* query property to the given value. + pub fn video_id(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { + self._video_id = Some(new_value.to_string()); + self + } + /// The playlistId parameter specifies the unique ID of the playlist for which you want to retrieve playlist items. Note that even though this is an optional parameter, every request to retrieve playlist items must specify a value for either the id parameter or the playlistId parameter. + /// + /// Sets the *playlist id* query property to the given value. + pub fn playlist_id(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { + self._playlist_id = Some(new_value.to_string()); + self + } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> PlaylistItemListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The id parameter specifies a comma-separated list of one or more unique playlist item IDs. + /// + /// Sets the *id* query property to the given value. + pub fn id(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { + self._id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlaylistItemListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlaylistItemListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlaylistItemListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Modifies a playlist item. For example, you could update the item's position in the playlist. +/// +/// A builder for the *update* method supported by a *playlistItem* resource. +/// It is not used directly, but through a `PlaylistItemMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::PlaylistItem; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = PlaylistItem::default(); +/// +/// // 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 ! +/// let result = hub.playlist_items().update(req) +/// .doit(); +/// # } +/// ``` +pub struct PlaylistItemUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: PlaylistItem, + _part: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for PlaylistItemUpdateCall<'a, C, A> {} + +impl<'a, C, A> PlaylistItemUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, PlaylistItem)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.playlistItems.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + for &field in ["alt", "part"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: PlaylistItem) -> PlaylistItemUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. + /// + /// Note that this method will override the existing values for all of the mutable properties that are contained in any parts that the parameter value specifies. For example, a playlist item can specify a start time and end time, which identify the times portion of the video that should play when users watch the video in the playlist. If your request is updating a playlist item that sets these values, and the request's part parameter value includes the contentDetails part, the playlist item's start and end times will be updated to whatever value the request body specifies. If the request body does not specify values, the existing start and end times will be removed and replaced with the default settings. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> PlaylistItemUpdateCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> PlaylistItemUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> PlaylistItemUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> PlaylistItemUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists live chat messages for a specific chat. +/// +/// A builder for the *list* method supported by a *liveChatMessage* resource. +/// It is not used directly, but through a `LiveChatMessageMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// * *https://www.googleapis.com/auth/youtube.readonly* +/// +/// The default scope will be `Scope::Readonly`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_chat_messages().list("liveChatId", "part") +/// .profile_image_size(16) +/// .page_token("vero") +/// .max_results(65) +/// .hl("sed") +/// .doit(); +/// # } +/// ``` +pub struct LiveChatMessageListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _live_chat_id: String, + _part: String, + _profile_image_size: Option, + _page_token: Option, + _max_results: Option, + _hl: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveChatMessageListCall<'a, C, A> {} + +impl<'a, C, A> LiveChatMessageListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveChatMessageListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveChatMessages.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); + params.push(("liveChatId", self._live_chat_id.to_string())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._profile_image_size { + params.push(("profileImageSize", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._hl { + params.push(("hl", value.to_string())); + } + for &field in ["alt", "liveChatId", "part", "profileImageSize", "pageToken", "maxResults", "hl"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveChat/messages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The liveChatId parameter specifies the ID of the chat whose messages will be returned. + /// + /// Sets the *live chat id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn live_chat_id(mut self, new_value: &str) -> LiveChatMessageListCall<'a, C, A> { + self._live_chat_id = new_value.to_string(); + self + } + /// The part parameter specifies the liveChatComment resource parts that the API response will include. Supported values are id and snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + pub fn part(mut self, new_value: &str) -> LiveChatMessageListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The profileImageSize parameter specifies the size of the user profile pictures that should be returned in the result set. Default: 88. + /// + /// Sets the *profile image size* query property to the given value. + pub fn profile_image_size(mut self, new_value: u32) -> LiveChatMessageListCall<'a, C, A> { + self._profile_image_size = Some(new_value); + self + } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identify other pages that could be retrieved. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> LiveChatMessageListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maxResults parameter specifies the maximum number of messages that should be returned in the result set. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> LiveChatMessageListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The hl parameter instructs the API to retrieve localized resource metadata for a specific application language that the YouTube website supports. The parameter value must be a language code included in the list returned by the i18nLanguages.list method. + /// + /// If localized resource details are available in that language, the resource's snippet.localized object will contain the localized values. However, if localized details are not available, the snippet.localized object will contain resource details in the resource's default language. + /// + /// Sets the *hl* query property to the given value. + pub fn hl(mut self, new_value: &str) -> LiveChatMessageListCall<'a, C, A> { + self._hl = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveChatMessageListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveChatMessageListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveChatMessageListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a chat message. +/// +/// A builder for the *delete* method supported by a *liveChatMessage* resource. +/// It is not used directly, but through a `LiveChatMessageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_chat_messages().delete("id") +/// .doit(); +/// # } +/// ``` +pub struct LiveChatMessageDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveChatMessageDeleteCall<'a, C, A> {} + +impl<'a, C, A> LiveChatMessageDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveChatMessages.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + for &field in ["id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/liveChat/messages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter specifies the YouTube chat message ID of the resource that is being deleted. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LiveChatMessageDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveChatMessageDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveChatMessageDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveChatMessageDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Adds a message to a live chat. +/// +/// A builder for the *insert* method supported by a *liveChatMessage* resource. +/// It is not used directly, but through a `LiveChatMessageMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::LiveChatMessage; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = LiveChatMessage::default(); +/// +/// // 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 ! +/// let result = hub.live_chat_messages().insert(req) +/// .doit(); +/// # } +/// ``` +pub struct LiveChatMessageInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: LiveChatMessage, + _part: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveChatMessageInsertCall<'a, C, A> {} + +impl<'a, C, A> LiveChatMessageInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveChatMessage)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveChatMessages.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + for &field in ["alt", "part"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveChat/messages".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: LiveChatMessage) -> LiveChatMessageInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes. It identifies the properties that the write operation will set as well as the properties that the API response will include. Set the parameter value to snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> LiveChatMessageInsertCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveChatMessageInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveChatMessageInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveChatMessageInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of categories that can be associated with YouTube videos. +/// +/// A builder for the *list* method supported by a *videoCategory* resource. +/// It is not used directly, but through a `VideoCategoryMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.video_categories().list("part") +/// .region_code("justo") +/// .id("dolore") +/// .hl("vero") +/// .doit(); +/// # } +/// ``` +pub struct VideoCategoryListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _region_code: Option, + _id: Option, + _hl: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VideoCategoryListCall<'a, C, A> {} + +impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VideoCategoryListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.videoCategories.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._region_code { + params.push(("regionCode", value.to_string())); + } + if let Some(value) = self._id { + params.push(("id", value.to_string())); + } + if let Some(value) = self._hl { + params.push(("hl", value.to_string())); + } + for &field in ["alt", "part", "regionCode", "id", "hl"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/videoCategories".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies the videoCategory resource properties that the API response will include. Set the parameter value to snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn part(mut self, new_value: &str) -> VideoCategoryListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The regionCode parameter instructs the API to return the list of video categories available in the specified country. The parameter value is an ISO 3166-1 alpha-2 country code. + /// + /// Sets the *region code* query property to the given value. + pub fn region_code(mut self, new_value: &str) -> VideoCategoryListCall<'a, C, A> { + self._region_code = Some(new_value.to_string()); + self + } + /// The id parameter specifies a comma-separated list of video category IDs for the resources that you are retrieving. + /// + /// Sets the *id* query property to the given value. + pub fn id(mut self, new_value: &str) -> VideoCategoryListCall<'a, C, A> { + self._id = Some(new_value.to_string()); + self + } + /// The hl parameter specifies the language that should be used for text values in the API response. + /// + /// Sets the *hl* query property to the given value. + pub fn hl(mut self, new_value: &str) -> VideoCategoryListCall<'a, C, A> { + self._hl = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> VideoCategoryListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VideoCategoryListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> VideoCategoryListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of content regions that the YouTube website supports. +/// +/// A builder for the *list* method supported by a *i18nRegion* resource. +/// It is not used directly, but through a `I18nRegionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.i18n_regions().list("part") +/// .hl("takimata") +/// .doit(); +/// # } +/// ``` +pub struct I18nRegionListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _hl: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for I18nRegionListCall<'a, C, A> {} + +impl<'a, C, A> I18nRegionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, I18nRegionListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.i18nRegions.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._hl { + params.push(("hl", value.to_string())); + } + for &field in ["alt", "part", "hl"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/i18nRegions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies the i18nRegion resource properties that the API response will include. Set the parameter value to snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn part(mut self, new_value: &str) -> I18nRegionListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The hl parameter specifies the language that should be used for text values in the API response. + /// + /// Sets the *hl* query property to the given value. + pub fn hl(mut self, new_value: &str) -> I18nRegionListCall<'a, C, A> { + self._hl = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> I18nRegionListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> I18nRegionListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> I18nRegionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12404,7 +22522,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.subscriptions.insert", + dlg.begin(MethodInfo { id: "youtube.subscriptions.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if self._part.len() == 0 { @@ -12428,14 +22546,14 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -12479,7 +22597,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12489,10 +22607,10 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> { self._request = new_value; @@ -12534,10 +22652,10 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> { self._part = new_value.to_string(); @@ -12555,12 +22673,12 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionInsertCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> SubscriptionInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a subscription. +/// +/// A builder for the *delete* method supported by a *subscription* resource. +/// It is not used directly, but through a `SubscriptionMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.subscriptions().delete("id") +/// .doit(); +/// # } +/// ``` +pub struct SubscriptionDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SubscriptionDeleteCall<'a, C, A> {} + +impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.subscriptions.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + for &field in ["id"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/subscriptions".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter specifies the YouTube subscription ID for the resource that is being deleted. In a subscription resource, the id property specifies the YouTube subscription ID. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> SubscriptionDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SubscriptionDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SubscriptionDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SubscriptionDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12622,16 +22944,16 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.subscriptions.list", + dlg.begin(MethodInfo { id: "youtube.subscriptions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("part", self._part.to_string())); @@ -12720,7 +23042,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -12756,7 +23078,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12766,10 +23088,10 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -12804,7 +23126,7 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *part* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn part(mut self, new_value: &str) -> SubscriptionListCall<'a, C, A> { self._part = new_value.to_string(); @@ -12898,12 +23220,12 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -12920,17 +23242,17 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubscriptionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SubscriptionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -12938,10 +23260,262 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, } -/// Deletes a subscription. +/// Adds a new ban to the chat. /// -/// A builder for the *delete* method supported by a *subscription* resource. -/// It is not used directly, but through a `SubscriptionMethods` instance. +/// A builder for the *insert* method supported by a *liveChatBan* resource. +/// It is not used directly, but through a `LiveChatBanMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::LiveChatBan; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = LiveChatBan::default(); +/// +/// // 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 ! +/// let result = hub.live_chat_bans().insert(req) +/// .doit(); +/// # } +/// ``` +pub struct LiveChatBanInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: LiveChatBan, + _part: String, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveChatBanInsertCall<'a, C, A> {} + +impl<'a, C, A> LiveChatBanInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveChatBan)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveChatBans.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + for &field in ["alt", "part"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveChat/bans".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// 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: LiveChatBan) -> LiveChatBanInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response returns. Set the parameter value to snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + pub fn part(mut self, new_value: &str) -> LiveChatBanInsertCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveChatBanInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveChatBanInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveChatBanInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Removes a chat ban. +/// +/// A builder for the *delete* method supported by a *liveChatBan* resource. +/// It is not used directly, but through a `LiveChatBanMethods` instance. /// /// # Example /// @@ -12964,11 +23538,11 @@ impl<'a, C, A> SubscriptionListCall<'a, C, A> where C: BorrowMut, /// // 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 ! -/// let result = hub.subscriptions().delete("id") +/// let result = hub.live_chat_bans().delete("id") /// .doit(); /// # } /// ``` -pub struct SubscriptionDeleteCall<'a, C, A> +pub struct LiveChatBanDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a YouTube, @@ -12978,9 +23552,9 @@ pub struct SubscriptionDeleteCall<'a, C, A> _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for SubscriptionDeleteCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for LiveChatBanDeleteCall<'a, C, A> {} -impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> LiveChatBanDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. @@ -12992,7 +23566,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.subscriptions.delete", + dlg.begin(MethodInfo { id: "youtube.liveChatBans.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -13007,12 +23581,12 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13048,7 +23622,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13058,10 +23632,10 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> { + pub fn id(mut self, new_value: &str) -> LiveChatBanDeleteCall<'a, C, A> { self._id = new_value.to_string(); self } @@ -13096,18 +23670,18 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SubscriptionDeleteCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> LiveChatBanDeleteCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13117,24 +23691,3025 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut(mut self, name: T, value: T) -> SubscriptionDeleteCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> LiveChatBanDeleteCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SubscriptionDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> LiveChatBanDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Lists sponsors for a channel. +/// +/// A builder for the *list* method supported by a *sponsor* resource. +/// It is not used directly, but through a `SponsorMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// * *https://www.googleapis.com/auth/youtube.readonly* +/// +/// The default scope will be `Scope::Readonly`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.sponsors().list("part") +/// .page_token("sea") +/// .max_results(5) +/// .filter("diam") +/// .doit(); +/// # } +/// ``` +pub struct SponsorListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _page_token: Option, + _max_results: Option, + _filter: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for SponsorListCall<'a, C, A> {} + +impl<'a, C, A> SponsorListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, SponsorListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.sponsors.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._filter { + params.push(("filter", value.to_string())); + } + for &field in ["alt", "part", "pageToken", "maxResults", "filter"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/sponsors".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies the sponsor resource parts that the API response will include. Supported values are id and snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + pub fn part(mut self, new_value: &str) -> SponsorListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> SponsorListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> SponsorListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The filter parameter specifies which channel sponsors to return. + /// + /// Sets the *filter* query property to the given value. + pub fn filter(mut self, new_value: &str) -> SponsorListCall<'a, C, A> { + self._filter = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> SponsorListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> SponsorListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> SponsorListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of abuse reasons that can be used for reporting abusive videos. +/// +/// A builder for the *list* method supported by a *videoAbuseReportReason* resource. +/// It is not used directly, but through a `VideoAbuseReportReasonMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// * *https://www.googleapis.com/auth/youtube.readonly* +/// +/// The default scope will be `Scope::Readonly`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.video_abuse_report_reasons().list("part") +/// .hl("dolores") +/// .doit(); +/// # } +/// ``` +pub struct VideoAbuseReportReasonListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _hl: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for VideoAbuseReportReasonListCall<'a, C, A> {} + +impl<'a, C, A> VideoAbuseReportReasonListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, VideoAbuseReportReasonListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.videoAbuseReportReasons.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._hl { + params.push(("hl", value.to_string())); + } + for &field in ["alt", "part", "hl"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/videoAbuseReportReasons".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies the videoCategory resource parts that the API response will include. Supported values are id and snippet. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + pub fn part(mut self, new_value: &str) -> VideoAbuseReportReasonListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The hl parameter specifies the language that should be used for text values in the API response. + /// + /// Sets the *hl* query property to the given value. + pub fn hl(mut self, new_value: &str) -> VideoAbuseReportReasonListCall<'a, C, A> { + self._hl = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> VideoAbuseReportReasonListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> VideoAbuseReportReasonListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> VideoAbuseReportReasonListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Controls the settings for a slate that can be displayed in the broadcast stream. +/// +/// A builder for the *control* method supported by a *liveBroadcast* resource. +/// It is not used directly, but through a `LiveBroadcastMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// * *contentDetails* +/// * *status* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// +/// The default scope will be `Scope::Full`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_broadcasts().control("id", "part") +/// .walltime("aliquyam") +/// .on_behalf_of_content_owner_channel("elitr") +/// .on_behalf_of_content_owner("ea") +/// .offset_time_ms("et") +/// .display_slate(false) +/// .doit(); +/// # } +/// ``` +pub struct LiveBroadcastControlCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _part: String, + _walltime: Option, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _offset_time_ms: Option, + _display_slate: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveBroadcastControlCall<'a, C, A> {} + +impl<'a, C, A> LiveBroadcastControlCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.control", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._walltime { + params.push(("walltime", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + if let Some(value) = self._offset_time_ms { + params.push(("offsetTimeMs", value.to_string())); + } + if let Some(value) = self._display_slate { + params.push(("displaySlate", value.to_string())); + } + for &field in ["alt", "id", "part", "walltime", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner", "offsetTimeMs", "displaySlate"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts/control".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter specifies the YouTube live broadcast ID that uniquely identifies the broadcast in which the slate is being updated. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *contentDetails* + /// * *status* + pub fn part(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The walltime parameter specifies the wall clock time at which the specified slate change will occur. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sssZ) format. + /// + /// Sets the *walltime* query property to the given value. + pub fn walltime(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { + self._walltime = Some(new_value.to_string()); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The offsetTimeMs parameter specifies a positive time offset when the specified slate change will occur. The value is measured in milliseconds from the beginning of the broadcast's monitor stream, which is the time that the testing phase for the broadcast began. Even though it is specified in milliseconds, the value is actually an approximation, and YouTube completes the requested action as closely as possible to that time. + /// + /// If you do not specify a value for this parameter, then YouTube performs the action as soon as possible. See the Getting started guide for more details. + /// + /// Important: You should only specify a value for this parameter if your broadcast stream is delayed. + /// + /// Sets the *offset time ms* query property to the given value. + pub fn offset_time_ms(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { + self._offset_time_ms = Some(new_value.to_string()); + self + } + /// The displaySlate parameter specifies whether the slate is being enabled or disabled. + /// + /// Sets the *display slate* query property to the given value. + pub fn display_slate(mut self, new_value: bool) -> LiveBroadcastControlCall<'a, C, A> { + self._display_slate = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveBroadcastControlCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveBroadcastControlCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveBroadcastControlCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Updates a broadcast. For example, you could modify the broadcast settings defined in the liveBroadcast resource's contentDetails object. +/// +/// A builder for the *update* method supported by a *liveBroadcast* resource. +/// It is not used directly, but through a `LiveBroadcastMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// * *contentDetails* +/// * *status* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// +/// The default scope will be `Scope::Full`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::LiveBroadcast; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = LiveBroadcast::default(); +/// req.status = Default::default(); // is LiveBroadcastStatus +/// req.content_details = Default::default(); // is LiveBroadcastContentDetails +/// req.snippet = Default::default(); // is LiveBroadcastSnippet +/// req.id = Some("sed".to_string()); +/// +/// // 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 ! +/// let result = hub.live_broadcasts().update(req) +/// .on_behalf_of_content_owner_channel("dolor") +/// .on_behalf_of_content_owner("sanctus") +/// .doit(); +/// # } +/// ``` +pub struct LiveBroadcastUpdateCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: LiveBroadcast, + _part: String, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveBroadcastUpdateCall<'a, C, A> {} + +impl<'a, C, A> LiveBroadcastUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.update", + http_method: hyper::method::Method::Put }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["alt", "part", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *contentDetails* + /// * *status* + pub fn request(mut self, new_value: LiveBroadcast) -> LiveBroadcastUpdateCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. + /// + /// The part properties that you can include in the parameter value are id, snippet, contentDetails, and status. + /// + /// Note that this method will override the existing values for all of the mutable properties that are contained in any parts that the parameter value specifies. For example, a broadcast's privacy status is defined in the status part. As such, if your request is updating a private or unlisted broadcast, and the request's part parameter value includes the status part, the broadcast's privacy setting will be updated to whatever value the request body specifies. If the request body does not specify a value, the existing privacy setting will be removed and the broadcast will revert to the default privacy setting. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *contentDetails* + /// * *status* + pub fn part(mut self, new_value: &str) -> LiveBroadcastUpdateCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastUpdateCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastUpdateCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveBroadcastUpdateCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveBroadcastUpdateCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveBroadcastUpdateCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream, though a video stream may be bound to more than one broadcast. +/// +/// A builder for the *bind* method supported by a *liveBroadcast* resource. +/// It is not used directly, but through a `LiveBroadcastMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// * *contentDetails* +/// * *status* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// +/// The default scope will be `Scope::Full`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_broadcasts().bind("id", "part") +/// .stream_id("consetetur") +/// .on_behalf_of_content_owner_channel("consetetur") +/// .on_behalf_of_content_owner("eirmod") +/// .doit(); +/// # } +/// ``` +pub struct LiveBroadcastBindCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _part: String, + _stream_id: Option, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveBroadcastBindCall<'a, C, A> {} + +impl<'a, C, A> LiveBroadcastBindCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.bind", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._stream_id { + params.push(("streamId", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["alt", "id", "part", "streamId", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts/bind".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter specifies the unique ID of the broadcast that is being bound to a video stream. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LiveBroadcastBindCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *contentDetails* + /// * *status* + pub fn part(mut self, new_value: &str) -> LiveBroadcastBindCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The streamId parameter specifies the unique ID of the video stream that is being bound to a broadcast. If this parameter is omitted, the API will remove any existing binding between the broadcast and a video stream. + /// + /// Sets the *stream id* query property to the given value. + pub fn stream_id(mut self, new_value: &str) -> LiveBroadcastBindCall<'a, C, A> { + self._stream_id = Some(new_value.to_string()); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastBindCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastBindCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveBroadcastBindCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveBroadcastBindCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveBroadcastBindCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Creates a broadcast. +/// +/// A builder for the *insert* method supported by a *liveBroadcast* resource. +/// It is not used directly, but through a `LiveBroadcastMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// * *contentDetails* +/// * *status* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// +/// The default scope will be `Scope::Full`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::LiveBroadcast; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = LiveBroadcast::default(); +/// req.status = Default::default(); // is LiveBroadcastStatus +/// req.content_details = Default::default(); // is LiveBroadcastContentDetails +/// req.snippet = Default::default(); // is LiveBroadcastSnippet +/// req.id = Some("labore".to_string()); +/// +/// // 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 ! +/// let result = hub.live_broadcasts().insert(req) +/// .on_behalf_of_content_owner_channel("gubergren") +/// .on_behalf_of_content_owner("et") +/// .doit(); +/// # } +/// ``` +pub struct LiveBroadcastInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: LiveBroadcast, + _part: String, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveBroadcastInsertCall<'a, C, A> {} + +impl<'a, C, A> LiveBroadcastInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + if self._part.len() == 0 { + self._part = self._request.to_parts(); + } + params.push(("part", self._part.to_string())); + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["alt", "part", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(ContentType(json_mime_type.clone())) + .header(ContentLength(request_size as u64)) + .body(&mut request_value_reader); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *contentDetails* + /// * *status* + pub fn request(mut self, new_value: LiveBroadcast) -> LiveBroadcastInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. + /// + /// The part properties that you can include in the parameter value are id, snippet, contentDetails, and status. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the *parts* list is automatically derived from *Resource* passed in + /// during instantiation and indicates which values you are passing, the response would contain the very same parts. + /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, + /// like statistics that are generated server side. Therefore you should use this method to specify + /// the parts you provide in addition to the ones you want in the response. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *contentDetails* + /// * *status* + pub fn part(mut self, new_value: &str) -> LiveBroadcastInsertCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastInsertCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastInsertCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveBroadcastInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveBroadcastInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveBroadcastInsertCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Deletes a broadcast. +/// +/// A builder for the *delete* method supported by a *liveBroadcast* resource. +/// It is not used directly, but through a `LiveBroadcastMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_broadcasts().delete("id") +/// .on_behalf_of_content_owner_channel("accusam") +/// .on_behalf_of_content_owner("magna") +/// .doit(); +/// # } +/// ``` +pub struct LiveBroadcastDeleteCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _id: String, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveBroadcastDeleteCall<'a, C, A> {} + +impl<'a, C, A> LiveBroadcastDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.delete", + http_method: hyper::method::Method::Delete }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + params.push(("id", self._id.to_string())); + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["id", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The id parameter specifies the YouTube live broadcast ID for the resource that is being deleted. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LiveBroadcastDeleteCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastDeleteCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastDeleteCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveBroadcastDeleteCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveBroadcastDeleteCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveBroadcastDeleteCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Returns a list of YouTube broadcasts that match the API request parameters. +/// +/// A builder for the *list* method supported by a *liveBroadcast* resource. +/// It is not used directly, but through a `LiveBroadcastMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// * *contentDetails* +/// * *status* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// * *https://www.googleapis.com/auth/youtube.readonly* +/// +/// The default scope will be `Scope::Readonly`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_broadcasts().list("part") +/// .page_token("rebum.") +/// .on_behalf_of_content_owner_channel("et") +/// .on_behalf_of_content_owner("clita") +/// .mine(true) +/// .max_results(32) +/// .id("vero") +/// .broadcast_type("consetetur") +/// .broadcast_status("vero") +/// .doit(); +/// # } +/// ``` +pub struct LiveBroadcastListCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _part: String, + _page_token: Option, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _mine: Option, + _max_results: Option, + _id: Option, + _broadcast_type: Option, + _broadcast_status: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveBroadcastListCall<'a, C, A> {} + +impl<'a, C, A> LiveBroadcastListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcastListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.list", + http_method: hyper::method::Method::Get }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + if let Some(value) = self._mine { + params.push(("mine", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._id { + params.push(("id", value.to_string())); + } + if let Some(value) = self._broadcast_type { + params.push(("broadcastType", value.to_string())); + } + if let Some(value) = self._broadcast_status { + params.push(("broadcastStatus", value.to_string())); + } + for &field in ["alt", "part", "pageToken", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner", "mine", "maxResults", "id", "broadcastType", "broadcastStatus"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *contentDetails* + /// * *status* + pub fn part(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The mine parameter can be used to instruct the API to only return broadcasts owned by the authenticated user. Set the parameter value to true to only retrieve your own broadcasts. + /// + /// Sets the *mine* query property to the given value. + pub fn mine(mut self, new_value: bool) -> LiveBroadcastListCall<'a, C, A> { + self._mine = Some(new_value); + self + } + /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> LiveBroadcastListCall<'a, C, A> { + self._max_results = Some(new_value); + self + } + /// The id parameter specifies a comma-separated list of YouTube broadcast IDs that identify the broadcasts being retrieved. In a liveBroadcast resource, the id property specifies the broadcast's ID. + /// + /// Sets the *id* query property to the given value. + pub fn id(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { + self._id = Some(new_value.to_string()); + self + } + /// The broadcastType parameter filters the API response to only include broadcasts with the specified type. This is only compatible with the mine filter for now. + /// + /// Sets the *broadcast type* query property to the given value. + pub fn broadcast_type(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { + self._broadcast_type = Some(new_value.to_string()); + self + } + /// The broadcastStatus parameter filters the API response to only include broadcasts with the specified status. + /// + /// Sets the *broadcast status* query property to the given value. + pub fn broadcast_status(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { + self._broadcast_status = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveBroadcastListCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveBroadcastListCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Readonly`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveBroadcastListCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Changes the status of a YouTube live broadcast and initiates any processes associated with the new status. For example, when you transition a broadcast's status to testing, YouTube starts to transmit video to that broadcast's monitor stream. Before calling this method, you should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active. +/// +/// A builder for the *transition* method supported by a *liveBroadcast* resource. +/// It is not used directly, but through a `LiveBroadcastMethods` instance. +/// +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// * *contentDetails* +/// * *status* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// +/// The default scope will be `Scope::Full`. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let result = hub.live_broadcasts().transition("broadcastStatus", "id", "part") +/// .on_behalf_of_content_owner_channel("tempor") +/// .on_behalf_of_content_owner("gubergren") +/// .doit(); +/// # } +/// ``` +pub struct LiveBroadcastTransitionCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _broadcast_status: String, + _id: String, + _part: String, + _on_behalf_of_content_owner_channel: Option, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for LiveBroadcastTransitionCall<'a, C, A> {} + +impl<'a, C, A> LiveBroadcastTransitionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.transition", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); + params.push(("broadcastStatus", self._broadcast_status.to_string())); + params.push(("id", self._id.to_string())); + params.push(("part", self._part.to_string())); + if let Some(value) = self._on_behalf_of_content_owner_channel { + params.push(("onBehalfOfContentOwnerChannel", value.to_string())); + } + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["alt", "broadcastStatus", "id", "part", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts/transition".to_string(); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + let mut req_result = { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + + dlg.pre_request(); + req.send() + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// The broadcastStatus parameter identifies the state to which the broadcast is changing. Note that to transition a broadcast to either the testing or live state, the status.streamStatus must be active for the stream that the broadcast is bound to. + /// + /// Sets the *broadcast status* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn broadcast_status(mut self, new_value: &str) -> LiveBroadcastTransitionCall<'a, C, A> { + self._broadcast_status = new_value.to_string(); + self + } + /// The id parameter specifies the unique ID of the broadcast that is transitioning to another status. + /// + /// Sets the *id* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn id(mut self, new_value: &str) -> LiveBroadcastTransitionCall<'a, C, A> { + self._id = new_value.to_string(); + self + } + /// The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. + /// + /// Sets the *part* query property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + /// * *contentDetails* + /// * *status* + pub fn part(mut self, new_value: &str) -> LiveBroadcastTransitionCall<'a, C, A> { + self._part = new_value.to_string(); + self + } + /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. + /// + /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. + /// + /// Sets the *on behalf of content owner channel* query property to the given value. + pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastTransitionCall<'a, C, A> { + self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastTransitionCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> LiveBroadcastTransitionCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> LiveBroadcastTransitionCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> LiveBroadcastTransitionCall<'a, C, A> + where T: AsRef { + self._scopes.insert(scope.as_ref().to_string(), ()); + self + } +} + + +/// Uploads a channel banner image to YouTube. This method represents the first two steps in a three-step process to update the banner image for a channel: +/// +/// - Call the channelBanners.insert method to upload the binary image data to YouTube. The image must have a 16:9 aspect ratio and be at least 2120x1192 pixels. +/// - Extract the url property's value from the response that the API returns for step 1. +/// - Call the channels.update method to update the channel's branding settings. Set the brandingSettings.image.bannerExternalUrl property's value to the URL obtained in step 2. +/// +/// A builder for the *insert* method supported by a *channelBanner* resource. +/// It is not used directly, but through a `ChannelBannerMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate yup_oauth2 as oauth2; +/// # extern crate google_youtube3 as youtube3; +/// use youtube3::ChannelBannerResource; +/// use std::fs; +/// # #[test] fn egal() { +/// # use std::default::Default; +/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; +/// # use youtube3::YouTube; +/// +/// # let secret: ApplicationSecret = Default::default(); +/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, +/// # hyper::Client::new(), +/// # ::default(), None); +/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! +/// let mut req = ChannelBannerResource::default(); +/// +/// // You can configure optional parameters by calling the respective setters at will, and +/// // execute the final call using `upload(...)`. +/// // Values shown here are possibly random and not representative ! +/// let result = hub.channel_banners().insert(req) +/// .on_behalf_of_content_owner("dolore") +/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); +/// # } +/// ``` +pub struct ChannelBannerInsertCall<'a, C, A> + where C: 'a, A: 'a { + + hub: &'a YouTube, + _request: ChannelBannerResource, + _on_behalf_of_content_owner: Option, + _delegate: Option<&'a mut Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, C, A> CallBuilder for ChannelBannerInsertCall<'a, C, A> {} + +impl<'a, C, A> ChannelBannerInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { + + + /// Perform the operation you have build so far. + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, ChannelBannerResource)> + where RS: ReadSeek { + use std::io::{Read, Seek}; + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; + let mut dd = DefaultDelegate; + let mut dlg: &mut Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(MethodInfo { id: "youtube.channelBanners.insert", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); + if let Some(value) = self._on_behalf_of_content_owner { + params.push(("onBehalfOfContentOwner", value.to_string())); + } + for &field in ["alt", "onBehalfOfContentOwner"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let (mut url, upload_type) = + if protocol == "simple" { + ("https://www.googleapis.com/upload/youtube/v3/channelBanners/insert".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://www.googleapis.com/resumable/upload/youtube/v3/channelBanners/insert".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); + if self._scopes.len() == 0 { + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); + } + + + if params.len() > 0 { + url.push('?'); + url.push_str(&url::form_urlencoded::serialize(params)); + } + + let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request); + remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; + + loop { + let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { + Ok(token) => token, + Err(err) => { + match dlg.token(&*err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(Error::MissingToken(err)) + } + } + } + }; + let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, + access_token: token.access_token }); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut mp_reader: MultiPartReader = Default::default(); + let (mut body_reader, content_type) = match protocol { + "simple" => { + mp_reader.reserve_exact(2); + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 6291456 { + return Err(Error::UploadSizeLimitExceeded(size, 6291456)) + } + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) + .add_part(&mut reader, size, reader_mime_type.clone()); + let mime_type = mp_reader.mime_type(); + (&mut mp_reader as &mut io::Read, ContentType(mime_type)) + }, + _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), + }; + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()) + .header(content_type) + .body(&mut body_reader); + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } + }; + + match req_result { + Err(err) => { + if let oauth2::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status.is_success() { + let mut json_err = String::new(); + res.read_to_string(&mut json_err).unwrap(); + if let oauth2::Retry::After(d) = dlg.http_failure(&res, + json::from_str(&json_err).ok(), + json::from_str(&json_err).ok()) { + sleep(d); + continue; + } + dlg.finished(false); + return match json::from_str::(&json_err){ + Err(_) => Err(Error::Failure(res)), + Ok(serr) => Err(Error::BadRequest(serr)) + } + } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 6291456 { + return Err(Error::UploadSizeLimitExceeded(size, 6291456)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + match json::from_str(&json_response) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&json_response, &err); + return Err(Error::JsonDecodeError(json_response, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. + /// + /// * *max size*: 6MB + /// * *multipart*: yes + /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, ChannelBannerResource)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") + } + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 6MB + /// * *multipart*: yes + /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, ChannelBannerResource)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// + /// Sets the *request* property to the given value. + /// + /// 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: ChannelBannerResource) -> ChannelBannerInsertCall<'a, C, A> { + self._request = new_value; + self + } + /// Note: This parameter is intended exclusively for YouTube content partners. + /// + /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. + /// + /// Sets the *on behalf of content owner* query property to the given value. + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> ChannelBannerInsertCall<'a, C, A> { + self._on_behalf_of_content_owner = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// 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 Delegate) -> ChannelBannerInsertCall<'a, C, A> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known paramters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *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. Overrides userIp if both are provided. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *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. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *alt* (query-string) - Data format for the response. + pub fn param(mut self, name: T, value: T) -> ChannelBannerInsertCall<'a, C, A> + where T: AsRef { + self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); + self + } + + /// Identifies the authorization scope for the method you are building. + /// + /// Use this method to actively specify which scope should be used, instead the default `Scope` variant + /// `Scope::Full`. + /// + /// The `scope` will be added to a set of scopes. This is important as one can maintain access + /// tokens for more than one scope. + /// + /// 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(mut self, scope: T) -> ChannelBannerInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13169,36 +26744,36 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SearchListCall<'a, C, A> where C: BorrowMut, A: oa Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.search.list", + dlg.begin(MethodInfo { id: "youtube.search.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((33 + self._additional_params.len())); params.push(("part", self._part.to_string())); @@ -13367,7 +26942,7 @@ impl<'a, C, A> SearchListCall<'a, C, A> where C: BorrowMut, A: oa self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -13403,7 +26978,7 @@ impl<'a, C, A> SearchListCall<'a, C, A> where C: BorrowMut, A: oa match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13413,10 +26988,10 @@ impl<'a, C, A> SearchListCall<'a, C, A> where C: BorrowMut, A: oa if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -13449,7 +27024,7 @@ impl<'a, C, A> SearchListCall<'a, C, A> where C: BorrowMut, A: oa /// /// Sets the *part* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn part(mut self, new_value: &str) -> SearchListCall<'a, C, A> { self._part = new_value.to_string(); @@ -13691,12 +27266,12 @@ impl<'a, C, A> SearchListCall<'a, C, A> where C: BorrowMut, A: oa } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -13713,17 +27288,17 @@ impl<'a, C, A> SearchListCall<'a, C, A> where C: BorrowMut, A: oa } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> SearchListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> SearchListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -13731,10 +27306,10 @@ impl<'a, C, A> SearchListCall<'a, C, A> where C: BorrowMut, A: oa } -/// Returns a list of content regions that the YouTube website supports. +/// Uploads a custom video thumbnail to YouTube and sets it for a video. /// -/// A builder for the *list* method supported by a *i18nRegion* resource. -/// It is not used directly, but through a `I18nRegionMethods` instance. +/// A builder for the *set* method supported by a *thumbnail* resource. +/// It is not used directly, but through a `ThumbnailMethods` instance. /// /// # Example /// @@ -13744,5566 +27319,6 @@ impl<'a, C, A> SearchListCall<'a, C, A> where C: BorrowMut, A: oa /// # extern crate hyper; /// # extern crate yup_oauth2 as oauth2; /// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.i18n_regions().list("part") -/// .hl("sit") -/// .doit(); -/// # } -/// ``` -pub struct I18nRegionListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _hl: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for I18nRegionListCall<'a, C, A> {} - -impl<'a, C, A> I18nRegionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, I18nRegionListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.i18nRegions.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._hl { - params.push(("hl", value.to_string())); - } - for &field in ["alt", "part", "hl"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/i18nRegions".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies the i18nRegion resource properties that the API response will include. Set the parameter value to snippet. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn part(mut self, new_value: &str) -> I18nRegionListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The hl parameter specifies the language that should be used for text values in the API response. - /// - /// Sets the *hl* query property to the given value. - pub fn hl(mut self, new_value: &str) -> I18nRegionListCall<'a, C, A> { - self._hl = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> I18nRegionListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> I18nRegionListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> I18nRegionListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a list of comment threads that match the API request parameters. -/// -/// A builder for the *list* method supported by a *commentThread* resource. -/// It is not used directly, but through a `CommentThreadMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.comment_threads().list("part") -/// .video_id("ut") -/// .text_format("justo") -/// .search_terms("est") -/// .page_token("amet") -/// .order("accusam") -/// .moderation_status("clita") -/// .max_results(22) -/// .id("justo") -/// .channel_id("est") -/// .all_threads_related_to_channel_id("clita") -/// .doit(); -/// # } -/// ``` -pub struct CommentThreadListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _video_id: Option, - _text_format: Option, - _search_terms: Option, - _page_token: Option, - _order: Option, - _moderation_status: Option, - _max_results: Option, - _id: Option, - _channel_id: Option, - _all_threads_related_to_channel_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CommentThreadListCall<'a, C, A> {} - -impl<'a, C, A> CommentThreadListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CommentThreadListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.commentThreads.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._video_id { - params.push(("videoId", value.to_string())); - } - if let Some(value) = self._text_format { - params.push(("textFormat", value.to_string())); - } - if let Some(value) = self._search_terms { - params.push(("searchTerms", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._order { - params.push(("order", value.to_string())); - } - if let Some(value) = self._moderation_status { - params.push(("moderationStatus", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._id { - params.push(("id", value.to_string())); - } - if let Some(value) = self._channel_id { - params.push(("channelId", value.to_string())); - } - if let Some(value) = self._all_threads_related_to_channel_id { - params.push(("allThreadsRelatedToChannelId", value.to_string())); - } - for &field in ["alt", "part", "videoId", "textFormat", "searchTerms", "pageToken", "order", "moderationStatus", "maxResults", "id", "channelId", "allThreadsRelatedToChannelId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/commentThreads".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies a comma-separated list of one or more commentThread resource properties that the API response will include. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn part(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The videoId parameter instructs the API to return comment threads associated with the specified video ID. - /// - /// Sets the *video id* query property to the given value. - pub fn video_id(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { - self._video_id = Some(new_value.to_string()); - self - } - /// Set this parameter's value to html or plainText to instruct the API to return the comments left by users in html formatted or in plain text. - /// - /// Sets the *text format* query property to the given value. - pub fn text_format(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { - self._text_format = Some(new_value.to_string()); - self - } - /// The searchTerms parameter instructs the API to limit the API response to only contain comments that contain the specified search terms. - /// - /// Note: This parameter is not supported for use in conjunction with the id parameter. - /// - /// Sets the *search terms* query property to the given value. - pub fn search_terms(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { - self._search_terms = Some(new_value.to_string()); - self - } - /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identifies the next page of the result that can be retrieved. - /// - /// Note: This parameter is not supported for use in conjunction with the id parameter. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// The order parameter specifies the order in which the API response should list comment threads. Valid values are: - /// - time - Comment threads are ordered by time. This is the default behavior. - /// - relevance - Comment threads are ordered by relevance.Note: This parameter is not supported for use in conjunction with the id parameter. - /// - /// Sets the *order* query property to the given value. - pub fn order(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { - self._order = Some(new_value.to_string()); - self - } - /// Set this parameter to limit the returned comment threads to a particular moderation state. - /// - /// Note: This parameter is not supported for use in conjunction with the id parameter. - /// - /// Sets the *moderation status* query property to the given value. - pub fn moderation_status(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { - self._moderation_status = Some(new_value.to_string()); - self - } - /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. - /// - /// Note: This parameter is not supported for use in conjunction with the id parameter. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> CommentThreadListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The id parameter specifies a comma-separated list of comment thread IDs for the resources that should be retrieved. - /// - /// Sets the *id* query property to the given value. - pub fn id(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { - self._id = Some(new_value.to_string()); - self - } - /// The channelId parameter instructs the API to return comment threads containing comments about the specified channel. (The response will not include comments left on videos that the channel uploaded.) - /// - /// Sets the *channel id* query property to the given value. - pub fn channel_id(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { - self._channel_id = Some(new_value.to_string()); - self - } - /// The allThreadsRelatedToChannelId parameter instructs the API to return all comment threads associated with the specified channel. The response can include comments about the channel or about the channel's videos. - /// - /// Sets the *all threads related to channel id* query property to the given value. - pub fn all_threads_related_to_channel_id(mut self, new_value: &str) -> CommentThreadListCall<'a, C, A> { - self._all_threads_related_to_channel_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CommentThreadListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CommentThreadListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CommentThreadListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Modifies the top-level comment in a comment thread. -/// -/// A builder for the *update* method supported by a *commentThread* resource. -/// It is not used directly, but through a `CommentThreadMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::CommentThread; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = CommentThread::default(); -/// -/// // 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 ! -/// let result = hub.comment_threads().update(req) -/// .doit(); -/// # } -/// ``` -pub struct CommentThreadUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: CommentThread, - _part: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CommentThreadUpdateCall<'a, C, A> {} - -impl<'a, C, A> CommentThreadUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CommentThread)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.commentThreads.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - for &field in ["alt", "part"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/commentThreads".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: CommentThread) -> CommentThreadUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter specifies a comma-separated list of commentThread resource properties that the API response will include. You must at least include the snippet part in the parameter value since that part contains all of the properties that the API request can update. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - pub fn part(mut self, new_value: &str) -> CommentThreadUpdateCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CommentThreadUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CommentThreadUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CommentThreadUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a new top-level comment. To add a reply to an existing comment, use the comments.insert method instead. -/// -/// A builder for the *insert* method supported by a *commentThread* resource. -/// It is not used directly, but through a `CommentThreadMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::CommentThread; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = CommentThread::default(); -/// -/// // 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 ! -/// let result = hub.comment_threads().insert(req) -/// .doit(); -/// # } -/// ``` -pub struct CommentThreadInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: CommentThread, - _part: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CommentThreadInsertCall<'a, C, A> {} - -impl<'a, C, A> CommentThreadInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CommentThread)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.commentThreads.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - for &field in ["alt", "part"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/commentThreads".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: CommentThread) -> CommentThreadInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter identifies the properties that the API response will include. Set the parameter value to snippet. The snippet part has a quota cost of 2 units. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - pub fn part(mut self, new_value: &str) -> CommentThreadInsertCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CommentThreadInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CommentThreadInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CommentThreadInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a video stream. If the properties that you want to change cannot be updated, then you need to create a new stream with the proper settings. -/// -/// A builder for the *update* method supported by a *liveStream* resource. -/// It is not used directly, but through a `LiveStreamMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// * *cdn* -/// * *status* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// -/// The default scope will be `Scope::Full`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::LiveStream; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = LiveStream::default(); -/// req.status = Default::default(); // is LiveStreamStatus -/// req.snippet = Default::default(); // is LiveStreamSnippet -/// req.cdn = Default::default(); // is CdnSettings -/// req.id = Some("invidunt".to_string()); -/// -/// // 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 ! -/// let result = hub.live_streams().update(req) -/// .on_behalf_of_content_owner_channel("ut") -/// .on_behalf_of_content_owner("dolores") -/// .doit(); -/// # } -/// ``` -pub struct LiveStreamUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: LiveStream, - _part: String, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveStreamUpdateCall<'a, C, A> {} - -impl<'a, C, A> LiveStreamUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LiveStream)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveStreams.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "part", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *cdn* - /// * *status* - pub fn request(mut self, new_value: LiveStream) -> LiveStreamUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. - /// - /// The part properties that you can include in the parameter value are id, snippet, cdn, and status. - /// - /// Note that this method will override the existing values for all of the mutable properties that are contained in any parts that the parameter value specifies. If the request body does not specify a value for a mutable property, the existing value for that property will be removed. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *cdn* - /// * *status* - pub fn part(mut self, new_value: &str) -> LiveStreamUpdateCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveStreamUpdateCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveStreamUpdateCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveStreamUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveStreamUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveStreamUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a video stream. -/// -/// A builder for the *delete* method supported by a *liveStream* resource. -/// It is not used directly, but through a `LiveStreamMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.live_streams().delete("id") -/// .on_behalf_of_content_owner_channel("voluptua.") -/// .on_behalf_of_content_owner("duo") -/// .doit(); -/// # } -/// ``` -pub struct LiveStreamDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveStreamDeleteCall<'a, C, A> {} - -impl<'a, C, A> LiveStreamDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveStreams.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["id", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter specifies the YouTube live stream ID for the resource that is being deleted. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> LiveStreamDeleteCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveStreamDeleteCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveStreamDeleteCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveStreamDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveStreamDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveStreamDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a list of video streams that match the API request parameters. -/// -/// A builder for the *list* method supported by a *liveStream* resource. -/// It is not used directly, but through a `LiveStreamMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// * *cdn* -/// * *status* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// * *https://www.googleapis.com/auth/youtube.readonly* -/// -/// The default scope will be `Scope::Readonly`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.live_streams().list("part") -/// .page_token("aliquyam") -/// .on_behalf_of_content_owner_channel("ea") -/// .on_behalf_of_content_owner("ea") -/// .mine(false) -/// .max_results(53) -/// .id("diam") -/// .doit(); -/// # } -/// ``` -pub struct LiveStreamListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _page_token: Option, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _mine: Option, - _max_results: Option, - _id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveStreamListCall<'a, C, A> {} - -impl<'a, C, A> LiveStreamListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LiveStreamListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveStreams.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - if let Some(value) = self._mine { - params.push(("mine", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._id { - params.push(("id", value.to_string())); - } - for &field in ["alt", "part", "pageToken", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner", "mine", "maxResults", "id"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies a comma-separated list of one or more liveStream resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, cdn, and status. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *cdn* - /// * *status* - pub fn part(mut self, new_value: &str) -> LiveStreamListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> LiveStreamListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveStreamListCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveStreamListCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The mine parameter can be used to instruct the API to only return streams owned by the authenticated user. Set the parameter value to true to only retrieve your own streams. - /// - /// Sets the *mine* query property to the given value. - pub fn mine(mut self, new_value: bool) -> LiveStreamListCall<'a, C, A> { - self._mine = Some(new_value); - self - } - /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> LiveStreamListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The id parameter specifies a comma-separated list of YouTube stream IDs that identify the streams being retrieved. In a liveStream resource, the id property specifies the stream's ID. - /// - /// Sets the *id* query property to the given value. - pub fn id(mut self, new_value: &str) -> LiveStreamListCall<'a, C, A> { - self._id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveStreamListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveStreamListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveStreamListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a video stream. The stream enables you to send your video to YouTube, which can then broadcast the video to your audience. -/// -/// A builder for the *insert* method supported by a *liveStream* resource. -/// It is not used directly, but through a `LiveStreamMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// * *cdn* -/// * *status* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// -/// The default scope will be `Scope::Full`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::LiveStream; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = LiveStream::default(); -/// req.status = Default::default(); // is LiveStreamStatus -/// req.snippet = Default::default(); // is LiveStreamSnippet -/// req.cdn = Default::default(); // is CdnSettings -/// req.id = Some("kasd".to_string()); -/// -/// // 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 ! -/// let result = hub.live_streams().insert(req) -/// .on_behalf_of_content_owner_channel("invidunt") -/// .on_behalf_of_content_owner("rebum.") -/// .doit(); -/// # } -/// ``` -pub struct LiveStreamInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: LiveStream, - _part: String, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveStreamInsertCall<'a, C, A> {} - -impl<'a, C, A> LiveStreamInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LiveStream)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveStreams.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "part", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *cdn* - /// * *status* - pub fn request(mut self, new_value: LiveStream) -> LiveStreamInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. - /// - /// The part properties that you can include in the parameter value are id, snippet, cdn, and status. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *cdn* - /// * *status* - pub fn part(mut self, new_value: &str) -> LiveStreamInsertCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveStreamInsertCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveStreamInsertCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveStreamInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveStreamInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveStreamInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a reply to an existing comment. Note: To create a top-level comment, use the commentThreads.insert method. -/// -/// A builder for the *insert* method supported by a *comment* resource. -/// It is not used directly, but through a `CommentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::Comment; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = Comment::default(); -/// -/// // 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 ! -/// let result = hub.comments().insert(req) -/// .doit(); -/// # } -/// ``` -pub struct CommentInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: Comment, - _part: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CommentInsertCall<'a, C, A> {} - -impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Comment)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.comments.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - for &field in ["alt", "part"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/comments".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Comment) -> CommentInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter identifies the properties that the API response will include. Set the parameter value to snippet. The snippet part has a quota cost of 2 units. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - pub fn part(mut self, new_value: &str) -> CommentInsertCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CommentInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CommentInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CommentInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Sets the moderation status of one or more comments. The API request must be authorized by the owner of the channel or video associated with the comments. -/// -/// A builder for the *setModerationStatus* method supported by a *comment* resource. -/// It is not used directly, but through a `CommentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.comments().set_moderation_status("id", "moderationStatus") -/// .ban_author(true) -/// .doit(); -/// # } -/// ``` -pub struct CommentSetModerationStatuCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _moderation_status: String, - _ban_author: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CommentSetModerationStatuCall<'a, C, A> {} - -impl<'a, C, A> CommentSetModerationStatuCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.comments.setModerationStatus", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - params.push(("moderationStatus", self._moderation_status.to_string())); - if let Some(value) = self._ban_author { - params.push(("banAuthor", value.to_string())); - } - for &field in ["id", "moderationStatus", "banAuthor"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/youtube/v3/comments/setModerationStatus".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter specifies a comma-separated list of IDs that identify the comments for which you are updating the moderation status. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> CommentSetModerationStatuCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// Identifies the new moderation status of the specified comments. - /// - /// Sets the *moderation status* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn moderation_status(mut self, new_value: &str) -> CommentSetModerationStatuCall<'a, C, A> { - self._moderation_status = new_value.to_string(); - self - } - /// The banAuthor parameter lets you indicate that you want to automatically reject any additional comments written by the comment's author. Set the parameter value to true to ban the author. - /// - /// Note: This parameter is only valid if the moderationStatus parameter is also set to rejected. - /// - /// Sets the *ban author* query property to the given value. - pub fn ban_author(mut self, new_value: bool) -> CommentSetModerationStatuCall<'a, C, A> { - self._ban_author = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CommentSetModerationStatuCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CommentSetModerationStatuCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CommentSetModerationStatuCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a comment. -/// -/// A builder for the *delete* method supported by a *comment* resource. -/// It is not used directly, but through a `CommentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.comments().delete("id") -/// .doit(); -/// # } -/// ``` -pub struct CommentDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CommentDeleteCall<'a, C, A> {} - -impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.comments.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - for &field in ["id"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/youtube/v3/comments".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter specifies the comment ID for the resource that is being deleted. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> CommentDeleteCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CommentDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CommentDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CommentDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a list of comments that match the API request parameters. -/// -/// A builder for the *list* method supported by a *comment* resource. -/// It is not used directly, but through a `CommentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.comments().list("part") -/// .text_format("consetetur") -/// .parent_id("et") -/// .page_token("sed") -/// .max_results(54) -/// .id("takimata") -/// .doit(); -/// # } -/// ``` -pub struct CommentListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _text_format: Option, - _parent_id: Option, - _page_token: Option, - _max_results: Option, - _id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CommentListCall<'a, C, A> {} - -impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CommentListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.comments.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((8 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._text_format { - params.push(("textFormat", value.to_string())); - } - if let Some(value) = self._parent_id { - params.push(("parentId", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._id { - params.push(("id", value.to_string())); - } - for &field in ["alt", "part", "textFormat", "parentId", "pageToken", "maxResults", "id"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/comments".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies a comma-separated list of one or more comment resource properties that the API response will include. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn part(mut self, new_value: &str) -> CommentListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// This parameter indicates whether the API should return comments formatted as HTML or as plain text. - /// - /// Sets the *text format* query property to the given value. - pub fn text_format(mut self, new_value: &str) -> CommentListCall<'a, C, A> { - self._text_format = Some(new_value.to_string()); - self - } - /// The parentId parameter specifies the ID of the comment for which replies should be retrieved. - /// - /// Note: YouTube currently supports replies only for top-level comments. However, replies to replies may be supported in the future. - /// - /// Sets the *parent id* query property to the given value. - pub fn parent_id(mut self, new_value: &str) -> CommentListCall<'a, C, A> { - self._parent_id = Some(new_value.to_string()); - self - } - /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identifies the next page of the result that can be retrieved. - /// - /// Note: This parameter is not supported for use in conjunction with the id parameter. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> CommentListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. - /// - /// Note: This parameter is not supported for use in conjunction with the id parameter. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> CommentListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The id parameter specifies a comma-separated list of comment IDs for the resources that are being retrieved. In a comment resource, the id property specifies the comment's ID. - /// - /// Sets the *id* query property to the given value. - pub fn id(mut self, new_value: &str) -> CommentListCall<'a, C, A> { - self._id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CommentListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CommentListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CommentListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Modifies a comment. -/// -/// A builder for the *update* method supported by a *comment* resource. -/// It is not used directly, but through a `CommentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::Comment; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = Comment::default(); -/// -/// // 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 ! -/// let result = hub.comments().update(req) -/// .doit(); -/// # } -/// ``` -pub struct CommentUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: Comment, - _part: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CommentUpdateCall<'a, C, A> {} - -impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Comment)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.comments.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - for &field in ["alt", "part"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/comments".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Comment) -> CommentUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter identifies the properties that the API response will include. You must at least include the snippet part in the parameter value since that part contains all of the properties that the API request can update. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - pub fn part(mut self, new_value: &str) -> CommentUpdateCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CommentUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CommentUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CommentUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Expresses the caller's opinion that one or more comments should be flagged as spam. -/// -/// A builder for the *markAsSpam* method supported by a *comment* resource. -/// It is not used directly, but through a `CommentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.comments().mark_as_spam("id") -/// .doit(); -/// # } -/// ``` -pub struct CommentMarkAsSpamCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CommentMarkAsSpamCall<'a, C, A> {} - -impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.comments.markAsSpam", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - for &field in ["id"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/youtube/v3/comments/markAsSpam".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter specifies a comma-separated list of IDs of comments that the caller believes should be classified as spam. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> CommentMarkAsSpamCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CommentMarkAsSpamCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CommentMarkAsSpamCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CommentMarkAsSpamCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a channel's metadata. Note that this method currently only supports updates to the channel resource's brandingSettings and invideoPromotion objects and their child properties. -/// -/// A builder for the *update* method supported by a *channel* resource. -/// It is not used directly, but through a `ChannelMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::Channel; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = Channel::default(); -/// -/// // 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 ! -/// let result = hub.channels().update(req) -/// .on_behalf_of_content_owner("nonumy") -/// .doit(); -/// # } -/// ``` -pub struct ChannelUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: Channel, - _part: String, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ChannelUpdateCall<'a, C, A> {} - -impl<'a, C, A> ChannelUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Channel)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.channels.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "part", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/channels".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Channel) -> ChannelUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. - /// - /// The API currently only allows the parameter value to be set to either brandingSettings or invideoPromotion. (You cannot update both of those parts with a single request.) - /// - /// Note that this method overrides the existing values for all of the mutable properties that are contained in any parts that the parameter value specifies. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - pub fn part(mut self, new_value: &str) -> ChannelUpdateCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The onBehalfOfContentOwner parameter indicates that the authenticated user is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with needs to be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> ChannelUpdateCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ChannelUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ChannelUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ChannelUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a collection of zero or more channel resources that match the request criteria. -/// -/// A builder for the *list* method supported by a *channel* resource. -/// It is not used directly, but through a `ChannelMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.channels().list("part") -/// .page_token("Lorem") -/// .on_behalf_of_content_owner("Lorem") -/// .my_subscribers(true) -/// .mine(true) -/// .max_results(64) -/// .managed_by_me(false) -/// .id("ipsum") -/// .hl("ut") -/// .for_username("dolor") -/// .category_id("sea") -/// .doit(); -/// # } -/// ``` -pub struct ChannelListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _page_token: Option, - _on_behalf_of_content_owner: Option, - _my_subscribers: Option, - _mine: Option, - _max_results: Option, - _managed_by_me: Option, - _id: Option, - _hl: Option, - _for_username: Option, - _category_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ChannelListCall<'a, C, A> {} - -impl<'a, C, A> ChannelListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ChannelListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.channels.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - if let Some(value) = self._my_subscribers { - params.push(("mySubscribers", value.to_string())); - } - if let Some(value) = self._mine { - params.push(("mine", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._managed_by_me { - params.push(("managedByMe", value.to_string())); - } - if let Some(value) = self._id { - params.push(("id", value.to_string())); - } - if let Some(value) = self._hl { - params.push(("hl", value.to_string())); - } - if let Some(value) = self._for_username { - params.push(("forUsername", value.to_string())); - } - if let Some(value) = self._category_id { - params.push(("categoryId", value.to_string())); - } - for &field in ["alt", "part", "pageToken", "onBehalfOfContentOwner", "mySubscribers", "mine", "maxResults", "managedByMe", "id", "hl", "forUsername", "categoryId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/channels".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies a comma-separated list of one or more channel resource properties that the API response will include. - /// - /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a channel resource, the contentDetails property contains other properties, such as the uploads properties. As such, if you set part=contentDetails, the API response will also contain all of those nested properties. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn part(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// Use the subscriptions.list method and its mySubscribers parameter to retrieve a list of subscribers to the authenticated user's channel. - /// - /// Sets the *my subscribers* query property to the given value. - pub fn my_subscribers(mut self, new_value: bool) -> ChannelListCall<'a, C, A> { - self._my_subscribers = Some(new_value); - self - } - /// Set this parameter's value to true to instruct the API to only return channels owned by the authenticated user. - /// - /// Sets the *mine* query property to the given value. - pub fn mine(mut self, new_value: bool) -> ChannelListCall<'a, C, A> { - self._mine = Some(new_value); - self - } - /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> ChannelListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// Set this parameter's value to true to instruct the API to only return channels managed by the content owner that the onBehalfOfContentOwner parameter specifies. The user must be authenticated as a CMS account linked to the specified content owner and onBehalfOfContentOwner must be provided. - /// - /// Sets the *managed by me* query property to the given value. - pub fn managed_by_me(mut self, new_value: bool) -> ChannelListCall<'a, C, A> { - self._managed_by_me = Some(new_value); - self - } - /// The id parameter specifies a comma-separated list of the YouTube channel ID(s) for the resource(s) that are being retrieved. In a channel resource, the id property specifies the channel's YouTube channel ID. - /// - /// Sets the *id* query property to the given value. - pub fn id(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { - self._id = Some(new_value.to_string()); - self - } - /// The hl parameter should be used for filter out the properties that are not in the given language. Used for the brandingSettings part. - /// - /// Sets the *hl* query property to the given value. - pub fn hl(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { - self._hl = Some(new_value.to_string()); - self - } - /// The forUsername parameter specifies a YouTube username, thereby requesting the channel associated with that username. - /// - /// Sets the *for username* query property to the given value. - pub fn for_username(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { - self._for_username = Some(new_value.to_string()); - self - } - /// The categoryId parameter specifies a YouTube guide category, thereby requesting YouTube channels associated with that category. - /// - /// Sets the *category id* query property to the given value. - pub fn category_id(mut self, new_value: &str) -> ChannelListCall<'a, C, A> { - self._category_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ChannelListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ChannelListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ChannelListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a list of abuse reasons that can be used for reporting abusive videos. -/// -/// A builder for the *list* method supported by a *videoAbuseReportReason* resource. -/// It is not used directly, but through a `VideoAbuseReportReasonMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// * *https://www.googleapis.com/auth/youtube.readonly* -/// -/// The default scope will be `Scope::Readonly`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.video_abuse_report_reasons().list("part") -/// .hl("eirmod") -/// .doit(); -/// # } -/// ``` -pub struct VideoAbuseReportReasonListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _hl: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for VideoAbuseReportReasonListCall<'a, C, A> {} - -impl<'a, C, A> VideoAbuseReportReasonListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VideoAbuseReportReasonListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.videoAbuseReportReasons.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._hl { - params.push(("hl", value.to_string())); - } - for &field in ["alt", "part", "hl"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/videoAbuseReportReasons".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies the videoCategory resource parts that the API response will include. Supported values are id and snippet. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - pub fn part(mut self, new_value: &str) -> VideoAbuseReportReasonListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The hl parameter specifies the language that should be used for text values in the API response. - /// - /// Sets the *hl* query property to the given value. - pub fn hl(mut self, new_value: &str) -> VideoAbuseReportReasonListCall<'a, C, A> { - self._hl = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> VideoAbuseReportReasonListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VideoAbuseReportReasonListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> VideoAbuseReportReasonListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Adds a resource to a playlist. -/// -/// A builder for the *insert* method supported by a *playlistItem* resource. -/// It is not used directly, but through a `PlaylistItemMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::PlaylistItem; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = PlaylistItem::default(); -/// -/// // 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 ! -/// let result = hub.playlist_items().insert(req) -/// .on_behalf_of_content_owner("sanctus") -/// .doit(); -/// # } -/// ``` -pub struct PlaylistItemInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: PlaylistItem, - _part: String, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for PlaylistItemInsertCall<'a, C, A> {} - -impl<'a, C, A> PlaylistItemInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, PlaylistItem)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.playlistItems.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "part", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: PlaylistItem) -> PlaylistItemInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - pub fn part(mut self, new_value: &str) -> PlaylistItemInsertCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> PlaylistItemInsertCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> PlaylistItemInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> PlaylistItemInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> PlaylistItemInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a playlist item. -/// -/// A builder for the *delete* method supported by a *playlistItem* resource. -/// It is not used directly, but through a `PlaylistItemMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.playlist_items().delete("id") -/// .doit(); -/// # } -/// ``` -pub struct PlaylistItemDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for PlaylistItemDeleteCall<'a, C, A> {} - -impl<'a, C, A> PlaylistItemDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.playlistItems.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - for &field in ["id"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter specifies the YouTube playlist item ID for the playlist item that is being deleted. In a playlistItem resource, the id property specifies the playlist item's ID. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> PlaylistItemDeleteCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> PlaylistItemDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> PlaylistItemDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> PlaylistItemDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs. -/// -/// A builder for the *list* method supported by a *playlistItem* resource. -/// It is not used directly, but through a `PlaylistItemMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.playlist_items().list("part") -/// .video_id("et") -/// .playlist_id("et") -/// .page_token("vero") -/// .on_behalf_of_content_owner("ut") -/// .max_results(71) -/// .id("et") -/// .doit(); -/// # } -/// ``` -pub struct PlaylistItemListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _video_id: Option, - _playlist_id: Option, - _page_token: Option, - _on_behalf_of_content_owner: Option, - _max_results: Option, - _id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for PlaylistItemListCall<'a, C, A> {} - -impl<'a, C, A> PlaylistItemListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, PlaylistItemListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.playlistItems.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._video_id { - params.push(("videoId", value.to_string())); - } - if let Some(value) = self._playlist_id { - params.push(("playlistId", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._id { - params.push(("id", value.to_string())); - } - for &field in ["alt", "part", "videoId", "playlistId", "pageToken", "onBehalfOfContentOwner", "maxResults", "id"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies a comma-separated list of one or more playlistItem resource properties that the API response will include. - /// - /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a playlistItem resource, the snippet property contains numerous fields, including the title, description, position, and resourceId properties. As such, if you set part=snippet, the API response will contain all of those properties. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn part(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The videoId parameter specifies that the request should return only the playlist items that contain the specified video. - /// - /// Sets the *video id* query property to the given value. - pub fn video_id(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { - self._video_id = Some(new_value.to_string()); - self - } - /// The playlistId parameter specifies the unique ID of the playlist for which you want to retrieve playlist items. Note that even though this is an optional parameter, every request to retrieve playlist items must specify a value for either the id parameter or the playlistId parameter. - /// - /// Sets the *playlist id* query property to the given value. - pub fn playlist_id(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { - self._playlist_id = Some(new_value.to_string()); - self - } - /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> PlaylistItemListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The id parameter specifies a comma-separated list of one or more unique playlist item IDs. - /// - /// Sets the *id* query property to the given value. - pub fn id(mut self, new_value: &str) -> PlaylistItemListCall<'a, C, A> { - self._id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> PlaylistItemListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> PlaylistItemListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> PlaylistItemListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Modifies a playlist item. For example, you could update the item's position in the playlist. -/// -/// A builder for the *update* method supported by a *playlistItem* resource. -/// It is not used directly, but through a `PlaylistItemMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::PlaylistItem; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = PlaylistItem::default(); -/// -/// // 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 ! -/// let result = hub.playlist_items().update(req) -/// .doit(); -/// # } -/// ``` -pub struct PlaylistItemUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: PlaylistItem, - _part: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for PlaylistItemUpdateCall<'a, C, A> {} - -impl<'a, C, A> PlaylistItemUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, PlaylistItem)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.playlistItems.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - for &field in ["alt", "part"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: PlaylistItem) -> PlaylistItemUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. - /// - /// Note that this method will override the existing values for all of the mutable properties that are contained in any parts that the parameter value specifies. For example, a playlist item can specify a start time and end time, which identify the times portion of the video that should play when users watch the video in the playlist. If your request is updating a playlist item that sets these values, and the request's part parameter value includes the contentDetails part, the playlist item's start and end times will be updated to whatever value the request body specifies. If the request body does not specify values, the existing start and end times will be removed and replaced with the default settings. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - pub fn part(mut self, new_value: &str) -> PlaylistItemUpdateCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> PlaylistItemUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> PlaylistItemUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> PlaylistItemUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Uploads a watermark image to YouTube and sets it for a channel. -/// -/// A builder for the *set* method supported by a *watermark* resource. -/// It is not used directly, but through a `WatermarkMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::InvideoBranding; /// use std::fs; /// # #[test] fn egal() { /// # use std::default::Default; @@ -19315,3433 +27330,33 @@ impl<'a, C, A> PlaylistItemUpdateCall<'a, C, A> where C: BorrowMut::default(), None); /// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = InvideoBranding::default(); -/// /// // You can configure optional parameters by calling the respective setters at will, and /// // execute the final call using `upload(...)`. /// // Values shown here are possibly random and not representative ! -/// let result = hub.watermarks().set(req, "channelId") -/// .on_behalf_of_content_owner("justo") +/// let result = hub.thumbnails().set("videoId") +/// .on_behalf_of_content_owner("aliquyam") /// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); /// # } /// ``` -pub struct WatermarkSetCall<'a, C, A> +pub struct ThumbnailSetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a YouTube, - _request: InvideoBranding, - _channel_id: String, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for WatermarkSetCall<'a, C, A> {} - -impl<'a, C, A> WatermarkSetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result - where RS: ReadSeek { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.watermarks.set", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("channelId", self._channel_id.to_string())); - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["channelId", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let (mut url, upload_type) = - if protocol == "simple" { - ("https://www.googleapis.com/upload/youtube/v3/watermarks/set".to_string(), "multipart") - } else if protocol == "resumable" { - ("https://www.googleapis.com/resumable/upload/youtube/v3/watermarks/set".to_string(), "resumable") - } else { - unreachable!() - }; - params.push(("uploadType", upload_type.to_string())); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - let mut should_ask_dlg_for_url = false; - let mut upload_url_from_server; - let mut upload_url: Option = None; - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { - should_ask_dlg_for_url = false; - upload_url_from_server = false; - let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); - hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { - res.status = hyper::status::StatusCode::Ok; - res.headers.set(Location(upload_url.as_ref().unwrap().clone())); - Ok(res) - }) - } else { - let mut mp_reader: MultiPartReader = Default::default(); - let (mut body_reader, content_type) = match protocol { - "simple" => { - mp_reader.reserve_exact(2); - let size = reader.seek(io::SeekFrom::End(0)).unwrap(); - reader.seek(io::SeekFrom::Start(0)).unwrap(); - if size > 10485760 { - return Err(Error::UploadSizeLimitExceeded(size, 10485760)) - } - mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) - .add_part(&mut reader, size, reader_mime_type.clone()); - let mime_type = mp_reader.mime_type(); - (&mut mp_reader as &mut io::Read, ContentType(mime_type)) - }, - _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), - }; - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(content_type) - .body(&mut body_reader); - upload_url_from_server = true; - if protocol == "resumable" { - req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); - } - - dlg.pre_request(); - req.send() - } - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - if protocol == "resumable" { - let size = reader.seek(io::SeekFrom::End(0)).unwrap(); - reader.seek(io::SeekFrom::Start(0)).unwrap(); - if size > 10485760 { - return Err(Error::UploadSizeLimitExceeded(size, 10485760)) - } - let mut client = &mut *self.hub.client.borrow_mut(); - let upload_result = { - let url_str = &res.headers.get::().expect("Location header is part of protocol").0; - if upload_url_from_server { - dlg.store_upload_url(Some(url_str)); - } - - cmn::ResumableUploadHelper { - client: &mut client.borrow_mut(), - delegate: dlg, - start_at: if upload_url_from_server { Some(0) } else { None }, - auth: &mut *self.hub.auth.borrow_mut(), - user_agent: &self.hub._user_agent, - auth_header: auth_header.clone(), - url: url_str, - reader: &mut reader, - media_type: reader_mime_type.clone(), - content_length: size - }.upload() - }; - match upload_result { - None => { - dlg.finished(false); - return Err(Error::Cancelled) - } - Some(Err(err)) => { - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Some(Ok(upload_result)) => { - res = upload_result; - if !res.status.is_success() { - dlg.store_upload_url(None); - dlg.finished(false); - return Err(Error::Failure(res)) - } - } - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - /// Upload media all at once. - /// If the upload fails for whichever reason, all progress is lost. - /// - /// * *max size*: 10MB - /// * *multipart*: yes - /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result - where RS: ReadSeek { - self.doit(stream, mime_type, "simple") - } - /// Upload media in a resumable fashion. - /// Even if the upload fails or is interrupted, it can be resumed for a - /// certain amount of time as the server maintains state temporarily. - /// - /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL - /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate - /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using - /// `cancel_chunk_upload(...)`. - /// - /// * *max size*: 10MB - /// * *multipart*: yes - /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result - where RS: ReadSeek { - self.doit(resumeable_stream, mime_type, "resumable") - } - - /// - /// Sets the *request* property to the given value. - /// - /// 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: InvideoBranding) -> WatermarkSetCall<'a, C, A> { - self._request = new_value; - self - } - /// The channelId parameter specifies the YouTube channel ID for which the watermark is being provided. - /// - /// Sets the *channel id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn channel_id(mut self, new_value: &str) -> WatermarkSetCall<'a, C, A> { - self._channel_id = new_value.to_string(); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> WatermarkSetCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> WatermarkSetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> WatermarkSetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> WatermarkSetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a channel's watermark image. -/// -/// A builder for the *unset* method supported by a *watermark* resource. -/// It is not used directly, but through a `WatermarkMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.watermarks().unset("channelId") -/// .on_behalf_of_content_owner("vero") -/// .doit(); -/// # } -/// ``` -pub struct WatermarkUnsetCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _channel_id: String, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for WatermarkUnsetCall<'a, C, A> {} - -impl<'a, C, A> WatermarkUnsetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.watermarks.unset", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); - params.push(("channelId", self._channel_id.to_string())); - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["channelId", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/youtube/v3/watermarks/unset".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The channelId parameter specifies the YouTube channel ID for which the watermark is being unset. - /// - /// Sets the *channel id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn channel_id(mut self, new_value: &str) -> WatermarkUnsetCall<'a, C, A> { - self._channel_id = new_value.to_string(); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> WatermarkUnsetCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> WatermarkUnsetCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> WatermarkUnsetCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> WatermarkUnsetCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Controls the settings for a slate that can be displayed in the broadcast stream. -/// -/// A builder for the *control* method supported by a *liveBroadcast* resource. -/// It is not used directly, but through a `LiveBroadcastMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// * *contentDetails* -/// * *status* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// -/// The default scope will be `Scope::Full`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.live_broadcasts().control("id", "part") -/// .walltime("et") -/// .on_behalf_of_content_owner_channel("nonumy") -/// .on_behalf_of_content_owner("et") -/// .offset_time_ms("sed") -/// .display_slate(true) -/// .doit(); -/// # } -/// ``` -pub struct LiveBroadcastControlCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _part: String, - _walltime: Option, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _offset_time_ms: Option, - _display_slate: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveBroadcastControlCall<'a, C, A> {} - -impl<'a, C, A> LiveBroadcastControlCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.control", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._walltime { - params.push(("walltime", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - if let Some(value) = self._offset_time_ms { - params.push(("offsetTimeMs", value.to_string())); - } - if let Some(value) = self._display_slate { - params.push(("displaySlate", value.to_string())); - } - for &field in ["alt", "id", "part", "walltime", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner", "offsetTimeMs", "displaySlate"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts/control".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter specifies the YouTube live broadcast ID that uniquely identifies the broadcast in which the slate is being updated. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *contentDetails* - /// * *status* - pub fn part(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The walltime parameter specifies the wall clock time at which the specified slate change will occur. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sssZ) format. - /// - /// Sets the *walltime* query property to the given value. - pub fn walltime(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { - self._walltime = Some(new_value.to_string()); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The offsetTimeMs parameter specifies a positive time offset when the specified slate change will occur. The value is measured in milliseconds from the beginning of the broadcast's monitor stream, which is the time that the testing phase for the broadcast began. Even though it is specified in milliseconds, the value is actually an approximation, and YouTube completes the requested action as closely as possible to that time. - /// - /// If you do not specify a value for this parameter, then YouTube performs the action as soon as possible. See the Getting started guide for more details. - /// - /// Important: You should only specify a value for this parameter if your broadcast stream is delayed. - /// - /// Sets the *offset time ms* query property to the given value. - pub fn offset_time_ms(mut self, new_value: &str) -> LiveBroadcastControlCall<'a, C, A> { - self._offset_time_ms = Some(new_value.to_string()); - self - } - /// The displaySlate parameter specifies whether the slate is being enabled or disabled. - /// - /// Sets the *display slate* query property to the given value. - pub fn display_slate(mut self, new_value: bool) -> LiveBroadcastControlCall<'a, C, A> { - self._display_slate = Some(new_value); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveBroadcastControlCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveBroadcastControlCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveBroadcastControlCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream, though a video stream may be bound to more than one broadcast. -/// -/// A builder for the *bind_direct* method supported by a *liveBroadcast* resource. -/// It is not used directly, but through a `LiveBroadcastMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// * *contentDetails* -/// * *status* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// -/// The default scope will be `Scope::Full`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.live_broadcasts().bind_direct("id", "part") -/// .stream_id("labore") -/// .on_behalf_of_content_owner_channel("aliquyam") -/// .on_behalf_of_content_owner("elitr") -/// .doit(); -/// # } -/// ``` -pub struct LiveBroadcastBindDirectCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _part: String, - _stream_id: Option, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveBroadcastBindDirectCall<'a, C, A> {} - -impl<'a, C, A> LiveBroadcastBindDirectCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.bind_direct", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._stream_id { - params.push(("streamId", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "id", "part", "streamId", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts/bind/direct".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter specifies the unique ID of the broadcast that is being bound to a video stream. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> LiveBroadcastBindDirectCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *contentDetails* - /// * *status* - pub fn part(mut self, new_value: &str) -> LiveBroadcastBindDirectCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The streamId parameter specifies the unique ID of the video stream that is being bound to a broadcast. If this parameter is omitted, the API will remove any existing binding between the broadcast and a video stream. - /// - /// Sets the *stream id* query property to the given value. - pub fn stream_id(mut self, new_value: &str) -> LiveBroadcastBindDirectCall<'a, C, A> { - self._stream_id = Some(new_value.to_string()); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastBindDirectCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastBindDirectCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveBroadcastBindDirectCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveBroadcastBindDirectCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveBroadcastBindDirectCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a broadcast. For example, you could modify the broadcast settings defined in the liveBroadcast resource's contentDetails object. -/// -/// A builder for the *update* method supported by a *liveBroadcast* resource. -/// It is not used directly, but through a `LiveBroadcastMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// * *contentDetails* -/// * *status* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// -/// The default scope will be `Scope::Full`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::LiveBroadcast; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = LiveBroadcast::default(); -/// req.status = Default::default(); // is LiveBroadcastStatus -/// req.content_details = Default::default(); // is LiveBroadcastContentDetails -/// req.snippet = Default::default(); // is LiveBroadcastSnippet -/// req.id = Some("consetetur".to_string()); -/// -/// // 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 ! -/// let result = hub.live_broadcasts().update(req) -/// .on_behalf_of_content_owner_channel("sea") -/// .on_behalf_of_content_owner("elitr") -/// .doit(); -/// # } -/// ``` -pub struct LiveBroadcastUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: LiveBroadcast, - _part: String, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveBroadcastUpdateCall<'a, C, A> {} - -impl<'a, C, A> LiveBroadcastUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "part", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *contentDetails* - /// * *status* - pub fn request(mut self, new_value: LiveBroadcast) -> LiveBroadcastUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. - /// - /// The part properties that you can include in the parameter value are id, snippet, contentDetails, and status. - /// - /// Note that this method will override the existing values for all of the mutable properties that are contained in any parts that the parameter value specifies. For example, a broadcast's privacy status is defined in the status part. As such, if your request is updating a private or unlisted broadcast, and the request's part parameter value includes the status part, the broadcast's privacy setting will be updated to whatever value the request body specifies. If the request body does not specify a value, the existing privacy setting will be removed and the broadcast will revert to the default privacy setting. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *contentDetails* - /// * *status* - pub fn part(mut self, new_value: &str) -> LiveBroadcastUpdateCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastUpdateCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastUpdateCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveBroadcastUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveBroadcastUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveBroadcastUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Creates a broadcast. -/// -/// A builder for the *insert* method supported by a *liveBroadcast* resource. -/// It is not used directly, but through a `LiveBroadcastMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// * *contentDetails* -/// * *status* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// -/// The default scope will be `Scope::Full`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::LiveBroadcast; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = LiveBroadcast::default(); -/// req.status = Default::default(); // is LiveBroadcastStatus -/// req.content_details = Default::default(); // is LiveBroadcastContentDetails -/// req.snippet = Default::default(); // is LiveBroadcastSnippet -/// req.id = Some("At".to_string()); -/// -/// // 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 ! -/// let result = hub.live_broadcasts().insert(req) -/// .on_behalf_of_content_owner_channel("sea") -/// .on_behalf_of_content_owner("consetetur") -/// .doit(); -/// # } -/// ``` -pub struct LiveBroadcastInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: LiveBroadcast, - _part: String, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveBroadcastInsertCall<'a, C, A> {} - -impl<'a, C, A> LiveBroadcastInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "part", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *contentDetails* - /// * *status* - pub fn request(mut self, new_value: LiveBroadcast) -> LiveBroadcastInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. - /// - /// The part properties that you can include in the parameter value are id, snippet, contentDetails, and status. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *contentDetails* - /// * *status* - pub fn part(mut self, new_value: &str) -> LiveBroadcastInsertCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastInsertCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastInsertCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveBroadcastInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveBroadcastInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveBroadcastInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a list of YouTube broadcasts that match the API request parameters. -/// -/// A builder for the *list* method supported by a *liveBroadcast* resource. -/// It is not used directly, but through a `LiveBroadcastMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// * *contentDetails* -/// * *status* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// * *https://www.googleapis.com/auth/youtube.readonly* -/// -/// The default scope will be `Scope::Readonly`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.live_broadcasts().list("part") -/// .page_token("accusam") -/// .on_behalf_of_content_owner_channel("dolores") -/// .on_behalf_of_content_owner("consetetur") -/// .mine(false) -/// .max_results(19) -/// .id("elitr") -/// .broadcast_status("ea") -/// .doit(); -/// # } -/// ``` -pub struct LiveBroadcastListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _page_token: Option, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _mine: Option, - _max_results: Option, - _id: Option, - _broadcast_status: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveBroadcastListCall<'a, C, A> {} - -impl<'a, C, A> LiveBroadcastListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcastListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - if let Some(value) = self._mine { - params.push(("mine", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._id { - params.push(("id", value.to_string())); - } - if let Some(value) = self._broadcast_status { - params.push(("broadcastStatus", value.to_string())); - } - for &field in ["alt", "part", "pageToken", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner", "mine", "maxResults", "id", "broadcastStatus"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *contentDetails* - /// * *status* - pub fn part(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The mine parameter can be used to instruct the API to only return broadcasts owned by the authenticated user. Set the parameter value to true to only retrieve your own broadcasts. - /// - /// Sets the *mine* query property to the given value. - pub fn mine(mut self, new_value: bool) -> LiveBroadcastListCall<'a, C, A> { - self._mine = Some(new_value); - self - } - /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> LiveBroadcastListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// The id parameter specifies a comma-separated list of YouTube broadcast IDs that identify the broadcasts being retrieved. In a liveBroadcast resource, the id property specifies the broadcast's ID. - /// - /// Sets the *id* query property to the given value. - pub fn id(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { - self._id = Some(new_value.to_string()); - self - } - /// The broadcastStatus parameter filters the API response to only include broadcasts with the specified status. - /// - /// Sets the *broadcast status* query property to the given value. - pub fn broadcast_status(mut self, new_value: &str) -> LiveBroadcastListCall<'a, C, A> { - self._broadcast_status = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveBroadcastListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveBroadcastListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveBroadcastListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a broadcast. -/// -/// A builder for the *delete* method supported by a *liveBroadcast* resource. -/// It is not used directly, but through a `LiveBroadcastMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.live_broadcasts().delete("id") -/// .on_behalf_of_content_owner_channel("Stet") -/// .on_behalf_of_content_owner("sed") -/// .doit(); -/// # } -/// ``` -pub struct LiveBroadcastDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveBroadcastDeleteCall<'a, C, A> {} - -impl<'a, C, A> LiveBroadcastDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["id", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter specifies the YouTube live broadcast ID for the resource that is being deleted. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> LiveBroadcastDeleteCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastDeleteCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastDeleteCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveBroadcastDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveBroadcastDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveBroadcastDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Changes the status of a YouTube live broadcast and initiates any processes associated with the new status. For example, when you transition a broadcast's status to testing, YouTube starts to transmit video to that broadcast's monitor stream. Before calling this method, you should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active. -/// -/// A builder for the *transition* method supported by a *liveBroadcast* resource. -/// It is not used directly, but through a `LiveBroadcastMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// * *contentDetails* -/// * *status* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// -/// The default scope will be `Scope::Full`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.live_broadcasts().transition("broadcastStatus", "id", "part") -/// .on_behalf_of_content_owner_channel("Lorem") -/// .on_behalf_of_content_owner("consetetur") -/// .doit(); -/// # } -/// ``` -pub struct LiveBroadcastTransitionCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _broadcast_status: String, - _id: String, - _part: String, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveBroadcastTransitionCall<'a, C, A> {} - -impl<'a, C, A> LiveBroadcastTransitionCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.transition", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); - params.push(("broadcastStatus", self._broadcast_status.to_string())); - params.push(("id", self._id.to_string())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "broadcastStatus", "id", "part", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts/transition".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The broadcastStatus parameter identifies the state to which the broadcast is changing. Note that to transition a broadcast to either the testing or live state, the status.streamStatus must be active for the stream that the broadcast is bound to. - /// - /// Sets the *broadcast status* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn broadcast_status(mut self, new_value: &str) -> LiveBroadcastTransitionCall<'a, C, A> { - self._broadcast_status = new_value.to_string(); - self - } - /// The id parameter specifies the unique ID of the broadcast that is transitioning to another status. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> LiveBroadcastTransitionCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *contentDetails* - /// * *status* - pub fn part(mut self, new_value: &str) -> LiveBroadcastTransitionCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastTransitionCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastTransitionCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveBroadcastTransitionCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveBroadcastTransitionCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveBroadcastTransitionCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream, though a video stream may be bound to more than one broadcast. -/// -/// A builder for the *bind* method supported by a *liveBroadcast* resource. -/// It is not used directly, but through a `LiveBroadcastMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// * *contentDetails* -/// * *status* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube* -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// -/// The default scope will be `Scope::Full`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.live_broadcasts().bind("id", "part") -/// .stream_id("labore") -/// .on_behalf_of_content_owner_channel("gubergren") -/// .on_behalf_of_content_owner("et") -/// .doit(); -/// # } -/// ``` -pub struct LiveBroadcastBindCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _part: String, - _stream_id: Option, - _on_behalf_of_content_owner_channel: Option, - _on_behalf_of_content_owner: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for LiveBroadcastBindCall<'a, C, A> {} - -impl<'a, C, A> LiveBroadcastBindCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, LiveBroadcast)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.liveBroadcasts.bind", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._stream_id { - params.push(("streamId", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner_channel { - params.push(("onBehalfOfContentOwnerChannel", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - for &field in ["alt", "id", "part", "streamId", "onBehalfOfContentOwnerChannel", "onBehalfOfContentOwner"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts/bind".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter specifies the unique ID of the broadcast that is being bound to a video stream. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> LiveBroadcastBindCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - /// * *contentDetails* - /// * *status* - pub fn part(mut self, new_value: &str) -> LiveBroadcastBindCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The streamId parameter specifies the unique ID of the video stream that is being bound to a broadcast. If this parameter is omitted, the API will remove any existing binding between the broadcast and a video stream. - /// - /// Sets the *stream id* query property to the given value. - pub fn stream_id(mut self, new_value: &str) -> LiveBroadcastBindCall<'a, C, A> { - self._stream_id = Some(new_value.to_string()); - self - } - /// This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner parameter specifies. - /// - /// This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. - /// - /// Sets the *on behalf of content owner channel* query property to the given value. - pub fn on_behalf_of_content_owner_channel(mut self, new_value: &str) -> LiveBroadcastBindCall<'a, C, A> { - self._on_behalf_of_content_owner_channel = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> LiveBroadcastBindCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> LiveBroadcastBindCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> LiveBroadcastBindCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> LiveBroadcastBindCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Uploads a caption track. -/// -/// A builder for the *insert* method supported by a *caption* resource. -/// It is not used directly, but through a `CaptionMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::Caption; -/// use std::fs; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = Caption::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `upload_resumable(...)`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.captions().insert(req) -/// .sync(true) -/// .on_behalf_of_content_owner("accusam") -/// .on_behalf_of("magna") -/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); -/// # } -/// ``` -pub struct CaptionInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: Caption, - _part: String, - _sync: Option, - _on_behalf_of_content_owner: Option, - _on_behalf_of: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CaptionInsertCall<'a, C, A> {} - -impl<'a, C, A> CaptionInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, Caption)> - where RS: ReadSeek { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.captions.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - if let Some(value) = self._sync { - params.push(("sync", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - if let Some(value) = self._on_behalf_of { - params.push(("onBehalfOf", value.to_string())); - } - for &field in ["alt", "part", "sync", "onBehalfOfContentOwner", "onBehalfOf"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let (mut url, upload_type) = - if protocol == "simple" { - ("https://www.googleapis.com/upload/youtube/v3/captions".to_string(), "multipart") - } else if protocol == "resumable" { - ("https://www.googleapis.com/resumable/upload/youtube/v3/captions".to_string(), "resumable") - } else { - unreachable!() - }; - params.push(("uploadType", upload_type.to_string())); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - let mut should_ask_dlg_for_url = false; - let mut upload_url_from_server; - let mut upload_url: Option = None; - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { - should_ask_dlg_for_url = false; - upload_url_from_server = false; - let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); - hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { - res.status = hyper::status::StatusCode::Ok; - res.headers.set(Location(upload_url.as_ref().unwrap().clone())); - Ok(res) - }) - } else { - let mut mp_reader: MultiPartReader = Default::default(); - let (mut body_reader, content_type) = match protocol { - "simple" => { - mp_reader.reserve_exact(2); - let size = reader.seek(io::SeekFrom::End(0)).unwrap(); - reader.seek(io::SeekFrom::Start(0)).unwrap(); - if size > 104857600 { - return Err(Error::UploadSizeLimitExceeded(size, 104857600)) - } - mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) - .add_part(&mut reader, size, reader_mime_type.clone()); - let mime_type = mp_reader.mime_type(); - (&mut mp_reader as &mut io::Read, ContentType(mime_type)) - }, - _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), - }; - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(content_type) - .body(&mut body_reader); - upload_url_from_server = true; - if protocol == "resumable" { - req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); - } - - dlg.pre_request(); - req.send() - } - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - if protocol == "resumable" { - let size = reader.seek(io::SeekFrom::End(0)).unwrap(); - reader.seek(io::SeekFrom::Start(0)).unwrap(); - if size > 104857600 { - return Err(Error::UploadSizeLimitExceeded(size, 104857600)) - } - let mut client = &mut *self.hub.client.borrow_mut(); - let upload_result = { - let url_str = &res.headers.get::().expect("Location header is part of protocol").0; - if upload_url_from_server { - dlg.store_upload_url(Some(url_str)); - } - - cmn::ResumableUploadHelper { - client: &mut client.borrow_mut(), - delegate: dlg, - start_at: if upload_url_from_server { Some(0) } else { None }, - auth: &mut *self.hub.auth.borrow_mut(), - user_agent: &self.hub._user_agent, - auth_header: auth_header.clone(), - url: url_str, - reader: &mut reader, - media_type: reader_mime_type.clone(), - content_length: size - }.upload() - }; - match upload_result { - None => { - dlg.finished(false); - return Err(Error::Cancelled) - } - Some(Err(err)) => { - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Some(Ok(upload_result)) => { - res = upload_result; - if !res.status.is_success() { - dlg.store_upload_url(None); - dlg.finished(false); - return Err(Error::Failure(res)) - } - } - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - /// Upload media all at once. - /// If the upload fails for whichever reason, all progress is lost. - /// - /// * *max size*: 100MB - /// * *multipart*: yes - /// * *valid mime types*: '*/*', 'application/octet-stream' and 'text/xml' - pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Caption)> - where RS: ReadSeek { - self.doit(stream, mime_type, "simple") - } - /// Upload media in a resumable fashion. - /// Even if the upload fails or is interrupted, it can be resumed for a - /// certain amount of time as the server maintains state temporarily. - /// - /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL - /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate - /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using - /// `cancel_chunk_upload(...)`. - /// - /// * *max size*: 100MB - /// * *multipart*: yes - /// * *valid mime types*: '*/*', 'application/octet-stream' and 'text/xml' - pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Caption)> - where RS: ReadSeek { - self.doit(resumeable_stream, mime_type, "resumable") - } - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Caption) -> CaptionInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter specifies the caption resource parts that the API response will include. Set the parameter value to snippet. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - pub fn part(mut self, new_value: &str) -> CaptionInsertCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The sync parameter indicates whether YouTube should automatically synchronize the caption file with the audio track of the video. If you set the value to true, YouTube will disregard any time codes that are in the uploaded caption file and generate new time codes for the captions. - /// - /// You should set the sync parameter to true if you are uploading a transcript, which has no time codes, or if you suspect the time codes in your file are incorrect and want YouTube to try to fix them. - /// - /// Sets the *sync* query property to the given value. - pub fn sync(mut self, new_value: bool) -> CaptionInsertCall<'a, C, A> { - self._sync = Some(new_value); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> CaptionInsertCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// ID of the Google+ Page for the channel that the request is be on behalf of - /// - /// Sets the *on behalf of* query property to the given value. - pub fn on_behalf_of(mut self, new_value: &str) -> CaptionInsertCall<'a, C, A> { - self._on_behalf_of = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CaptionInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CaptionInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CaptionInsertCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a list of caption tracks that are associated with a specified video. Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track. -/// -/// A builder for the *list* method supported by a *caption* resource. -/// It is not used directly, but through a `CaptionMethods` instance. -/// -/// **Settable Parts** -/// -/// * *id* -/// * *snippet* -/// -/// # Scopes -/// -/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: -/// -/// * *https://www.googleapis.com/auth/youtube.force-ssl* -/// * *https://www.googleapis.com/auth/youtubepartner* -/// -/// The default scope will be `Scope::ForceSsl`. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.captions().list("part", "videoId") -/// .on_behalf_of_content_owner("et") -/// .on_behalf_of("clita") -/// .id("eos") -/// .doit(); -/// # } -/// ``` -pub struct CaptionListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, _video_id: String, _on_behalf_of_content_owner: Option, - _on_behalf_of: Option, - _id: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for CaptionListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for ThumbnailSetCall<'a, C, A> {} -impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> ThumbnailSetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, CaptionListResponse)> { + fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, ThumbnailSetResponse)> + where RS: ReadSeek { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -22749,21 +27364,14 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.captions.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); - params.push(("part", self._part.to_string())); + dlg.begin(MethodInfo { id: "youtube.thumbnails.set", + http_method: hyper::method::Method::Post }); + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("videoId", self._video_id.to_string())); if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); } - if let Some(value) = self._on_behalf_of { - params.push(("onBehalfOf", value.to_string())); - } - if let Some(value) = self._id { - params.push(("id", value.to_string())); - } - for &field in ["alt", "part", "videoId", "onBehalfOfContentOwner", "onBehalfOf", "id"].iter() { + for &field in ["alt", "videoId", "onBehalfOfContentOwner"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -22775,18 +27383,29 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/youtube/v3/captions".to_string(); + let (mut url, upload_type) = + if protocol == "simple" { + ("https://www.googleapis.com/upload/youtube/v3/thumbnails/set".to_string(), "multipart") + } else if protocol == "resumable" { + ("https://www.googleapis.com/resumable/upload/youtube/v3/thumbnails/set".to_string(), "resumable") + } else { + unreachable!() + }; + params.push(("uploadType", upload_type.to_string())); if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); + self._scopes.insert(Scope::Full.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } + let mut should_ask_dlg_for_url = false; + let mut upload_url_from_server; + let mut upload_url: Option = None; loop { let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { @@ -22804,19 +27423,44 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, access_token: token.access_token }); let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() + if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { + should_ask_dlg_for_url = false; + upload_url_from_server = false; + let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); + hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { + res.status = hyper::status::StatusCode::Ok; + res.headers.set(Location(upload_url.as_ref().unwrap().clone())); + Ok(res) + }) + } else { + let mut client = &mut *self.hub.client.borrow_mut(); + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) + .header(UserAgent(self.hub._user_agent.clone())) + .header(auth_header.clone()); + if protocol == "simple" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 2097152 { + return Err(Error::UploadSizeLimitExceeded(size, 2097152)) + } + req = req.header(ContentType(reader_mime_type.clone())) + .header(ContentLength(size)) + .body(&mut reader); + } + upload_url_from_server = true; + if protocol == "resumable" { + req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); + } + + dlg.pre_request(); + req.send() + } }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22826,10 +27470,10 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -22838,6 +27482,51 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o Ok(serr) => Err(Error::BadRequest(serr)) } } + if protocol == "resumable" { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + if size > 2097152 { + return Err(Error::UploadSizeLimitExceeded(size, 2097152)) + } + let mut client = &mut *self.hub.client.borrow_mut(); + let upload_result = { + let url_str = &res.headers.get::().expect("Location header is part of protocol").0; + if upload_url_from_server { + dlg.store_upload_url(Some(url_str)); + } + + cmn::ResumableUploadHelper { + client: &mut client.borrow_mut(), + delegate: dlg, + start_at: if upload_url_from_server { Some(0) } else { None }, + auth: &mut *self.hub.auth.borrow_mut(), + user_agent: &self.hub._user_agent, + auth_header: auth_header.clone(), + url: url_str, + reader: &mut reader, + media_type: reader_mime_type.clone(), + content_length: size + }.upload() + }; + match upload_result { + None => { + dlg.finished(false); + return Err(Error::Cancelled) + } + Some(Err(err)) => { + dlg.finished(false); + return Err(Error::HttpError(err)) + } + Some(Ok(upload_result)) => { + res = upload_result; + if !res.status.is_success() { + dlg.store_upload_url(None); + dlg.finished(false); + return Err(Error::Failure(res)) + } + } + } + } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); @@ -22857,29 +27546,40 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o } } - - /// The part parameter specifies a comma-separated list of one or more caption resource parts that the API response will include. The part names that you can include in the parameter value are id and snippet. + /// Upload media all at once. + /// If the upload fails for whichever reason, all progress is lost. /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - /// - /// **Settable Parts** - /// - /// * *id* - /// * *snippet* - pub fn part(mut self, new_value: &str) -> CaptionListCall<'a, C, A> { - self._part = new_value.to_string(); - self + /// * *max size*: 2MB + /// * *multipart*: yes + /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, ThumbnailSetResponse)> + where RS: ReadSeek { + self.doit(stream, mime_type, "simple") } - /// The videoId parameter specifies the YouTube video ID of the video for which the API should return caption tracks. + /// Upload media in a resumable fashion. + /// Even if the upload fails or is interrupted, it can be resumed for a + /// certain amount of time as the server maintains state temporarily. + /// + /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL + /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate + /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using + /// `cancel_chunk_upload(...)`. + /// + /// * *max size*: 2MB + /// * *multipart*: yes + /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, ThumbnailSetResponse)> + where RS: ReadSeek { + self.doit(resumeable_stream, mime_type, "resumable") + } + + /// The videoId parameter specifies a YouTube video ID for which the custom video thumbnail is being provided. /// /// Sets the *video id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn video_id(mut self, new_value: &str) -> CaptionListCall<'a, C, A> { + pub fn video_id(mut self, new_value: &str) -> ThumbnailSetCall<'a, C, A> { self._video_id = new_value.to_string(); self } @@ -22888,42 +27588,28 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. /// /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> CaptionListCall<'a, C, A> { + pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> ThumbnailSetCall<'a, C, A> { self._on_behalf_of_content_owner = Some(new_value.to_string()); self } - /// ID of the Google+ Page for the channel that the request is on behalf of. - /// - /// Sets the *on behalf of* query property to the given value. - pub fn on_behalf_of(mut self, new_value: &str) -> CaptionListCall<'a, C, A> { - self._on_behalf_of = Some(new_value.to_string()); - self - } - /// The id parameter specifies a comma-separated list of IDs that identify the caption resources that should be retrieved. Each ID must identify a caption track associated with the specified video. - /// - /// Sets the *id* query property to the given value. - pub fn id(mut self, new_value: &str) -> CaptionListCall<'a, C, A> { - self._id = Some(new_value.to_string()); - self - } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// 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 Delegate) -> CaptionListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> ThumbnailSetCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -22933,24 +27619,24 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CaptionListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> ThumbnailSetCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. + /// `Scope::Full`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> CaptionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ThumbnailSetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -22958,13 +27644,25 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o } -/// Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter. +/// Lists fan funding events for a channel. /// -/// This method supports **media download**. To enable it, adjust the builder like this: -/// `.param("alt", "media")`. +/// A builder for the *list* method supported by a *fanFundingEvent* resource. +/// It is not used directly, but through a `FanFundingEventMethods` instance. /// -/// A builder for the *download* method supported by a *caption* resource. -/// It is not used directly, but through a `CaptionMethods` instance. +/// **Settable Parts** +/// +/// * *id* +/// * *snippet* +/// +/// # Scopes +/// +/// You will need authorization for at least one of the following scopes to make a valid call, possibly depending on *parts*: +/// +/// * *https://www.googleapis.com/auth/youtube* +/// * *https://www.googleapis.com/auth/youtube.force-ssl* +/// * *https://www.googleapis.com/auth/youtube.readonly* +/// +/// The default scope will be `Scope::Readonly`. /// /// # Example /// @@ -22987,944 +27685,33 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o /// // 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 ! -/// let result = hub.captions().download("id") -/// .tlang("vero") -/// .tfmt("consetetur") -/// .on_behalf_of_content_owner("vero") -/// .on_behalf_of("consetetur") +/// let result = hub.fan_funding_events().list("part") +/// .page_token("magna") +/// .max_results(40) +/// .hl("sit") /// .doit(); /// # } /// ``` -pub struct CaptionDownloadCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _tlang: Option, - _tfmt: Option, - _on_behalf_of_content_owner: Option, - _on_behalf_of: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CaptionDownloadCall<'a, C, A> {} - -impl<'a, C, A> CaptionDownloadCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.captions.download", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - if let Some(value) = self._tlang { - params.push(("tlang", value.to_string())); - } - if let Some(value) = self._tfmt { - params.push(("tfmt", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - if let Some(value) = self._on_behalf_of { - params.push(("onBehalfOf", value.to_string())); - } - for &field in ["id", "tlang", "tfmt", "onBehalfOfContentOwner", "onBehalfOf"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/youtube/v3/captions/{id}".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - for &(find_this, param_name) in [("{id}", "id")].iter() { - let mut replace_with: Option<&str> = None; - for &(name, ref value) in params.iter() { - if name == param_name { - replace_with = Some(value); - break; - } - } - url = url.replace(find_this, replace_with.expect("to find substitution value in params")); - } - { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["id"].iter() { - if let Some(index) = params.iter().position(|t| &t.0 == param_name) { - indices_for_removal.push(index); - } - } - for &index in indices_for_removal.iter() { - params.remove(index); - } - } - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter identifies the caption track that is being retrieved. The value is a caption track ID as identified by the id property in a caption resource. - /// - /// Sets the *id* path property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> CaptionDownloadCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// The tlang parameter specifies that the API response should return a translation of the specified caption track. The parameter value is an ISO 639-1 two-letter language code that identifies the desired caption language. The translation is generated by using machine translation, such as Google Translate. - /// - /// Sets the *tlang* query property to the given value. - pub fn tlang(mut self, new_value: &str) -> CaptionDownloadCall<'a, C, A> { - self._tlang = Some(new_value.to_string()); - self - } - /// The tfmt parameter specifies that the caption track should be returned in a specific format. If the parameter is not included in the request, the track is returned in its original format. - /// - /// Sets the *tfmt* query property to the given value. - pub fn tfmt(mut self, new_value: &str) -> CaptionDownloadCall<'a, C, A> { - self._tfmt = Some(new_value.to_string()); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> CaptionDownloadCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// ID of the Google+ Page for the channel that the request is be on behalf of - /// - /// Sets the *on behalf of* query property to the given value. - pub fn on_behalf_of(mut self, new_value: &str) -> CaptionDownloadCall<'a, C, A> { - self._on_behalf_of = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CaptionDownloadCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CaptionDownloadCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CaptionDownloadCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Deletes a specified caption track. -/// -/// A builder for the *delete* method supported by a *caption* resource. -/// It is not used directly, but through a `CaptionMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.captions().delete("id") -/// .on_behalf_of_content_owner("justo") -/// .on_behalf_of("tempor") -/// .doit(); -/// # } -/// ``` -pub struct CaptionDeleteCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _id: String, - _on_behalf_of_content_owner: Option, - _on_behalf_of: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CaptionDeleteCall<'a, C, A> {} - -impl<'a, C, A> CaptionDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.captions.delete", - http_method: hyper::method::Method::Delete }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - params.push(("id", self._id.to_string())); - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - if let Some(value) = self._on_behalf_of { - params.push(("onBehalfOf", value.to_string())); - } - for &field in ["id", "onBehalfOfContentOwner", "onBehalfOf"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - - let mut url = "https://www.googleapis.com/youtube/v3/captions".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = res; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The id parameter identifies the caption track that is being deleted. The value is a caption track ID as identified by the id property in a caption resource. - /// - /// Sets the *id* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn id(mut self, new_value: &str) -> CaptionDeleteCall<'a, C, A> { - self._id = new_value.to_string(); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> CaptionDeleteCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// ID of the Google+ Page for the channel that the request is be on behalf of - /// - /// Sets the *on behalf of* query property to the given value. - pub fn on_behalf_of(mut self, new_value: &str) -> CaptionDeleteCall<'a, C, A> { - self._on_behalf_of = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CaptionDeleteCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CaptionDeleteCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CaptionDeleteCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Updates a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both. -/// -/// A builder for the *update* method supported by a *caption* resource. -/// It is not used directly, but through a `CaptionMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::Caption; -/// use std::fs; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = Caption::default(); -/// -/// // You can configure optional parameters by calling the respective setters at will, and -/// // execute the final call using `upload_resumable(...)`. -/// // Values shown here are possibly random and not representative ! -/// let result = hub.captions().update(req) -/// .sync(false) -/// .on_behalf_of_content_owner("dolore") -/// .on_behalf_of("amet.") -/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); -/// # } -/// ``` -pub struct CaptionUpdateCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: Caption, - _part: String, - _sync: Option, - _on_behalf_of_content_owner: Option, - _on_behalf_of: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for CaptionUpdateCall<'a, C, A> {} - -impl<'a, C, A> CaptionUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - fn doit(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, Caption)> - where RS: ReadSeek { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.captions.update", - http_method: hyper::method::Method::Put }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - if let Some(value) = self._sync { - params.push(("sync", value.to_string())); - } - if let Some(value) = self._on_behalf_of_content_owner { - params.push(("onBehalfOfContentOwner", value.to_string())); - } - if let Some(value) = self._on_behalf_of { - params.push(("onBehalfOf", value.to_string())); - } - for &field in ["alt", "part", "sync", "onBehalfOfContentOwner", "onBehalfOf"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let (mut url, upload_type) = - if protocol == "simple" { - ("https://www.googleapis.com/upload/youtube/v3/captions".to_string(), "multipart") - } else if protocol == "resumable" { - ("https://www.googleapis.com/resumable/upload/youtube/v3/captions".to_string(), "resumable") - } else { - unreachable!() - }; - params.push(("uploadType", upload_type.to_string())); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::ForceSsl.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - let mut should_ask_dlg_for_url = false; - let mut upload_url_from_server; - let mut upload_url: Option = None; - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - if should_ask_dlg_for_url && (upload_url = dlg.upload_url()) == () && upload_url.is_some() { - should_ask_dlg_for_url = false; - upload_url_from_server = false; - let url = upload_url.as_ref().and_then(|s| Some(hyper::Url::parse(s).unwrap())).unwrap(); - hyper::client::Response::new(url, Box::new(cmn::DummyNetworkStream)).and_then(|mut res| { - res.status = hyper::status::StatusCode::Ok; - res.headers.set(Location(upload_url.as_ref().unwrap().clone())); - Ok(res) - }) - } else { - let mut mp_reader: MultiPartReader = Default::default(); - let (mut body_reader, content_type) = match protocol { - "simple" => { - mp_reader.reserve_exact(2); - let size = reader.seek(io::SeekFrom::End(0)).unwrap(); - reader.seek(io::SeekFrom::Start(0)).unwrap(); - if size > 104857600 { - return Err(Error::UploadSizeLimitExceeded(size, 104857600)) - } - mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) - .add_part(&mut reader, size, reader_mime_type.clone()); - let mime_type = mp_reader.mime_type(); - (&mut mp_reader as &mut io::Read, ContentType(mime_type)) - }, - _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), - }; - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(content_type) - .body(&mut body_reader); - upload_url_from_server = true; - if protocol == "resumable" { - req = req.header(cmn::XUploadContentType(reader_mime_type.clone())); - } - - dlg.pre_request(); - req.send() - } - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - if protocol == "resumable" { - let size = reader.seek(io::SeekFrom::End(0)).unwrap(); - reader.seek(io::SeekFrom::Start(0)).unwrap(); - if size > 104857600 { - return Err(Error::UploadSizeLimitExceeded(size, 104857600)) - } - let mut client = &mut *self.hub.client.borrow_mut(); - let upload_result = { - let url_str = &res.headers.get::().expect("Location header is part of protocol").0; - if upload_url_from_server { - dlg.store_upload_url(Some(url_str)); - } - - cmn::ResumableUploadHelper { - client: &mut client.borrow_mut(), - delegate: dlg, - start_at: if upload_url_from_server { Some(0) } else { None }, - auth: &mut *self.hub.auth.borrow_mut(), - user_agent: &self.hub._user_agent, - auth_header: auth_header.clone(), - url: url_str, - reader: &mut reader, - media_type: reader_mime_type.clone(), - content_length: size - }.upload() - }; - match upload_result { - None => { - dlg.finished(false); - return Err(Error::Cancelled) - } - Some(Err(err)) => { - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Some(Ok(upload_result)) => { - res = upload_result; - if !res.status.is_success() { - dlg.store_upload_url(None); - dlg.finished(false); - return Err(Error::Failure(res)) - } - } - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - /// Upload media all at once. - /// If the upload fails for whichever reason, all progress is lost. - /// - /// * *max size*: 100MB - /// * *multipart*: yes - /// * *valid mime types*: '*/*', 'application/octet-stream' and 'text/xml' - pub fn upload(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Caption)> - where RS: ReadSeek { - self.doit(stream, mime_type, "simple") - } - /// Upload media in a resumable fashion. - /// Even if the upload fails or is interrupted, it can be resumed for a - /// certain amount of time as the server maintains state temporarily. - /// - /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL - /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate - /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using - /// `cancel_chunk_upload(...)`. - /// - /// * *max size*: 100MB - /// * *multipart*: yes - /// * *valid mime types*: '*/*', 'application/octet-stream' and 'text/xml' - pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Caption)> - where RS: ReadSeek { - self.doit(resumeable_stream, mime_type, "resumable") - } - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Caption) -> CaptionUpdateCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. Set the property value to snippet if you are updating the track's draft status. Otherwise, set the property value to id. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - pub fn part(mut self, new_value: &str) -> CaptionUpdateCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// Note: The API server only processes the parameter value if the request contains an updated caption file. - /// - /// The sync parameter indicates whether YouTube should automatically synchronize the caption file with the audio track of the video. If you set the value to true, YouTube will automatically synchronize the caption track with the audio track. - /// - /// Sets the *sync* query property to the given value. - pub fn sync(mut self, new_value: bool) -> CaptionUpdateCall<'a, C, A> { - self._sync = Some(new_value); - self - } - /// Note: This parameter is intended exclusively for YouTube content partners. - /// - /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The actual CMS account that the user authenticates with must be linked to the specified YouTube content owner. - /// - /// Sets the *on behalf of content owner* query property to the given value. - pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> CaptionUpdateCall<'a, C, A> { - self._on_behalf_of_content_owner = Some(new_value.to_string()); - self - } - /// ID of the Google+ Page for the channel that the request is be on behalf of - /// - /// Sets the *on behalf of* query property to the given value. - pub fn on_behalf_of(mut self, new_value: &str) -> CaptionUpdateCall<'a, C, A> { - self._on_behalf_of = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> CaptionUpdateCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> CaptionUpdateCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::ForceSsl`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> CaptionUpdateCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a list of categories that can be associated with YouTube videos. -/// -/// A builder for the *list* method supported by a *videoCategory* resource. -/// It is not used directly, but through a `VideoCategoryMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.video_categories().list("part") -/// .region_code("magna") -/// .id("elitr") -/// .hl("magna") -/// .doit(); -/// # } -/// ``` -pub struct VideoCategoryListCall<'a, C, A> +pub struct FanFundingEventListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a YouTube, _part: String, - _region_code: Option, - _id: Option, + _page_token: Option, + _max_results: Option, _hl: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a, C, A> CallBuilder for VideoCategoryListCall<'a, C, A> {} +impl<'a, C, A> CallBuilder for FanFundingEventListCall<'a, C, A> {} -impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { +impl<'a, C, A> FanFundingEventListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, VideoCategoryListResponse)> { + pub fn doit(mut self) -> Result<(hyper::client::Response, FanFundingEventListResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; let mut dd = DefaultDelegate; @@ -23932,20 +27719,20 @@ impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtube.videoCategories.list", + dlg.begin(MethodInfo { id: "youtube.fanFundingEvents.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("part", self._part.to_string())); - if let Some(value) = self._region_code { - params.push(("regionCode", value.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); } - if let Some(value) = self._id { - params.push(("id", value.to_string())); + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); } if let Some(value) = self._hl { params.push(("hl", value.to_string())); } - for &field in ["alt", "part", "regionCode", "id", "hl"].iter() { + for &field in ["alt", "part", "pageToken", "maxResults", "hl"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -23957,12 +27744,12 @@ impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut params.push(("alt", "json".to_string())); - let mut url = "https://www.googleapis.com/youtube/v3/videoCategories".to_string(); + let mut url = "https://www.googleapis.com/youtube/v3/fanFundingEvents".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -23998,7 +27785,7 @@ impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24008,10 +27795,10 @@ impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -24040,34 +27827,41 @@ impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut } - /// The part parameter specifies the videoCategory resource properties that the API response will include. Set the parameter value to snippet. + /// The part parameter specifies the fanFundingEvent resource parts that the API response will include. Supported values are id and snippet. /// /// Sets the *part* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn part(mut self, new_value: &str) -> VideoCategoryListCall<'a, C, A> { + /// + /// **Settable Parts** + /// + /// * *id* + /// * *snippet* + pub fn part(mut self, new_value: &str) -> FanFundingEventListCall<'a, C, A> { self._part = new_value.to_string(); self } - /// The regionCode parameter instructs the API to return the list of video categories available in the specified country. The parameter value is an ISO 3166-1 alpha-2 country code. + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. /// - /// Sets the *region code* query property to the given value. - pub fn region_code(mut self, new_value: &str) -> VideoCategoryListCall<'a, C, A> { - self._region_code = Some(new_value.to_string()); + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> FanFundingEventListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); self } - /// The id parameter specifies a comma-separated list of video category IDs for the resources that you are retrieving. + /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. /// - /// Sets the *id* query property to the given value. - pub fn id(mut self, new_value: &str) -> VideoCategoryListCall<'a, C, A> { - self._id = Some(new_value.to_string()); + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: u32) -> FanFundingEventListCall<'a, C, A> { + self._max_results = Some(new_value); self } - /// The hl parameter specifies the language that should be used for text values in the API response. + /// The hl parameter instructs the API to retrieve localized resource metadata for a specific application language that the YouTube website supports. The parameter value must be a language code included in the list returned by the i18nLanguages.list method. + /// + /// If localized resource details are available in that language, the resource's snippet.localized object will contain the localized values. However, if localized details are not available, the snippet.localized object will contain resource details in the resource's default language. /// /// Sets the *hl* query property to the given value. - pub fn hl(mut self, new_value: &str) -> VideoCategoryListCall<'a, C, A> { + pub fn hl(mut self, new_value: &str) -> FanFundingEventListCall<'a, C, A> { self._hl = Some(new_value.to_string()); self } @@ -24077,18 +27871,18 @@ impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut /// 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 Delegate) -> VideoCategoryListCall<'a, C, A> { + pub fn delegate(mut self, new_value: &'a mut Delegate) -> FanFundingEventListCall<'a, C, A> { self._delegate = Some(new_value); self } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -24098,591 +27892,24 @@ impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> VideoCategoryListCall<'a, C, A> + pub fn param(mut self, name: T, value: T) -> FanFundingEventListCall<'a, C, A> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Readonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> VideoCategoryListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Returns a list of channel activity events that match the request criteria. For example, you can retrieve events associated with a particular channel, events associated with the user's subscriptions and Google+ friends, or the YouTube home page feed, which is customized for each user. -/// -/// A builder for the *list* method supported by a *activity* resource. -/// It is not used directly, but through a `ActivityMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let result = hub.activities().list("part") -/// .region_code("invidunt") -/// .published_before("accusam") -/// .published_after("labore") -/// .page_token("diam") -/// .mine(true) -/// .max_results(8) -/// .home(false) -/// .channel_id("magna") -/// .doit(); -/// # } -/// ``` -pub struct ActivityListCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _part: String, - _region_code: Option, - _published_before: Option, - _published_after: Option, - _page_token: Option, - _mine: Option, - _max_results: Option, - _home: Option, - _channel_id: Option, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ActivityListCall<'a, C, A> {} - -impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, ActivityListResponse)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.activities.list", - http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); - params.push(("part", self._part.to_string())); - if let Some(value) = self._region_code { - params.push(("regionCode", value.to_string())); - } - if let Some(value) = self._published_before { - params.push(("publishedBefore", value.to_string())); - } - if let Some(value) = self._published_after { - params.push(("publishedAfter", value.to_string())); - } - if let Some(value) = self._page_token { - params.push(("pageToken", value.to_string())); - } - if let Some(value) = self._mine { - params.push(("mine", value.to_string())); - } - if let Some(value) = self._max_results { - params.push(("maxResults", value.to_string())); - } - if let Some(value) = self._home { - params.push(("home", value.to_string())); - } - if let Some(value) = self._channel_id { - params.push(("channelId", value.to_string())); - } - for &field in ["alt", "part", "regionCode", "publishedBefore", "publishedAfter", "pageToken", "mine", "maxResults", "home", "channelId"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/activities".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Readonly.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// The part parameter specifies a comma-separated list of one or more activity resource properties that the API response will include. - /// - /// If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in an activity resource, the snippet property contains other properties that identify the type of activity, a display title for the activity, and so forth. If you set part=snippet, the API response will also contain all of those nested properties. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn part(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The regionCode parameter instructs the API to return results for the specified country. The parameter value is an ISO 3166-1 alpha-2 country code. YouTube uses this value when the authorized user's previous activity on YouTube does not provide enough information to generate the activity feed. - /// - /// Sets the *region code* query property to the given value. - pub fn region_code(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { - self._region_code = Some(new_value.to_string()); - self - } - /// The publishedBefore parameter specifies the date and time before which an activity must have occurred for that activity to be included in the API response. If the parameter value specifies a day, but not a time, then any activities that occurred that day will be excluded from the result set. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. - /// - /// Sets the *published before* query property to the given value. - pub fn published_before(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { - self._published_before = Some(new_value.to_string()); - self - } - /// The publishedAfter parameter specifies the earliest date and time that an activity could have occurred for that activity to be included in the API response. If the parameter value specifies a day, but not a time, then any activities that occurred that day will be included in the result set. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format. - /// - /// Sets the *published after* query property to the given value. - pub fn published_after(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { - self._published_after = Some(new_value.to_string()); - self - } - /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved. - /// - /// Sets the *page token* query property to the given value. - pub fn page_token(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { - self._page_token = Some(new_value.to_string()); - self - } - /// Set this parameter's value to true to retrieve a feed of the authenticated user's activities. - /// - /// Sets the *mine* query property to the given value. - pub fn mine(mut self, new_value: bool) -> ActivityListCall<'a, C, A> { - self._mine = Some(new_value); - self - } - /// The maxResults parameter specifies the maximum number of items that should be returned in the result set. - /// - /// Sets the *max results* query property to the given value. - pub fn max_results(mut self, new_value: u32) -> ActivityListCall<'a, C, A> { - self._max_results = Some(new_value); - self - } - /// Set this parameter's value to true to retrieve the activity feed that displays on the YouTube home page for the currently authenticated user. - /// - /// Sets the *home* query property to the given value. - pub fn home(mut self, new_value: bool) -> ActivityListCall<'a, C, A> { - self._home = Some(new_value); - self - } - /// The channelId parameter specifies a unique YouTube channel ID. The API will then return a list of that channel's activities. - /// - /// Sets the *channel id* query property to the given value. - pub fn channel_id(mut self, new_value: &str) -> ActivityListCall<'a, C, A> { - self._channel_id = Some(new_value.to_string()); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ActivityListCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ActivityListCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Readonly`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ActivityListCall<'a, C, A> - where T: AsRef { - self._scopes.insert(scope.as_ref().to_string(), ()); - self - } -} - - -/// Posts a bulletin for a specific channel. (The user submitting the request must be authorized to act on the channel's behalf.) -/// -/// Note: Even though an activity resource can contain information about actions like a user rating a video or marking a video as a favorite, you need to use other API methods to generate those activity resources. For example, you would use the API's videos.rate() method to rate a video and the playlistItems.insert() method to mark a video as a favorite. -/// -/// A builder for the *insert* method supported by a *activity* resource. -/// It is not used directly, but through a `ActivityMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate yup_oauth2 as oauth2; -/// # extern crate google_youtube3 as youtube3; -/// use youtube3::Activity; -/// # #[test] fn egal() { -/// # use std::default::Default; -/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; -/// # use youtube3::YouTube; -/// -/// # let secret: ApplicationSecret = Default::default(); -/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, -/// # hyper::Client::new(), -/// # ::default(), None); -/// # let mut hub = YouTube::new(hyper::Client::new(), 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 ! -/// let mut req = Activity::default(); -/// -/// // 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 ! -/// let result = hub.activities().insert(req) -/// .doit(); -/// # } -/// ``` -pub struct ActivityInsertCall<'a, C, A> - where C: 'a, A: 'a { - - hub: &'a YouTube, - _request: Activity, - _part: String, - _delegate: Option<&'a mut Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a, C, A> CallBuilder for ActivityInsertCall<'a, C, A> {} - -impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { - - - /// Perform the operation you have build so far. - pub fn doit(mut self) -> Result<(hyper::client::Response, Activity)> { - use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location}; - let mut dd = DefaultDelegate; - let mut dlg: &mut Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(MethodInfo { id: "youtube.activities.insert", - http_method: hyper::method::Method::Post }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); - if self._part.len() == 0 { - self._part = self._request.to_parts(); - } - params.push(("part", self._part.to_string())); - for &field in ["alt", "part"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = "https://www.googleapis.com/youtube/v3/activities".to_string(); - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Full.as_ref().to_string(), ()); - } - - - if params.len() > 0 { - url.push('?'); - url.push_str(&url::form_urlencoded::serialize(params)); - } - - let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request); - remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { - Ok(token) => token, - Err(err) => { - match dlg.token(&*err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(Error::MissingToken(err)) - } - } - } - }; - let auth_header = Authorization(oauth2::Scheme { token_type: oauth2::TokenType::Bearer, - access_token: token.access_token }); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) - .header(UserAgent(self.hub._user_agent.clone())) - .header(auth_header.clone()) - .header(ContentType(json_mime_type.clone())) - .header(ContentLength(request_size as u64)) - .body(&mut request_value_reader); - - dlg.pre_request(); - req.send() - }; - - match req_result { - Err(err) => { - if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return Err(Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status.is_success() { - let mut json_err = String::new(); - res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, - json::from_str(&json_err).ok(), - json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); - continue; - } - dlg.finished(false); - return match json::from_str::(&json_err){ - Err(_) => Err(Error::Failure(res)), - Ok(serr) => Err(Error::BadRequest(serr)) - } - } - let result_value = { - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - match json::from_str(&json_response) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&json_response, &err); - return Err(Error::JsonDecodeError(json_response, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// 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: Activity) -> ActivityInsertCall<'a, C, A> { - self._request = new_value; - self - } - /// The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. - /// - /// Sets the *part* query property to the given value. - /// - /// Even though the *parts* list is automatically derived from *Resource* passed in - /// during instantiation and indicates which values you are passing, the response would contain the very same parts. - /// This may not always be desirable, as you can obtain (newly generated) parts you cannot pass in, - /// like statistics that are generated server side. Therefore you should use this method to specify - /// the parts you provide in addition to the ones you want in the response. - pub fn part(mut self, new_value: &str) -> ActivityInsertCall<'a, C, A> { - self._part = new_value.to_string(); - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// 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 Delegate) -> ActivityInsertCall<'a, C, A> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known paramters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *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. Overrides userIp if both are provided. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *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. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits. - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *alt* (query-string) - Data format for the response. - pub fn param(mut self, name: T, value: T) -> ActivityInsertCall<'a, C, A> - where T: AsRef { - self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); - self - } - - /// Identifies the authorization scope for the method you are building. - /// - /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::Full`. - /// - /// The `scope` will be added to a set of scopes. This is important as one can maintain access - /// tokens for more than one scope. - /// - /// 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(mut self, scope: T) -> ActivityInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> FanFundingEventListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/youtubeanalytics1-cli/Cargo.toml b/gen/youtubeanalytics1-cli/Cargo.toml index 3e825e588d..90237eb8c3 100644 --- a/gen/youtubeanalytics1-cli/Cargo.toml +++ b/gen/youtubeanalytics1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtubeanalytics1-cli" -version = "0.3.2+20150921" +version = "0.3.3+20151211" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube Analytics (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtubeanalytics1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/youtubeanalytics1-cli/LICENSE.md b/gen/youtubeanalytics1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/youtubeanalytics1-cli/LICENSE.md +++ b/gen/youtubeanalytics1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/youtubeanalytics1-cli/README.md b/gen/youtubeanalytics1-cli/README.md index 7a1536983e..9fca09d2c3 100644 --- a/gen/youtubeanalytics1-cli/README.md +++ b/gen/youtubeanalytics1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *YouTube Analytics* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/youtubeanalytics1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/youtubeanalytics1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/youtubeanalytics1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/youtubeanalytics1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/youtubeanalytics1-cli). # Usage -This documentation was generated from the *YouTube Analytics* API at revision *20150921*. The CLI is at version *0.3.2*. +This documentation was generated from the *YouTube Analytics* API at revision *20151211*. The CLI is at version *0.3.3*. ```bash youtubeanalytics1 [options] @@ -47,18 +47,18 @@ youtubeanalytics1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/youtubeanalytics1-cli/mkdocs.yml b/gen/youtubeanalytics1-cli/mkdocs.yml index fa02971397..b65bde8bb1 100644 --- a/gen/youtubeanalytics1-cli/mkdocs.yml +++ b/gen/youtubeanalytics1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube Analytics v0.3.2+20150921 +site_name: YouTube Analytics v0.3.3+20151211 site_url: http://byron.github.io/google-apis-rs/google-youtubeanalytics1-cli site_description: Write integrating applications with bcore @@ -22,5 +22,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/youtubeanalytics1-cli/src/main.rs b/gen/youtubeanalytics1-cli/src/main.rs index ae9e9bc4ef..3579e799a4 100644 --- a/gen/youtubeanalytics1-cli/src/main.rs +++ b/gen/youtubeanalytics1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,19 +36,19 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::YouTubeAnalytics>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _batch_report_definitions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _batch_report_definitions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.batch_report_definitions().list(opt.value_of("on-behalf-of-content-owner").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -61,7 +61,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -74,7 +74,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -97,10 +97,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _batch_reports_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _batch_reports_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.batch_reports().list(opt.value_of("batch-report-definition-id").unwrap_or(""), opt.value_of("on-behalf-of-content-owner").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -113,7 +113,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -126,7 +126,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -149,10 +149,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _group_items_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _group_items_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.group_items().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -168,7 +168,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -182,7 +182,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -197,13 +197,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _group_items_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _group_items_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -217,8 +217,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "kind" => Some(("kind", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "etag" => Some(("etag", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -238,7 +238,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::GroupItem = json::value::from_value(object).unwrap(); let mut call = self.hub.group_items().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -254,7 +254,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -268,7 +268,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -291,10 +291,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _group_items_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _group_items_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.group_items().list(opt.value_of("group-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -310,7 +310,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -324,7 +324,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -347,10 +347,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().delete(opt.value_of("id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -366,7 +366,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -380,7 +380,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } match match protocol { @@ -395,13 +395,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_insert(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -415,8 +415,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "snippet.published-at" => Some(("snippet.publishedAt", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.title" => Some(("snippet.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -437,7 +437,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Group = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().insert(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -453,7 +453,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -467,7 +467,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -490,12 +490,15 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.groups().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { + "page-token" => { + call = call.page_token(value.unwrap_or("")); + }, "on-behalf-of-content-owner" => { call = call.on_behalf_of_content_owner(value.unwrap_or("")); }, @@ -515,10 +518,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["on-behalf-of-content-owner", "mine", "id"].iter().map(|v|*v)); + v.extend(["page-token", "on-behalf-of-content-owner", "mine", "id"].iter().map(|v|*v)); v } )); } } @@ -529,7 +532,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -552,13 +555,13 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _groups_update(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _groups_update(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -572,8 +575,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "snippet.published-at" => Some(("snippet.publishedAt", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "snippet.title" => Some(("snippet.title", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -594,7 +597,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Group = json::value::from_value(object).unwrap(); let mut call = self.hub.groups().update(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -610,7 +613,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -624,7 +627,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -647,10 +650,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _reports_query(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _reports_query(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.reports().query(opt.value_of("ids").unwrap_or(""), opt.value_of("start-date").unwrap_or(""), opt.value_of("end-date").unwrap_or(""), opt.value_of("metrics").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "start-index" => { @@ -681,7 +684,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["sort", "max-results", "dimensions", "start-index", "currency", "filters"].iter().map(|v|*v)); @@ -695,7 +698,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -810,14 +813,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "youtubeanalytics1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "youtubeanalytics1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -837,7 +840,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -876,7 +879,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("batch-report-definitions", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of available batch report definitions."##), "Details at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli/batch-report-definitions_list", vec![ @@ -901,7 +904,7 @@ fn main() { ]), ("batch-reports", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Retrieves a list of processed batch reports."##), "Details at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli/batch-reports_list", vec![ @@ -932,7 +935,7 @@ fn main() { ]), ("group-items", "methods: 'delete', 'insert' and 'list'", vec![ - ("delete", + ("delete", Some(r##"Removes an item from a group."##), "Details at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli/group-items_delete", vec![ @@ -948,7 +951,7 @@ fn main() { Some(false), Some(true)), ]), - ("insert", + ("insert", Some(r##"Creates a group item."##), "Details at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli/group-items_insert", vec![ @@ -970,7 +973,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a collection of group items that match the API request parameters."##), "Details at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli/group-items_list", vec![ @@ -995,7 +998,7 @@ fn main() { ]), ("groups", "methods: 'delete', 'insert', 'list' and 'update'", vec![ - ("delete", + ("delete", Some(r##"Deletes a group."##), "Details at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli/groups_delete", vec![ @@ -1011,7 +1014,7 @@ fn main() { Some(false), Some(true)), ]), - ("insert", + ("insert", Some(r##"Creates a group."##), "Details at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli/groups_insert", vec![ @@ -1033,7 +1036,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Returns a collection of groups that match the API request parameters. For example, you can retrieve all groups that the authenticated user owns, or you can retrieve one or more groups by their unique IDs."##), "Details at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli/groups_list", vec![ @@ -1049,7 +1052,7 @@ fn main() { Some(false), Some(false)), ]), - ("update", + ("update", Some(r##"Modifies a group. For example, you could change a group's title."##), "Details at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli/groups_update", vec![ @@ -1074,7 +1077,7 @@ fn main() { ]), ("reports", "methods: 'query'", vec![ - ("query", + ("query", Some(r##"Retrieve your YouTube Analytics reports."##), "Details at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli/reports_query", vec![ @@ -1122,7 +1125,7 @@ fn main() { let mut app = App::new("youtubeanalytics1") .author("Sebastian Thiel ") - .version("0.3.2+20150921") + .version("0.3.3+20151211") .about("Retrieve your YouTube Analytics reports.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli") .arg(Arg::with_name("url") @@ -1146,7 +1149,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -1157,7 +1160,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/youtubeanalytics1/Cargo.toml b/gen/youtubeanalytics1/Cargo.toml index 542ef50ab9..eb699734f4 100644 --- a/gen/youtubeanalytics1/Cargo.toml +++ b/gen/youtubeanalytics1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtubeanalytics1" -version = "0.1.10+20150921" +version = "0.1.11+20151211" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube Analytics (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtubeanalytics1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/youtubeanalytics1/LICENSE.md b/gen/youtubeanalytics1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/youtubeanalytics1/LICENSE.md +++ b/gen/youtubeanalytics1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/youtubeanalytics1/README.md b/gen/youtubeanalytics1/README.md index f1a7cda9ed..9d72fb0b1e 100644 --- a/gen/youtubeanalytics1/README.md +++ b/gen/youtubeanalytics1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-youtubeanalytics1` library allows access to all features of the *Google YouTube Analytics* service. -This documentation was generated from *YouTube Analytics* crate version *0.1.10+20150921*, where *20150921* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *YouTube Analytics* crate version *0.1.11+20151211*, where *20151211* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *YouTube Analytics* *v1* API can be found at the [official documentation site](http://developers.google.com/youtube/analytics/). @@ -104,9 +104,10 @@ let mut hub = YouTubeAnalytics::new(hyper::Client::new(), auth); // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.groups().list() - .on_behalf_of_content_owner("eirmod") - .mine(true) - .id("Stet") + .page_token("eirmod") + .on_behalf_of_content_owner("sit") + .mine(false) + .id("sed") .doit(); match result { diff --git a/gen/youtubeanalytics1/src/cmn.rs b/gen/youtubeanalytics1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/youtubeanalytics1/src/cmn.rs +++ b/gen/youtubeanalytics1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/youtubeanalytics1/src/lib.rs b/gen/youtubeanalytics1/src/lib.rs index e7542740db..98041ad0d5 100644 --- a/gen/youtubeanalytics1/src/lib.rs +++ b/gen/youtubeanalytics1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *YouTube Analytics* crate version *0.1.10+20150921*, where *20150921* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *YouTube Analytics* crate version *0.1.11+20151211*, where *20151211* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *YouTube Analytics* *v1* API can be found at the //! [official documentation site](http://developers.google.com/youtube/analytics/). @@ -105,9 +105,10 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.groups().list() -//! .on_behalf_of_content_owner("sea") -//! .mine(false) -//! .id("eos") +//! .page_token("erat") +//! .on_behalf_of_content_owner("sadipscing") +//! .mine(true) +//! .id("eirmod") //! .doit(); //! //! match result { diff --git a/gen/youtubeanalytics1/src/lib.rs.in b/gen/youtubeanalytics1/src/lib.rs.in index 392c3a7909..182f332576 100644 --- a/gen/youtubeanalytics1/src/lib.rs.in +++ b/gen/youtubeanalytics1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -107,9 +108,10 @@ impl Default for Scope { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.groups().list() -/// .on_behalf_of_content_owner("sed") +/// .page_token("et") +/// .on_behalf_of_content_owner("dolores") /// .mine(false) -/// .id("dolores") +/// .id("accusam") /// .doit(); /// /// match result { @@ -145,7 +147,7 @@ impl<'a, C, A> YouTubeAnalytics YouTubeAnalytics { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -166,7 +168,7 @@ impl<'a, C, A> YouTubeAnalytics } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -261,6 +263,9 @@ impl Part for GroupContentDetails {} /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GroupListResponse { + /// no description provided + #[serde(rename="nextPageToken")] + pub next_page_token: Option, /// no description provided pub items: Option>, /// no description provided @@ -827,6 +832,7 @@ impl<'a, C, A> GroupMethods<'a, C, A> { pub fn list(&self) -> GroupListCall<'a, C, A> { GroupListCall { hub: self.hub, + _page_token: Default::default(), _on_behalf_of_content_owner: Default::default(), _mine: Default::default(), _id: Default::default(), @@ -950,12 +956,12 @@ impl<'a, C, A> BatchReportMethods<'a, C, A> { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.reports().query("ids", "start-date", "end-date", "metrics") -/// .start_index(-1) -/// .sort("erat") -/// .max_results(-35) -/// .filters("sea") -/// .dimensions("nonumy") -/// .currency("dolores") +/// .start_index(-35) +/// .sort("sea") +/// .max_results(-90) +/// .filters("dolores") +/// .dimensions("gubergren") +/// .currency("sadipscing") /// .doit(); /// # } /// ``` @@ -992,7 +998,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubeAnalytics.reports.query", + dlg.begin(MethodInfo { id: "youtubeAnalytics.reports.query", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("ids", self._ids.to_string())); @@ -1031,10 +1037,10 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o let mut url = "https://www.googleapis.com/youtube/analytics/v1/reports".to_string(); if self._scopes.len() == 0 { - self._scopes.insert(Scope::YtAnalyticMonetaryReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::YoutubeReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1070,7 +1076,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1080,10 +1086,10 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1118,7 +1124,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *ids* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn ids(mut self, new_value: &str) -> ReportQueryCall<'a, C, A> { self._ids = new_value.to_string(); @@ -1128,7 +1134,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *start-date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn start_date(mut self, new_value: &str) -> ReportQueryCall<'a, C, A> { self._start_date = new_value.to_string(); @@ -1138,7 +1144,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *end-date* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn end_date(mut self, new_value: &str) -> ReportQueryCall<'a, C, A> { self._end_date = new_value.to_string(); @@ -1148,7 +1154,7 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *metrics* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn metrics(mut self, new_value: &str) -> ReportQueryCall<'a, C, A> { self._metrics = new_value.to_string(); @@ -1208,12 +1214,12 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1230,17 +1236,17 @@ impl<'a, C, A> ReportQueryCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant - /// `Scope::YtAnalyticMonetaryReadonly`. + /// `Scope::YoutubeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportQueryCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportQueryCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1302,7 +1308,7 @@ impl<'a, C, A> BatchReportDefinitionListCall<'a, C, A> where C: BorrowMut d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubeAnalytics.batchReportDefinitions.list", + dlg.begin(MethodInfo { id: "youtubeAnalytics.batchReportDefinitions.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("onBehalfOfContentOwner", self._on_behalf_of_content_owner.to_string())); @@ -1323,7 +1329,7 @@ impl<'a, C, A> BatchReportDefinitionListCall<'a, C, A> where C: BorrowMut 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1359,7 +1365,7 @@ impl<'a, C, A> BatchReportDefinitionListCall<'a, C, A> where C: BorrowMut { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1369,10 +1375,10 @@ impl<'a, C, A> BatchReportDefinitionListCall<'a, C, A> where C: BorrowMut BatchReportDefinitionListCall<'a, C, A> where C: BorrowMut BatchReportDefinitionListCall<'a, C, A> { self._on_behalf_of_content_owner = new_value.to_string(); @@ -1423,12 +1429,12 @@ impl<'a, C, A> BatchReportDefinitionListCall<'a, C, A> where C: BorrowMut BatchReportDefinitionListCall<'a, C, A> where C: BorrowMut(mut self, scope: T) -> BatchReportDefinitionListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BatchReportDefinitionListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1496,7 +1502,7 @@ impl<'a, C, A> BatchReportDefinitionListCall<'a, C, A> where C: BorrowMut GroupItemInsertCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubeAnalytics.groupItems.insert", + dlg.begin(MethodInfo { id: "youtubeAnalytics.groupItems.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._on_behalf_of_content_owner { @@ -1548,14 +1554,14 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Youtube.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -1599,7 +1605,7 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1609,10 +1615,10 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1644,7 +1650,7 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: GroupItem) -> GroupItemInsertCall<'a, C, A> { self._request = new_value; @@ -1671,12 +1677,12 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1693,17 +1699,17 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Youtube`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupItemInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupItemInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1738,7 +1744,7 @@ impl<'a, C, A> GroupItemInsertCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.group_items().list("groupId") -/// .on_behalf_of_content_owner("ea") +/// .on_behalf_of_content_owner("justo") /// .doit(); /// # } /// ``` @@ -1767,7 +1773,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubeAnalytics.groupItems.list", + dlg.begin(MethodInfo { id: "youtubeAnalytics.groupItems.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("groupId", self._group_id.to_string())); @@ -1791,7 +1797,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: self._scopes.insert(Scope::YoutubeReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1827,7 +1833,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1837,10 +1843,10 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1873,7 +1879,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *group id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn group_id(mut self, new_value: &str) -> GroupItemListCall<'a, C, A> { self._group_id = new_value.to_string(); @@ -1900,12 +1906,12 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -1922,17 +1928,17 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YoutubeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupItemListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupItemListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1967,7 +1973,7 @@ impl<'a, C, A> GroupItemListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.group_items().delete("id") -/// .on_behalf_of_content_owner("justo") +/// .on_behalf_of_content_owner("et") /// .doit(); /// # } /// ``` @@ -1996,7 +2002,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubeAnalytics.groupItems.delete", + dlg.begin(MethodInfo { id: "youtubeAnalytics.groupItems.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -2019,7 +2025,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::Youtube.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2055,7 +2061,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2065,10 +2071,10 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2091,7 +2097,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> GroupItemDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -2118,12 +2124,12 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2140,17 +2146,17 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Youtube`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupItemDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupItemDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2185,7 +2191,7 @@ impl<'a, C, A> GroupItemDeleteCall<'a, C, A> where C: BorrowMut, /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.groups().delete("id") -/// .on_behalf_of_content_owner("et") +/// .on_behalf_of_content_owner("diam") /// .doit(); /// # } /// ``` @@ -2214,7 +2220,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubeAnalytics.groups.delete", + dlg.begin(MethodInfo { id: "youtubeAnalytics.groups.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); @@ -2237,7 +2243,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Youtube.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2273,7 +2279,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2283,10 +2289,10 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2309,7 +2315,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn id(mut self, new_value: &str) -> GroupDeleteCall<'a, C, A> { self._id = new_value.to_string(); @@ -2336,12 +2342,12 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2358,17 +2364,17 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Youtube`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2409,7 +2415,7 @@ impl<'a, C, A> GroupDeleteCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.groups().insert(req) -/// .on_behalf_of_content_owner("et") +/// .on_behalf_of_content_owner("ipsum") /// .doit(); /// # } /// ``` @@ -2438,7 +2444,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubeAnalytics.groups.insert", + dlg.begin(MethodInfo { id: "youtubeAnalytics.groups.insert", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._on_behalf_of_content_owner { @@ -2461,14 +2467,14 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Youtube.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2512,7 +2518,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2522,10 +2528,10 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2557,7 +2563,7 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Group) -> GroupInsertCall<'a, C, A> { self._request = new_value; @@ -2584,12 +2590,12 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2606,17 +2612,17 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Youtube`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupInsertCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupInsertCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2651,9 +2657,10 @@ impl<'a, C, A> GroupInsertCall<'a, C, A> where C: BorrowMut, A: o /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.groups().list() -/// .on_behalf_of_content_owner("diam") +/// .page_token("Lorem") +/// .on_behalf_of_content_owner("et") /// .mine(false) -/// .id("Lorem") +/// .id("aliquyam") /// .doit(); /// # } /// ``` @@ -2661,6 +2668,7 @@ pub struct GroupListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a YouTubeAnalytics, + _page_token: Option, _on_behalf_of_content_owner: Option, _mine: Option, _id: Option, @@ -2683,9 +2691,12 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubeAnalytics.groups.list", + dlg.begin(MethodInfo { id: "youtubeAnalytics.groups.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); } @@ -2695,7 +2706,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau if let Some(value) = self._id { params.push(("id", value.to_string())); } - for &field in ["alt", "onBehalfOfContentOwner", "mine", "id"].iter() { + for &field in ["alt", "pageToken", "onBehalfOfContentOwner", "mine", "id"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2712,7 +2723,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::YoutubeReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2748,7 +2759,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2758,10 +2769,10 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2790,6 +2801,13 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } + /// The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identifies the next page that can be retrieved. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> GroupListCall<'a, C, A> { + self._page_token = Some(new_value.to_string()); + self + } /// Note: This parameter is intended exclusively for YouTube content partners. /// /// The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. @@ -2825,12 +2843,12 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -2847,17 +2865,17 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YoutubeReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2898,7 +2916,7 @@ impl<'a, C, A> GroupListCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.groups().update(req) -/// .on_behalf_of_content_owner("et") +/// .on_behalf_of_content_owner("sea") /// .doit(); /// # } /// ``` @@ -2927,7 +2945,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubeAnalytics.groups.update", + dlg.begin(MethodInfo { id: "youtubeAnalytics.groups.update", http_method: hyper::method::Method::Put }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._on_behalf_of_content_owner { @@ -2950,14 +2968,14 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o self._scopes.insert(Scope::Youtube.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -3001,7 +3019,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3011,10 +3029,10 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3046,7 +3064,7 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Group) -> GroupUpdateCall<'a, C, A> { self._request = new_value; @@ -3073,12 +3091,12 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3095,17 +3113,17 @@ impl<'a, C, A> GroupUpdateCall<'a, C, A> where C: BorrowMut, A: o } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::Youtube`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> GroupUpdateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> GroupUpdateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -3168,7 +3186,7 @@ impl<'a, C, A> BatchReportListCall<'a, C, A> where C: BorrowMut, Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubeAnalytics.batchReports.list", + dlg.begin(MethodInfo { id: "youtubeAnalytics.batchReports.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("batchReportDefinitionId", self._batch_report_definition_id.to_string())); @@ -3190,7 +3208,7 @@ impl<'a, C, A> BatchReportListCall<'a, C, A> where C: BorrowMut, self._scopes.insert(Scope::YtAnalyticMonetaryReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -3226,7 +3244,7 @@ impl<'a, C, A> BatchReportListCall<'a, C, A> where C: BorrowMut, match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3236,10 +3254,10 @@ impl<'a, C, A> BatchReportListCall<'a, C, A> where C: BorrowMut, if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -3272,7 +3290,7 @@ impl<'a, C, A> BatchReportListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *batch report definition id* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn batch_report_definition_id(mut self, new_value: &str) -> BatchReportListCall<'a, C, A> { self._batch_report_definition_id = new_value.to_string(); @@ -3282,7 +3300,7 @@ impl<'a, C, A> BatchReportListCall<'a, C, A> where C: BorrowMut, /// /// Sets the *on behalf of content owner* query property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn on_behalf_of_content_owner(mut self, new_value: &str) -> BatchReportListCall<'a, C, A> { self._on_behalf_of_content_owner = new_value.to_string(); @@ -3300,12 +3318,12 @@ impl<'a, C, A> BatchReportListCall<'a, C, A> where C: BorrowMut, } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *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. Overrides userIp if both are provided. @@ -3322,17 +3340,17 @@ impl<'a, C, A> BatchReportListCall<'a, C, A> where C: BorrowMut, } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YtAnalyticMonetaryReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> BatchReportListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> BatchReportListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self diff --git a/gen/youtubereporting1-cli/Cargo.toml b/gen/youtubereporting1-cli/Cargo.toml index 69588963de..644a1b22b0 100644 --- a/gen/youtubereporting1-cli/Cargo.toml +++ b/gen/youtubereporting1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtubereporting1-cli" -version = "0.3.2+20150923" +version = "0.3.3+20151026" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube Reporting (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtubereporting1-cli" @@ -21,10 +21,10 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" strsim = "0.4" yup-hyper-mock = "1.0" -clap = "1.5" +clap = "2.0" [build-dependencies] syntex = { version = ">= 0.23" } diff --git a/gen/youtubereporting1-cli/LICENSE.md b/gen/youtubereporting1-cli/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/youtubereporting1-cli/LICENSE.md +++ b/gen/youtubereporting1-cli/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/youtubereporting1-cli/README.md b/gen/youtubereporting1-cli/README.md index 51f45d22b9..7542ff2c8e 100644 --- a/gen/youtubereporting1-cli/README.md +++ b/gen/youtubereporting1-cli/README.md @@ -17,14 +17,14 @@ Everything else about the *YouTube Reporting* API can be found at the You can download the pre-compiled 64bit binaries for the following platforms: -* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/youtubereporting1.tar.gz) -* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/youtubereporting1.tar.gz) +* ![icon](http://megaicons.net/static/img/icons_sizes/6/140/16/ubuntu-icon.png) [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/youtubereporting1.tar.gz) +* ![icon](http://hydra-media.cursecdn.com/wow.gamepedia.com/a/a2/Apple-icon-16x16.png?version=25ddd67ac3dd3b634478e3978b76cb74) [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/youtubereporting1.tar.gz) Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/youtubereporting1-cli). # Usage -This documentation was generated from the *YouTube Reporting* API at revision *20150923*. The CLI is at version *0.3.2*. +This documentation was generated from the *YouTube Reporting* API at revision *20151026*. The CLI is at version *0.3.3*. ```bash youtubereporting1 [options] @@ -43,18 +43,18 @@ youtubereporting1 [options] Configuration: [--scope ]... - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. If unset, it defaults to the shortest scope url for a particular method. --config-dir - A directory into which we will store our persistent data. Defaults to + A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation. [default: ~/.google-service-cli] --debug - Output all server communication to standard error. `tx` and `rx` are placed + Output all server communication to standard error. `tx` and `rx` are placed into the same stream. --debug-auth - Output all communication related to authentication to standard error. `tx` + Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream. ``` diff --git a/gen/youtubereporting1-cli/mkdocs.yml b/gen/youtubereporting1-cli/mkdocs.yml index 1b9f62e00d..bef97546c5 100644 --- a/gen/youtubereporting1-cli/mkdocs.yml +++ b/gen/youtubereporting1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube Reporting v0.3.2+20150923 +site_name: YouTube Reporting v0.3.3+20151026 site_url: http://byron.github.io/google-apis-rs/google-youtubereporting1-cli site_description: Write integrating applications with bcore @@ -20,5 +20,5 @@ pages: theme: readthedocs -copyright: Copyright © 2015, `Sebastian Thiel` +copyright: Copyright © 2015-2016, `Sebastian Thiel` diff --git a/gen/youtubereporting1-cli/src/main.rs b/gen/youtubereporting1-cli/src/main.rs index 47387d9d2e..7da96969b9 100644 --- a/gen/youtubereporting1-cli/src/main.rs +++ b/gen/youtubereporting1-cli/src/main.rs @@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, +use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol, calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo}; @@ -36,22 +36,22 @@ enum DoitError { ApiError(api::Error), } -struct Engine<'n, 'a> { - opt: ArgMatches<'n, 'a>, +struct Engine<'n> { + opt: ArgMatches<'n>, hub: api::YouTubeReporting>, gp: Vec<&'static str>, gpm: Vec<(&'static str, &'static str)>, } -impl<'n, 'a> Engine<'n, 'a> { - fn _jobs_create(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) +impl<'n> Engine<'n> { + fn _jobs_create(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut field_cursor = FieldCursor::default(); let mut object = json::value::Value::Object(Default::default()); - for kvarg in opt.values_of("kv").unwrap_or(Vec::new()).iter() { + for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); @@ -65,8 +65,8 @@ impl<'n, 'a> Engine<'n, 'a> { } continue; } - - let type_info: Option<(&'static str, JsonTypeInfo)> = + + let type_info: Option<(&'static str, JsonTypeInfo)> = match &temp_cursor.to_string()[..] { "report-type-id" => Some(("reportTypeId", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), "id" => Some(("id", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })), @@ -84,7 +84,7 @@ impl<'n, 'a> Engine<'n, 'a> { } let mut request: api::Job = json::value::from_value(object).unwrap(); let mut call = self.hub.jobs().create(request); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -100,7 +100,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -114,7 +114,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -137,10 +137,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_delete(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_delete(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().delete(opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -156,7 +156,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -170,7 +170,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -193,10 +193,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().get(opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -212,7 +212,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -226,7 +226,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -249,10 +249,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -274,7 +274,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "on-behalf-of-content-owner", "page-size"].iter().map(|v|*v)); @@ -288,7 +288,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -311,10 +311,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_reports_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_reports_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().reports_get(opt.value_of("job-id").unwrap_or(""), opt.value_of("report-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "on-behalf-of-content-owner" => { @@ -330,7 +330,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["on-behalf-of-content-owner"].iter().map(|v|*v)); @@ -344,7 +344,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -367,10 +367,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _jobs_reports_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _jobs_reports_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.jobs().reports_list(opt.value_of("job-id").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -382,6 +382,9 @@ impl<'n, 'a> Engine<'n, 'a> { "on-behalf-of-content-owner" => { call = call.on_behalf_of_content_owner(value.unwrap_or("")); }, + "created-after" => { + call = call.created_after(value.unwrap_or("")); + }, _ => { let mut found = false; for param in &self.gp { @@ -392,10 +395,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); - v.extend(["page-token", "on-behalf-of-content-owner", "page-size"].iter().map(|v|*v)); + v.extend(["page-token", "on-behalf-of-content-owner", "created-after", "page-size"].iter().map(|v|*v)); v } )); } } @@ -406,7 +409,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -429,11 +432,11 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _media_download(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _media_download(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut download_mode = false; let mut call = self.hub.media().download(opt.value_of("resource-name").unwrap_or("")); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { _ => { @@ -449,7 +452,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v } )); @@ -462,7 +465,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -490,10 +493,10 @@ impl<'n, 'a> Engine<'n, 'a> { } } - fn _report_types_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) + fn _report_types_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError) -> Result<(), DoitError> { let mut call = self.hub.report_types().list(); - for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() { + for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { let (key, value) = parse_kv_arg(&*parg, err, false); match key { "page-token" => { @@ -515,7 +518,7 @@ impl<'n, 'a> Engine<'n, 'a> { } } if !found { - err.issues.push(CLIError::UnknownParameter(key.to_string(), + err.issues.push(CLIError::UnknownParameter(key.to_string(), {let mut v = Vec::new(); v.extend(self.gp.iter().map(|v|*v)); v.extend(["page-token", "on-behalf-of-content-owner", "page-size"].iter().map(|v|*v)); @@ -529,7 +532,7 @@ impl<'n, 'a> Engine<'n, 'a> { Ok(()) } else { assert!(err.issues.len() == 0); - for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() { + for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() { call = call.add_scope(scope); } let mut ostream = match writer_from_opts(opt.value_of("out")) { @@ -622,14 +625,14 @@ impl<'n, 'a> Engine<'n, 'a> { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { + fn new(opt: ArgMatches<'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; - match cmn::application_secret_from_directory(&config_dir, "youtubereporting1-secret.json", + match cmn::application_secret_from_directory(&config_dir, "youtubereporting1-secret.json", "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { Ok(secret) => (config_dir, secret), Err(e) => return Err(InvalidOptionsError::single(e, 4)) @@ -649,7 +652,7 @@ impl<'n, 'a> Engine<'n, 'a> { db_dir: config_dir.clone(), }, None); - let client = + let client = if opt.is_present("debug") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpsConnector::::default() @@ -692,7 +695,7 @@ fn main() { let mut exit_status = 0i32; let arg_data = [ ("jobs", "methods: 'create', 'delete', 'get', 'list', 'reports-get' and 'reports-list'", vec![ - ("create", + ("create", Some(r##"Creates a job and returns it."##), "Details at http://byron.github.io/google-apis-rs/google_youtubereporting1_cli/jobs_create", vec![ @@ -714,7 +717,7 @@ fn main() { Some(false), Some(false)), ]), - ("delete", + ("delete", Some(r##"Deletes a job."##), "Details at http://byron.github.io/google-apis-rs/google_youtubereporting1_cli/jobs_delete", vec![ @@ -736,7 +739,7 @@ fn main() { Some(false), Some(false)), ]), - ("get", + ("get", Some(r##"Gets a job."##), "Details at http://byron.github.io/google-apis-rs/google_youtubereporting1_cli/jobs_get", vec![ @@ -758,7 +761,7 @@ fn main() { Some(false), Some(false)), ]), - ("list", + ("list", Some(r##"Lists jobs."##), "Details at http://byron.github.io/google-apis-rs/google_youtubereporting1_cli/jobs_list", vec![ @@ -774,7 +777,7 @@ fn main() { Some(false), Some(false)), ]), - ("reports-get", + ("reports-get", Some(r##"Gets the metadata of a specific report."##), "Details at http://byron.github.io/google-apis-rs/google_youtubereporting1_cli/jobs_reports-get", vec![ @@ -802,7 +805,7 @@ fn main() { Some(false), Some(false)), ]), - ("reports-list", + ("reports-list", Some(r##"Lists reports created by a specific job. Returns NOT_FOUND if the job does not exist."##), "Details at http://byron.github.io/google-apis-rs/google_youtubereporting1_cli/jobs_reports-list", vec![ @@ -827,7 +830,7 @@ fn main() { ]), ("media", "methods: 'download'", vec![ - ("download", + ("download", Some(r##"Method for media download. Download is supported on the URI `/v1/media/{+name}?alt=media`."##), "Details at http://byron.github.io/google-apis-rs/google_youtubereporting1_cli/media_download", vec![ @@ -852,7 +855,7 @@ fn main() { ]), ("report-types", "methods: 'list'", vec![ - ("list", + ("list", Some(r##"Lists report types."##), "Details at http://byron.github.io/google-apis-rs/google_youtubereporting1_cli/report-types_list", vec![ @@ -874,7 +877,7 @@ fn main() { let mut app = App::new("youtubereporting1") .author("Sebastian Thiel ") - .version("0.3.2+20150923") + .version("0.3.3+20151026") .about("An API to schedule reporting jobs and download the resulting bulk data reports about YouTube channels, videos etc. in the form of CSV files.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_youtubereporting1_cli") .arg(Arg::with_name("url") @@ -898,7 +901,7 @@ fn main() { .multiple(false) .takes_value(false)); - for &(main_command_name, ref about, ref subcommands) in arg_data.iter() { + for &(main_command_name, about, ref subcommands) in arg_data.iter() { let mut mcmd = SubCommand::with_name(main_command_name).about(about); for &(sub_command_name, ref desc, url_info, ref args) in subcommands { @@ -909,7 +912,7 @@ fn main() { scmd = scmd.after_help(url_info); for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args { - let arg_name_str = + let arg_name_str = match (arg_name, flag) { (&Some(an), _ ) => an, (_ , &Some(f)) => f, diff --git a/gen/youtubereporting1/Cargo.toml b/gen/youtubereporting1/Cargo.toml index b7c45d25ea..ece3046d54 100644 --- a/gen/youtubereporting1/Cargo.toml +++ b/gen/youtubereporting1/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtubereporting1" -version = "0.1.10+20150923" +version = "0.1.11+20151026" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube Reporting (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtubereporting1" @@ -20,7 +20,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" url = ">= 0.5" [build-dependencies] diff --git a/gen/youtubereporting1/LICENSE.md b/gen/youtubereporting1/LICENSE.md index ae22e6ec52..ff523b4547 100644 --- a/gen/youtubereporting1/LICENSE.md +++ b/gen/youtubereporting1/LICENSE.md @@ -6,7 +6,7 @@ DO NOT EDIT ! The MIT License (MIT) ===================== -Copyright © `2015` `Sebastian Thiel` +Copyright © `2015-2016` `Sebastian Thiel` Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/gen/youtubereporting1/README.md b/gen/youtubereporting1/README.md index 2fa3a56f4e..a6ec995e0c 100644 --- a/gen/youtubereporting1/README.md +++ b/gen/youtubereporting1/README.md @@ -5,7 +5,7 @@ DO NOT EDIT ! --> The `google-youtubereporting1` library allows access to all features of the *Google YouTube Reporting* service. -This documentation was generated from *YouTube Reporting* crate version *0.1.10+20150923*, where *20150923* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +This documentation was generated from *YouTube Reporting* crate version *0.1.11+20151026*, where *20151026* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. Everything else about the *YouTube Reporting* *v1* API can be found at the [official documentation site](https://developers.google.com/youtube/reporting/v1/reports/). @@ -109,6 +109,7 @@ let result = hub.jobs().reports_list("jobId") .page_token("sit") .page_size(-65) .on_behalf_of_content_owner("sed") + .created_after("et") .doit(); match result { diff --git a/gen/youtubereporting1/src/cmn.rs b/gen/youtubereporting1/src/cmn.rs index 1fa92569bb..87b91a8986 100644 --- a/gen/youtubereporting1/src/cmn.rs +++ b/gen/youtubereporting1/src/cmn.rs @@ -5,7 +5,8 @@ use std; use std::fmt::{self, Display}; use std::str::FromStr; use std::error; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2::{TokenType, Retry, self}; @@ -43,7 +44,7 @@ pub trait RequestValue {} /// This might be a bug within the google API schema. pub trait UnusedType {} -/// Identifies types which are only used as part of other types, which +/// Identifies types which are only used as part of other types, which /// usually are carrying the `Resource` trait. pub trait Part {} @@ -78,7 +79,7 @@ pub struct ErrorResponse { pub struct ServerError { errors: Vec, code: u16, - message: String, + message: String, } #[derive(Deserialize, Serialize, Debug)] @@ -115,11 +116,11 @@ impl hyper::net::NetworkStream for DummyNetworkStream { Ok("127.0.0.1:1337".parse().unwrap()) } - fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_read_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } - fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { + fn set_write_timeout(&self, _dur: Option) -> io::Result<()> { Ok(()) } } @@ -128,7 +129,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream { /// A trait specifying functionality to help controlling any request performed by the API. /// The trait has a conservative default implementation. /// -/// It contains methods to deal with all common issues, as well with the ones related to +/// It contains methods to deal with all common issues, as well with the ones related to /// uploading media pub trait Delegate { @@ -136,12 +137,12 @@ pub trait Delegate { /// information if he is interesting in knowing more context when further calls to it /// are made. /// The matching `finished()` call will always be made, no matter whether or not the API - /// request was successful. That way, the delegate may easily maintain a clean state + /// request was successful. That way, the delegate may easily maintain a clean state /// between various API calls. fn begin(&mut self, MethodInfo) {} /// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems. - /// + /// /// If you choose to retry after a duration, the duration should be chosen using the /// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff). /// @@ -150,7 +151,7 @@ pub trait Delegate { Retry::Abort } - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for your applications API key after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn api_key(&mut self) -> Option { @@ -179,7 +180,7 @@ pub trait Delegate { } /// Called after we have retrieved a new upload URL for a resumable upload to store it - /// in case we fail or cancel. That way, we can attempt to resume the upload later, + /// in case we fail or cancel. That way, we can attempt to resume the upload later, /// see `upload_url()`. /// It will also be called with None after a successful upload, which allows the delegate /// to forget the URL. That way, we will not attempt to resume an upload that has already @@ -191,7 +192,7 @@ pub trait Delegate { /// Called whenever a server response could not be decoded from json. /// It's for informational purposes only, the caller will return with an error /// accordingly. - /// + /// /// # Arguments /// /// * `json_encoded_value` - The json-encoded value which failed to decode. @@ -202,7 +203,7 @@ pub trait Delegate { } /// Called whenever the http request returns with a non-success status code. - /// This can involve authentication issues, or anything else that very much + /// This can involve authentication issues, or anything else that very much /// depends on the used API method. /// The delegate should check the status, header and decoded json error to decide /// whether to retry or not. In the latter case, the underlying call will fail. @@ -213,7 +214,7 @@ pub trait Delegate { Retry::Abort } - /// Called prior to sending the main request of the given method. It can be used to time + /// Called prior to sending the main request of the given method. It can be used to time /// the call or to print progress information. /// It's also useful as you can be sure that a request will definitely be made. fn pre_request(&mut self) { } @@ -232,14 +233,14 @@ pub trait Delegate { fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool { let _ = chunk; false - } + } /// Called before the API request method returns, in every case. It can be used to clean up /// internal state between calls to the API. /// This call always has a matching call to `begin(...)`. /// /// # Arguments - /// + /// /// * `is_success` - a true value indicates the operation was successful. If false, you should /// discard all values stored during `store_upload_url`. fn finished(&mut self, is_success: bool) { @@ -304,9 +305,9 @@ impl Display for Error { Error::BadRequest(ref err) => { try!(writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message)); for err in err.error.errors.iter() { - try!(writeln!(f, " {}: {}, {}{}", - err.domain, - err.message, + try!(writeln!(f, " {}: {}, {}{}", + err.domain, + err.message, err.reason, match &err.location { &Some(ref loc) => format!("@{}", loc), @@ -317,13 +318,13 @@ impl Display for Error { }, Error::MissingToken(ref err) => writeln!(f, "Token retrieval failed with error: {}", err), - Error::Cancelled => + Error::Cancelled => writeln!(f, "Operation cancelled by delegate"), Error::FieldClash(field) => writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field), - Error::JsonDecodeError(ref json_str, ref err) + Error::JsonDecodeError(ref json_str, ref err) => writeln!(f, "{}: {}", err, json_str), - Error::Failure(ref response) => + Error::Failure(ref response) => writeln!(f, "Http status indicates failure: {:?}", response), } } @@ -418,8 +419,8 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match (self.raw_parts.len(), - self.current_part.is_none(), + match (self.raw_parts.len(), + self.current_part.is_none(), self.last_part_boundary.is_none()) { (_, _, false) => { let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); @@ -432,7 +433,7 @@ impl<'a> Read for MultiPartReader<'a> { (n, true, _) if n > 0 => { let (headers, reader) = self.raw_parts.remove(0); let mut c = Cursor::new(Vec::::new()); - (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + (write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, headers, LINE_ENDING)).unwrap(); c.seek(SeekFrom::Start(0)).unwrap(); self.current_part = Some((c, reader)); @@ -446,12 +447,12 @@ impl<'a> Read for MultiPartReader<'a> { let b = c.read(buf).unwrap_or(0); (b, reader.read(&mut buf[b..])) }; - + match rr { Ok(bytes_read) => { if hb < buf.len() && bytes_read == 0 { if self.is_last_part() { - // before clearing the last part, we will add the boundary that + // before clearing the last part, we will add the boundary that // will be written last self.last_part_boundary = Some(Cursor::new( format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes())) @@ -498,7 +499,7 @@ impl<'a> Read for MultiPartReader<'a> { /// The `X-Upload-Content-Type` header. /// -/// Generated via rustc --pretty expanded -Z unstable-options, and manually +/// Generated via rustc --pretty expanded -Z unstable-options, and manually /// processed to be more readable. #[derive(PartialEq, Debug, Clone)] pub struct XUploadContentType(pub Mime); @@ -657,7 +658,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Ok(r)) @@ -667,7 +668,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Err(Err(err)) @@ -725,10 +726,10 @@ impl<'a, A> ResumableUploadHelper<'a, A> if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let Retry::After(d) = self.delegate.http_failure(&res, + if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } } @@ -736,7 +737,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } return Some(Err(err)) diff --git a/gen/youtubereporting1/src/lib.rs b/gen/youtubereporting1/src/lib.rs index eba4c6bb3c..4957697263 100644 --- a/gen/youtubereporting1/src/lib.rs +++ b/gen/youtubereporting1/src/lib.rs @@ -2,7 +2,7 @@ // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *YouTube Reporting* crate version *0.1.10+20150923*, where *20150923* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.10*. +//! This documentation was generated from *YouTube Reporting* crate version *0.1.11+20151026*, where *20151026* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.11*. //! //! Everything else about the *YouTube Reporting* *v1* API can be found at the //! [official documentation site](https://developers.google.com/youtube/reporting/v1/reports/). @@ -107,9 +107,10 @@ //! // execute the final call using `doit()`. //! // Values shown here are possibly random and not representative ! //! let result = hub.jobs().reports_list("jobId") -//! .page_token("et") -//! .page_size(-70) -//! .on_behalf_of_content_owner("aliquyam") +//! .page_token("sea") +//! .page_size(-55) +//! .on_behalf_of_content_owner("eos") +//! .created_after("erat") //! .doit(); //! //! match result { diff --git a/gen/youtubereporting1/src/lib.rs.in b/gen/youtubereporting1/src/lib.rs.in index 8b31fc1496..0d4e8cf3a0 100644 --- a/gen/youtubereporting1/src/lib.rs.in +++ b/gen/youtubereporting1/src/lib.rs.in @@ -19,10 +19,11 @@ use std::collections::BTreeMap; use serde_json as json; use std::io; use std::fs; -use std::thread::sleep_ms; +use std::thread::sleep; +use std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, - ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, + ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; @@ -95,9 +96,10 @@ impl Default for Scope { /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.jobs().reports_list("jobId") -/// .page_token("dolores") -/// .page_size(-63) -/// .on_behalf_of_content_owner("accusam") +/// .page_token("kasd") +/// .page_size(-22) +/// .on_behalf_of_content_owner("takimata") +/// .created_after("justo") /// .doit(); /// /// match result { @@ -133,7 +135,7 @@ impl<'a, C, A> YouTubeReporting YouTubeReporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/0.1.10".to_string(), + _user_agent: "google-api-rust-client/0.1.11".to_string(), } } @@ -148,7 +150,7 @@ impl<'a, C, A> YouTubeReporting } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/0.1.10`. + /// It defaults to `google-api-rust-client/0.1.11`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -573,6 +575,7 @@ impl<'a, C, A> JobMethods<'a, C, A> { _page_token: Default::default(), _page_size: Default::default(), _on_behalf_of_content_owner: Default::default(), + _created_after: Default::default(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), @@ -681,7 +684,7 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubereporting.media.download", + dlg.begin(MethodInfo { id: "youtubereporting.media.download", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("resourceName", self._resource_name.to_string())); @@ -742,7 +745,7 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -778,7 +781,7 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -788,10 +791,10 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -824,7 +827,7 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *resource name* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource_name(mut self, new_value: &str) -> MediaDownloadCall<'a, C, A> { self._resource_name = new_value.to_string(); @@ -842,12 +845,12 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -870,17 +873,17 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YtAnalyticMonetaryReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> MediaDownloadCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> MediaDownloadCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -915,9 +918,9 @@ impl<'a, C, A> MediaDownloadCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.report_types().list() -/// .page_token("justo") -/// .page_size(-1) -/// .on_behalf_of_content_owner("erat") +/// .page_token("erat") +/// .page_size(-35) +/// .on_behalf_of_content_owner("sea") /// .doit(); /// # } /// ``` @@ -947,7 +950,7 @@ impl<'a, C, A> ReportTypeListCall<'a, C, A> where C: BorrowMut, A Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubereporting.reportTypes.list", + dlg.begin(MethodInfo { id: "youtubereporting.reportTypes.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -976,7 +979,7 @@ impl<'a, C, A> ReportTypeListCall<'a, C, A> where C: BorrowMut, A self._scopes.insert(Scope::YtAnalyticMonetaryReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1012,7 +1015,7 @@ impl<'a, C, A> ReportTypeListCall<'a, C, A> where C: BorrowMut, A match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1022,10 +1025,10 @@ impl<'a, C, A> ReportTypeListCall<'a, C, A> where C: BorrowMut, A if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1087,12 +1090,12 @@ impl<'a, C, A> ReportTypeListCall<'a, C, A> where C: BorrowMut, A } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1115,17 +1118,17 @@ impl<'a, C, A> ReportTypeListCall<'a, C, A> where C: BorrowMut, A } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YtAnalyticMonetaryReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> ReportTypeListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> ReportTypeListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1160,7 +1163,7 @@ impl<'a, C, A> ReportTypeListCall<'a, C, A> where C: BorrowMut, A /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.jobs().delete("jobId") -/// .on_behalf_of_content_owner("sea") +/// .on_behalf_of_content_owner("dolores") /// .doit(); /// # } /// ``` @@ -1189,7 +1192,7 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubereporting.jobs.delete", + dlg.begin(MethodInfo { id: "youtubereporting.jobs.delete", http_method: hyper::method::Method::Delete }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("jobId", self._job_id.to_string())); @@ -1234,7 +1237,7 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1270,7 +1273,7 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1280,10 +1283,10 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1316,7 +1319,7 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> JobDeleteCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -1341,12 +1344,12 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1369,17 +1372,17 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YtAnalyticMonetaryReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobDeleteCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobDeleteCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1414,7 +1417,7 @@ impl<'a, C, A> JobDeleteCall<'a, C, A> where C: BorrowMut, A: oau /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.jobs().reports_get("jobId", "reportId") -/// .on_behalf_of_content_owner("gubergren") +/// .on_behalf_of_content_owner("aliquyam") /// .doit(); /// # } /// ``` @@ -1444,7 +1447,7 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubereporting.jobs.reports.get", + dlg.begin(MethodInfo { id: "youtubereporting.jobs.reports.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); params.push(("jobId", self._job_id.to_string())); @@ -1490,7 +1493,7 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1526,7 +1529,7 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1536,10 +1539,10 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1572,7 +1575,7 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> JobReportGetCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -1582,7 +1585,7 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *report id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn report_id(mut self, new_value: &str) -> JobReportGetCall<'a, C, A> { self._report_id = new_value.to_string(); @@ -1607,12 +1610,12 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1635,17 +1638,17 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YtAnalyticMonetaryReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobReportGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobReportGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1680,7 +1683,7 @@ impl<'a, C, A> JobReportGetCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.jobs().get("jobId") -/// .on_behalf_of_content_owner("aliquyam") +/// .on_behalf_of_content_owner("no") /// .doit(); /// # } /// ``` @@ -1709,7 +1712,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubereporting.jobs.get", + dlg.begin(MethodInfo { id: "youtubereporting.jobs.get", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("jobId", self._job_id.to_string())); @@ -1754,7 +1757,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -1790,7 +1793,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1800,10 +1803,10 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -1836,7 +1839,7 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> JobGetCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -1861,12 +1864,12 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -1889,17 +1892,17 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YtAnalyticMonetaryReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobGetCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobGetCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -1934,9 +1937,10 @@ impl<'a, C, A> JobGetCall<'a, C, A> where C: BorrowMut, A: oauth2 /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.jobs().reports_list("jobId") -/// .page_token("no") -/// .page_size(-21) -/// .on_behalf_of_content_owner("justo") +/// .page_token("justo") +/// .page_size(-34) +/// .on_behalf_of_content_owner("et") +/// .created_after("diam") /// .doit(); /// # } /// ``` @@ -1948,6 +1952,7 @@ pub struct JobReportListCall<'a, C, A> _page_token: Option, _page_size: Option, _on_behalf_of_content_owner: Option, + _created_after: Option, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap @@ -1967,9 +1972,9 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubereporting.jobs.reports.list", + dlg.begin(MethodInfo { id: "youtubereporting.jobs.reports.list", http_method: hyper::method::Method::Get }); - let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("jobId", self._job_id.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -1980,7 +1985,10 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); } - for &field in ["alt", "jobId", "pageToken", "pageSize", "onBehalfOfContentOwner"].iter() { + if let Some(value) = self._created_after { + params.push(("createdAfter", value.to_string())); + } + for &field in ["alt", "jobId", "pageToken", "pageSize", "onBehalfOfContentOwner", "createdAfter"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(Error::FieldClash(field)); @@ -2018,7 +2026,7 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: params.remove(index); } } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2054,7 +2062,7 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2064,10 +2072,10 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2100,7 +2108,7 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: /// /// Sets the *job id* path property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn job_id(mut self, new_value: &str) -> JobReportListCall<'a, C, A> { self._job_id = new_value.to_string(); @@ -2127,6 +2135,13 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: self._on_behalf_of_content_owner = Some(new_value.to_string()); self } + /// If set, only reports created after the specified date/time are returned. + /// + /// Sets the *created after* query property to the given value. + pub fn created_after(mut self, new_value: &str) -> JobReportListCall<'a, C, A> { + self._created_after = Some(new_value.to_string()); + self + } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// @@ -2139,12 +2154,12 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2167,17 +2182,17 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YtAnalyticMonetaryReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobReportListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobReportListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2212,9 +2227,9 @@ impl<'a, C, A> JobReportListCall<'a, C, A> where C: BorrowMut, A: /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.jobs().list() -/// .page_token("et") -/// .page_size(-17) -/// .on_behalf_of_content_owner("diam") +/// .page_token("ipsum") +/// .page_size(-5) +/// .on_behalf_of_content_owner("et") /// .doit(); /// # } /// ``` @@ -2244,7 +2259,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubereporting.jobs.list", + dlg.begin(MethodInfo { id: "youtubereporting.jobs.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if let Some(value) = self._page_token { @@ -2273,7 +2288,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth self._scopes.insert(Scope::YtAnalyticMonetaryReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); @@ -2309,7 +2324,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2319,10 +2334,10 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2384,12 +2399,12 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2412,17 +2427,17 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YtAnalyticMonetaryReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobListCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobListCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self @@ -2463,7 +2478,7 @@ impl<'a, C, A> JobListCall<'a, C, A> where C: BorrowMut, A: oauth /// // execute the final call using `doit()`. /// // Values shown here are possibly random and not representative ! /// let result = hub.jobs().create(req) -/// .on_behalf_of_content_owner("ipsum") +/// .on_behalf_of_content_owner("duo") /// .doit(); /// # } /// ``` @@ -2492,7 +2507,7 @@ impl<'a, C, A> JobCreateCall<'a, C, A> where C: BorrowMut, A: oau Some(d) => d, None => &mut dd }; - dlg.begin(MethodInfo { id: "youtubereporting.jobs.create", + dlg.begin(MethodInfo { id: "youtubereporting.jobs.create", http_method: hyper::method::Method::Post }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._on_behalf_of_content_owner { @@ -2515,14 +2530,14 @@ impl<'a, C, A> JobCreateCall<'a, C, A> where C: BorrowMut, A: oau self._scopes.insert(Scope::YtAnalyticMonetaryReadonly.as_ref().to_string(), ()); } - + if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); - let mut request_value_reader = + let mut request_value_reader = { let mut value = json::value::to_value(&self._request); remove_json_null_values(&mut value); @@ -2566,7 +2581,7 @@ impl<'a, C, A> JobCreateCall<'a, C, A> where C: BorrowMut, A: oau match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2576,10 +2591,10 @@ impl<'a, C, A> JobCreateCall<'a, C, A> where C: BorrowMut, A: oau if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); - if let oauth2::Retry::After(d) = dlg.http_failure(&res, + if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep_ms(d.num_milliseconds() as u32); + sleep(d); continue; } dlg.finished(false); @@ -2611,7 +2626,7 @@ impl<'a, C, A> JobCreateCall<'a, C, A> where C: BorrowMut, A: oau /// /// Sets the *request* property to the given value. /// - /// Even though the property as already been set when instantiating this call, + /// 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: Job) -> JobCreateCall<'a, C, A> { self._request = new_value; @@ -2636,12 +2651,12 @@ impl<'a, C, A> JobCreateCall<'a, C, A> where C: BorrowMut, A: oau } /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own + /// It should be used to set parameters which are not yet available through their own /// setters. /// /// Please note that this method must not be used to set any of the known paramters /// which have their own setter method. If done anyway, the request will fail. - /// + /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. @@ -2664,17 +2679,17 @@ impl<'a, C, A> JobCreateCall<'a, C, A> where C: BorrowMut, A: oau } /// Identifies the authorization scope for the method you are building. - /// + /// /// Use this method to actively specify which scope should be used, instead the default `Scope` variant /// `Scope::YtAnalyticMonetaryReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. - /// + /// /// 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(mut self, scope: T) -> JobCreateCall<'a, C, A> + pub fn add_scope(mut self, scope: T) -> JobCreateCall<'a, C, A> where T: AsRef { self._scopes.insert(scope.as_ref().to_string(), ()); self